mirror of
https://github.com/ivuorinen/gh-codeql-report.git
synced 2026-01-26 03:34:05 +00:00
fix: running with npx
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
import { writeFile } from 'node:fs/promises';
|
import { writeFile } from 'node:fs/promises';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
import { Octokit } from 'octokit';
|
import { Octokit } from 'octokit';
|
||||||
import yargs from 'yargs';
|
import yargs from 'yargs';
|
||||||
import { hideBin } from 'yargs/helpers';
|
import { hideBin } from 'yargs/helpers';
|
||||||
@@ -114,7 +115,12 @@ export async function main(): Promise<number> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Only run if this is the main module (not imported for testing)
|
// Only run if this is the main module (not imported for testing)
|
||||||
if (import.meta.url === `file://${process.argv[1]}`) {
|
const modulePath = fileURLToPath(import.meta.url);
|
||||||
|
const isMainModule =
|
||||||
|
process.argv[1] &&
|
||||||
|
(modulePath === process.argv[1] || modulePath === fileURLToPath(`file://${process.argv[1]}`));
|
||||||
|
|
||||||
|
if (isMainModule) {
|
||||||
main().then((exitCode) => {
|
main().then((exitCode) => {
|
||||||
process.exit(exitCode);
|
process.exit(exitCode);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user