-
Notifications
You must be signed in to change notification settings - Fork 27
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
Conversation
I just saw that one test, which uses |
…s` as it is not used.
Not sure whether it's too low timeout set for Lerna 🤔 |
@@ -10,7 +10,7 @@ module.exports = function getLicenseBanner() { | |||
|
|||
/* eslint-disable indent */ | |||
return ( | |||
`/** | |||
`/*! |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Travis has some troubles. |
* @license Copyright (c) 2003-${ date.getFullYear() }, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/` | ||
`/*--------------------------------------------------------------------------------------* |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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. | ||
*/` | ||
`/*--------------------------------------------------------------------------------------* |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #373 (comment) too 😄
There was a problem hiding this comment.
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 addtrue
– add the default oneString
– 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
} ),
There was a problem hiding this comment.
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.
Ready for the review once again :) |
@@ -33,7 +33,8 @@ | |||
] | |||
}, | |||
"eslintIgnore": [ | |||
"coverage/**" | |||
"coverage/**", | |||
"packages/*/node_modules/**" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this?
There was a problem hiding this comment.
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 => { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, see https://github.com/webpack/tapable.
@@ -6,7 +6,12 @@ | |||
"main": "lib/index.js", | |||
"dependencies": { | |||
"@ckeditor/ckeditor5-dev-utils": "^9.0.1", | |||
"rimraf": "^2.6.2" | |||
"chalk": "^2.4.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it imported anywhere?
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this too?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both were missing.
Suggested merge commit message (convention)
Other: Updated
CKEditorWebpackPlugin
to support webpack@4. Updated webpack in testing tools. Closes #371.Additional information
Changes in other repos:
BREAKING CHANGE: Breaks compatibility with webpack v3.