diff --git a/.npmignore b/.npmignore new file mode 100644 index 000000000000..4ab7cc4f278f --- /dev/null +++ b/.npmignore @@ -0,0 +1,11 @@ +# The paths in this file are specified so that they align with the file structure in `./build` after this file is copied +# into it by the prepack script `scripts/prepack.ts`. + +* + +# TODO remove bundles (which in the tarball are inside `build`) in v7 +!/build/**/* + +!/dist/**/* +!/esm/**/* +!/types/**/* diff --git a/.size-limit.js b/.size-limit.js index ad0aae688eae..8c51fdb70b84 100644 --- a/.size-limit.js +++ b/.size-limit.js @@ -39,14 +39,14 @@ module.exports = [ }, { name: '@sentry/react - Webpack (gzipped + minified)', - path: 'packages/react/esm/index.js', + path: 'packages/react/build/esm/index.js', import: '{ init }', gzip: true, limit: '100 KB', }, { name: '@sentry/nextjs Client - Webpack (gzipped + minified)', - path: 'packages/nextjs/esm/index.client.js', + path: 'packages/nextjs/build/esm/index.client.js', import: '{ init }', gzip: true, limit: '100 KB', diff --git a/packages/browser/.npmignore b/packages/browser/.npmignore deleted file mode 100644 index 8c9dff2dc460..000000000000 --- a/packages/browser/.npmignore +++ /dev/null @@ -1,12 +0,0 @@ -# Info: the paths in this file are specified so that they align with the file -# structure in `./build` where this file is copied to. This is done by the -# prepack script `sentry-javascript/scripts/prepack.ts`. - -* - -# TODO remove bundles (which in the tarball are inside `build`) in v7 -!/build/**/* - -!/dist/**/* -!/types/**/* -!/esm/**/* diff --git a/packages/browser/package.json b/packages/browser/package.json index 211c933c10bd..316f3c5f55fe 100644 --- a/packages/browser/package.json +++ b/packages/browser/package.json @@ -58,7 +58,7 @@ "build:dev:watch": "run-p build:cjs:watch build:esm:watch build:types:watch", "build:esm:watch": "tsc -p tsconfig.esm.json --watch", "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build/npm", + "build:npm": "ts-node ../../scripts/prepack.ts --bundles && npm pack ./build/npm", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf build coverage .rpt2_cache", "fix": "run-s fix:eslint fix:prettier", diff --git a/packages/core/.npmignore b/packages/core/.npmignore deleted file mode 100644 index 0514c96743ba..000000000000 --- a/packages/core/.npmignore +++ /dev/null @@ -1,9 +0,0 @@ -# Info: the paths in this file are specified so that they align with the file -# structure in `./build` where this file is copied to. This is done by the -# prepack script `sentry-javascript/scripts/prepack.ts`. - -* - -!/dist/**/* -!/esm/**/* -!/types/**/* diff --git a/packages/core/package.json b/packages/core/package.json index eea768058926..a5cc730b465d 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -35,7 +35,7 @@ "build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***", "build:esm:watch": "tsc -p tsconfig.esm.json --watch", "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:npm": "ts-node ../../scripts/prepack.ts -noBundles && npm pack ./build", + "build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf dist esm build coverage", "fix": "run-s fix:eslint fix:prettier", diff --git a/packages/gatsby/.npmignore b/packages/gatsby/.npmignore index fb585a43c956..b8bb08da7374 100644 --- a/packages/gatsby/.npmignore +++ b/packages/gatsby/.npmignore @@ -1,6 +1,5 @@ -# Info: the paths in this file are specified so that they align with the file -# structure in `./build` where this file is copied to. This is done by the -# prepack script `sentry-javascript/scripts/prepack.ts`. +# The paths in this file are specified so that they align with the file structure in `./build` after this file is copied +# into it by the prepack script `scripts/prepack.ts`. * diff --git a/packages/gatsby/package.json b/packages/gatsby/package.json index 1ba4b1793c10..0c4b865a8d38 100644 --- a/packages/gatsby/package.json +++ b/packages/gatsby/package.json @@ -46,7 +46,7 @@ "build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***", "build:esm:watch": "tsc -p tsconfig.esm.json --watch", "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:npm": "ts-node ../../scripts/prepack.ts -noBundles && npm pack ./build", + "build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf dist esm build coverage", "fix": "run-s fix:eslint fix:prettier", diff --git a/packages/hub/.npmignore b/packages/hub/.npmignore deleted file mode 100644 index 0514c96743ba..000000000000 --- a/packages/hub/.npmignore +++ /dev/null @@ -1,9 +0,0 @@ -# Info: the paths in this file are specified so that they align with the file -# structure in `./build` where this file is copied to. This is done by the -# prepack script `sentry-javascript/scripts/prepack.ts`. - -* - -!/dist/**/* -!/esm/**/* -!/types/**/* diff --git a/packages/hub/package.json b/packages/hub/package.json index 8f40d5e0ffd1..c0678cdd9e4a 100644 --- a/packages/hub/package.json +++ b/packages/hub/package.json @@ -33,7 +33,7 @@ "build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***", "build:esm:watch": "tsc -p tsconfig.esm.json --watch", "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:npm": "ts-node ../../scripts/prepack.ts -noBundles && npm pack ./build", + "build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf dist esm coverage", "fix": "run-s fix:eslint fix:prettier", diff --git a/packages/integrations/.npmignore b/packages/integrations/.npmignore deleted file mode 100644 index c6e94588f342..000000000000 --- a/packages/integrations/.npmignore +++ /dev/null @@ -1,12 +0,0 @@ -# Info: the paths in this file are specified so that they align with the file -# structure in `./build` where this file is copied to. This is done by the -# prepack script `sentry-javascript/scripts/prepack.ts`. - -* - -# TODO remove bundles (which in the tarball are inside `build`) in v7 -!/build/**/* - -!/dist/**/* -!/esm/**/* -!/types/**/* diff --git a/packages/integrations/package.json b/packages/integrations/package.json index 25dd588c9a34..69e5e0579413 100644 --- a/packages/integrations/package.json +++ b/packages/integrations/package.json @@ -38,7 +38,7 @@ "build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***", "build:esm:watch": "tsc -p tsconfig.esm.json --watch", "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build/npm", + "build:npm": "ts-node ../../scripts/prepack.ts --bundles && npm pack ./build/npm", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf dist esm build coverage .rpt2_cache", "fix": "run-s fix:eslint fix:prettier", diff --git a/packages/minimal/.npmignore b/packages/minimal/.npmignore deleted file mode 100644 index 0514c96743ba..000000000000 --- a/packages/minimal/.npmignore +++ /dev/null @@ -1,9 +0,0 @@ -# Info: the paths in this file are specified so that they align with the file -# structure in `./build` where this file is copied to. This is done by the -# prepack script `sentry-javascript/scripts/prepack.ts`. - -* - -!/dist/**/* -!/esm/**/* -!/types/**/* diff --git a/packages/minimal/package.json b/packages/minimal/package.json index 7caf902785cb..7643117419af 100644 --- a/packages/minimal/package.json +++ b/packages/minimal/package.json @@ -33,7 +33,7 @@ "build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***", "build:esm:watch": "tsc -p tsconfig.esm.json --watch", "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:npm": "ts-node ../../scripts/prepack.ts -noBundles && npm pack ./build", + "build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf dist esm build coverage", "fix": "run-s fix:eslint fix:prettier", diff --git a/packages/nextjs/.npmignore b/packages/nextjs/.npmignore deleted file mode 100644 index 8904efca5aea..000000000000 --- a/packages/nextjs/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -* -!/dist/**/* -!/esm/**/* -!/build/types/**/* diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index 93ee47f2c0ff..07b93ebe96d7 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -9,10 +9,10 @@ "engines": { "node": ">=6" }, - "main": "./dist/index.server.js", - "module": "./esm/index.server.js", - "browser": "./esm/index.client.js", - "types": "./build/types/index.server.d.ts", + "main": "build/dist/index.server.js", + "module": "build/esm/index.server.js", + "browser": "build/esm/index.client.js", + "types": "build/types/index.server.d.ts", "publishConfig": { "access": "public" }, @@ -55,9 +55,9 @@ "build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***", "build:esm:watch": "tsc -p tsconfig.esm.json --watch", "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:npm": "npm pack", + "build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build", "circularDepCheck": "madge --circular src/index.client.ts && madge --circular --exclude 'config/types\\.ts' src/index.server.ts # see https://github.com/pahen/madge/issues/306", - "clean": "rimraf dist esm coverage *.js *.js.map *.d.ts", + "clean": "rimraf dist esm build coverage *.js *.js.map *.d.ts", "fix": "run-s fix:eslint fix:prettier", "fix:eslint": "eslint . --format stylish --fix", "fix:prettier": "prettier --write \"{src,test,scripts}/**/*.ts\"", diff --git a/packages/nextjs/tsconfig.cjs.json b/packages/nextjs/tsconfig.cjs.json index abd80f77e1ff..e3a918fc70af 100644 --- a/packages/nextjs/tsconfig.cjs.json +++ b/packages/nextjs/tsconfig.cjs.json @@ -3,6 +3,6 @@ "compilerOptions": { "module": "commonjs", - "outDir": "dist" + "outDir": "build/dist" } } diff --git a/packages/nextjs/tsconfig.esm.json b/packages/nextjs/tsconfig.esm.json index b6ee3fa615c0..0b86c52918cc 100644 --- a/packages/nextjs/tsconfig.esm.json +++ b/packages/nextjs/tsconfig.esm.json @@ -3,6 +3,6 @@ "compilerOptions": { "module": "es6", - "outDir": "esm" + "outDir": "build/esm" } } diff --git a/packages/node/.npmignore b/packages/node/.npmignore deleted file mode 100644 index 16627b7131ce..000000000000 --- a/packages/node/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -* -!/dist/**/* -!/esm/**/* -!build/types/**/* diff --git a/packages/node/package.json b/packages/node/package.json index d2a4b5cfb787..d8cf0464d20a 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -9,8 +9,8 @@ "engines": { "node": ">=6" }, - "main": "dist/index.js", - "module": "esm/index.js", + "main": "build/dist/index.js", + "module": "build/esm/index.js", "types": "build/types/index.d.ts", "publishConfig": { "access": "public" @@ -46,9 +46,9 @@ "build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***", "build:esm:watch": "tsc -p tsconfig.esm.json --watch", "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:npm": "npm pack", + "build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build", "circularDepCheck": "madge --circular src/index.ts", - "clean": "rimraf dist esm coverage", + "clean": "rimraf dist esm build coverage", "fix": "run-s fix:eslint fix:prettier", "fix:eslint": "eslint . --format stylish --fix", "fix:prettier": "prettier --write \"{src,test,scripts}/**/*.ts\"", diff --git a/packages/node/test/manual/apm-transaction/main.js b/packages/node/test/manual/apm-transaction/main.js index 74c679ae1a99..e34088b4eaaf 100644 --- a/packages/node/test/manual/apm-transaction/main.js +++ b/packages/node/test/manual/apm-transaction/main.js @@ -1,7 +1,7 @@ const http = require('http'); const express = require('express'); const app = express(); -const Sentry = require('../../../dist'); +const Sentry = require('../../../build/dist'); Sentry.init({ debug: true, diff --git a/packages/node/test/manual/express-scope-separation/start.js b/packages/node/test/manual/express-scope-separation/start.js index 7523f059648b..2e89fa14f4ec 100644 --- a/packages/node/test/manual/express-scope-separation/start.js +++ b/packages/node/test/manual/express-scope-separation/start.js @@ -1,7 +1,7 @@ const http = require('http'); const express = require('express'); const app = express(); -const Sentry = require('../../../dist'); +const Sentry = require('../../../build/dist'); function assertTags(actual, expected) { if (JSON.stringify(actual) !== JSON.stringify(expected)) { diff --git a/packages/node/test/manual/memory-leak/context-memory.js b/packages/node/test/manual/memory-leak/context-memory.js index b7d6abdbcb03..9c63343c1fd8 100644 --- a/packages/node/test/manual/memory-leak/context-memory.js +++ b/packages/node/test/manual/memory-leak/context-memory.js @@ -1,4 +1,4 @@ -const Sentry = require('../../../dist'); +const Sentry = require('../../../build/dist'); Sentry.init({ dsn: 'https://public@app.getsentry.com/12345' }); diff --git a/packages/node/test/manual/memory-leak/express-patient.js b/packages/node/test/manual/memory-leak/express-patient.js index 4a5ac9bb1895..90be8be575d4 100644 --- a/packages/node/test/manual/memory-leak/express-patient.js +++ b/packages/node/test/manual/memory-leak/express-patient.js @@ -1,4 +1,4 @@ -const Sentry = require('../../../dist'); +const Sentry = require('../../../build/dist'); Sentry.init({ dsn: 'https://public@app.getsentry.com/12345' }); diff --git a/packages/node/test/manual/release-health/session-aggregates/aggregates-disable-single-session.js b/packages/node/test/manual/release-health/session-aggregates/aggregates-disable-single-session.js index 3514c834634d..cedd795e9a57 100644 --- a/packages/node/test/manual/release-health/session-aggregates/aggregates-disable-single-session.js +++ b/packages/node/test/manual/release-health/session-aggregates/aggregates-disable-single-session.js @@ -1,7 +1,7 @@ const http = require('http'); const express = require('express'); const app = express(); -const Sentry = require('../../../../dist'); +const Sentry = require('../../../../build/dist'); const { assertSessions, BaseDummyTransport } = require('../test-utils'); function cleanUpAndExitSuccessfully() { diff --git a/packages/node/test/manual/release-health/single-session/caught-exception-errored-session.js b/packages/node/test/manual/release-health/single-session/caught-exception-errored-session.js index fd8b35bf178f..9f538a1ba993 100644 --- a/packages/node/test/manual/release-health/single-session/caught-exception-errored-session.js +++ b/packages/node/test/manual/release-health/single-session/caught-exception-errored-session.js @@ -1,4 +1,4 @@ -const Sentry = require('../../../../dist'); +const Sentry = require('../../../../build/dist'); const { assertSessions, constructStrippedSessionObject, diff --git a/packages/node/test/manual/release-health/single-session/errors-in-session-capped-to-one.js b/packages/node/test/manual/release-health/single-session/errors-in-session-capped-to-one.js index 744b9ce9fbc8..65c2bf05ef7f 100644 --- a/packages/node/test/manual/release-health/single-session/errors-in-session-capped-to-one.js +++ b/packages/node/test/manual/release-health/single-session/errors-in-session-capped-to-one.js @@ -1,4 +1,4 @@ -const Sentry = require('../../../../dist'); +const Sentry = require('../../../../build/dist'); const { assertSessions, constructStrippedSessionObject, diff --git a/packages/node/test/manual/release-health/single-session/healthy-session.js b/packages/node/test/manual/release-health/single-session/healthy-session.js index e4faee92dcc1..05712ae7dcc2 100644 --- a/packages/node/test/manual/release-health/single-session/healthy-session.js +++ b/packages/node/test/manual/release-health/single-session/healthy-session.js @@ -1,4 +1,4 @@ -const Sentry = require('../../../../dist'); +const Sentry = require('../../../../build/dist'); const { assertSessions, constructStrippedSessionObject, diff --git a/packages/node/test/manual/release-health/single-session/terminal-state-sessions-sent-once.js b/packages/node/test/manual/release-health/single-session/terminal-state-sessions-sent-once.js index 90f52ef7afbb..1fe58a972569 100644 --- a/packages/node/test/manual/release-health/single-session/terminal-state-sessions-sent-once.js +++ b/packages/node/test/manual/release-health/single-session/terminal-state-sessions-sent-once.js @@ -1,4 +1,4 @@ -const Sentry = require('../../../../dist'); +const Sentry = require('../../../../build/dist'); const { assertSessions, constructStrippedSessionObject, diff --git a/packages/node/test/manual/release-health/single-session/uncaught-exception-crashed-session.js b/packages/node/test/manual/release-health/single-session/uncaught-exception-crashed-session.js index 1cc79e2457a7..8007b7d0ea4c 100644 --- a/packages/node/test/manual/release-health/single-session/uncaught-exception-crashed-session.js +++ b/packages/node/test/manual/release-health/single-session/uncaught-exception-crashed-session.js @@ -1,4 +1,4 @@ -const Sentry = require('../../../../dist'); +const Sentry = require('../../../../build/dist'); const { assertSessions, constructStrippedSessionObject, BaseDummyTransport } = require('../test-utils'); class DummyTransport extends BaseDummyTransport { diff --git a/packages/node/test/manual/release-health/single-session/unhandled-rejection-crashed-session.js b/packages/node/test/manual/release-health/single-session/unhandled-rejection-crashed-session.js index 0eea86f3f637..f24c557c878a 100644 --- a/packages/node/test/manual/release-health/single-session/unhandled-rejection-crashed-session.js +++ b/packages/node/test/manual/release-health/single-session/unhandled-rejection-crashed-session.js @@ -1,4 +1,4 @@ -const Sentry = require('../../../../dist'); +const Sentry = require('../../../../build/dist'); const { assertSessions, constructStrippedSessionObject, diff --git a/packages/node/test/manual/webpack-domain/index.js b/packages/node/test/manual/webpack-domain/index.js index 56037d2c0547..e0479e0fec78 100644 --- a/packages/node/test/manual/webpack-domain/index.js +++ b/packages/node/test/manual/webpack-domain/index.js @@ -1,4 +1,4 @@ -const Sentry = require('../../../dist'); +const Sentry = require('../../../build/dist'); let remaining = 2; diff --git a/packages/node/tsconfig.cjs.json b/packages/node/tsconfig.cjs.json index abd80f77e1ff..e3a918fc70af 100644 --- a/packages/node/tsconfig.cjs.json +++ b/packages/node/tsconfig.cjs.json @@ -3,6 +3,6 @@ "compilerOptions": { "module": "commonjs", - "outDir": "dist" + "outDir": "build/dist" } } diff --git a/packages/node/tsconfig.esm.json b/packages/node/tsconfig.esm.json index b6ee3fa615c0..0b86c52918cc 100644 --- a/packages/node/tsconfig.esm.json +++ b/packages/node/tsconfig.esm.json @@ -3,6 +3,6 @@ "compilerOptions": { "module": "es6", - "outDir": "esm" + "outDir": "build/esm" } } diff --git a/packages/react/.npmignore b/packages/react/.npmignore deleted file mode 100644 index 8904efca5aea..000000000000 --- a/packages/react/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -* -!/dist/**/* -!/esm/**/* -!/build/types/**/* diff --git a/packages/react/package.json b/packages/react/package.json index 6cc96bc70d65..97eb215c19d9 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -9,8 +9,8 @@ "engines": { "node": ">=6" }, - "main": "dist/index.js", - "module": "esm/index.js", + "main": "build/dist/index.js", + "module": "build/esm/index.js", "types": "build/types/index.d.ts", "publishConfig": { "access": "public" @@ -61,7 +61,7 @@ "build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***", "build:esm:watch": "tsc -p tsconfig.esm.json --watch", "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:npm": "npm pack", + "build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf dist esm build coverage", "fix": "run-s fix:eslint fix:prettier", diff --git a/packages/react/tsconfig.cjs.json b/packages/react/tsconfig.cjs.json index abd80f77e1ff..e3a918fc70af 100644 --- a/packages/react/tsconfig.cjs.json +++ b/packages/react/tsconfig.cjs.json @@ -3,6 +3,6 @@ "compilerOptions": { "module": "commonjs", - "outDir": "dist" + "outDir": "build/dist" } } diff --git a/packages/react/tsconfig.esm.json b/packages/react/tsconfig.esm.json index b6ee3fa615c0..0b86c52918cc 100644 --- a/packages/react/tsconfig.esm.json +++ b/packages/react/tsconfig.esm.json @@ -3,6 +3,6 @@ "compilerOptions": { "module": "es6", - "outDir": "esm" + "outDir": "build/esm" } } diff --git a/packages/serverless/.npmignore b/packages/serverless/.npmignore deleted file mode 100644 index dc37d2b5dcac..000000000000 --- a/packages/serverless/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -* -!/dist/**/* -!/esm/**/* -!/build/**/* diff --git a/packages/serverless/package.json b/packages/serverless/package.json index 66672cdae949..56460a4bdeb9 100644 --- a/packages/serverless/package.json +++ b/packages/serverless/package.json @@ -9,8 +9,8 @@ "engines": { "node": ">=10" }, - "main": "dist/index.js", - "module": "esm/index.js", + "main": "build/dist/index.js", + "module": "build/esm/index.js", "types": "build/types/index.d.ts", "publishConfig": { "access": "public" @@ -52,7 +52,7 @@ "build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***", "build:esm:watch": "tsc -p tsconfig.esm.json --watch", "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:npm": "npm pack", + "build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf dist esm build dist-awslambda-layer coverage", "fix": "run-s fix:eslint fix:prettier", diff --git a/packages/serverless/scripts/build-awslambda-layer.js b/packages/serverless/scripts/build-awslambda-layer.js index bc01ac2606d2..674dba133c73 100644 --- a/packages/serverless/scripts/build-awslambda-layer.js +++ b/packages/serverless/scripts/build-awslambda-layer.js @@ -69,7 +69,7 @@ async function collectPackages(cwd, packages = {}) { async function main() { const workDir = path.resolve(__dirname, '..'); // packages/serverless directory - const distRequirements = path.resolve(workDir, 'dist'); + const distRequirements = path.resolve(workDir, 'build', 'dist'); if (!fs.existsSync(distRequirements)) { console.log(`The path ${distRequirements} must exist.`); return; diff --git a/packages/serverless/tsconfig.cjs.json b/packages/serverless/tsconfig.cjs.json index abd80f77e1ff..e3a918fc70af 100644 --- a/packages/serverless/tsconfig.cjs.json +++ b/packages/serverless/tsconfig.cjs.json @@ -3,6 +3,6 @@ "compilerOptions": { "module": "commonjs", - "outDir": "dist" + "outDir": "build/dist" } } diff --git a/packages/serverless/tsconfig.esm.json b/packages/serverless/tsconfig.esm.json index b6ee3fa615c0..0b86c52918cc 100644 --- a/packages/serverless/tsconfig.esm.json +++ b/packages/serverless/tsconfig.esm.json @@ -3,6 +3,6 @@ "compilerOptions": { "module": "es6", - "outDir": "esm" + "outDir": "build/esm" } } diff --git a/packages/tracing/.npmignore b/packages/tracing/.npmignore deleted file mode 100644 index c6e94588f342..000000000000 --- a/packages/tracing/.npmignore +++ /dev/null @@ -1,12 +0,0 @@ -# Info: the paths in this file are specified so that they align with the file -# structure in `./build` where this file is copied to. This is done by the -# prepack script `sentry-javascript/scripts/prepack.ts`. - -* - -# TODO remove bundles (which in the tarball are inside `build`) in v7 -!/build/**/* - -!/dist/**/* -!/esm/**/* -!/types/**/* diff --git a/packages/tracing/package.json b/packages/tracing/package.json index c8f37b4e921f..4cdc56f98534 100644 --- a/packages/tracing/package.json +++ b/packages/tracing/package.json @@ -43,7 +43,7 @@ "build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***", "build:esm:watch": "tsc -p tsconfig.esm.json --watch", "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build/npm", + "build:npm": "ts-node ../../scripts/prepack.ts --bundles && npm pack ./build/npm", "clean": "rimraf dist esm build coverage", "circularDepCheck": "madge --circular src/index.ts", "fix": "run-s fix:eslint fix:prettier", diff --git a/packages/types/.npmignore b/packages/types/.npmignore deleted file mode 100644 index 8904efca5aea..000000000000 --- a/packages/types/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -* -!/dist/**/* -!/esm/**/* -!/build/types/**/* diff --git a/packages/types/package.json b/packages/types/package.json index abc72f62ad2c..a81c2be756b9 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -9,8 +9,8 @@ "engines": { "node": ">=6" }, - "main": "dist/index.js", - "module": "esm/index.js", + "main": "build/dist/index.js", + "module": "build/esm/index.js", "types": "build/types/index.d.ts", "publishConfig": { "access": "public" @@ -28,7 +28,8 @@ "build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***", "build:esm:watch": "tsc -p tsconfig.esm.json --watch", "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:npm": "npm pack", + "build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build", + "clean": "rimraf dist esm build", "link:yarn": "yarn link", "lint": "run-s lint:prettier lint:eslint", "lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish", diff --git a/packages/types/tsconfig.cjs.json b/packages/types/tsconfig.cjs.json index abd80f77e1ff..e3a918fc70af 100644 --- a/packages/types/tsconfig.cjs.json +++ b/packages/types/tsconfig.cjs.json @@ -3,6 +3,6 @@ "compilerOptions": { "module": "commonjs", - "outDir": "dist" + "outDir": "build/dist" } } diff --git a/packages/types/tsconfig.esm.json b/packages/types/tsconfig.esm.json index b6ee3fa615c0..0b86c52918cc 100644 --- a/packages/types/tsconfig.esm.json +++ b/packages/types/tsconfig.esm.json @@ -3,6 +3,6 @@ "compilerOptions": { "module": "es6", - "outDir": "esm" + "outDir": "build/esm" } } diff --git a/packages/utils/.npmignore b/packages/utils/.npmignore deleted file mode 100644 index ee4707643c99..000000000000 --- a/packages/utils/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -* -!/esm/**/* -!/dist/**/* -!/build/types/**/* diff --git a/packages/utils/package.json b/packages/utils/package.json index 564ddbcecfd3..280b79da2069 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -9,8 +9,8 @@ "engines": { "node": ">=6" }, - "main": "dist/index.js", - "module": "esm/index.js", + "main": "build/dist/index.js", + "module": "build/esm/index.js", "types": "build/types/index.d.ts", "publishConfig": { "access": "public" @@ -36,9 +36,9 @@ "build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***", "build:esm:watch": "tsc -p tsconfig.esm.json --watch", "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:npm": "npm pack", + "build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build", "circularDepCheck": "madge --circular src/index.ts", - "clean": "rimraf dist esm coverage *.js *.js.map *.d.ts", + "clean": "rimraf dist esm build coverage *.js *.js.map *.d.ts", "fix": "run-s fix:eslint fix:prettier", "fix:eslint": "eslint . --format stylish --fix", "fix:prettier": "prettier --write \"{src,test,scripts}/**/*.ts\"", diff --git a/packages/utils/test/types/index.js b/packages/utils/test/types/index.js index 5ff997d32269..a8f9e9360b68 100644 --- a/packages/utils/test/types/index.js +++ b/packages/utils/test/types/index.js @@ -3,7 +3,7 @@ const path = require('path'); const testStrings = ['/// ']; -const paths = [path.join('./dist'), path.join('./esm')]; +const paths = [path.join('./build/dist'), path.join('./build/esm')]; paths.forEach(dir => { if (!fs.existsSync(dir)) { diff --git a/packages/utils/tsconfig.cjs.json b/packages/utils/tsconfig.cjs.json index abd80f77e1ff..e3a918fc70af 100644 --- a/packages/utils/tsconfig.cjs.json +++ b/packages/utils/tsconfig.cjs.json @@ -3,6 +3,6 @@ "compilerOptions": { "module": "commonjs", - "outDir": "dist" + "outDir": "build/dist" } } diff --git a/packages/utils/tsconfig.esm.json b/packages/utils/tsconfig.esm.json index b6ee3fa615c0..0b86c52918cc 100644 --- a/packages/utils/tsconfig.esm.json +++ b/packages/utils/tsconfig.esm.json @@ -3,6 +3,6 @@ "compilerOptions": { "module": "es6", - "outDir": "esm" + "outDir": "build/esm" } } diff --git a/packages/vue/.npmignore b/packages/vue/.npmignore deleted file mode 100644 index dc37d2b5dcac..000000000000 --- a/packages/vue/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -* -!/dist/**/* -!/esm/**/* -!/build/**/* diff --git a/packages/vue/package.json b/packages/vue/package.json index ae2251a1460f..d4e5a7c85b67 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -9,8 +9,8 @@ "engines": { "node": ">=6" }, - "main": "dist/index.js", - "module": "esm/index.js", + "main": "build/dist/index.js", + "module": "build/esm/index.js", "types": "build/types/index.d.ts", "publishConfig": { "access": "public" @@ -44,7 +44,7 @@ "build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***", "build:esm:watch": "tsc -p tsconfig.esm.json --watch", "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:npm": "npm pack", + "build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf dist esm build coverage", "fix": "run-s fix:eslint fix:prettier", diff --git a/packages/vue/tsconfig.cjs.json b/packages/vue/tsconfig.cjs.json index abd80f77e1ff..e3a918fc70af 100644 --- a/packages/vue/tsconfig.cjs.json +++ b/packages/vue/tsconfig.cjs.json @@ -3,6 +3,6 @@ "compilerOptions": { "module": "commonjs", - "outDir": "dist" + "outDir": "build/dist" } } diff --git a/packages/vue/tsconfig.esm.json b/packages/vue/tsconfig.esm.json index b6ee3fa615c0..0b86c52918cc 100644 --- a/packages/vue/tsconfig.esm.json +++ b/packages/vue/tsconfig.esm.json @@ -3,6 +3,6 @@ "compilerOptions": { "module": "es6", - "outDir": "esm" + "outDir": "build/esm" } } diff --git a/packages/wasm/.npmignore b/packages/wasm/.npmignore deleted file mode 100644 index 0514c96743ba..000000000000 --- a/packages/wasm/.npmignore +++ /dev/null @@ -1,9 +0,0 @@ -# Info: the paths in this file are specified so that they align with the file -# structure in `./build` where this file is copied to. This is done by the -# prepack script `sentry-javascript/scripts/prepack.ts`. - -* - -!/dist/**/* -!/esm/**/* -!/types/**/* diff --git a/packages/wasm/package.json b/packages/wasm/package.json index be2d9ac1a9ca..3e3fd70256b9 100644 --- a/packages/wasm/package.json +++ b/packages/wasm/package.json @@ -43,7 +43,7 @@ "build:es5:watch": "yarn build:cjs:watch # *** backwards compatibility - remove in v7 ***", "build:esm:watch": "tsc -p tsconfig.esm.json --watch", "build:types:watch": "tsc -p tsconfig.types.json --watch", - "build:npm": "ts-node ../../scripts/prepack.ts -skipBundleCopy && npm pack ./build/npm", + "build:npm": "ts-node ../../scripts/prepack.ts --bundles --skipBundleCopy && npm pack ./build/npm", "circularDepCheck": "madge --circular src/index.ts", "clean": "rimraf dist esm build coverage *.js.map *.d.ts", "fix": "run-s fix:eslint fix:prettier", diff --git a/scripts/prepack.ts b/scripts/prepack.ts index ea8b7ed97770..bac7a544a2f5 100644 --- a/scripts/prepack.ts +++ b/scripts/prepack.ts @@ -12,11 +12,12 @@ import * as path from 'path'; const NPM_BUILD_DIR = 'build/npm'; const BUILD_DIR = 'build'; +const NPM_IGNORE = fs.existsSync('.npmignore') ? '.npmignore' : '../../.npmignore'; -const ASSETS = ['README.md', 'LICENSE', 'package.json', '.npmignore']; -const ENTRY_POINTS = ['main', 'module', 'types']; +const ASSETS = ['README.md', 'LICENSE', 'package.json', NPM_IGNORE]; +const ENTRY_POINTS = ['main', 'module', 'types', 'browser']; -const packageWithBundles = !process.argv.includes('-noBundles'); +const packageWithBundles = process.argv.includes('--bundles'); const buildDir = packageWithBundles ? NPM_BUILD_DIR : BUILD_DIR; // check if build dir exists @@ -39,7 +40,9 @@ ASSETS.forEach(asset => { console.error(`Asset ${asset} does not exist.`); process.exit(1); } - fs.copyFileSync(assetPath, path.resolve(buildDir, asset)); + const destinationPath = path.resolve(buildDir, path.basename(asset)); + console.log(`Copying ${path.basename(asset)} to ${path.relative('../..', destinationPath)}.`); + fs.copyFileSync(assetPath, destinationPath); } catch (error) { console.error(`Error while copying ${asset} to ${buildDir}`); process.exit(1); @@ -50,7 +53,7 @@ ASSETS.forEach(asset => { // copy CDN bundles into npm dir to temporarily keep bundles in npm tarball // inside the tarball, they are located in `build/` // for now, copy it by default, unless explicitly forbidden via an command line arg -const tmpCopyBundles = packageWithBundles && !process.argv.includes('-skipBundleCopy'); +const tmpCopyBundles = packageWithBundles && !process.argv.includes('--skipBundleCopy'); if (tmpCopyBundles) { const npmTmpBundlesPath = path.resolve(buildDir, 'build'); const cdnBundlesPath = path.resolve('build', 'bundles');