Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade webpack plugin and testing environment for webpack v4 #373

Merged
merged 16 commits into from
Jul 5, 2018
Merged

Conversation

ma2ciek
Copy link
Contributor

@ma2ciek ma2ciek commented Mar 6, 2018

@ma2ciek
Copy link
Contributor Author

ma2ciek commented Mar 6, 2018

I just saw that one test, which uses import * as enitreModule from 'someModule' fails during creating a spy. https://github.com/ckeditor/ckeditor5-ui/blob/a98b63ef0b7995db9fde3f2296e5fddcadb36a5d/tests/panel/balloon/balloonpanelview.js#L175

@ma2ciek
Copy link
Contributor Author

ma2ciek commented Mar 6, 2018

Yep, now webpack creates only getters for module exports, so sinon can't wrap these functions. We can drop this test or attach getOptimalPosition to the BalloonPanelView, to enable wrapping it.

cc @oleq, @Reinmar

@ma2ciek ma2ciek changed the title Upgrade webpack plugin and testing environment for webpack v4 [Do not merge] Upgrade webpack plugin and testing environment for webpack v4 Mar 7, 2018
@coveralls
Copy link

coveralls commented Mar 22, 2018

Coverage Status

Coverage decreased (-0.1%) to 90.188% when pulling f64d160 on t/371 into 404bdec on master.

@ma2ciek
Copy link
Contributor Author

ma2ciek commented Jun 28, 2018

$ lerna bootstrap
lerna info version 2.11.0
lerna info versioning independent
lerna info Bootstrapping 8 packages
lerna info lifecycle preinstall
lerna info Installing external dependencies
lerna info hoist Installing hoisted dependencies into root

No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received

Not sure whether it's too low timeout set for Lerna 🤔

@@ -10,7 +10,7 @@ module.exports = function getLicenseBanner() {

/* eslint-disable indent */
return (
`/**
`/*!
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed comment, so it differs now a little bit from the original comments used in the code. It's the result of webpack/webpack#6630 (comment).

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use /* (with one *)? This ! looks like a typo.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or something like:

/*-------------------------*
 *                         *
 *-------------------------*/

Anything what does not look like a typo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with

/*-------------------------*
 *                         *
 *-------------------------*/

It just needs to differ from original license headers.

@pomek
Copy link
Member

pomek commented Jun 29, 2018

Not sure whether it's too low timeout set for Lerna 🤔

Travis has some troubles.

@ma2ciek ma2ciek changed the title [Do not merge] Upgrade webpack plugin and testing environment for webpack v4 Upgrade webpack plugin and testing environment for webpack v4 Jun 29, 2018
* @license Copyright (c) 2003-${ date.getFullYear() }, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.
*/`
`/*--------------------------------------------------------------------------------------*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem like nicely aligned. Is it GH's way of rendering this string? Or isn't the box wide enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${ date.getFullYear() } that becomes 4-character-long as it evaluates.

* @license Copyright (c) 2003-${ date.getFullYear() }, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.
*/`
`/*--------------------------------------------------------------------------------------*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It requires a comment on why it needs to look this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can think about a shorter comment or some short custom plugin for the banner.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW can't we look for /\/\*\n \* @license/? And use the old license comment?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because once you wrote about a shorter comment I thought that it unnecessarily increases a size of every build. Not by much, perhaps it gzips well, but it seems unnecessary if the regexp can look for @license too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh, we use @license in every single source file :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #373 (comment) too 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a couple of deep breaths, I'm for extending CKEditorWebpackPlugin so it adds this banner in a way which doesn't conflict with minification.

This way, we'll simplify maintaining configurations. We'll be able to get rid of this:

		new webpack.BannerPlugin( {
			banner: bundler.getLicenseBanner(),
			raw: true
		} ),

And will be able to avoid adding this:

new UglifyJsWebpackPlugin( {
		sourceMap: true,
		uglifyOptions: {
			output: {
				comments: /^\**!/
			}
		}
	} )

So, CKEditorWebpackPlugin() should have the following option:

[options.addLicense=false] {Boolean|String}

  • false – don't add
  • true – add the default one
  • String – if any of sub-CKEditor projects will require a bit different license text

Additionally, we may need to rethink configuration because it will get crowded:

		new CKEditorWebpackPlugin( {
			// Main language that will be built into the main bundle.
			language: 'en',

			// Additional languages that will be emitted to the `outputDirectory`.
			// This option can be set to an array of language codes or `'all'` to build all found languages.
			// The bundle is optimized for one language when this option is omitted.
			additionalLanguages: 'all',

			// Optional directory for emitted translations. Relative to the webpack's output.
			// Defaults to `'translations'`.
			// outputDirectory: 'ckeditor5-translations',

			// Whether the build process should fail if an error occurs.
			// Defaults to `false`.
			// strict: true,

			// Whether to log all warnings to the console.
			// Defaults to `false`.
			// verbose: true
		} ),

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll move this to the ticket cause it'd be pity to lose this.

@ma2ciek
Copy link
Contributor Author

ma2ciek commented Jul 3, 2018

Ready for the review once again :)

@@ -33,7 +33,8 @@
]
},
"eslintIgnore": [
"coverage/**"
"coverage/**",
"packages/*/node_modules/**"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When installing two versions of dependencies in 2 different packages inside ckeditor5-dev's subrepos, both aren't moved to the ckeditor5-dev by Lerna.

compiler.plugin( 'after-resolvers', () => {
const resolver = compiler.resolvers.normal;
// Add core translations before `translateSourceLoader` starts translating.
compiler.hooks.normalModuleFactory.tap( 'CKEditor5Plugin', normalModuleFactory => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this consistent with webpack plugins' naming convention?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -6,7 +6,12 @@
"main": "lib/index.js",
"dependencies": {
"@ckeditor/ckeditor5-dev-utils": "^9.0.1",
"rimraf": "^2.6.2"
"chalk": "^2.4.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it imported anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"rimraf": "^2.6.2"
"chalk": "^2.4.1",
"rimraf": "^2.6.2",
"webpack-sources": "^1.0.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this too?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually see it was imported previously. So it was missing previously, yes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both were missing.

@Reinmar Reinmar merged commit d0cbbca into master Jul 5, 2018
@Reinmar Reinmar deleted the t/371 branch July 5, 2018 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants