Skip to content

Commit 8445c0b

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 a1e97ea commit 8445c0b

File tree

6 files changed

+9
-7
lines changed

6 files changed

+9
-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, makeMinificationVariants } from '../../rollup.config';
1+
import { makeBaseBundleConfig, makeMinificationVariants, rootBuildDirectory } from '../../rollup.config';
22

33
const builds = [];
44

@@ -8,7 +8,7 @@ const builds = [];
88
isAddOn: false,
99
jsVersion,
1010
licenseTitle: '@sentry/browser',
11-
outputFileBase: `build/bundle${jsVersion === 'es6' ? '.es6' : ''}`,
11+
outputFileBase: `${rootBuildDirectory}/build/bundle${jsVersion === 'es6' ? '.es6' : ''}`,
1212
});
1313

1414
builds.push(...makeMinificationVariants(baseBundleConfig));

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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,3 +232,4 @@ export function makeMinificationVariants(existingConfigs) {
232232

233233
return newConfigs;
234234
}
235+
export const rootBuildDirectory = 'build';

0 commit comments

Comments
 (0)