Add --build-only parameter to filter build outputs
Also, don't generate test bundle by default, but provide `npm run build-test` instead.
This commit is contained in:
parent
6a3d04ade6
commit
c20b75252b
|
@ -27,9 +27,11 @@
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "rollup --config",
|
"build": "rollup --config",
|
||||||
|
"build-test": "npm run build --build-only=test",
|
||||||
"prepare": "npm run build",
|
"prepare": "npm run build",
|
||||||
"test": "mocha --timeout 120000 test/unittests.js",
|
"test": "mocha --timeout 120000 test/unittests.js",
|
||||||
"start": "http-server",
|
"start": "http-server",
|
||||||
|
"prebrowsertest": "npm run build-test",
|
||||||
"browsertest": "npm start -- -o test/unittests.html",
|
"browsertest": "npm start -- -o test/unittests.html",
|
||||||
"coverage": "nyc npm test",
|
"coverage": "nyc npm test",
|
||||||
"lint": "eslint 'src/**/*.js' 'test/crypto/**/*.js'",
|
"lint": "eslint 'src/**/*.js' 'test/crypto/**/*.js'",
|
||||||
|
|
|
@ -23,7 +23,7 @@ const terserOptions = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default [
|
export default Object.assign([
|
||||||
{
|
{
|
||||||
input: 'src/index.js',
|
input: 'src/index.js',
|
||||||
output: [
|
output: [
|
||||||
|
@ -100,4 +100,14 @@ export default [
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
].filter(config => {
|
||||||
|
config.output = config.output.filter(output => {
|
||||||
|
return (output.file || output.dir + '/' + output.entryFileNames).includes(
|
||||||
|
process.env.npm_config_build_only || // E.g. `npm install --build-only=lightweight`.
|
||||||
|
'dist' // Don't build test bundle by default.
|
||||||
|
);
|
||||||
|
});
|
||||||
|
return config.output.length;
|
||||||
|
}), {
|
||||||
|
allow_empty: true // Fake option to trick rollup into accepting empty config array when filtered above.
|
||||||
|
});
|
||||||
|
|
|
@ -14,6 +14,7 @@ elif [ $OPENPGPJSTEST = "unit" ]; then
|
||||||
elif [ $OPENPGPJSTEST = "browserstack" ]; then
|
elif [ $OPENPGPJSTEST = "browserstack" ]; then
|
||||||
echo "Running OpenPGP.js browser unit tests on Browserstack."
|
echo "Running OpenPGP.js browser unit tests on Browserstack."
|
||||||
|
|
||||||
|
npm run build-test
|
||||||
echo -n "Using config: "
|
echo -n "Using config: "
|
||||||
echo "{\"browsers\": [$BROWSER], \"test_framework\": \"mocha\", \"test_path\": [\"test/unittests.html?ci=true${LIGHTWEIGHT+&lightweight=true&grep=lightweight}\"], \"timeout\": 1800, \"exit_with_fail\": true, \"project\": \"openpgpjs/${TRAVIS_EVENT_TYPE:-push}${LIGHTWEIGHT:+/lightweight}\"}" > browserstack.json
|
echo "{\"browsers\": [$BROWSER], \"test_framework\": \"mocha\", \"test_path\": [\"test/unittests.html?ci=true${LIGHTWEIGHT+&lightweight=true&grep=lightweight}\"], \"timeout\": 1800, \"exit_with_fail\": true, \"project\": \"openpgpjs/${TRAVIS_EVENT_TYPE:-push}${LIGHTWEIGHT:+/lightweight}\"}" > browserstack.json
|
||||||
cat browserstack.json
|
cat browserstack.json
|
||||||
|
|
Loading…
Reference in New Issue
Block a user