Upgrade build pipeline and remove n8-make #228
Conversation
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.
This generally looks good, although I have a few minor comments. Thank you for working on this, @jsnajdr!
@rm -rfv $(BUILDDIR) | ||
|
||
distclean: | ||
@rm -rfv 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.
Should distclean
run clean
too? It seems odd for it to clear node_modules
but leave previously built files behind.
@@ -0,0 +1,13 @@ | |||
module.exports = { |
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 wondering if we should use calypso-build
for this, to ensure config compatibility. Then again, I expect this will only be used for the standalone bundle, while it exists outside of the monorepo?
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.
My intent here was to do some cleanups before importing this project to the Calypso monorepo. Then it will use calypso-build
. At that time, it won't be a huge upgrade of everything, but just a little change that ideally won't change the build output at all.
@@ -41,20 +44,23 @@ | |||
"./build/lib/util/fs.js": "./build/lib/util/fs-browser.js" | |||
}, | |||
"dependencies": { | |||
"babel-runtime": "^6.9.2", | |||
"@babel/runtime": "^7.4.3", |
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.
Could probably use a few version bumps here and there, since this PR has been open for a while. If you go for Babel 7.5.x, do bear babel/babel#10261 in mind.
Any progress here, @jsnajdr? The topic of modernising |
Removes dependency on
n8-make
and upgrades the build tools to latest versions:Babel uses
@wordpress/browserslist-config
to determine target browsers and the set of transforms. Missing platform features are polyfilled with CoreJS2, using theuseBuiltIns: entry
option.Runtime helpers are transformed to imports from
@babel/runtime
.There is a minimalistic Webpack configuration to create the bundled
wpcom.js
script that's intended for direct inclusion with a script tag.Makefile doesn't need
n8-make
and is completely self-contained.How to test:
The output should be almost indentical to the previous version. Best tested by linking the package into Calypso and testing there.
Note that I removed the
add-module-exports
Babel transform. That could break some usages that do the import incorrectly:no longer works, because
Me
is a property of the default export, not an exported binding.We'll bump the major version when publishing, so the breaking change shouldn't be a problem.