Skip to content

Commit d9936eb

Browse files
committed
ref(build): Rename dist directories to cjs (#4900)
rename the dist directories in all build dirs to cjs. Hence, also the tarballs' structure changes which is why this PR also introduces a breaking change. Additional change: cleanup `yarn clean` commands by removing no longer existing directories
1 parent 42a11c8 commit d9936eb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+104
-106
lines changed

.eslintrc.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,16 @@ module.exports = {
1010
ecmaVersion: 2018,
1111
},
1212
extends: ['@sentry-internal/sdk'],
13-
ignorePatterns: ['coverage/**', 'build/**', 'dist/**', 'esm/**', 'examples/**', 'test/manual/**', 'types/**'],
13+
ignorePatterns: [
14+
'coverage/**',
15+
'build/**',
16+
'dist/**',
17+
'cjs/**',
18+
'esm/**',
19+
'examples/**',
20+
'test/manual/**',
21+
'types/**',
22+
],
1423
overrides: [
1524
{
1625
files: ['*.ts', '*.tsx', '*.d.ts'],

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ env:
2323

2424
CACHED_BUILD_PATHS: |
2525
${{ github.workspace }}/packages/**/build
26-
${{ github.workspace }}/packages/**/dist
26+
${{ github.workspace }}/packages/**/cjs
2727
${{ github.workspace }}/packages/**/esm
2828
${{ github.workspace }}/packages/ember/*.d.ts
2929
${{ github.workspace }}/packages/ember/instance-initializers

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package-lock.json
55

66
# build and test
77
build/
8-
packages/*/dist/
8+
packages/*/cjs/
99
packages/*/esm/
1010
coverage/
1111
scratch/

.npmignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
*
55

6-
!/dist/**/*
6+
!/cjs/**/*
77
!/esm/**/*
88
!/types/**/*

.vscode/launch.json

+19-30
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
"version": "0.2.0",
66
"inputs": [
77
{
8-
"id": "getPackageName",
9-
"type": "command",
10-
"command": "shellCommand.execute",
11-
"args": {
12-
"command": "echo '${file}' | sed s/'.*sentry-javascript\\/packages\\/'// | grep --extended-regexp --only-matching --max-count 1 '[^\\/]+' | head -1",
13-
"cwd": "${workspaceFolder}" ,
14-
// normally `input` commands bring up a selector for the user, but given that there should only be one
15-
// choice here, this lets us skip the prompt
16-
"useSingleResult": true
17-
}
8+
"id": "getPackageName",
9+
"type": "command",
10+
"command": "shellCommand.execute",
11+
"args": {
12+
"command": "echo '${file}' | sed s/'.*sentry-javascript\\/packages\\/'// | grep --extended-regexp --only-matching --max-count 1 '[^\\/]+' | head -1",
13+
"cwd": "${workspaceFolder}",
14+
// normally `input` commands bring up a selector for the user, but given that there should only be one
15+
// choice here, this lets us skip the prompt
16+
"useSingleResult": true
17+
}
1818
}
1919
],
2020
"configurations": [
@@ -25,18 +25,9 @@
2525
"cwd": "${workspaceFolder}/packages/${input:getPackageName}",
2626
"request": "launch",
2727
"runtimeExecutable": "yarn",
28-
"runtimeArgs": [
29-
"rollup",
30-
"-c",
31-
"${file}"
32-
],
33-
"skipFiles": [
34-
"<node_internals>/**"
35-
],
36-
"outFiles": [
37-
"${workspaceFolder}/**/*.js",
38-
"!**/node_modules/**"
39-
],
28+
"runtimeArgs": ["rollup", "-c", "${file}"],
29+
"skipFiles": ["<node_internals>/**"],
30+
"outFiles": ["${workspaceFolder}/**/*.js", "!**/node_modules/**"],
4031
"sourceMaps": true,
4132
"smartStep": true,
4233
"internalConsoleOptions": "openOnSessionStart",
@@ -67,14 +58,13 @@
6758
],
6859
"sourceMaps": true,
6960
"smartStep": true,
70-
// otherwise it goes to the VSCode debug terminal, which prints the test output or console logs (depending on
71-
// "outputCapture" option here; default is to show console logs), but not both
61+
// otherwise it goes to the VSCode debug terminal, which prints the test output or console logs (depending on
62+
// "outputCapture" option here; default is to show console logs), but not both
7263
"console": "integratedTerminal",
7364
// since we're not using it, don't automatically switch to it
74-
"internalConsoleOptions": "neverOpen",
65+
"internalConsoleOptions": "neverOpen"
7566
},
7667

77-
7868
// @sentry/nextjs - Run a specific integration test file
7969
// Must have test file in currently active tab when hitting the play button, and must already have run `yarn` in test app directory
8070
{
@@ -105,18 +95,17 @@
10595
// this controls which files are sourcemapped
10696
"outFiles": [
10797
// our SDK code
108-
"${workspaceFolder}/**/dist/**/*.js",
98+
"${workspaceFolder}/**/cjs/**/*.js",
10999
// the built test app
110100
"${workspaceFolder}/packages/nextjs/test/integration/.next/**/*.js",
111101
"!**/node_modules/**"
112102
],
113103
"resolveSourceMapLocations": [
114-
"${workspaceFolder}/**/dist/**",
104+
"${workspaceFolder}/**/cjs/**",
115105
"${workspaceFolder}/packages/nextjs/test/integration/.next/**",
116106
"!**/node_modules/**"
117107
],
118108
"internalConsoleOptions": "openOnSessionStart"
119-
120-
},
109+
}
121110
]
122111
}

