@conceptcraft/mindframes 0.1.39 → 0.3.0
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/bin/postinstall.js +32 -22
- package/dist/index.js +102 -84
- package/package.json +14 -6
package/bin/postinstall.js
CHANGED
|
@@ -19,42 +19,52 @@ const cliPath = join(__dirname, "cli.js");
|
|
|
19
19
|
* e.g. "ccr" → "conceptcraft", "mf" → "mindframes"
|
|
20
20
|
*/
|
|
21
21
|
function detectBrandId() {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
const COMMAND_TO_BRAND = {
|
|
23
|
+
cc: "conceptcraft",
|
|
24
|
+
ccr: "conceptcraft",
|
|
25
|
+
conceptcraft: "conceptcraft",
|
|
26
|
+
mf: "mindframes",
|
|
27
|
+
mindframes: "mindframes",
|
|
28
|
+
};
|
|
29
|
+
try {
|
|
30
|
+
const pkg = JSON.parse(
|
|
31
|
+
readFileSync(join(__dirname, "..", "package.json"), "utf-8"),
|
|
32
|
+
);
|
|
33
|
+
const firstBin = Object.keys(pkg.bin ?? {})[0] ?? "";
|
|
34
|
+
return COMMAND_TO_BRAND[firstBin] ?? "conceptcraft";
|
|
35
|
+
} catch {
|
|
36
|
+
return "conceptcraft";
|
|
37
|
+
}
|
|
30
38
|
}
|
|
31
39
|
|
|
32
40
|
/**
|
|
33
41
|
* External skills to install via npx skills add
|
|
34
42
|
*/
|
|
35
43
|
const EXTERNAL_SKILLS = [
|
|
36
|
-
|
|
44
|
+
// { repo: "https://github.com/remotion-dev/skills", skill: "remotion-best-practices" },
|
|
37
45
|
];
|
|
38
46
|
|
|
39
47
|
function silentRun(command, env) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
try {
|
|
49
|
+
execSync(command, { stdio: "pipe", env: { ...process.env, ...env } });
|
|
50
|
+
return true;
|
|
51
|
+
} catch {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
46
54
|
}
|
|
47
55
|
|
|
48
56
|
async function main() {
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
const brandId = detectBrandId();
|
|
58
|
+
silentRun(`node "${cliPath}" skill install --force`, {
|
|
59
|
+
CC_BRAND_ID: brandId,
|
|
60
|
+
});
|
|
51
61
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
for (const { repo, skill } of EXTERNAL_SKILLS) {
|
|
63
|
+
silentRun(`npx skills add ${repo} --skill ${skill} -y -g`);
|
|
64
|
+
}
|
|
55
65
|
}
|
|
56
66
|
|
|
57
67
|
// Always exit successfully - postinstall failures should not block npm install
|
|
58
68
|
main()
|
|
59
|
-
|
|
60
|
-
|
|
69
|
+
.catch(() => {})
|
|
70
|
+
.finally(() => process.exit(0));
|