Merge pull request #24317 from blaggacao/chore/cleanup-esbuild-path-resolution
chore: remove confusing indirections from esbuild path resolution
This commit is contained in:
commit
6cf8f4ecae
3 changed files with 7 additions and 17 deletions
|
|
@ -19,7 +19,6 @@ const {
|
||||||
assets_path,
|
assets_path,
|
||||||
apps_path,
|
apps_path,
|
||||||
sites_path,
|
sites_path,
|
||||||
get_app_path,
|
|
||||||
get_public_path,
|
get_public_path,
|
||||||
log,
|
log,
|
||||||
log_warn,
|
log_warn,
|
||||||
|
|
@ -87,11 +86,9 @@ 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
|
||||||
app_list
|
app_list.map((app) => path.resolve(apps_path, app, "node_modules")).filter(fs.existsSync),
|
||||||
.map((app) => path.resolve(get_app_path(app), "../node_modules"))
|
|
||||||
.filter(fs.existsSync),
|
|
||||||
// import js file of any app if you provide the full path
|
// import js file of any app if you provide the full path
|
||||||
app_list.map((app) => path.resolve(get_app_path(app), "..")).filter(fs.existsSync)
|
app_list.map((app) => path.resolve(apps_path, app)).filter(fs.existsSync)
|
||||||
);
|
);
|
||||||
const USING_CACHED = Boolean(argv["using-cached"]);
|
const USING_CACHED = Boolean(argv["using-cached"]);
|
||||||
|
|
||||||
|
|
@ -497,7 +494,7 @@ function run_build_command_for_apps(apps) {
|
||||||
for (let app of apps) {
|
for (let app of apps) {
|
||||||
if (app === "frappe") continue;
|
if (app === "frappe") continue;
|
||||||
|
|
||||||
let root_app_path = path.resolve(get_app_path(app), "..");
|
let root_app_path = path.resolve(apps_path, app);
|
||||||
let package_json = path.resolve(root_app_path, "package.json");
|
let package_json = path.resolve(root_app_path, "package.json");
|
||||||
let node_modules = path.resolve(root_app_path, "node_modules");
|
let node_modules = path.resolve(root_app_path, "node_modules");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
let path = require("path");
|
let path = require("path");
|
||||||
let { get_app_path, app_list } = require("./utils");
|
let { apps_path, app_list } = require("./utils");
|
||||||
|
|
||||||
let app_paths = app_list.map(get_app_path).map((app_path) => path.resolve(app_path, ".."));
|
let app_paths = app_list.map((app) => path.resolve(apps_path, app));
|
||||||
let node_modules_path = app_paths.map((app_path) => path.resolve(app_path, "node_modules"));
|
let node_modules_path = app_paths.map((app_path) => path.resolve(app_path, "node_modules"));
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
||||||
|
|
@ -14,16 +14,12 @@ const sites_path = path.resolve(bench_path, "sites");
|
||||||
const assets_path = path.resolve(sites_path, "assets");
|
const assets_path = path.resolve(sites_path, "assets");
|
||||||
const app_list = get_apps_list();
|
const app_list = get_apps_list();
|
||||||
|
|
||||||
const app_paths = app_list.reduce((out, app) => {
|
|
||||||
out[app] = path.resolve(apps_path, app, app);
|
|
||||||
return out;
|
|
||||||
}, {});
|
|
||||||
const public_paths = app_list.reduce((out, app) => {
|
const public_paths = app_list.reduce((out, app) => {
|
||||||
out[app] = path.resolve(app_paths[app], "public");
|
out[app] = path.resolve(apps_path, app, app, "public");
|
||||||
return out;
|
return out;
|
||||||
}, {});
|
}, {});
|
||||||
const public_js_paths = app_list.reduce((out, app) => {
|
const public_js_paths = app_list.reduce((out, app) => {
|
||||||
out[app] = path.resolve(app_paths[app], "public/js");
|
out[app] = path.resolve(apps_path, app, app, "public/js");
|
||||||
return out;
|
return out;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
|
|
@ -71,8 +67,6 @@ function run_serially(tasks) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
const get_app_path = (app) => app_paths[app];
|
|
||||||
|
|
||||||
function get_apps_list() {
|
function get_apps_list() {
|
||||||
return fs
|
return fs
|
||||||
.readFileSync(path.resolve(sites_path, "apps.txt"), {
|
.readFileSync(path.resolve(sites_path, "apps.txt"), {
|
||||||
|
|
@ -140,7 +134,6 @@ module.exports = {
|
||||||
get_public_path,
|
get_public_path,
|
||||||
get_build_json_path,
|
get_build_json_path,
|
||||||
get_build_json,
|
get_build_json,
|
||||||
get_app_path,
|
|
||||||
delete_file,
|
delete_file,
|
||||||
run_serially,
|
run_serially,
|
||||||
get_cli_arg,
|
get_cli_arg,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue