Skip to content

Commit

Permalink
fix: remove source maps reference from the production build
Browse files Browse the repository at this point in the history
  • Loading branch information
Sakchai-Refinitiv committed Oct 6, 2021
1 parent aad83c7 commit 655d0bb
Show file tree
Hide file tree
Showing 23 changed files with 48 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- run: npm ci --ignore-scripts --audit=false --fund=false

- run: lerna run build --include-dependencies --since
- run: lerna run build:prod --include-dependencies --since

- run: lerna version --conventional-commits --yes

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"scripts": {
"lerna": "lerna",
"build": "lerna run build",
"build:prod": "lerna run build:prod",
"start": "node cli start",
"test": "node cli test",
"lint": "node cli lint"
Expand Down
4 changes: 2 additions & 2 deletions packages/configurations/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"experimentalDecorators": true,
"esModuleInterop": true,
"strict": true,
"sourceMap": true,
"sourceMap": false,
"declaration": true,
"declarationMap": true,
"declarationMap": false,
}
}
2 changes: 1 addition & 1 deletion packages/core/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ tsconfig.json
/__demo__/

# map files
/lib/**/*.d.ts.map
/lib/**/*.map
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"author": "Refinitiv",
"license": "Apache-2.0",
"scripts": {
"build": "tsc",
"build": "tsc --sourceMap --declarationMap",
"build:prod": "tsc",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "npm run build && karma start ../../karma.config.js --package=core",
Expand Down
2 changes: 1 addition & 1 deletion packages/demo-block/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ tsconfig.json
/__demo__/

# map files
/lib/**/*.d.ts.map
/lib/**/*.map
5 changes: 3 additions & 2 deletions packages/demo-block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"module": "./lib/demo-block.js",
"types": "./lib/demo-block.d.ts",
"scripts": {
"build": "tsc",
"build:watch": "tsc --watch --preserveWatchOutput --sourceMap",
"build": "tsc --sourceMap --declarationMap",
"build:watch": "npm run build -- --watch --preserveWatchOutput",
"build:prod": "tsc",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"start": "npm run build && concurrently \"npm run build:watch\" \"web-dev-server --config ../../server.config.js --app-index __demo__\"",
Expand Down
1 change: 1 addition & 0 deletions packages/elemental-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"build:light": "theme-compiler light --variant=light",
"build:dark": "theme-compiler dark --variant=dark",
"build": "npm run build:light && npm run build:dark",
"build:prod": "npm run build",
"watch": "watch \"npm run build\" src --wait=10"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/elements/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ tsconfig.json
/__demo__/

# map files
/lib/**/*.d.ts.map
/lib/**/*.map

# config
*.config.js
Expand Down
3 changes: 2 additions & 1 deletion packages/elements/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"./lib/*": "./lib/*/index.js"
},
"scripts": {
"build": "node cli build",
"build": "node cli build --sourceMap --declarationMap",
"build:prod": "node cli build",
"start": "node cli start",
"test": "node cli test",
"test:watch": "node cli test --watch",
Expand Down
16 changes: 15 additions & 1 deletion packages/elements/scripts/cmd/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,30 @@ exports.builder = yargs => {
type: 'boolean',
default: false,
description: 'Watch file change'
})
.option('sourceMap', {
type: 'boolean',
default: false,
description: 'Create source map files for emitted JavaScript files.'
})
.option('declarationMap', {
type: 'boolean',
default: false,
description: 'Create sourcemaps for d.ts files.'
});
};
exports.handler = (argv) => {
const watch = !!argv.watch;
const sourceMap = !!argv.sourceMap;
const declarationMap = !!argv.declarationMap;

info(watch ? 'Watch element changes' : 'Build all elements');

try {
const command = ['tsc'];
watch && command.push('--watch', '--preserveWatchOutput', '--sourceMap');
watch && command.push('--watch', '--preserveWatchOutput');
sourceMap && command.push('--sourceMap');
declarationMap && command.push('--declarationMap');

execSync(command.join(' '), { stdio: 'inherit' });

Expand Down
1 change: 1 addition & 0 deletions packages/halo-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"build:dark": "theme-compiler dark --variant=dark",
"build:light": "theme-compiler light --variant=light",
"build": "npm run build:dark && npm run build:light",
"build:prod": "npm run build",
"watch": "watch \"npm run build\" src --wait=10"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ tsconfig.json
/__demo__/

# map files
/lib/**/*.d.ts.map
/lib/**/*.map
3 changes: 2 additions & 1 deletion packages/i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"directory": "packages/i18n"
},
"scripts": {
"build": "tsc",
"build": "tsc --sourceMap --declarationMap",
"build:prod": "tsc",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "npm run build && karma start ../../karma.config.js --package=i18n --include-snapshots=false",
Expand Down
2 changes: 1 addition & 1 deletion packages/phrasebook/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ tsconfig.json
/__demo__/

# map files
/lib/**/*.d.ts.map
/lib/**/*.map
3 changes: 2 additions & 1 deletion packages/phrasebook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"directory": "packages/phrasebook"
},
"scripts": {
"build": "tsc",
"build": "tsc --sourceMap --declarationMap",
"build:prod": "tsc",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "npm run build && mocha __test__/**/*.js --require esm"
Expand Down
1 change: 1 addition & 0 deletions packages/solar-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"build:charcoal": "theme-compiler charcoal --variant=charcoal",
"build:pearl": "theme-compiler pearl --variant=pearl",
"build": "npm run build:charcoal && npm run build:pearl",
"build:prod": "npm run build",
"watch": "watch \"npm run build\" src --wait=10"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/test-helpers/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ tsconfig.json
/__demo__/

# map files
/lib/**/*.d.ts.map
/lib/**/*.map
3 changes: 2 additions & 1 deletion packages/test-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"author": "Refinitiv",
"license": "Apache-2.0",
"scripts": {
"build": "tsc --sourceMap false",
"build": "tsc --sourceMap --declarationMap",
"build:prod": "tsc",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "npm run build && karma start ../../karma.config.js --package=test-helpers --include-snapshots=false",
Expand Down
2 changes: 1 addition & 1 deletion packages/translate/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ lib/test/
/__demo__/

# map files
/lib/**/*.d.ts.map
/lib/**/*.map
5 changes: 3 additions & 2 deletions packages/translate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
"directory": "packages/translate"
},
"scripts": {
"build": "tsc --sourceMap false",
"build:watch": "tsc --watch --preserveWatchOutput --sourceMap",
"build": "tsc --sourceMap --declarationMap",
"build:prod": "tsc",
"build:watch": "npm run build -- --watch --preserveWatchOutput",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"start": "npm run build && concurrently \"npm run build:watch\" \"web-dev-server --config ../../server.config.js --app-index __demo__\"",
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ tsconfig.json
/__demo__/

# map files
/lib/**/*.d.ts.map
/lib/**/*.map
3 changes: 2 additions & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"build": "tsc --sourceMap false"
"build": "tsc --sourceMap --declarationMap",
"build:prod": "tsc"
},
"dependencies": {
"@types/d3-color": "^2.0.1",
Expand Down

0 comments on commit 655d0bb

Please sign in to comment.