-
Notifications
You must be signed in to change notification settings - Fork 326
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
Migrate Gulp and Node.js build tasks to ESM #2982
Conversation
eb2788f
to
fcfc213
Compare
fcfc213
to
0b031ee
Compare
gulpfile.mjs
Outdated
* Watch task | ||
* Runs tasks when files are modified | ||
*/ | ||
gulp.task('watch', watch) |
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've added this so gulp watch
still works, do we want 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.
I say nah. Can't think of a good enough reason to use it outside of the dev task.
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.
Thanks @domoscargin I'll remove it, rebase, and get this merged 😊
require('./tasks/gulp/compile-assets.js') | ||
require('./tasks/gulp/copy-to-destination.js') | ||
require('./tasks/gulp/watch.js') | ||
import { compileJavaScripts, compileStylesheets } from './tasks/gulp/compile-assets.mjs' |
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.
Are we happy losing the gulp js:compile
and gulp scss:compile
tasks?
They're still available via gulp compile
which includes compileJavaScripts() and compileStylesheets()
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 can see edge cases where somebody is working on some finicky interaction between CSS and JS, but that feels such an unlikely case, and these are not part of the "public" package json scripts, so I think we're OK to toss 'em.
* | ||
* @returns {import('stream').Stream} Output file stream | ||
*/ | ||
export function copyAssets () { |
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.
Moved this one from gulpfile.mjs
Made sense to have copyAssets() (fonts, images) alongside copyFiles()
d7bf7cd
to
fb1de88
Compare
fb1de88
to
c30ddb4
Compare
c30ddb4
to
4d7cf6c
Compare
4d7cf6c
to
04638b8
Compare
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 don't have any blocking comments - I think this makes sense, especially since we're using ESM for most of our source code. Ran through the npm
scripts and they seemed fine.
require('./tasks/gulp/compile-assets.js') | ||
require('./tasks/gulp/copy-to-destination.js') | ||
require('./tasks/gulp/watch.js') | ||
import { compileJavaScripts, compileStylesheets } from './tasks/gulp/compile-assets.mjs' |
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 can see edge cases where somebody is working on some finicky interaction between CSS and JS, but that feels such an unlikely case, and these are not part of the "public" package json scripts, so I think we're OK to toss 'em.
gulpfile.mjs
Outdated
* Watch task | ||
* Runs tasks when files are modified | ||
*/ | ||
gulp.task('watch', watch) |
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 say nah. Can't think of a good enough reason to use it outside of the dev task.
Also avoids the named `yargs` ESM export differing to the destructured `{ yargs }` CommonJS export
Avoids blocking a future upgrade to `slash@5` (ESM only) since we can’t yet use an ESM `postcss.config.mjs` without `postcss-load-config@4` We’ll need to keep a CommonJS config for a little longer
04638b8
to
b6f06dd
Compare
b6f06dd
to
39d7329
Compare
This PR upgrades our build tooling to ESM using
*.mjs
filesWhy? We have a couple of packages noted in #2937 with "ESM only" upgrades
Both of them are flagged by dependabot:
Additional considerations
The following Gulp tasks have been removed by name but are still part of their npm script:
gulp scss:compile
→npm run compile
gulp js:compile
→npm run compile
gulp copy:assets
→npm run build:dist
gulp copy:files
→npm run build:package
For convenience I've kept
gulp watch
but perhapsnpm start
is enough?I've also ensured new ESM imports have no "side effects" which means moving (some)
gulp.task()
calls togulpfile.mjs
which chips away a bit more at: