-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ref(build): Introduce central build
directory to packages with bundles
#4838
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
postbuild.sh
to node scriptbuild
directory to packages with bundles
173880a
to
c889c0e
Compare
c889c0e
to
31e1f5d
Compare
It's fine if you want to leave it like this for this PR (and the one making this same change to the non-bundle packages), and then make a wholesale change separately, but the more I think about it, the more I think this work shouldn't happen on every build, since it's really only relevant to publishing and only a tiny fraction of builds go on to be published. |
Super tiny nit: Especially for a PR where the idea is to have each commit be one idea, and where you want to look at each commit as an entity in and of itself, it'd be great to have the first commit's message explain what that commit is (as all the others' respective messages do), rather than just be the PR title. |
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.
LGTM!
Yes you're right. My initial idea was to make the postbuild->prepack change in a separate PR but tbh I think this can still fit in this one. Especially, when considering that I'm basing the rest of the build dir conversions on this work here so I'd essentially be adding things to that branch of which I know that I'd change them directly afterwards again.
Good point, thanks for mentioning it. I'll do better with the next PR coming soon. |
in this commit: * move browser npm build files to `build/npm` * adjust `postbuild.ts` for tmp copying of bundles into npm
adjust postbuild.ts to take optional CL arg to not tmp copy CDN bundles
31e1f5d
to
7d62442
Compare
co-authored by: @lobsterkatie
add postbuild->prepack changes to `@sentry/browser` add postbuild->prepack changes to `@sentry/integrations` add postbuild->prepack changes to `@sentry/tracing` add postbuild->prepack changes to `@sentry/wasm`
b327388
to
148ee3f
Compare
size-limit report 📦
|
for some reason, these tests require a `package.json` file in the `build` directory. The quick fix is to simply run `prepack.ts` in Tracing after building
…dles (Part 1) (#4854) This PR is part 1 of adding the `build` directory to packages _without_ CDN bundles. It is split into two parts to make reviewing easier. It covers the following packages: * Core * Gatsby * Hub * Minimal Additionally, it adjusts `prepack.ts` to handle both kinds of packages (with/without CDN bundles) via a CL argument. For the Gatsby SDK, additional actions have to be performed which are only relevant for this package. Therefore, `prepack.ts` now supports calling a package-specific `prepack.ts` file located in `<package>/scripts/prepack.ts`. While the tarball structure is identical to the structure in #4838 (except for temporary CDN bundles), the `build` directory structure is simplified due to the fact that there are no CDN bundles or legacy NPM packages to be added to it. Therefore we can reduce one hierarchy level, resulting in the following structure: ``` <sdk>/ ├─ build/ │ ├─ cjs/ // dist until v7 │ │ ├─ CJS modules (+maps) │ ├─ esm/ │ │ ├─ ES6 modules (+maps) │ ├─ types/ │ │ ├─ *.d.ts files (+maps) │ ├─ package.json │ ├─ LICENSE │ ├─ README.md ├─ ... ``` Co-authored-by: Abhijeet Prasad <[email protected]>
Background
This is the continuation of the build directory restructuring started in #4688. The goal is to put everything building related (i.e. compiled code and non-code assets for NPM tarballs) into one central directory.
Changes
This PR introduces the central
build
directory to all our packages producing CDN bundles in addition to NPM tarballs:The new
build
directory for packages with CDN bundles will have the following structure:Inside the tarball, the directory structure is as follows*:
A small note here: CDN bundles will be removed from the tarball in v7. Until then, they remain in the
build
directory in the tarball, which should not be mistaken for the centralbuild
directory described above. I know, this is confusing but otherwise, this would be a breaking change for people unofficially using our CDN bundles e.g. via UNPKG.*for WASM, CDN bundles are not added to the tarball as they were not previously included.
Procedure:
yarn build
will start compilation (no changes on this end).yarn build:npm
starts the prepack script and subsequently creates the NPM tarball. Theprepack.ts
script:build/npm
build/npm/build
until v7package.json
entry points to align with the NPM tarball structure described abovepackage.json
yarn build:npm
will pack the NPM tarball from insidebuild/npm
and save it in the package root directory.Additional Information
"But what about Vue
and WASMbundles!?" you might ask. Well, it turns out, those are created but not published. So we actually do not need to create them either for every build. To not clutter this PR too much, I'll deactivate the bundle creation by default in a separate one coming soon (TM).How to best review: Every commit represents the changes for one package. For reviewing, it might be helpful to go through the changes commit-by-commit, starting with fd0da2c. I double and triple checked the correct tarball creation but given that a bug in this PR could easily break users, a second pair of eyes can't hurt.
ref: https://getsentry.atlassian.net/browse/WEB-780