Skip to content

ref(build): Rename dist directories to cjs #4900

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@ module.exports = {
ecmaVersion: 2018,
},
extends: ['@sentry-internal/sdk'],
ignorePatterns: ['coverage/**', 'build/**', 'dist/**', 'esm/**', 'examples/**', 'test/manual/**', 'types/**'],
ignorePatterns: [
'coverage/**',
'build/**',
'dist/**',
'cjs/**',
'esm/**',
'examples/**',
'test/manual/**',
'types/**',
],
overrides: [
{
files: ['*.ts', '*.tsx', '*.d.ts'],
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ env:

CACHED_BUILD_PATHS: |
${{ github.workspace }}/packages/**/build
${{ github.workspace }}/packages/**/dist
${{ github.workspace }}/packages/**/cjs
${{ github.workspace }}/packages/**/esm
${{ github.workspace }}/packages/ember/*.d.ts
${{ github.workspace }}/packages/ember/instance-initializers
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package-lock.json

# build and test
build/
packages/*/dist/
packages/*/cjs/
packages/*/esm/
coverage/
scratch/
Expand Down
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

*

!/dist/**/*
!/cjs/**/*
!/esm/**/*
!/types/**/*
49 changes: 19 additions & 30 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
"version": "0.2.0",
"inputs": [
{
"id": "getPackageName",
"type": "command",
"command": "shellCommand.execute",
"args": {
"command": "echo '${file}' | sed s/'.*sentry-javascript\\/packages\\/'// | grep --extended-regexp --only-matching --max-count 1 '[^\\/]+' | head -1",
"cwd": "${workspaceFolder}" ,
// normally `input` commands bring up a selector for the user, but given that there should only be one
// choice here, this lets us skip the prompt
"useSingleResult": true
}
"id": "getPackageName",
"type": "command",
"command": "shellCommand.execute",
"args": {
"command": "echo '${file}' | sed s/'.*sentry-javascript\\/packages\\/'// | grep --extended-regexp --only-matching --max-count 1 '[^\\/]+' | head -1",
"cwd": "${workspaceFolder}",
// normally `input` commands bring up a selector for the user, but given that there should only be one
// choice here, this lets us skip the prompt
"useSingleResult": true
}
}
],
"configurations": [
Expand All @@ -25,18 +25,9 @@
"cwd": "${workspaceFolder}/packages/${input:getPackageName}",
"request": "launch",
"runtimeExecutable": "yarn",
"runtimeArgs": [
"rollup",
"-c",
"${file}"
],
"skipFiles": [
"<node_internals>/**"
],
"outFiles": [
"${workspaceFolder}/**/*.js",
"!**/node_modules/**"
],
"runtimeArgs": ["rollup", "-c", "${file}"],
"skipFiles": ["<node_internals>/**"],
"outFiles": ["${workspaceFolder}/**/*.js", "!**/node_modules/**"],
"sourceMaps": true,
"smartStep": true,
"internalConsoleOptions": "openOnSessionStart",
Expand Down Expand Up @@ -67,14 +58,13 @@
],
"sourceMaps": true,
"smartStep": true,
// otherwise it goes to the VSCode debug terminal, which prints the test output or console logs (depending on
// "outputCapture" option here; default is to show console logs), but not both
// otherwise it goes to the VSCode debug terminal, which prints the test output or console logs (depending on
// "outputCapture" option here; default is to show console logs), but not both
"console": "integratedTerminal",
// since we're not using it, don't automatically switch to it
"internalConsoleOptions": "neverOpen",
"internalConsoleOptions": "neverOpen"
},


// @sentry/nextjs - Run a specific integration test file
// Must have test file in currently active tab when hitting the play button, and must already have run `yarn` in test app directory
{
Expand Down Expand Up @@ -105,18 +95,17 @@
// this controls which files are sourcemapped
"outFiles": [
// our SDK code
"${workspaceFolder}/**/dist/**/*.js",
"${workspaceFolder}/**/cjs/**/*.js",
// the built test app
"${workspaceFolder}/packages/nextjs/test/integration/.next/**/*.js",
"!**/node_modules/**"
],
"resolveSourceMapLocations": [
"${workspaceFolder}/**/dist/**",
"${workspaceFolder}/**/cjs/**",
"${workspaceFolder}/packages/nextjs/test/integration/.next/**",
"!**/node_modules/**"
],
"internalConsoleOptions": "openOnSessionStart"

},
}
]
}
2 changes: 1 addition & 1 deletion packages/angular/.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*
!/dist/**/*
!/cjs/**/*
!/esm/**/*
!/build/types/**/*
4 changes: 2 additions & 2 deletions packages/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"engines": {
"node": ">=8"
},
"main": "dist/index.js",
"main": "cjs/index.js",
"module": "esm/index.js",
"types": "build/types/index.d.ts",
"publishConfig": {
Expand Down Expand Up @@ -47,7 +47,7 @@
"build:types:watch": "tsc -p tsconfig.types.json --watch",
"build:npm": "npm pack",
"circularDepCheck": "madge --circular src/index.ts",
"clean": "rimraf dist esm build coverage",
"clean": "rimraf cjs esm build coverage",
"fix": "run-s fix:eslint fix:prettier",
"fix:eslint": "eslint . --format stylish --fix",
"fix:prettier": "prettier --write \"{src,test,scripts}/**/*.ts\"",
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

"compilerOptions": {
"module": "commonjs",
"outDir": "dist"
"outDir": "cjs"
}
}
2 changes: 1 addition & 1 deletion packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"engines": {
"node": ">=8"
},
"main": "build/npm/dist/index.js",
"main": "build/npm/cjs/index.js",
"module": "build/npm/esm/index.js",
"types": "build/npm/types/index.d.ts",
"publishConfig": {
Expand Down
4 changes: 2 additions & 2 deletions packages/browser/test/package/test-code.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-console */
const Sentry = require('../../build/npm/dist/index.js');
const Integrations = require('../../../integrations/build/npm/dist/dedupe.js');
const Sentry = require('../../build/npm/cjs/index.js');
const Integrations = require('../../../integrations/build/npm/cjs/dedupe.js');

// Init
Sentry.init({
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

"compilerOptions": {
"module": "commonjs",
"outDir": "build/npm/dist"
"outDir": "build/npm/cjs"
}
}
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"engines": {
"node": ">=8"
},
"main": "build/dist/index.js",
"main": "build/cjs/index.js",
"module": "build/esm/index.js",
"types": "build/types/index.d.ts",
"publishConfig": {
Expand Down Expand Up @@ -37,7 +37,7 @@
"build:types:watch": "tsc -p tsconfig.types.json --watch",
"build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build",
"circularDepCheck": "madge --circular src/index.ts",
"clean": "rimraf dist esm build coverage",
"clean": "rimraf build coverage",
"fix": "run-s fix:eslint fix:prettier",
"fix:eslint": "eslint . --format stylish --fix",
"fix:prettier": "prettier --write \"{src,test,scripts}/**/*.ts\"",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

"compilerOptions": {
"module": "commonjs",
"outDir": "build/dist"
"outDir": "build/cjs"
}
}
2 changes: 1 addition & 1 deletion packages/gatsby/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

*

!/dist/**/*
!/cjs/**/*
!/esm/**/*
!/types/**/*

Expand Down
4 changes: 2 additions & 2 deletions packages/gatsby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"engines": {
"node": ">=8"
},
"main": "build/dist/index.js",
"main": "build/cjs/index.js",
"module": "build/esm/index.js",
"types": "build/types/index.d.ts",
"publishConfig": {
Expand Down Expand Up @@ -48,7 +48,7 @@
"build:types:watch": "tsc -p tsconfig.types.json --watch",
"build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build",
"circularDepCheck": "madge --circular src/index.ts",
"clean": "rimraf dist esm build coverage",
"clean": "rimraf build coverage",
"fix": "run-s fix:eslint fix:prettier",
"fix:eslint": "eslint . --format stylish --fix",
"fix:prettier": "prettier --write \"{src,test,scripts}/**/*.ts\"",
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

"compilerOptions": {
"module": "commonjs",
"outDir": "build/dist"
"outDir": "build/cjs"
}
}
4 changes: 2 additions & 2 deletions packages/hub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"engines": {
"node": ">=8"
},
"main": "build/dist/index.js",
"main": "build/cjs/index.js",
"module": "build/esm/index.js",
"types": "build/types/index.d.ts",
"publishConfig": {
Expand All @@ -35,7 +35,7 @@
"build:types:watch": "tsc -p tsconfig.types.json --watch",
"build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build",
"circularDepCheck": "madge --circular src/index.ts",
"clean": "rimraf dist esm coverage",
"clean": "rimraf build coverage",
"fix": "run-s fix:eslint fix:prettier",
"fix:eslint": "eslint . --format stylish --fix",
"fix:prettier": "prettier --write \"{src,test,scripts}/**/*.ts\"",
Expand Down
2 changes: 1 addition & 1 deletion packages/hub/tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

"compilerOptions": {
"module": "commonjs",
"outDir": "build/dist"
"outDir": "build/cjs"
}
}
4 changes: 2 additions & 2 deletions packages/integration-tests/utils/generatePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ const useBundle = bundleKey && !useCompiledModule;

const BUNDLE_PATHS: Record<string, Record<string, string>> = {
browser: {
cjs: 'build/npm/dist/index.js',
cjs: 'build/npm/cjs/index.js',
esm: 'build/npm/esm/index.js',
bundle_es5: 'build/bundles/bundle.js',
bundle_es5_min: 'build/bundles/bundle.min.js',
bundle_es6: 'build/bundles/bundle.es6.js',
bundle_es6_min: 'build/bundles/bundle.es6.min.js',
},
tracing: {
cjs: 'build/npm/dist/index.js',
cjs: 'build/npm/cjs/index.js',
esm: 'build/npm/esm/index.js',
bundle_es5: 'build/bundles/bundle.tracing.js',
bundle_es5_min: 'build/bundles/bundle.tracing.min.js',
Expand Down
4 changes: 2 additions & 2 deletions packages/integrations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"publishConfig": {
"access": "public"
},
"main": "build/npm/dist/index.js",
"main": "build/npm/cjs/index.js",
"module": "build/npm/esm/index.js",
"types": "build/npm/types/index.d.ts",
"dependencies": {
Expand Down Expand Up @@ -40,7 +40,7 @@
"build:types:watch": "tsc -p tsconfig.types.json --watch",
"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",
"clean": "rimraf build coverage .rpt2_cache",
"fix": "run-s fix:eslint fix:prettier",
"fix:eslint": "eslint . --format stylish --fix",
"fix:prettier": "prettier --write \"{src,test,scripts}/**/*.ts\"",
Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

"compilerOptions": {
"module": "commonjs",
"outDir": "build/npm/dist"
"outDir": "build/npm/cjs"
}
}
4 changes: 2 additions & 2 deletions packages/minimal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"engines": {
"node": ">=8"
},
"main": "build/dist/index.js",
"main": "build/cjs/index.js",
"module": "build/esm/index.js",
"types": "build/types/index.d.ts",
"publishConfig": {
Expand All @@ -35,7 +35,7 @@
"build:types:watch": "tsc -p tsconfig.types.json --watch",
"build:npm": "ts-node ../../scripts/prepack.ts && npm pack ./build",
"circularDepCheck": "madge --circular src/index.ts",
"clean": "rimraf dist esm build coverage",
"clean": "rimraf build coverage",
"fix": "run-s fix:eslint fix:prettier",
"fix:eslint": "eslint . --format stylish --fix",
"fix:prettier": "prettier --write \"{src,test,scripts}/**/*.ts\"",
Expand Down
2 changes: 1 addition & 1 deletion packages/minimal/tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

"compilerOptions": {
"module": "commonjs",
"outDir": "build/dist"
"outDir": "build/cjs"
}
}
6 changes: 3 additions & 3 deletions packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"engines": {
"node": ">=8"
},
"main": "build/dist/index.server.js",
"main": "build/cjs/index.server.js",
"module": "build/esm/index.server.js",
"browser": "build/esm/index.client.js",
"types": "build/types/index.server.d.ts",
Expand Down Expand Up @@ -57,7 +57,7 @@
"build:types:watch": "tsc -p tsconfig.types.json --watch",
"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 build coverage *.js *.js.map *.d.ts",
"clean": "rimraf 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\"",
Expand Down Expand Up @@ -97,7 +97,7 @@
}
},
"sideEffects": [
"./dist/index.server.js",
"./cjs/index.server.js",
"./esm/index.server.js",
"./src/index.server.ts"
]
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

"compilerOptions": {
"module": "commonjs",
"outDir": "build/dist"
"outDir": "build/cjs"
}
}
2 changes: 1 addition & 1 deletion packages/nextjs/vercel/install-sentry-from-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ yarn --prod false
echo " "
echo "BUILDING SDK"
# We need to build es5 versions because `next.config.js` calls `require` on the SDK (to get `withSentryConfig`) and
# therefore it looks for `dist/index.js`
# therefore it looks for `cjs/index.js`
yarn build:cjs
# We need to build esm versions because that's what `next` actually uses when it builds the app
yarn build:esm
Expand Down
Loading