fix: Run build command only in bench build
This commit is contained in:
parent
555ba2818e
commit
41d9bc64e1
2 changed files with 9 additions and 1 deletions
|
|
@ -47,6 +47,10 @@ let argv = yargs
|
|||
type: "boolean",
|
||||
description: "Run build in production mode"
|
||||
})
|
||||
.option("run-build-command", {
|
||||
type: "boolean",
|
||||
description: "Run build command for apps"
|
||||
})
|
||||
.example(
|
||||
"node esbuild --apps frappe,erpnext",
|
||||
"Run build only for frappe and erpnext"
|
||||
|
|
@ -63,6 +67,8 @@ const APPS = (!argv.apps ? app_list : argv.apps.split(",")).filter(
|
|||
const FILES_TO_BUILD = argv.files ? argv.files.split(",") : [];
|
||||
const WATCH_MODE = Boolean(argv.watch);
|
||||
const PRODUCTION = Boolean(argv.production);
|
||||
const RUN_BUILD_COMMAND = !WATCH_MODE && Boolean(argv["run-build-command"]);
|
||||
|
||||
const TOTAL_BUILD_TIME = `${chalk.black.bgGreen(" DONE ")} Total Build Time`;
|
||||
const NODE_PATHS = [].concat(
|
||||
// node_modules of apps directly importable
|
||||
|
|
@ -76,7 +82,7 @@ const NODE_PATHS = [].concat(
|
|||
);
|
||||
|
||||
execute()
|
||||
.then(() => !WATCH_MODE && run_build_command_for_apps(APPS))
|
||||
.then(() => RUN_BUILD_COMMAND && run_build_command_for_apps(APPS))
|
||||
.catch(e => console.error(e));
|
||||
|
||||
async function execute() {
|
||||
|
|
|
|||
|
|
@ -221,6 +221,8 @@ def bundle(mode, apps=None, make_copy=False, restore=False, verbose=False, skip_
|
|||
if files:
|
||||
command += " --files {files}".format(files=','.join(files))
|
||||
|
||||
command += " --run-build-command"
|
||||
|
||||
check_yarn()
|
||||
frappe_app_path = frappe.get_app_path("frappe", "..")
|
||||
frappe.commands.popen(command, cwd=frappe_app_path, env=get_node_env())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue