-
Notifications
You must be signed in to change notification settings - Fork 421
chore: simplify and standardize package.json
scripts and CI setup
#7069
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
Conversation
📊 Benchmark resultsComparing with fb36998
|
package.json
Outdated
"site:build": "run-s site:build:*", | ||
"site:build:install": "cd site && npm install --no-audit", | ||
"site:build:assets": "cd site && npm run build", | ||
"postinstall-pack": "node ./scripts/postinstall.js", |
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.
This postinstall-pack
hook gets renamed to postinstall
in a script triggered from the prepublishOnly
hook, so that when users install this package they see some output we want them to see at install time.
"site:build:install": "cd site && npm install --no-audit", | ||
"site:build:assets": "cd site && npm run build", | ||
"postinstall-pack": "node ./scripts/postinstall.js", | ||
"postinstall": "npm run build && node ./scripts/postinstall.js", |
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.
See comment above – we were also triggering this when running npm i
in this repo when developing in this repo, but that seems unnecessary so I didn't bother preserving it.
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.
... In fact this may be why we had the preinstall build step in the first place... so that this script can run (it uses some npm deps).
06768a9
to
b914412
Compare
There were two separate scripts for doing the same thing.
b914412
to
da1f74b
Compare
``` | ||
|
||
### Attaching a Debugger | ||
|
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.
Whoops, my editor reformatted this. I can revert it if the reviewer cares.
CONTRIBUTING.md
Outdated
npm install && npm run site:build:install | ||
npm install |
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.
This being mentioned here didn't make any sense so I removed it (there's a section below about the docs site)
package.json
Outdated
"test:ci:vitest:integration": "vitest run --coverage tests/integration/", | ||
"e2e": "node ./tools/e2e/run.js", | ||
"docs": "npm run --prefix=site build", | ||
"site:build": "npm run build && npm install --prefix=site --no-audit && npm run --prefix=site build", |
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 love the npm install
inside a script but that's a whole can of worms that didn't seem worth pursuing
No behavioural changes in this commit.
- It's nonstandard - It's surprising - Since we use `tsc` to build, it causes every CI check to fail if you have type errors - It causes issues when rewriting git history - It's a bit magical
ava was removed a couple years ago
They handle two kinds of benchmarks, only one of which is package size
da1f74b
to
946bd2d
Compare
package.json
scripts and CI setup
We're using `run-s` which comes from this dep but it only happens to work because one of our dependencies has a transitive dependency on `npm-run-all`. IMO we should kill this, but for now this just adds the missing dep. Note: npm-run-all2 is a maintained fork of the unmaintained npm-run-all
946bd2d
to
ec2e860
Compare
"test": "run-s format test:dev", | ||
"format": "run-s format:check-fix:*", | ||
"format:ci": "run-s format:check:*", | ||
"format:check-fix:lint": "run-s format:check:lint format:fix:lint", |
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.
bonus win: this was running eslint twice... fixing also checks, so it was redundant!
"format:check-fix:lint": "run-s format:check:lint format:fix:lint", | ||
"format:check:lint": "cross-env-shell eslint $npm_package_config_eslint", | ||
"format:fix:lint": "cross-env-shell eslint --fix $npm_package_config_eslint", | ||
"format:check-fix:prettier": "run-s format:check:prettier format:fix:prettier", |
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.
same for prettier
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.
The CLI currently runs `npm run build` in a post-install script. Many of commands in the CLI implicitly depend on this behavior, which is unnecessarily complicated. This post-install script conflicts with the user-facing post-install script, which means we need to do a little pre- publish post-install script juggling to ensure that the end user runs the correct script after installing the CLI. This change removes the post-install script in favor of explicitly building the CLI before e.g. CI steps that require a built CLI. Partial un-reversion of #7069, which was reverted in #7085.
The CLI currently runs `npm run build` in a post-install script. Many of commands in the CLI implicitly depend on this behavior, which is unnecessarily complicated. This post-install script conflicts with the user-facing post-install script, which means we need to do a little pre- publish post-install script juggling to ensure that the end user runs the correct script after installing the CLI. This change removes the post-install script in favor of explicitly building the CLI before e.g. CI steps that require a built CLI. Partial un-reversion of #7069, which was reverted in #7085.
The CLI currently runs `npm run build` in a post-install script. Many of commands in the CLI implicitly depend on this behavior, which is unnecessarily complicated. This post-install script conflicts with the user-facing post-install script, which means we need to do a little pre- publish post-install script juggling to ensure that the end user runs the correct script after installing the CLI. This change removes the post-install script in favor of explicitly building the CLI before e.g. CI steps that require a built CLI. Partial un-reversion of #7069, which was reverted in #7085.
The CLI currently runs `npm run build` in a post-install script. Many of commands in the CLI implicitly depend on this behavior, which is unnecessarily complicated. This post-install script conflicts with the user-facing post-install script, which means we need to do a little pre- publish post-install script juggling to ensure that the end user runs the correct script after installing the CLI. This change removes the post-install script in favor of explicitly building the CLI before e.g. CI steps that require a built CLI. Partial un-reversion of #7069, which was reverted in #7085.
The CLI currently runs `npm run build` in a post-install script. Many of commands in the CLI implicitly depend on this behavior, which is unnecessarily complicated. This post-install script conflicts with the user-facing post-install script, which means we need to do a little pre- publish post-install script juggling to ensure that the end user runs the correct script after installing the CLI. This change removes the post-install script in favor of explicitly building the CLI before e.g. CI steps that require a built CLI. Partial un-reversion of #7069, which was reverted in #7085.
The CLI currently runs `npm run build` in a post-install script. Many of commands in the CLI implicitly depend on this behavior, which is unnecessarily complicated. This post-install script conflicts with the user-facing post-install script, which means we need to do a little pre- publish post-install script juggling to ensure that the end user runs the correct script after installing the CLI. This change removes the post-install script in favor of explicitly building the CLI before e.g. CI steps that require a built CLI. Partial un-reversion of #7069, which was reverted in #7085.
The CLI currently runs `npm run build` in a post-install script. Many of commands in the CLI implicitly depend on this behavior, which is unnecessarily complicated. This post-install script conflicts with the user-facing post-install script, which means we need to do a little pre- publish post-install script juggling to ensure that the end user runs the correct script after installing the CLI. This change removes the post-install script in favor of explicitly building the CLI before e.g. CI steps that require a built CLI. Partial un-reversion of #7069, which was reverted in #7085.
The CLI currently runs `npm run build` in a post-install script. Many of commands in the CLI implicitly depend on this behavior, which is unnecessarily complicated. This post-install script conflicts with the user-facing post-install script, which means we need to do a little pre- publish post-install script juggling to ensure that the end user runs the correct script after installing the CLI. This change removes the post-install script in favor of explicitly building the CLI before e.g. CI steps that require a built CLI. Partial un-reversion of #7069, which was reverted in #7085.
📣 You should probably review this commit by commit!
2593f33 Remove
postinstall
hook that builds the packagetsc
to build, it causes every CI check to fail if you have type errorsI refactored an affected script in a separate commit first (be729a2), for easier review.
b57d815 Simplify site build scripts
There were two separate scripts for doing the same thing for some reason. I ran into this oddity while making the above change.
5c3f767 Remove leftover refs to
ava
ava was removed a couple years ago
f4119f8 Rename misleading CI jobs
They handle two kinds of benchmarks, only one of which is package size
bf2bfa2 Split formating, linting, and unit testing
846d1c4 Simplify CI workflow skipping for release branches
You can just skip the whole job instead of skipping every step!
7169000 chore(package.json): sort scripts
ec2e860 Add missing dependency on
npm-run-all
We're using
run-s
which comes from this dep but it only happens to work because one ofour dependencies has a transitive dependency on
npm-run-all
.IMO we should kill this, but for now this just adds the missing dep.
Note: npm-run-all2 is a maintained fork of the unmaintained npm-run-all