Skip to content
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

Build wrapper #6239

Merged
merged 8 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.idea/
.vscode/
build
tree*.html
coverage
docs
examples/dist
Expand Down
28 changes: 28 additions & 0 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Build helper scripts
// Format: node build.mjs [options]
// Options:
// target:<moduleFormat>:<buildType> - Specify the target module format and build type. Example: target:esm:release
// target:<moduleFormat> - Specify the target module format only. Example: target:esm
// target:<buildType> - Specify the build type only. Example: target:release
// tree:<treeType> - Specify the tree type. Example: tree:map
import { execSync } from 'child_process';

const ARGS = process.argv.slice(2);

const ENV_START_MATCHES = [
'target',
'treemap',
'treenet',
'treesun'
];

const env = [];
for (let i = 0; i < ARGS.length; i++) {
if (ENV_START_MATCHES.some(match => ARGS[i].startsWith(match))) {
env.push(`--environment ${ARGS[i]}`);
}
}

const cmd = `rollup -c ${env.join(' ')}`;
console.log(cmd);
execSync(cmd, { stdio: 'inherit' });
42 changes: 21 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,29 +124,29 @@
"xhr2": "^0.2.1"
},
"scripts": {
"build": "rollup -c",
"build:release": "rollup -c --environment target:release",
"build:debug": "rollup -c --environment target:debug",
"build:profiler": "rollup -c --environment target:profiler",
"build:extras": "rollup -c --environment target:extras",
"build:types": "rollup -c --environment target:types",
"build:umd": "rollup -c --environment target:umd",
"build:esm": "rollup -c --environment target:esm",
"build:esm:release": "rollup -c --environment target:esm:release",
"build:esm:debug": "rollup -c --environment target:esm:debug",
"build:treemap": "npm run build:umd -- --environment treemap",
"build:treenet": "npm run build:umd -- --environment treenet",
"build:treesun": "npm run build:umd -- --environment treesun",
"build": "node ./build.mjs",
"build:release": "npm run build target:release",
"build:debug": "npm run build target:debug",
"build:profiler": "npm run build target:profiler",
"build:extras": "npm run build target:extras",
"build:types": "npm run build target:types",
"build:umd": "npm run build target:umd",
"build:esm": "npm run build target:esm",
"build:esm:release": "npm run build target:esm:release",
"build:esm:debug": "npm run build target:esm:debug",
"build:treemap": "npm run build target:umd treemap",
"build:treenet": "npm run build target:umd treenet",
"build:treesun": "npm run build target:umd treesun",
"build:sourcemaps": "npm run build -- -m",
"build:publish": "npm run build && npm run build:types && npm run publint",
"build:publish": "npm run build && npm run publint",
"watch": "npm run build -- -w",
"watch:release": "npm run build:release -- -w",
"watch:debug": "npm run build:debug -- -w",
"watch:profiler": "npm run build:profiler -- -w",
"watch:umd": "npm run build:umd -- -w",
"watch:esm": "npm run build:esm -- -w",
"watch:esm:release": "npm run build:esm:release -- -w",
"watch:esm:debug": "npm run build:esm:debug -- -w",
"watch:release": "npm run build target:release -- -w",
"watch:debug": "npm run build target:debug -- -w",
"watch:profiler": "npm run build target:profiler -- -w",
"watch:umd": "npm run build target:umd -- -w",
"watch:esm": "npm run build target:esm -- -w",
"watch:esm:release": "npm run build target:esm:release -- -w",
"watch:esm:debug": "npm run build target:esm:debug -- -w",
"docs": "typedoc",
"lint": "eslint --ext .js,.mjs extras scripts src test utils rollup.config.mjs",
"publint": "publint",
Expand Down