-
-
Notifications
You must be signed in to change notification settings - Fork 688
Add npm workspaces #1372
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
Add npm workspaces #1372
Conversation
In the messages/javascript package.json, try adding: {
"scripts": {
"prepare": "npm run pbjs && npm run pbts",
...
}
}That should run automatically after |
My understanding of npm workspaces is that you're only supposed to run Any idea? |
|
Looks like the answer is "we fixed it recently" npm/cli#1965. I'll push a commit and we find out? |
so we generate the code from the protobuf definition right after install
|
Worked for me locally with a fresh clone! Also npm 7 is very fast! |
react/javascript/Makefile
Outdated
| dist/src/styles/cucumber-react.css: src/styles/styles.scss src/styles/react-accessible-accordion.css | ||
| mkdir -p $(@D) | ||
| ./node_modules/.bin/sass $< > $@ | ||
| ../../node_modules/.bin/sass $< > $@ |
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.
What about using npx sass instead of a relative path to the binary?
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.
and/or could we move to the package.json, maybe another candidate for using prepare?
- make sure .codegen happens in react when `npm install` - make sure to copy `messages.js` and `messages.d.ts` in `dist` in messages when `npm install`
| "declaration": true, | ||
| "declarationMap": true, | ||
| "sourceMap": true, | ||
| "target": "es6", |
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.
Given Node 10 is our lowest common denominator, we should be able to target es2018 - means no transpilation of async/await etc.
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.
Although I guess we need to ensure some packages work in browser. Do we leave it up to consuming projects to do transpilation?
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.
Given Node 10 is our lowest common denominator
Is it though? Some modules also need to work in the browser, such as cucumber/@react and all its dependencies. I also know that some teams use cucumber/@gherkin in the browser - I recently decoupled node-specific libraries to make this possible without polyfills.
So with that in mind, what do you think we should target?
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.
Yeah I remembered about browsers right after I hit Comment :)
I'd like to think we could just ship ES[current] code and have consuming projects do the transpiling they need, but I don't think the ecosystem is there yet. So:
es6assuming we aren't worried about IEes5if we do need to worry about IE
As npm install and buid are not in makefiles anymore, I've just executed those steps before make ci in the job itself.
|
The details provided by @aslakhellesoy here and @davidjgoss, here, would be useful inclusions in the existing item:
|
Removes some requirements for javascript jobs
json-to-messages/javascript, or at least its test suite, does not work with json generated from cucumber-js 7.
Summary
Binging NPM 7 Workspaces into the monorepo
Details
Refs. #1259
TODO
tsconfig.build.jsonso we cannpm i && npm run buildall npm modules from root.npm run eslint-fixwork from rootnpm run upgradework from root*/javascript/package.jsonand only declare them once in the rootpackage.json*/javascript/package.jsonfiles (should only be in the root one).preparelifecycle script won't run when consumers install the package.templates/javascript/default.mk.templates/javascript/.eslintrc.jsonand all copies.templates/javascript/.prettierrcand all copiesmessages/javascript/src/messages.jsandmessages/javascript/src/messages.d.tsfilesnpm i && npm run buildwill fail from a fresh clone. We don't want to have to donpm i && pushd messages/javascript && make && popd && npm run buildnpm run buildfrom the root)tsconfig.jsonfiles to just{ "extends": "../../tsconfig.json" }compilerOptions.pathsin roottsconfig.jsonfile.circleci/config.ymlnpm install && npm run build?npm test?npm iin root. Runningnpm run buildshould be the last step. Runnpm testto test all modules..templates/javascript/default.mkremove-local-dependencies./tsconfig.base.jsonand./tsconfig.build.json- at the moment some duplication remains in those files.rsync) to the new packages (message-streams,gherkin-streams)gherkinacceptance tests are running