Skip to content

Discussion: Make developing babel on Windows easier#9674

Closed
danez wants to merge 3 commits intobabel:masterfrom
danez:gulp
Closed

Discussion: Make developing babel on Windows easier#9674
danez wants to merge 3 commits intobabel:masterfrom
danez:gulp

Conversation

@danez
Copy link
Copy Markdown
Member

@danez danez commented Mar 13, 2019

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.

@danez danez changed the title Discussion: Move from make+bash to gulp+npm scripts Discussion: Make developing babel on Windows easier Mar 13, 2019
@danez danez removed the help wanted label Mar 13, 2019
@alexzherdev
Copy link
Copy Markdown
Contributor

FWIW I know eslint uses shelljs/make https://github.com/eslint/eslint/blob/06fa1655c3da8394ed9144d727115fc434b0416f/Makefile.js
Don't know much about their experience though.

@danez
Copy link
Copy Markdown
Member Author

danez commented Mar 13, 2019

FWIW I know eslint uses shelljs/make https://github.com/eslint/eslint/blob/06fa1655c3da8394ed9144d727115fc434b0416f/Makefile.js
Don't know much about their experience though.

Oh interesting, so we could directly translate the Makefile to shelljs/make, that might be even less work.

@hzoo
Copy link
Copy Markdown
Member

hzoo commented Mar 13, 2019

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

@danez danez mentioned this pull request Jul 27, 2019
@danez danez closed this Nov 7, 2021
@danez danez deleted the gulp branch November 7, 2021 16:01
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Feb 7, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

i: discussion os: windows outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants