Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Upgrade build pipeline and remove n8-make #228

Merged
merged 1 commit into from Jan 27, 2020
Merged

Conversation

jsnajdr
Copy link
Member

@jsnajdr jsnajdr commented Apr 3, 2019

Removes dependency on n8-make and upgrades the build tools to latest versions:

  • Babel 7 with CoreJS 2
  • Webpack 4
  • ESLint 5
  • Mocha 6

Babel uses @wordpress/browserslist-config to determine target browsers and the set of transforms. Missing platform features are polyfilled with CoreJS2, using the useBuiltIns: 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:

import { Me } from 'wpcom';

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.

Copy link

@sgomes sgomes left a 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
Copy link

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 = {
Copy link

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?

Copy link
Member Author

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",
Copy link

@sgomes sgomes Aug 12, 2019

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.

@sgomes
Copy link

sgomes commented Dec 12, 2019

Any progress here, @jsnajdr? The topic of modernising wpcom, wpcom-xhr-request and friends, and bringing them into the Calypso monorepo has popped up again: Automattic/wp-calypso#33324

@jsnajdr jsnajdr merged commit bf23b4a into master Jan 27, 2020
@jsnajdr jsnajdr deleted the upgrade/build-pipeline branch January 27, 2020 14:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants