skissue 0.1.16 → 0.1.18
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/README.md +9 -11
- package/dist/entry.js +663 -365
- package/package.json +1 -1
- package/scripts/ensure-local-bin.mjs +21 -15
package/package.json
CHANGED
|
@@ -10,23 +10,29 @@ import { chmodSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
|
10
10
|
import { dirname, join, sep } from "node:path";
|
|
11
11
|
import { fileURLToPath } from "node:url";
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
/**
|
|
14
|
+
* @param {string} scriptPath Absolute path to this file (or a test fixture path with the same layout).
|
|
15
|
+
*/
|
|
16
|
+
export function runEnsureLocalBin(scriptPath) {
|
|
17
|
+
if (scriptPath.split(sep).includes("node_modules")) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
17
20
|
|
|
18
|
-
const root = dirname(dirname(scriptPath));
|
|
19
|
-
const dist = join(root, "dist", "entry.js");
|
|
20
|
-
const binDir = join(root, "node_modules", ".bin");
|
|
21
|
-
const out = join(binDir, "skissue");
|
|
21
|
+
const root = dirname(dirname(scriptPath));
|
|
22
|
+
const dist = join(root, "dist", "entry.js");
|
|
23
|
+
const binDir = join(root, "node_modules", ".bin");
|
|
24
|
+
const out = join(binDir, "skissue");
|
|
22
25
|
|
|
23
|
-
if (!existsSync(dist)) {
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
+
if (!existsSync(dist)) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
26
29
|
|
|
27
|
-
mkdirSync(binDir, { recursive: true });
|
|
28
|
-
const content = `#!/usr/bin/env sh
|
|
30
|
+
mkdirSync(binDir, { recursive: true });
|
|
31
|
+
const content = `#!/usr/bin/env sh
|
|
29
32
|
exec node "${dist}" "$@"
|
|
30
33
|
`;
|
|
31
|
-
writeFileSync(out, content, { mode: 0o755 });
|
|
32
|
-
chmodSync(out, 0o755);
|
|
34
|
+
writeFileSync(out, content, { mode: 0o755 });
|
|
35
|
+
chmodSync(out, 0o755);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
runEnsureLocalBin(fileURLToPath(import.meta.url));
|