[FIX] devtools: Fix build commands for windows users

This commit adapts the commands used and the rollup file to be
compatible with windows console commands syntax.
This commit is contained in:
Julien Carion (juca)
2023-04-13 10:04:07 +02:00
committed by Géry Debongnie
parent afd7f957df
commit aa19897031
2 changed files with 18 additions and 10 deletions
+2 -2
View File
@@ -19,8 +19,8 @@
"build:devtools": "rollup -c ./tools/devtools/rollup.config.js",
"dev:devtools-chrome": "npm run build:devtools -- --config-browser=chrome",
"dev:devtools-firefox": "npm run build:devtools -- --config-browser=firefox",
"build:devtools-chrome": "NODE_ENV=production npm run dev:devtools-chrome",
"build:devtools-firefox": "NODE_ENV=production npm run dev:devtools-firefox",
"build:devtools-chrome": "npm run dev:devtools-chrome -- --config-env=production",
"build:devtools-firefox": "npm run dev:devtools-firefox -- --config-env=production",
"test": "jest",
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand --watch --testTimeout=5000000",
"test:watch": "jest --watch",
+16 -8
View File
@@ -4,8 +4,10 @@ import execute from "rollup-plugin-execute";
import del from "rollup-plugin-delete";
import { string } from "rollup-plugin-string";
export default ({ "config-browser": browser }) => {
const isProduction = process.env.NODE_ENV === "production";
const isWindows = process.platform === "win32";
export default ({ "config-browser": browser, "config-env": env }) => {
const isProduction = env === "production";
const isChrome = browser === "chrome";
const filesToMove = [
{ src: "tools/devtools/assets/**/*", dest: "dist/devtools/assets/" },
@@ -53,13 +55,19 @@ export default ({ "config-browser": browser }) => {
};
}
const commands = new Array(2);
commands[1] =
"npm run compile_templates -- tools/devtools/src && mv templates.js tools/devtools/assets/templates.js";
commands[1] = isWindows
? "npm run compile_templates -- tools\\devtools\\src && move templates.js tools\\devtools\\assets\\templates.js"
: "npm run compile_templates -- tools/devtools/src && mv templates.js tools/devtools/assets/templates.js";
const firstRule = generateRule("tools/devtools/src/page_scripts/owl_devtools_global_hook.js");
if (isProduction)
commands[0] =
"npm run build && cp dist/owl.iife.js tools/devtools/assets/owl.js && npm run build:compiler";
else commands[0] = "cp dist/owl.iife.js tools/devtools/assets/owl.js";
if (isProduction) {
commands[0] = isWindows
? "npm run build && copy dist\\owl.iife.js tools\\devtools\\assets\\owl.js && npm run build:compiler"
: "npm run build && cp dist/owl.iife.js tools/devtools/assets/owl.js && npm run build:compiler";
} else {
commands[0] = isWindows
? "copy dist\\owl.iife.js tools\\devtools\\assets\\owl.js"
: "cp dist/owl.iife.js tools/devtools/assets/owl.js";
}
firstRule.plugins.push(execute(commands, true));
const secondRule = generateRule("tools/devtools/src/content.js");
secondRule.plugins.push(copy({ targets: filesToMove }));