mcpscraper-cli 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.
- package/dist/bin/cli.js +13 -3
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
// src/cli.ts
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
import { fileURLToPath } from "url";
|
|
6
|
+
import { realpathSync } from "fs";
|
|
6
7
|
import { ScraperClient, ScraperApiError } from "mcpscraper-sdk";
|
|
7
8
|
|
|
8
9
|
// src/version.ts
|
|
9
|
-
var CLI_VERSION = "0.1.
|
|
10
|
+
var CLI_VERSION = "0.1.1";
|
|
10
11
|
|
|
11
12
|
// src/cli.ts
|
|
12
13
|
function printResult(result, json, summarize) {
|
|
@@ -163,10 +164,19 @@ Vault deposit: ${page.memory.deposited ? `saved to ${page.memory.vault}` : "fail
|
|
|
163
164
|
});
|
|
164
165
|
return program;
|
|
165
166
|
}
|
|
166
|
-
|
|
167
|
+
function isMainModule(metaUrl, argvPath = process.argv[1]) {
|
|
168
|
+
if (!argvPath) return false;
|
|
169
|
+
try {
|
|
170
|
+
return realpathSync(argvPath) === realpathSync(fileURLToPath(metaUrl));
|
|
171
|
+
} catch {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
var isMain = isMainModule(import.meta.url);
|
|
167
176
|
if (isMain) {
|
|
168
177
|
await createProgram().parseAsync(process.argv);
|
|
169
178
|
}
|
|
170
179
|
export {
|
|
171
|
-
createProgram
|
|
180
|
+
createProgram,
|
|
181
|
+
isMainModule
|
|
172
182
|
};
|