@olomonhelpdesk2/helpdesk 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.
@@ -2005,6 +2005,19 @@ async function loadPlaywright() {
2005
2005
  }
2006
2006
  }
2007
2007
 
2008
+ // adapters/invoked-as-command.ts
2009
+ import { realpathSync } from "node:fs";
2010
+ import { pathToFileURL } from "node:url";
2011
+ function runningAsCommand(moduleUrl) {
2012
+ const invoked = process.argv[1];
2013
+ if (!invoked) return false;
2014
+ try {
2015
+ return moduleUrl === pathToFileURL(realpathSync(invoked)).href;
2016
+ } catch {
2017
+ return false;
2018
+ }
2019
+ }
2020
+
2008
2021
  // adapters/capture-stage.ts
2009
2022
  import { spawn } from "node:child_process";
2010
2023
 
@@ -3261,7 +3274,7 @@ The session will be saved to ${sessionPath} and sent nowhere.
3261
3274
  Saved ${sessionPath}. Pass it to a capture run with --session ${sessionPath}.`);
3262
3275
  return 0;
3263
3276
  }
3264
- if (import.meta.url === `file://${process.argv[1]}`) {
3277
+ if (runningAsCommand(import.meta.url)) {
3265
3278
  main(process.argv.slice(2)).then(
3266
3279
  (code) => process.exit(code),
3267
3280
  (error) => {
package/helpdesk-seed.mjs CHANGED
@@ -10,6 +10,19 @@ function helpdeskCommand(command, args = []) {
10
10
  return parts.join(" ");
11
11
  }
12
12
 
13
+ // adapters/invoked-as-command.ts
14
+ import { realpathSync } from "node:fs";
15
+ import { pathToFileURL } from "node:url";
16
+ function runningAsCommand(moduleUrl) {
17
+ const invoked = process.argv[1];
18
+ if (!invoked) return false;
19
+ try {
20
+ return moduleUrl === pathToFileURL(realpathSync(invoked)).href;
21
+ } catch {
22
+ return false;
23
+ }
24
+ }
25
+
13
26
  // core/seed/cassette.ts
14
27
  var CASSETTE_SCHEMA = "olomon.seed-cassette/1";
15
28
  var DROP_HEADERS = /* @__PURE__ */ new Set([
@@ -1367,6 +1380,15 @@ async function routes(args) {
1367
1380
  function missFile(cassette) {
1368
1381
  return cassette.replace(/\.json$/, "") + ".misses.json";
1369
1382
  }
1383
+ if (runningAsCommand(import.meta.url)) {
1384
+ main(process.argv.slice(2)).then(
1385
+ (code) => process.exit(code),
1386
+ (error) => {
1387
+ console.error(error instanceof Error ? error.message : String(error));
1388
+ process.exit(1);
1389
+ }
1390
+ );
1391
+ }
1370
1392
  export {
1371
1393
  carriedReport,
1372
1394
  main
package/helpdesk.mjs CHANGED
@@ -1067,6 +1067,19 @@ function originOf(cwd) {
1067
1067
  }
1068
1068
  }
1069
1069
 
1070
+ // adapters/invoked-as-command.ts
1071
+ import { realpathSync } from "node:fs";
1072
+ import { pathToFileURL } from "node:url";
1073
+ function runningAsCommand(moduleUrl) {
1074
+ const invoked = process.argv[1];
1075
+ if (!invoked) return false;
1076
+ try {
1077
+ return moduleUrl === pathToFileURL(realpathSync(invoked)).href;
1078
+ } catch {
1079
+ return false;
1080
+ }
1081
+ }
1082
+
1070
1083
  // adapters/map-bin.ts
1071
1084
  function arg(name) {
1072
1085
  const index = process.argv.indexOf(`--${name}`);
@@ -1091,7 +1104,9 @@ async function main() {
1091
1104
  });
1092
1105
  console.log(result.report);
1093
1106
  }
1094
- main().catch((error) => {
1095
- console.error(error instanceof Error ? error.message : String(error));
1096
- process.exit(1);
1097
- });
1107
+ if (runningAsCommand(import.meta.url)) {
1108
+ main().catch((error) => {
1109
+ console.error(error instanceof Error ? error.message : String(error));
1110
+ process.exit(1);
1111
+ });
1112
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olomonhelpdesk2/helpdesk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Reads a product's screens, plans its help articles, and photographs them.",
5
5
  "type": "module",
6
6
  "engines": {