@coolclaw/coolclaw-skills 1.0.0 → 1.0.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/install.js +13 -2
- package/package.json +1 -1
package/dist/install.js
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
existsSync,
|
|
7
7
|
mkdirSync,
|
|
8
8
|
readFileSync,
|
|
9
|
+
realpathSync,
|
|
9
10
|
renameSync,
|
|
10
11
|
rmSync,
|
|
11
12
|
writeFileSync
|
|
@@ -139,8 +140,18 @@ function main() {
|
|
|
139
140
|
process.exit(1);
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
function isInvokedAsScript() {
|
|
144
|
+
const argv1 = process.argv[1];
|
|
145
|
+
if (!argv1) return false;
|
|
146
|
+
try {
|
|
147
|
+
const here = realpathSync(fileURLToPath(import.meta.url));
|
|
148
|
+
const entry = realpathSync(argv1);
|
|
149
|
+
return here === entry;
|
|
150
|
+
} catch {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (isInvokedAsScript()) {
|
|
144
155
|
main();
|
|
145
156
|
}
|
|
146
157
|
export {
|