@crouton-kit/capture 1.3.1 → 1.3.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.
- package/bin/capture +15 -0
- package/package.json +2 -2
- package/src/capture.ts +18 -0
package/bin/capture
CHANGED
|
@@ -5821,6 +5821,21 @@ Workflow:
|
|
|
5821
5821
|
}
|
|
5822
5822
|
async function main2() {
|
|
5823
5823
|
const [command, ...args] = process.argv.slice(2);
|
|
5824
|
+
if (command === "--version" || command === "-v" || command === "version") {
|
|
5825
|
+
const declared = "1.3.2";
|
|
5826
|
+
if (declared) {
|
|
5827
|
+
console.log(declared);
|
|
5828
|
+
return;
|
|
5829
|
+
}
|
|
5830
|
+
try {
|
|
5831
|
+
const pkgPath = path4.resolve(__dirname, "..", "package.json");
|
|
5832
|
+
const pkg = JSON.parse(fs4.readFileSync(pkgPath, "utf-8"));
|
|
5833
|
+
console.log(pkg.version);
|
|
5834
|
+
} catch {
|
|
5835
|
+
console.log("unknown");
|
|
5836
|
+
}
|
|
5837
|
+
return;
|
|
5838
|
+
}
|
|
5824
5839
|
switch (command) {
|
|
5825
5840
|
case "session":
|
|
5826
5841
|
return sessionMain(args);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crouton-kit/capture",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Browser automation and UI validation via CDP — session-based screenshots, HAR, a11y, click/type, and JS exec",
|
|
5
5
|
"bin": {
|
|
6
6
|
"capture": "./bin/capture"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"src"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"build": "esbuild src/capture.ts --bundle --platform=node --format=cjs --outfile=bin/capture '--banner:js=#!/usr/bin/env node' && chmod +x bin/capture"
|
|
13
|
+
"build": "esbuild src/capture.ts --bundle --platform=node --format=cjs --outfile=bin/capture '--banner:js=#!/usr/bin/env node' \"--define:globalThis.__CAPTURE_VERSION__=\\\"$npm_package_version\\\"\" && chmod +x bin/capture"
|
|
14
14
|
},
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
package/src/capture.ts
CHANGED
|
@@ -406,6 +406,24 @@ Workflow:
|
|
|
406
406
|
async function main(): Promise<void> {
|
|
407
407
|
const [command, ...args] = process.argv.slice(2);
|
|
408
408
|
|
|
409
|
+
if (command === "--version" || command === "-v" || command === "version") {
|
|
410
|
+
// Version is injected at build time via esbuild's --define flag.
|
|
411
|
+
// Falls back to reading package.json at runtime if not injected.
|
|
412
|
+
const declared = (globalThis as { __CAPTURE_VERSION__?: string }).__CAPTURE_VERSION__;
|
|
413
|
+
if (declared) {
|
|
414
|
+
console.log(declared);
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
try {
|
|
418
|
+
const pkgPath = path.resolve(__dirname, "..", "package.json");
|
|
419
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8")) as { version: string };
|
|
420
|
+
console.log(pkg.version);
|
|
421
|
+
} catch {
|
|
422
|
+
console.log("unknown");
|
|
423
|
+
}
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
|
|
409
427
|
switch (command) {
|
|
410
428
|
case "session":
|
|
411
429
|
return sessionMain(args);
|