@zalify/cli 0.24.0 → 0.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +25 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -20568,7 +20568,9 @@ async function collect(base) {
|
|
|
20568
20568
|
}
|
|
20569
20569
|
}
|
|
20570
20570
|
for (const rel of campaignDirs(base)) {
|
|
20571
|
-
|
|
20571
|
+
const payload = await collectFolder(base, rel);
|
|
20572
|
+
const imported = typeof payload.doc === "object" && payload.doc !== null && payload.doc.imported === true;
|
|
20573
|
+
files.push(imported ? { path: payload.path, doc: payload.doc } : payload);
|
|
20572
20574
|
}
|
|
20573
20575
|
return { files };
|
|
20574
20576
|
}
|
|
@@ -20750,10 +20752,22 @@ async function adsPull(opts) {
|
|
|
20750
20752
|
}
|
|
20751
20753
|
const result = await res.json();
|
|
20752
20754
|
const bindings = readBindings(root2);
|
|
20755
|
+
const ownedElsewhere = new Map;
|
|
20756
|
+
for (const [key, v] of Object.entries(bindings.nodes)) {
|
|
20757
|
+
if (v.kind === "campaign")
|
|
20758
|
+
ownedElsewhere.set(v.id, key.split("#")[0]);
|
|
20759
|
+
}
|
|
20753
20760
|
let written = 0;
|
|
20754
20761
|
let unchanged = 0;
|
|
20762
|
+
let owned = 0;
|
|
20755
20763
|
const skipped = [];
|
|
20756
20764
|
for (const f of result.files) {
|
|
20765
|
+
const campaignId = result.bindings[`${f.path}#campaign`]?.id;
|
|
20766
|
+
const owner = campaignId ? ownedElsewhere.get(campaignId) : undefined;
|
|
20767
|
+
if (owner && owner !== f.path) {
|
|
20768
|
+
owned += 1;
|
|
20769
|
+
continue;
|
|
20770
|
+
}
|
|
20757
20771
|
const abs = join11(root2, f.path);
|
|
20758
20772
|
const nextHash = sha(f.yaml);
|
|
20759
20773
|
const lastPulled = bindings.pulled[f.path];
|
|
@@ -20764,7 +20778,7 @@ async function adsPull(opts) {
|
|
|
20764
20778
|
bindings.pulled[f.path] = nextHash;
|
|
20765
20779
|
continue;
|
|
20766
20780
|
}
|
|
20767
|
-
const locallyEdited = lastPulled
|
|
20781
|
+
const locallyEdited = lastPulled === undefined || sha(current) !== lastPulled;
|
|
20768
20782
|
if (locallyEdited && !opts.force) {
|
|
20769
20783
|
skipped.push(f.path);
|
|
20770
20784
|
continue;
|
|
@@ -20775,7 +20789,14 @@ async function adsPull(opts) {
|
|
|
20775
20789
|
bindings.pulled[f.path] = nextHash;
|
|
20776
20790
|
written += 1;
|
|
20777
20791
|
}
|
|
20778
|
-
Object.
|
|
20792
|
+
for (const [key, v] of Object.entries(result.bindings)) {
|
|
20793
|
+
const file2 = key.split("#")[0];
|
|
20794
|
+
const campaignId = result.bindings[`${file2}#campaign`]?.id;
|
|
20795
|
+
const owner = campaignId ? ownedElsewhere.get(campaignId) : undefined;
|
|
20796
|
+
if (owner && owner !== file2)
|
|
20797
|
+
continue;
|
|
20798
|
+
bindings.nodes[key] = v;
|
|
20799
|
+
}
|
|
20779
20800
|
const bindingsPath = join11(root2, "accounts", ".bindings.json");
|
|
20780
20801
|
mkdirSync5(dirname2(bindingsPath), { recursive: true });
|
|
20781
20802
|
writeFileSync10(bindingsPath, `${JSON.stringify(bindings, null, 2)}
|
|
@@ -20783,7 +20804,7 @@ async function adsPull(opts) {
|
|
|
20783
20804
|
const exported = new Set(result.files.map((f) => f.path));
|
|
20784
20805
|
const gone = Object.keys(bindings.pulled).filter((p) => !exported.has(p) && existsSync11(join11(root2, p)));
|
|
20785
20806
|
const s = result.summary;
|
|
20786
|
-
console.log(`pulled ${s.campaigns} campaigns (${s.adSets} ad sets, ${s.ads} ads): ` + `${written} written, ${unchanged} unchanged, ${skipped.length} kept (locally edited)`);
|
|
20807
|
+
console.log(`pulled ${s.campaigns} campaigns (${s.adSets} ad sets, ${s.ads} ads): ` + `${written} written, ${unchanged} unchanged, ${skipped.length} kept (locally edited)` + `${owned ? `, ${owned} owned by authored files` : ""}`);
|
|
20787
20808
|
for (const p of skipped)
|
|
20788
20809
|
console.log(` kept ${p} (edited — --force overwrites)`);
|
|
20789
20810
|
if (gone.length > 0) {
|