packages/angular/.npmignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
*
2-
!/dist/**/*
2+
!/cjs/**/*
33
!/esm/**/*
44
!/build/types/**/*

packages/angular/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"engines": {
1010
"node": ">=8"
1111
},
12-
"main": "dist/index.js",
12+
"main": "cjs/index.js",
1313
"module": "esm/index.js",
1414
"types": "build/types/index.d.ts",
1515
"publishConfig": {
@@ -47,7 +47,7 @@
4747
"build:types:watch": "tsc -p tsconfig.types.json --watch",
4848
"build:npm": "npm pack",
4949
"circularDepCheck": "madge --circular src/index.ts",
50-
"clean": "rimraf dist esm build coverage",
50+
"clean": "rimraf cjs esm build coverage",
5151
"fix": "run-s fix:eslint fix:prettier",
5252
"fix:eslint": "eslint . --format stylish --fix",
5353
"fix:prettier": "prettier --write \"{src,test,scripts}/**/*.ts\"",

packages/angular/tsconfig.cjs.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

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

packages/browser/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"engines": {
1010
"node": ">=8"
1111
},
12-
"main": "build/npm/dist/index.js",
12+
"main": "build/npm/cjs/index.js",
1313
"module": "build/npm/esm/index.js",
1414
"types": "build/npm/types/index.d.ts",
1515
"publishConfig": {

packages/browser/test/package/test-code.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable no-console */
2-
const Sentry = require('../../build/npm/dist/index.js');
3-
const Integrations = require('../../../integrations/build/npm/dist/dedupe.js');
2+
const Sentry = require('../../build/npm/cjs/index.js');
3+
const Integrations = require('../../../integrations/build/npm/cjs/dedupe.js');
44

55
// Init
66
Sentry.init({

packages/browser/tsconfig.cjs.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

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

packages/core/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"engines": {
1010
"node": ">=8"
1111
},
12-
"main": "build/dist/index.js",
12+
"main": "build/cjs/index.js",
1313
"module": "build/esm/index.js",
1414
"types": "build/types/index.d.ts",
1515
"publishConfig": {
@@ -37,7 +37,7 @@
3737
"build:types:watch": "tsc -p tsconfig.types.json --watch",
3838
"build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build",
3939
"circularDepCheck": "madge --circular src/index.ts",
40-
"clean": "rimraf dist esm build coverage",
40+
"clean": "rimraf build coverage",
4141
"fix": "run-s fix:eslint fix:prettier",
4242
"fix:eslint": "eslint . --format stylish --fix",
4343
"fix:prettier": "prettier --write \"{src,test,scripts}/**/*.ts\"",

packages/core/tsconfig.cjs.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

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

packages/gatsby/.npmignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
*
55

6-
!/dist/**/*
6+
!/cjs/**/*
77
!/esm/**/*
88
!/types/**/*
99

packages/gatsby/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"engines": {
1414
"node": ">=8"
1515
},
16-
"main": "build/dist/index.js",
16+
"main": "build/cjs/index.js",
1717
"module": "build/esm/index.js",
1818
"types": "build/types/index.d.ts",
1919
"publishConfig": {
@@ -48,7 +48,7 @@
4848
"build:types:watch": "tsc -p tsconfig.types.json --watch",
4949
"build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build",
5050
"circularDepCheck": "madge --circular src/index.ts",
51-
"clean": "rimraf dist esm build coverage",
51+
"clean": "rimraf build coverage",
5252
"fix": "run-s fix:eslint fix:prettier",
5353
"fix:eslint": "eslint . --format stylish --fix",
5454
"fix:prettier": "prettier --write \"{src,test,scripts}/**/*.ts\"",

packages/gatsby/tsconfig.cjs.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

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

packages/hub/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"engines": {
1010
"node": ">=8"
1111
},
12-
"main": "build/dist/index.js",
12+
"main": "build/cjs/index.js",
1313
"module": "build/esm/index.js",
1414
"types": "build/types/index.d.ts",
1515
"publishConfig": {
@@ -35,7 +35,7 @@
3535
"build:types:watch": "tsc -p tsconfig.types.json --watch",
3636
"build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build",
3737
"circularDepCheck": "madge --circular src/index.ts",
38-
"clean": "rimraf dist esm coverage",
38+
"clean": "rimraf build coverage",
3939
"fix": "run-s fix:eslint fix:prettier",
4040
"fix:eslint": "eslint . --format stylish --fix",
4141
"fix:prettier": "prettier --write \"{src,test,scripts}/**/*.ts\"",

packages/hub/tsconfig.cjs.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

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

packages/integration-tests/utils/generatePlugin.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ const useBundle = bundleKey && !useCompiledModule;
1717

1818
const BUNDLE_PATHS: Record<string, Record<string, string>> = {
1919
browser: {
20-
cjs: 'build/npm/dist/index.js',
20+
cjs: 'build/npm/cjs/index.js',
2121
esm: 'build/npm/esm/index.js',
2222
bundle_es5: 'build/bundles/bundle.js',
2323
bundle_es5_min: 'build/bundles/bundle.min.js',
2424
bundle_es6: 'build/bundles/bundle.es6.js',
2525
bundle_es6_min: 'build/bundles/bundle.es6.min.js',
2626
},
2727
tracing: {
28-
cjs: 'build/npm/dist/index.js',
28+
cjs: 'build/npm/cjs/index.js',
2929
esm: 'build/npm/esm/index.js',
3030
bundle_es5: 'build/bundles/bundle.tracing.js',
3131
bundle_es5_min: 'build/bundles/bundle.tracing.min.js',

packages/integrations/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"publishConfig": {
1313
"access": "public"
1414
},
15-
"main": "build/npm/dist/index.js",
15+
"main": "build/npm/cjs/index.js",
1616
"module": "build/npm/esm/index.js",
1717
"types": "build/npm/types/index.d.ts",
1818
"dependencies": {
@@ -40,7 +40,7 @@
4040
"build:types:watch": "tsc -p tsconfig.types.json --watch",
4141
"build:npm": "ts-node ../../scripts/prepack.ts --bundles && npm pack ./build/npm",
4242
"circularDepCheck": "madge --circular src/index.ts",
43-
"clean": "rimraf dist esm build coverage .rpt2_cache",
43+
"clean": "rimraf build coverage .rpt2_cache",
4444
"fix": "run-s fix:eslint fix:prettier",
4545
"fix:eslint": "eslint . --format stylish --fix",
4646
"fix:prettier": "prettier --write \"{src,test,scripts}/**/*.ts\"",

packages/integrations/tsconfig.cjs.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

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

packages/minimal/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"engines": {
1010
"node": ">=8"
1111
},
12-
"main": "build/dist/index.js",
12+
"main": "build/cjs/index.js",
1313
"module": "build/esm/index.js",
1414
"types": "build/types/index.d.ts",
1515
"publishConfig": {
@@ -35,7 +35,7 @@
3535
"build:types:watch": "tsc -p tsconfig.types.json --watch",
3636
"build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build",
3737
"circularDepCheck": "madge --circular src/index.ts",
38-
"clean": "rimraf dist esm build coverage",
38+
"clean": "rimraf build coverage",
3939
"fix": "run-s fix:eslint fix:prettier",
4040
"fix:eslint": "eslint . --format stylish --fix",
4141
"fix:prettier": "prettier --write \"{src,test,scripts}/**/*.ts\"",

packages/minimal/tsconfig.cjs.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

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

packages/nextjs/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"engines": {
1010
"node": ">=8"
1111
},
12-
"main": "build/dist/index.server.js",
12+
"main": "build/cjs/index.server.js",
1313
"module": "build/esm/index.server.js",
1414
"browser": "build/esm/index.client.js",
1515
"types": "build/types/index.server.d.ts",
@@ -57,7 +57,7 @@
5757
"build:types:watch": "tsc -p tsconfig.types.json --watch",
5858
"build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build",
5959
"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",
60-
"clean": "rimraf dist esm build coverage *.js *.js.map *.d.ts",
60+
"clean": "rimraf build coverage *.js *.js.map *.d.ts",
6161
"fix": "run-s fix:eslint fix:prettier",
6262
"fix:eslint": "eslint . --format stylish --fix",
6363
"fix:prettier": "prettier --write \"{src,test,scripts}/**/*.ts\"",
@@ -97,7 +97,7 @@
9797
}
9898
},
9999
"sideEffects": [
100-
"./dist/index.server.js",
100+
"./cjs/index.server.js",
101101
"./esm/index.server.js",
102102
"./src/index.server.ts"
103103
]

packages/nextjs/tsconfig.cjs.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

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

packages/nextjs/vercel/install-sentry-from-branch.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ yarn --prod false
2828
echo " "
2929
echo "BUILDING SDK"
3030
# We need to build es5 versions because `next.config.js` calls `require` on the SDK (to get `withSentryConfig`) and
31-
# therefore it looks for `dist/index.js`
31+
# therefore it looks for `cjs/index.js`
3232
yarn build:cjs
3333
# We need to build esm versions because that's what `next` actually uses when it builds the app
3434
yarn build:esm

0 commit comments

Comments
 (0)