-
Notifications
You must be signed in to change notification settings - Fork 331
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
Build tasks: Create tasks per target without --destination
#3372
Conversation
eb8b184
to
0d43aa4
Compare
0d43aa4
to
2044ef4
Compare
9192bbd
to
b8a552a
Compare
2044ef4
to
c79a20a
Compare
--destination
--destination
c79a20a
to
03875b1
Compare
03875b1
to
1822d0f
Compare
16f672f
to
38031a8
Compare
1822d0f
to
a1f1160
Compare
a1f1160
to
a04c67b
Compare
a04c67b
to
52595ea
Compare
52595ea
to
9ff9388
Compare
9643234
to
3a5b346
Compare
9ff9388
to
3615dab
Compare
a467fe2
to
b05e66c
Compare
Tests replaced with `isDev` flag support
b05e66c
to
d18cc43
Compare
d18cc43
to
6801042
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.
Think this looks great - to my eye this simplifies these workflows a bunch. And thank you for a really easy-to-follow set of commits - despite quite a large overall codebase change.
Coupla questions in addition to a few small separate comments:
- I haven't dug into the tests - are we confident they'd detect any issues with this approach? Anything we can take the opportunity to shore up?
- This is a fairly big PR. Feels like we could maybe separate out the
gulp-task-listing
(and maybe the browser tasks?) as they don't seem to rely on--destination
?
tasks/compile-javascripts.mjs
Outdated
import { getListing } from '../lib/file-helper.js' | ||
import { componentPathToModuleName } from '../lib/helper-functions.js' | ||
|
||
import { writeAsset } from './compile-assets.mjs' | ||
import { isDist, isPackage, isPublic } from './task-arguments.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.
🎉
}) | ||
|
||
// Compile JavaScript ESM to CommonJS | ||
const bundled = await bundle[!isPackage ? 'generate' : 'write']({ | ||
const bundled = await bundle[moduleDestPath.endsWith('.min.js') ? 'generate' : 'write']({ |
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.
Neat!
export const isDist = target === 'dist' | ||
export const isDev = isPublic && tasks.includes('dev') | ||
// Check for development task | ||
export const isDev = tasks.includes('dev') |
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.
Ha, neat!
@@ -34,7 +34,7 @@ npm scripts are defined in `package.json`. These trigger a number of Gulp tasks. | |||
**`npm run build:app` will do the following:** | |||
|
|||
- clean the `./public` folder | |||
- output files into `./public`, or another location via the `--destination` flag |
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 do this personally, but is it worth checking whether anybody else makes use of --destination
to, say, build to a temp directory while developing?
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 asked on Slack 😊
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.
Looking good for removal so far
Split out from this PR now, but I'm happy with destPath
being configurable per destination:
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 think if nobody's doing anything other than standard builds anyway, let's not bother. We can always pop it back in quick enough if folks complain.
docs/contributing/tasks.md
Outdated
@@ -63,9 +63,9 @@ npm scripts are defined in `package.json`. These trigger a number of Gulp tasks. | |||
|
|||
## Gulp tasks | |||
|
|||
Gulp tasks are defined in `gulpfile.js` and .`/tasks/gulp/` folder. | |||
Gulp tasks are defined in `gulpfile.mjs` and .`/tasks/` folder. |
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.
Am I missing something about why the full stop is outside of the <code>
element here?
Also, can we tweak it to either "and the ./tasks/
folder" or "and ./tasks/
"?
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.
Hmm how strange, I didn't even notice. It's been in since 2017 2e64f5b#diff-06cac645496a5082a65db61580c0d7b2d3890e8d164ca7f4d1193e8a28f76a68R92
To avoid lots of rebasing, mind if we add a follow up typo PR?
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.
@domoscargin Full stop removal included in edeb6d7
package.json
Outdated
@@ -55,7 +55,6 @@ | |||
"gulp": "^4.0.2", | |||
"gulp-cli": "^2.3.0", | |||
"gulp-rename": "^2.0.0", | |||
"gulp-task-listing": "^1.1.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.
🔥
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.
Split out into PR #3402
gulpfile.mjs
Outdated
destPath: paths.dist | ||
}) | ||
)) | ||
gulp.task('build:app', build.app()) |
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.
So satisfying!
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.
Split out into PR #3403
6801042
to
f0aca84
Compare
f0aca84
to
19a6a98
Compare
Thanks for the review @domoscargin
Tests wise we've still got the
I've dropped a few commits from this PR branch and moved them to: |
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.
Awesome, nice to simplify things.
I've diffed this against package, dist and public folders and there are no changes in output, so I think this is ready to go.
This PR removes our build target
--destination
flagWe didn't actually use it and there's a lot of complexity including/moving/renaming files via:
This helps to unblock:
Where we'll need to build the JavaScript twice to include version numbers:
1x as Rollup AMD module bundles
1x as Rollup ES module bundles
Task options
All tasks like
compileJavaScripts()
now acceptoptions
to show what's happening: