Skip to content

Commit

Permalink
Updates for dist builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Apr 18, 2020
1 parent 3135d7f commit 25102d4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 28 deletions.
2 changes: 1 addition & 1 deletion admin/cmds/set-option.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const arg = process.argv[2];
}

default:
console.log("unknown option");
console.log("Unknown option:", arg);
return 1;
}
});
Expand Down
23 changes: 6 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,14 @@
"build": "tsc --build ./tsconfig.project.json",
"_build-cjs": "node ./admin/cmds/set-option cjs && npm run build",
"_build-esm": "node ./admin/cmds/set-option esm && npm run build",
"_dist_ancillary": "rollup -c rollup-ancillary.config.js",
"_dist-min-all": "node ./admin/cmds/set-option.js browser-lang-all && rollup -c --configMinify && rollup -c --configMinify --configModule && mv ./packages/ethers/dist/ethers.umd.min.js ./packages/ethers/dist/ethers-all.umd.min.js && mv ./packages/ethers/dist/ethers.esm.min.js ./packages/ethers/dist/ethers-all.esm.min.js",
"_dist-min-en": "node ./admin/cmds/set-option.js browser-lang-en && rollup -c --configMinify && rollup -c --configMinify --configModule",
"_dist-full": "rollup -c && rollup -c --configModule",
"_dist": "npm run _dist-min-all && npm run _dist-min-en && npm run _dist-full && npm run _dist_ancillary",
"build-all": "node ./admin/cmds/update-exports.js && npm run _build-esm && npm run _build-cjs && npm run _dist",

"_dist-ancillary": "node ./admin/cmds/set-option esm && rollup -c rollup-ancillary.config.js",
"_dist-umd": "node ./admin/cmds/set-option cjs browser-lang-all && rollup -c && mv ./packages/ethers/dist/ethers.umd.min.js ./packages/ethers/dist/ethers-all.umd.min.js && node ./admin/cmds/set-option cjs && rollup -c",
"_dist-esm": "node ./admin/cmds/set-option esm browser-lang-all && rollup -c --configModule && mv ./packages/ethers/dist/ethers.esm.min.js ./packages/ethers/dist/ethers-all.esm.min.js && node ./admin/cmds/set-option esm && rollup -c --configModule",
"_dist": "npm run _dist-esm && npm run _dist-ancillary && npm run _dist-umd",

"clean": "node ./admin/cmds/reset-build.js && tsc --build --clean ./tsconfig.project.json",
"__dist_ethers": "npm run _dist-min-all && npm run _dist-min-en && npm run _dist-full",
"__dist_prepare": "npm run clean && npm run bootstrap && npm run build && node ./admin/cmds/update-exports.js",
"__dist_tests": "rollup -c --configTest && rollup -c --configTest --configMinify && rollup -c --configTest --configModule && rollup -c --configTest --configModule --configMinify",
"__test_prepare": "npm run _dist_prepare && npm run _dist_tests",
"__test_node": "npm run _test_prepare && npm run _test_node",
"__dist_old": "npm run clean && npm run bootstrap && npm run build && lerna run dist",
"__old-test": "npm run _dist_old && npm run test-check",
"__old-test-check": "if [ \"$RUN_PHANTOMJS\" = \"1\" ]; then npm run-script test-phantomjs; else npm run-script test-node; fi",
"__old-test-node": "cd packages/tests && mocha --no-colors --reporter ./tests/reporter ./tests/test-*.js",
"__old-test-phantomjs": "cd packages/tests && npm run dist-phantomjs && phantomjs --web-security=false ../../node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js ./test.html ./tests/reporter.js",
"__old-test-aion": "npm run dist && npm run test-aion-node",
"__old-test-aion-node": "cd packages/aion-tests && mocha --no-colors --reporter ../tests/tests/reporter ./tests/test-*.js",
"_dist-test-esm": "rollup -c rollup-tests.config.js --configModule",
"_dist-test-umd": "rollup -c rollup-tests.config.js",
"_test-browser-umd": "karma start --single-run --browsers ChromeHeadless karma-umd.conf.js",
Expand Down
16 changes: 6 additions & 10 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ function getConfig(minify, buildModule, testing) {
commonjs({
namedExports: {
"bn.js": [ "BN" ],
"hash.js": [ "hmac", "ripemd160", "sha256", "sha512" ],
"elliptic": [ "ec" ],
"scrypt-js": [ "scrypt", "syncScrypt" ],
},
Expand Down Expand Up @@ -135,15 +136,10 @@ function getConfig(minify, buildModule, testing) {

export default commandLineArgs => {
const testing = commandLineArgs.configTest;
const buildModule = commandLineArgs.configModule;

if (commandLineArgs.configAll) {
return [
getConfig(false, false, testing),
getConfig(false, true, testing),
getConfig(true, false, testing),
getConfig(true, true, testing)
];
}

return getConfig(commandLineArgs.configMinify, commandLineArgs.configModule, testing);
return [
getConfig(false, buildModule, testing),
getConfig(true, buildModule, testing),
];
}

0 comments on commit 25102d4

Please sign in to comment.