create-threadlens-app 0.2.0 → 0.2.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/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/index.js +12 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { realpathSync } from 'node:fs';
|
|
2
3
|
import { parseArgs } from './args.js';
|
|
3
4
|
import { runCommand as defaultRunCommand } from './commands.js';
|
|
4
5
|
import { install as defaultInstall } from './install.js';
|
|
5
6
|
import { createLogger } from './output.js';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
6
8
|
|
|
7
9
|
export async function main(argv = process.argv.slice(2), deps = {}) {
|
|
8
10
|
const stdout = deps.stdout ?? console.log;
|
|
@@ -31,7 +33,16 @@ export async function main(argv = process.argv.slice(2), deps = {}) {
|
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
function isDirectRun() {
|
|
37
|
+
if (!process.argv[1]) return false;
|
|
38
|
+
try {
|
|
39
|
+
return realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url));
|
|
40
|
+
} catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (isDirectRun()) {
|
|
35
46
|
const code = await main();
|
|
36
47
|
process.exitCode = code;
|
|
37
48
|
}
|