Browse Source

fix: Run build command only in bench build

version-14
Faris Ansari 4 years ago
parent
commit
41d9bc64e1
2 changed files with 9 additions and 1 deletions
  1. +7
    -1
      esbuild/esbuild.js
  2. +2
    -0
      frappe/build.py

+ 7
- 1
esbuild/esbuild.js View File

@@ -47,6 +47,10 @@ let argv = yargs
type: "boolean", type: "boolean",
description: "Run build in production mode" description: "Run build in production mode"
}) })
.option("run-build-command", {
type: "boolean",
description: "Run build command for apps"
})
.example( .example(
"node esbuild --apps frappe,erpnext", "node esbuild --apps frappe,erpnext",
"Run build only for frappe and 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 FILES_TO_BUILD = argv.files ? argv.files.split(",") : [];
const WATCH_MODE = Boolean(argv.watch); const WATCH_MODE = Boolean(argv.watch);
const PRODUCTION = Boolean(argv.production); 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 TOTAL_BUILD_TIME = `${chalk.black.bgGreen(" DONE ")} Total Build Time`;
const NODE_PATHS = [].concat( const NODE_PATHS = [].concat(
// node_modules of apps directly importable // node_modules of apps directly importable
@@ -76,7 +82,7 @@ const NODE_PATHS = [].concat(
); );


execute() 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)); .catch(e => console.error(e));


async function execute() { async function execute() {


+ 2
- 0
frappe/build.py View File

@@ -221,6 +221,8 @@ def bundle(mode, apps=None, make_copy=False, restore=False, verbose=False, skip_
if files: if files:
command += " --files {files}".format(files=','.join(files)) command += " --files {files}".format(files=','.join(files))


command += " --run-build-command"

check_yarn() check_yarn()
frappe_app_path = frappe.get_app_path("frappe", "..") frappe_app_path = frappe.get_app_path("frappe", "..")
frappe.commands.popen(command, cwd=frappe_app_path, env=get_node_env()) frappe.commands.popen(command, cwd=frappe_app_path, env=get_node_env())


Loading…
Cancel
Save