MCPcopy Create free account
hub / github.com/dailydotdev/apps / targetForOverride

Function targetForOverride

packages/world-cli/src/dev.js:89–106  ·  view source on GitHub ↗
(file, targets)

Source from the content-addressed store, hash-verified

87 `${scope}:${scope === "realm" ? realm : niche}:${family}`;
88
89const targetForOverride = (file, targets) => {
90 const stem = basename(file, extname(file));
91 const family = FAMILY_KINDS.find((kind) => stem.endsWith(`-${kind}`));
92 if (!family) return null;
93
94 const niche = stem.slice(0, -(family.length + 1));
95 const district = targets.find((target) => target.niche === niche);
96 if (!district) {
97 return { error: `${basename(file)} names an unknown district "${niche}"` };
98 }
99 if (!district.families.includes(family)) {
100 return {
101 error: `${family} is not unlocked in ${niche} at level ${district.level}`,
102 };
103 }
104
105 return { scope: "district", ...district, family };
106};
107
108const realmForFile = (file) => {
109 const stem = basename(file, extname(file));

Callers 1

rebuildFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected