Skip to content
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

feat(dev): Clean up package.json scripts and add build:dev option #4048

Merged
merged 1 commit into from
Oct 11, 2021

Conversation

lobsterkatie
Copy link
Member

The more packages our repo accumulates, the slower building gets. When we're actively working on a particular task, though, what we actually need to build is only a subset of what running yarn:build at the top level of the repo gets us. Specifically, we generally don't need CDN bundles, and we don't need any non-core ("core" in the English sense, not the @sentry/core sense) packages other than the one we're working on.

This introduces three new top-level yarn scripts:, build:dev, build:dev:filter, and build:dev:watch. The first is the same as build, except it doesn't build any CDN bundles. The second takes an argument, the name of a particular package, and only builds packages related to it - it, its dependents, and its dependencies. The third is the first, but in watch mode. It doesn't bother with filtering because incremental builds are so fast that the filtering really doesn't gain you much.

It also does some cleanup and standardization of the scripts entry of all of the package.json files in the repo - it alphabetizes the options, gets rid of the unused build:dist synonym of build:es5 which exists only in the browser package and isn't used anywhere, and moves the :watch suffix last in all script names with three parts (as was the case in some packages but not others).

A sampling of the time savings when using the new options:

yarn build: 190 sec
yarn build:dev: 89 sec
yarn build:dev:filter @sentry/angular: 27 sec
yarn build:dev:filter @sentry/ember: 30 sec
yarn build:dev:filter @sentry/gatsby: 40 sec
yarn build:dev:filter @sentry/nextjs: 50 sec
yarn build:dev:filter @sentry/node: 64 sec
yarn build:dev:filter @sentry/react: 54 sec
yarn build:dev:filter @sentry/serverless: 48 sec
yarn build:dev:filter @sentry/tracing: 70 sec
yarn build:dev:filter @sentry/vue: 28 sec
yarn build:dev:filter @sentry/wasm: 27 sec

@github-actions
Copy link
Contributor

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 22.33 KB (-0.01% 🔽)
@sentry/browser - Webpack 23.31 KB (0%)
@sentry/react - Webpack 23.34 KB (0%)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 29.79 KB (-0.01% 🔽)

@kamilogorek
Copy link
Contributor

TIL --include-filtered-dependencies --include-filtered-dependents. I didn't review all of it, as it's the same change everywhere and changed sorting order, but looks fine.

@lobsterkatie lobsterkatie merged commit e82a9bc into master Oct 11, 2021
@lobsterkatie lobsterkatie deleted the kmclb-package-json-scripts-build-dev branch October 11, 2021 16:11
lobsterkatie added a commit that referenced this pull request Oct 11, 2021
This updates `CONTRIBUTING.md` to use the `build:dev` commands introduced in #4048. It also includes some very minor wordsmithing and a few changes made by the auto-formatter.
lobsterkatie added a commit that referenced this pull request Oct 19, 2021
…4074)

As of #4048, it's more likely that one might try to run the full test suite without having built the browser bundle. Since the wasm tests rely on it, this adds a check before they run, along with an error message letting the user know why things aren't working.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants