@natjswenson/devlog 0.5.0 → 0.5.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/devlog.js +12 -2
  2. package/package.json +1 -1
package/bin/devlog.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawn, spawnSync, execSync } from 'node:child_process';
3
- import { existsSync, mkdirSync, readFileSync, copyFileSync } from 'node:fs';
3
+ import { existsSync, mkdirSync, readFileSync, copyFileSync, realpathSync } from 'node:fs';
4
4
  import { dirname, join, resolve, basename } from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import { createRequire } from 'node:module';
@@ -725,7 +725,17 @@ Issues: https://github.com/natejswenson/devlog/issues
725
725
  // ─── dispatch ────────────────────────────────────────────────────────────────
726
726
  // Only run the CLI dispatch when this file is executed directly, not when it is
727
727
  // imported (e.g. by the test suite). Importing the module must have no side effects.
728
- const isMain = process.argv[1] === fileURLToPath(import.meta.url);
728
+ // Both sides are realpath'd: under npm/npx, argv[1] is the node_modules/.bin/devlog
729
+ // SYMLINK while import.meta.url is the resolved file — a naive === never matches
730
+ // and every npx invocation becomes a silent no-op.
731
+ const isMain = (() => {
732
+ if (!process.argv[1]) return false;
733
+ try {
734
+ return realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url));
735
+ } catch {
736
+ return false;
737
+ }
738
+ })();
729
739
  if (isMain) {
730
740
  const arg = process.argv[2];
731
741
  const rest = process.argv.slice(3);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@natjswenson/devlog",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Release dev log generator \u2014 Claude Code skill + preview app for publishing version-release dev logs, written in your voice, to your site",
5
5
  "license": "MIT",
6
6
  "author": "Nate Swenson",