run-repo-script 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/dist/cli.js +12 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,4 +1,6 @@
1
+ #!/usr/bin/env node
1
2
  import { parseArgs } from 'node:util';
3
+ import { realpathSync } from 'node:fs';
2
4
  import { rm } from 'node:fs/promises';
3
5
  import { pathToFileURL } from 'node:url';
4
6
  import { resolveInstaller } from './discovery.js';
@@ -84,8 +86,16 @@ export async function runCli(argv) {
84
86
  }
85
87
  }
86
88
  function isDirectExecution() {
87
- return (Boolean(process.argv[1]) &&
88
- import.meta.url === pathToFileURL(process.argv[1]).href);
89
+ const entrypoint = process.argv[1];
90
+ if (!entrypoint) {
91
+ return false;
92
+ }
93
+ try {
94
+ return import.meta.url === pathToFileURL(realpathSync(entrypoint)).href;
95
+ }
96
+ catch {
97
+ return import.meta.url === pathToFileURL(entrypoint).href;
98
+ }
89
99
  }
90
100
  if (isDirectExecution()) {
91
101
  process.exitCode = await runCli(process.argv.slice(2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run-repo-script",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Fetch a GitHub repository and run its installer script",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.13.1",