This repository was archived by the owner on Aug 30, 2023. It is now read-only.
ref(build): Align package.json build scripts with JS SDK scripts#320
Merged
ref(build): Align package.json build scripts with JS SDK scripts#320
package.json build scripts with JS SDK scripts#320Conversation
size-limit report 📦
|
9 tasks
mydea
approved these changes
Nov 18, 2022
f371bcf to
6a73681
Compare
mydea
pushed a commit
to getsentry/sentry-javascript
that referenced
this pull request
Nov 23, 2022
…etsentry/sentry-replay#320) Align the scripts in `package.json` with the scripts we use in the JS SDK repo. Doing this now doesn't hurt us and it's one less thing to worry about when migrating. Admittedly, the `build:*` scripts look a little scary now but this is just because I wanted to preserve the separate build scripts for worker and core. Therefore, we'll end up with a few more scripts than we have in most other SDKs (s.g. [Svelte](https://github.com/getsentry/sentry-javascript/blob/d22380097b70bc503613cebbf2b914175174221c/packages/svelte/package.jsongetsentry/sentry-replay#L34-L42)). In the monorepo, we don't set env variables for prod vs. dev builds. I still need to think about what we're going to do about them but we can make these changes iteratively. Here's a quick overview of the most important changes. All these scripts are used in the monorepo, not just by us but also by CI, so we need to align them: * `build` now serves as a "default" build command. I renamed what used to be the `build` script to `build:rollup` (which is also consistent with the monorepo). I left `build:prod` from devEx reasons for now but we can remove it after migrating. * `build:dev` basically remains unchanged as it's already mostly consistent with the monorepo * Added `build:watch` and `build:dev:watch` to re-build on file changes. I think previously, the `--watch` param was only applied to `build-core` but I figured we could also watch for worker changes. Which is why I added the `build:all:watch` sub-script to do this. I left the `dev` script for now to not disturb devEx but after migrating we can remove it, as it isn't used in the monorepo at all. * Added `build:npm` script to pack a tarball when publishing. In the monorepo, we use a script that makes some changes to `package.json` before packing. We'll need to add this here as well but not now, as it requires more changes. Also, I changed the "Build" GH workflow to use this command instead of `npm pack`. * Added `lint` and `fix` scripts that use eslint and prettier. I left the original commands eslint untouched, just changed the script names around it (and added the prettier stuff) I added the `npm-run-all` dev dependency for the time being, to get the `run-p/s` commands we use in the monorepo. After migrating, we can remove the dependency again from this package because it's registered as a top-level dependency in the monorepo.
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR aligns the scripts in
package.jsonwith the scripts we use in the JS SDK repo. Doing this now doesn't hurt us and it's one less thing to worry about when migrating. Admittedly, thebuild:*scripts look a little scary now but this is just because I wanted to preserve the separate build scripts for worker and core. Therefore, we'll end up with a few more scripts than we have in most other SDKs (s.g. Svelte).In the monorepo, we don't set env variables for prod vs. dev builds. I still need to think about what we're going to do about them but we can make these changes iteratively.
Here's a quick overview of the most important changes. All these scripts are used in the monorepo, not just by us but also by CI, so we need to align them:
buildnow serves as a "default" build command. I renamed what used to be thebuildscript tobuild:rollup(which is also consistent with the monorepo). I leftbuild:prodfrom devEx reasons for now but we can remove it after migrating.build:devbasically remains unchanged as it's already mostly consistent with the monorepobuild:watchandbuild:dev:watchto re-build on file changes. I think previously, the--watchparam was only applied tobuild-corebut I figured we could also watch for worker changes. Which is why I added thebuild:all:watchsub-script to do this. I left thedevscript for now to not disturb devEx but after migrating we can remove it, as it isn't used in the monorepo at all.build:npmscript to pack a tarball when publishing. In the monorepo, we use a script that makes some changes topackage.jsonbefore packing. We'll need to add this here as well but not now, as it requires more changes. Also, I changed the "Build" GH workflow to use this command instead ofnpm pack.lintandfixscripts that use eslint and prettier. I left the original commands eslint untouched, just changed the script names around it (and added the prettier stuff)I added the
npm-run-alldev dependency for the time being, to get therun-p/scommands we use in the monorepo. After migrating, we can remove the dependency again from this package because it's registered as a top-level dependency in the monorepo.ref #311