Sfoglia il codice sorgente

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 anni fa
parent
commit
b175490849
1 ha cambiato i file con 10 aggiunte e 3 eliminazioni
  1. +10
    -3
      esbuild/esbuild.js

+ 10
- 3
esbuild/esbuild.js Vedi File

@@ -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 }) {


Caricamento…
Annulla
Salva