Skip to content

Commit

Permalink
[REF] package: improve scripts name
Browse files Browse the repository at this point in the history
This commit improves the clarity of the scripts name in the package.json
file.

Note that the `build` script has been kept in order to maintain
compatibility with various scripts.

closes #5015

Task: 0
Signed-off-by: Vincent Schippefilt (vsc) <[email protected]>
  • Loading branch information
pro-odoo committed Sep 26, 2024
1 parent 288f0b7 commit f317053
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 32 deletions.
2 changes: 1 addition & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<script src="../node_modules/chart.js/dist/chart.umd.js"></script>
<script src="../node_modules/luxon/build/global/luxon.js"></script>
<script src="../node_modules/chartjs-adapter-luxon/dist/chartjs-adapter-luxon.umd.js"></script>
<script src="../build/o_spreadsheet.dev.js"></script>
<script src="../build/o_spreadsheet.iife.js"></script>
<script src="main.js" type="module"></script>
<link rel="stylesheet" href="main.css" />
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.min.css" />
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@
"dist/*.xml"
],
"scripts": {
"serve-static": "live-server --open=demo --watch=build/o_spreadsheet.dev.js,build/o_spreadsheet.xml,demo",
"dev": "npm-run-all --print-label buildDev --parallel server serve-static watch:*",
"serve-static": "live-server --open=demo --watch=build/o_spreadsheet.iife.js,build/o_spreadsheet.xml,demo",
"dev": "npm-run-all --print-label bundle:dev --parallel server serve-static watch",
"server": "node tools/server/main.cjs",
"build:js": "tsc --module es6 --incremental",
"build:bundleJsDev": "rollup -c -m --configDev",
"build:bundleJs": "rollup -c -m --configDist",
"build:bundleXml": "node tools/bundle_xml/main.cjs",
"buildDev": "npm-run-all build:js build:bundleJsDev \"build:bundleXml -- --outDir build\"",
"build": "npm-run-all build:js build:bundleJs \"build:bundleXml -- --outDir build\"",
"precommit": "npm run prettier && npm run doc",
"bundle:iife": "rollup -c -m -- --format iife",
"bundle:esm": "rollup -c -m -- --format esm",
"bundle:xml": "node tools/bundle_xml/main.cjs",
"bundle:dev": "npm-run-all build:js bundle:iife \"bundle:xml -- --outDir build\"",
"dist": "tsc --module es6 --declaration --declarationDir dist/types && rollup -c && npm run bundle:xml -- --outDir dist",
"test": "tsc --noEmit --project tsconfig.jest.json && jest",
"test:watch": "jest --watch",
"prettier": "prettier . --write",
"check-formatting": "prettier . --check",
"dist": "tsc --module es6 --declaration --declarationDir dist/types && rollup -c && npm run build:bundleXml -- --outDir dist",
"prepare": "husky install",
"watch:bundle": "npm run build:bundleJsDev -- --watch",
"watch": "npm-run-all -p watch:*",
"watch:bundle": "npm run bundle:iife -- --watch",
"watch:ts": "npm run build:js -- --watch",
"watch:xml": "node tools/bundle_xml/watch_xml_templates.cjs",
"unzipXlsx": "node tools/bundle_xlsx/unzip_xlsx_demo.cjs",
"zipXlsx": "node tools/bundle_xlsx/zip_xlsx_demo.cjs"
"zipXlsx": "node tools/bundle_xlsx/zip_xlsx_demo.cjs",
"build": "npm-run-all build:js bundle:esm \"bundle:xml -- --outDir build\""
},
"browserslist": [
"last 1 Chrome versions"
Expand Down
33 changes: 13 additions & 20 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,22 @@ export default (commandLineArgs) => {
let plugins = [nodeResolve()];
let config = {};

if (commandLineArgs.configDev || commandLineArgs.configDist) {
if (commandLineArgs.format) {
// Only build one version to improve speed
input = "build/js/index.js";
output = [
{
name: "o_spreadsheet",
extend: true,
outro,
banner: bundle.jsBanner(),
globals: { "@odoo/owl": "owl" },
},
];
if (commandLineArgs.configDev) {
output[0].file = `build/o_spreadsheet.dev.js`;
output[0].format = `iife`;
} else {
output[0].file = `build/o_spreadsheet.js`;
output[0].format = `esm`;
}
config = {
input,
input: "build/js/index.js",
external: ["@odoo/owl"],
output,
output: [
{
name: "o_spreadsheet",
extend: true,
outro,
banner: bundle.jsBanner(),
globals: { "@odoo/owl": "owl" },
file: `build/o_spreadsheet.${commandLineArgs.format}.js`,
format: commandLineArgs.format,
},
],
plugins,
};
} else {
Expand Down

0 comments on commit f317053

Please sign in to comment.