This repository was archived by the owner on Aug 30, 2023. It is now read-only.
ref(build): Add central build directory from JS SDK#321
Merged
Conversation
Member
|
Thanks for the detailed explanation -- I agree with you in regards to the breaking change. |
billyvg
approved these changes
Nov 18, 2022
f371bcf to
6a73681
Compare
Co-authored-by: Billy Vong <billyvg@users.noreply.github.com>
size-limit report 📦
|
Member
Author
I guess we can't simplify this transition for size-bot 🤔 |
9 tasks
mydea
pushed a commit
to getsentry/sentry-javascript
that referenced
this pull request
Nov 23, 2022
…ry-replay#321) Introduce central `build` directory to the Replay package: * Change build output to `build/npm` (see explanation below) * Change `build:npm` command to execute a prepack script * Temporarily introduce the `./scripts/tmp-prepack.ts` script which copies files like `README.md`, `LICENSE` and `package.json` into `build/npm`. This is a simplified version of the monorepo's prepack script. While doing so, the script makes changes to `package.json` to align the entry points. * This file will be removed once we migrated as we can then use the monorepo's prepack script. * Remove the `files` entry in `package.json` for consistency with the monorepo (we just rely on `.npmignore`s) * Adjust occurrances of `dist` folder, replacing or adding `build` as appropriate As of this patch, the build directory will have the following structure: ``` <replay-root>/ ├─ build/ │ ├─ npm/ <-- everything in this directory goes into the NPM tarball │ │ ├─ types/ │ │ │ ├─ *.d.ts files (+maps) │ │ ├─ index(.es)?.js file + map │ │ ├─ package.json │ │ ├─ LICENSE │ | ├─ README.md ├─ ... ``` Co-authored-by: Billy Vong <billyvg@users.noreply.github.com>
8 tasks
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 makes a change to the build process: Previously, transpiled JS, declaration files and source maps were written into
dist. To align Replay with the build process in the SDK monorepo, this PR makes the following changes:build/npm(see explanation below)build:npmcommand to execute a prepack script./scripts/tmp-prepack.tsscript which copies files likeREADME.md,LICENSEandpackage.jsonintobuild/npm. This is a simplified version of the monorepo's prepack script. While doing so, the script makes changes topackage.jsonto align the entry points.filesentry inpackage.jsonfor consistency with the monorepo (we just rely on.npmignores)distfolder, replacing or addingbuildas appropriateAs of this PR, the build directory will have the following structure:
More context on the JS SDK's build directory structure:
While this is arguably not the simplest setup, the structure below serves two purposes:
For example, we remove certain properties in the shipped
package.json, which our users don't needOnce we finished the migration of Replay, the build directory structure will be identical to the JS SDK structure of SDK packages with bundles:
Note that as soon as we change the entry point paths in
package.json(main, modules, types), we're technically introducing a breaking change. It is however a very edge-case-y scenario in which users import modules from an explicit path rather than from the top-level package:I would argue that introducing this breaking change is fine as long as we're in this
0.x/alpha state but I'm happy to hear other opinions on this.As of this PR nothing breaking is happening yet.