@gpdoc/cli 1.1.0 → 1.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/bin/gpdoc.js +11 -1
  2. package/package.json +1 -1
package/bin/gpdoc.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  // @spec CLI-001, CLI-002, CLI-003, CLI-004, CLI-005, CLI-006, CLI-007, CLI-008, CLI-009, CLI-014, CLI-015
3
+ import { realpathSync } from 'node:fs';
3
4
  import { access, readFile, rename, stat, unlink, writeFile } from 'node:fs/promises';
4
5
  import { spawn } from 'node:child_process';
5
6
  import path from 'node:path';
@@ -251,7 +252,16 @@ export async function run(argv, runtime = {}) {
251
252
  else if (warnings.length) process.stderr.write(`${warnings.join('\n')}\n`);
252
253
  }
253
254
 
254
- if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
255
+ function isCliEntrypoint() {
256
+ if (!process.argv[1]) return false;
257
+ try {
258
+ return realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url));
259
+ } catch {
260
+ return path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
261
+ }
262
+ }
263
+
264
+ if (isCliEntrypoint()) {
255
265
  try {
256
266
  await run(process.argv.slice(2));
257
267
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gpdoc/cli",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "description": "GPDoc command-line file conversion and validation tools",
6
6
  "repository": "https://github.com/repetere/gpdoc.git",