Skip to content

Commit 723267a

Browse files
committed
feat(build): introduce root build directory in @sentry/browser
* add root build directory as the output directory for all module formats and bundles. This puts all build JS files and modules (bundles, esm, cjs) into one central build directory. Currently, `package.json`, Readme, License, etc. are still in the package root directories. This should keep things more organized and more clearly arranged. * adjust `tsconfig.json` to build type declarations (*.d.ts) into a separate directory (`build/types`). This deduplicates the identical declarations that were peviously compiled into `dist` and `esm`. * introduce `rootBuildDirectory` export in root `rollup.config.js` as it will (probably) be used in multiple packages and this lets us change the name for all of them at once.
1 parent 845aada commit 723267a

File tree

6 files changed

+10
-7
lines changed

6 files changed

+10
-7
lines changed

packages/browser/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
"engines": {
1010
"node": ">=6"
1111
},
12-
"main": "dist/index.js",
13-
"module": "esm/index.js",
14-
"types": "dist/index.d.ts",
12+
"main": "build/dist/index.js",
13+
"module": "build/esm/index.js",
14+
"types": "build/types/index.d.ts",
1515
"publishConfig": {
1616
"access": "public"
1717
},

packages/browser/rollup.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { makeBaseBundleConfig, makeLicensePlugin, terserPlugin } from '../../rollup.config';
1+
import { makeBaseBundleConfig, makeLicensePlugin, rootBuildDirectory, terserPlugin } from '../../rollup.config';
22

33
const builds = [];
44

@@ -9,7 +9,7 @@ const licensePlugin = makeLicensePlugin();
99
input: 'src/index.ts',
1010
isAddOn: false,
1111
jsVersion,
12-
outputFileBase: `build/bundle${jsVersion === 'es6' ? '.es6' : ''}`,
12+
outputFileBase: `${rootBuildDirectory}/bundle/bundle${jsVersion === 'es6' ? '.es6' : ''}`,
1313
});
1414

1515
builds.push(

packages/browser/tsconfig.cjs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
"compilerOptions": {
55
"module": "commonjs",
6-
"outDir": "dist"
6+
"outDir": "build/dist",
77
}
88
}

packages/browser/tsconfig.esm.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
"compilerOptions": {
55
"module": "es6",
6-
"outDir": "esm"
6+
"outDir": "build/esm",
77
}
88
}

packages/browser/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55

66
"compilerOptions": {
77
// package-specific options
8+
"declarationDir": "build/types"
89
}
910
}

rollup.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,5 @@ export function makeBaseBundleConfig(options) {
207207

208208
return deepMerge(sharedBundleConfig, isAddOn ? addOnBundleConfig : standAloneBundleConfig);
209209
}
210+
211+
export const rootBuildDirectory = 'build';

0 commit comments

Comments
 (0)