recent-project-checker 0.1.0 → 0.1.2

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/package.json +1 -1
  2. package/src/cli.js +13 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "recent-project-checker",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Estimate recently used projects from shell history and show restart-ready candidates.",
5
5
  "type": "module",
6
6
  "main": "src/cli.js",
package/src/cli.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import fs from "node:fs";
3
3
  import os from "node:os";
4
4
  import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
5
6
 
6
7
  import { extractDirsFromCmd } from "./extract/dirs.js";
7
8
  import { formatJson, formatText } from "./format/output.js";
@@ -735,7 +736,18 @@ export async function runFromArgs(argv = process.argv.slice(2)) {
735
736
  return 0;
736
737
  }
737
738
 
738
- if (import.meta.url === `file://${process.argv[1]}`) {
739
+ function isDirectRun() {
740
+ if (!process.argv[1]) {
741
+ return false;
742
+ }
743
+ try {
744
+ return fs.realpathSync(process.argv[1]) === fs.realpathSync(fileURLToPath(import.meta.url));
745
+ } catch {
746
+ return false;
747
+ }
748
+ }
749
+
750
+ if (isDirectRun()) {
739
751
  (async () => {
740
752
  try {
741
753
  const code = await runFromArgs(process.argv.slice(2));