You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are still make for a lot of tasks we run for publish, build, test, etc right now. As we all know make is not necessarily a native thing on Windows and it has been brought up a couple of times internally as well as in pull requests/issues that this is not an ideal situation for Windows users.
We had a PR (#4843) before which migrated the make file to npm scripts. This worked, but did not solve the problem completely, as bash - another non windows native - was still required. And imho it was also not very easy to read and understand.
In our build and bundle process we use gulp hidden behind make. I'm not sure where using two tools originated, but looks like another reason to me to tackle this topic and maybe settle on one tool to orchestrate all the tasks.
As gulp was already setup it was simple for me to see how gulp would work running without make.
POC make => gulp
This is a proof of concept and does not cover all our cases.
This PR is a POC how gulp could potentially be used to run all our tasks in a structured way. All I did in this PR is to come up with an infrastructure for tasks to be defined in gulp without having to have everything in one big file.
I tried different things like gulp-hub for example, which did not work with the recommended way of defining gulp tasks (which is simply exporting them).
I ended up creating a folder where each file is a gulp task. This tasks are then loaded in the main gulpfile and simply reexported.
I converted the main build as well as the rollup task. Additionally I added a test task which does right now exactly what the shell script did. This task is to demonstrate how we can run shell scripts from within gulp
Now this might not make much sense now that we have jest. We could simply add some npm scripts to package.json ("test": "jest", "test:ci": "jest --ci --maxWorkers=4", "test-inspect": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand"). This would cover all cases and make use of the jest cli instead of our TEST_* variables like yarn test ./packages/babel-parser/ instead of TEST_ONLY=babel-parser yarn test
Other cli calls like rm and mkdir can be replaced with npm packages or node builtins. The only requirement left that I can currently see would be git, which everyone who has babel cloned obviously has. And git is only used for very specific tasks anyway (test262, flow tests and probably publish).
Other task runners
Now I haven't looked at any other tools, but most that came to my mind require developers to install certain tool (e.g. ant or gradle) and I guess this is not any better, and require yet another language/syntax to handle. So having a tool where the configuration is in javascript seems like a big plus. Alternatives I know for gulp are grunt (which seems outdated and barely maintained) or broccoli (not sure how popular that is). To my knowledge gulp is the most prominent one.
Questions
Are there any other task runners we should consider or look at?
The approach I took for gulp is that the right direction?
Does it make sense to have certain simple tools directly in package.json? Like jest? Or should we create a gulp task for everything no matter what?
Is there something I missed? Anything that could be hard to do in gulp?
Are there any better patterns to structure gulp tasks?
Are there any big projects we could look at that solved this in a nice way?
I'm happy for any input no matter if you are babel maintainer or first time contributor.
I'm cool with gulp if it makes it possible for Windows and easier for contributors.
Does it make sense to have certain simple tools directly in package.json? Like jest? Or should we create a gulp task for everything no matter what?
In theory it would be best if anyone can just use the same commands for other projects like yarn/npm test etc. We never ended up figuring out #5309 either
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We are still
makefor a lot of tasks we run for publish, build, test, etc right now. As we all knowmakeis not necessarily a native thing on Windows and it has been brought up a couple of times internally as well as in pull requests/issues that this is not an ideal situation for Windows users.We had a PR (#4843) before which migrated the make file to npm scripts. This worked, but did not solve the problem completely, as bash - another non windows native - was still required. And imho it was also not very easy to read and understand.
In our build and bundle process we use
gulphidden behindmake. I'm not sure where using two tools originated, but looks like another reason to me to tackle this topic and maybe settle on one tool to orchestrate all the tasks.As
gulpwas already setup it was simple for me to see how gulp would work running withoutmake.POC
make=>gulpThis PR is a POC how
gulpcould potentially be used to run all our tasks in a structured way. All I did in this PR is to come up with an infrastructure for tasks to be defined ingulpwithout having to have everything in one big file.I tried different things like
gulp-hubfor example, which did not work with the recommended way of defining gulp tasks (which is simply exporting them).I ended up creating a folder where each file is a gulp task. This tasks are then loaded in the main gulpfile and simply reexported.
I converted the main build as well as the rollup task. Additionally I added a
testtask which does right now exactly what the shell script did. This task is to demonstrate how we can run shell scripts from withingulpOther cli calls like
rmandmkdircan be replaced with npm packages or node builtins. The only requirement left that I can currently see would begit, which everyone who has babel cloned obviously has. Andgitis only used for very specific tasks anyway (test262, flow tests and probably publish).Other task runners
Now I haven't looked at any other tools, but most that came to my mind require developers to install certain tool (e.g.
antorgradle) and I guess this is not any better, and require yet another language/syntax to handle. So having a tool where the configuration is in javascript seems like a big plus. Alternatives I know forgulparegrunt(which seems outdated and barely maintained) orbroccoli(not sure how popular that is). To my knowledgegulpis the most prominent one.Questions
package.json? Likejest? Or should we create a gulp task for everything no matter what?gulp?