-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added build wrapper for better build customisation * updated gitignore to ignore tree-* html files * reverted tree changes (allow for multiple args at once) * fixed arg propagation in build wrapper * Updated comments in build.mjs * cleaned up build script comments * minor refactor in package json
- Loading branch information
Showing
3 changed files
with
60 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
.idea/ | ||
.vscode/ | ||
build | ||
tree*.html | ||
coverage | ||
docs | ||
examples/dist | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* Build helper scripts | ||
* Usage: node build.mjs [options] -- [rollup 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 | ||
* | ||
* treemap - Enable treemap build visualization. | ||
* treenet - Enable treenet build visualization. | ||
* treesun - Enable treesun build visualization. | ||
*/ | ||
|
||
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]}`); | ||
args.splice(i, 1); | ||
i--; | ||
continue; | ||
} | ||
} | ||
|
||
const cmd = `rollup -c ${args.join(' ')} ${env.join(' ')}`; | ||
console.log(cmd); | ||
execSync(cmd, { stdio: 'inherit' }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters