浏览代码

fix: Update assets_json instead of overwriting

When you run build for specific apps, it should remove the entries of other apps
version-14
Faris Ansari 4 年前
父节点
当前提交
b175490849
共有 1 个文件被更改,包括 10 次插入3 次删除
  1. +10
    -3
      esbuild/esbuild.js

+ 10
- 3
esbuild/esbuild.js 查看文件

@@ -278,22 +278,29 @@ function write_meta_file(metafile) {
}
}

let assets_json = JSON.stringify(out, null, 4);
return fs.promises
.writeFile(
path.resolve(assets_path, "frappe", "dist", "assets.json"),
assets_json
JSON.stringify(out, null, 4)
)
.then(() => {
let client = get_redis_subscriber("redis_cache");
// update assets_json cache in redis, so that it can be read directly by python
client.set("assets_json", assets_json, (err) => {
client.get("assets_json", (err, data) => {
if (err) return;
// get existing json
let assets_json = JSON.parse(data || "{}");
// overwrite new values
assets_json = Object.assign({}, assets_json, out);

client.set("assets_json", JSON.stringify(assets_json), err => {
if (err) {
log_warn("Could not update assets_json in redis_cache");
}
client.unref();
});
});
});
}

async function notify_redis({ error, success }) {


正在加载...
取消
保存