@y11i-3d/chrome-recording 1.1.0 → 1.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/README.md +3 -2
- package/dist/chrome.js +18 -3
- package/package.json +2 -3
- package/dist/postinstall.d.ts +0 -2
- package/dist/postinstall.js +0 -19
package/README.md
CHANGED
|
@@ -19,13 +19,14 @@ CLI for recording Windows Chrome content from WSL, using ffmpeg's ddagrab.
|
|
|
19
19
|
npm install -g @y11i-3d/chrome-recording
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
Or run directly with `npx`:
|
|
22
|
+
Or run directly with `npx` or `bunx`:
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
npx @y11i-3d/chrome-recording <subcommand> [options]
|
|
26
|
+
bunx @y11i-3d/chrome-recording <subcommand> [options]
|
|
26
27
|
```
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
The `record` and `resize` commands need a PowerShell script (`chrome.ps1`) on the Windows side. It is copied to `%LOCALAPPDATA%\y11i-3d\chrome-recording\` every time one of them runs.
|
|
29
30
|
|
|
30
31
|
## Subcommands
|
|
31
32
|
|
package/dist/chrome.js
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import { execSync } from "child_process";
|
|
2
|
+
import { copyFileSync, mkdirSync, rmSync } from "fs";
|
|
3
|
+
import { dirname, resolve } from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
import pkg from "../package.json" with { type: "json" };
|
|
2
6
|
const SCRIPT_NAME = "chrome.ps1";
|
|
3
|
-
|
|
7
|
+
const LEGACY_SCRIPT_NAME = "get_chrome_info.ps1";
|
|
8
|
+
function deployScript() {
|
|
4
9
|
const localAppDataWin = execSync("powershell.exe -Command '$env:LOCALAPPDATA'")
|
|
5
10
|
.toString()
|
|
6
11
|
.trim();
|
|
7
|
-
|
|
12
|
+
const localAppDataLinux = execSync(`wslpath -u "${localAppDataWin}"`)
|
|
13
|
+
.toString()
|
|
14
|
+
.trim();
|
|
15
|
+
const segments = pkg.name.replace(/^@/, "").split("/");
|
|
16
|
+
const destDirLinux = resolve(localAppDataLinux, ...segments);
|
|
17
|
+
mkdirSync(destDirLinux, { recursive: true });
|
|
18
|
+
const srcDir = dirname(fileURLToPath(import.meta.url));
|
|
19
|
+
copyFileSync(resolve(srcDir, SCRIPT_NAME), resolve(destDirLinux, SCRIPT_NAME));
|
|
20
|
+
rmSync(resolve(destDirLinux, LEGACY_SCRIPT_NAME), { force: true });
|
|
21
|
+
return [localAppDataWin, ...segments, SCRIPT_NAME].join("\\");
|
|
8
22
|
}
|
|
9
23
|
export function runChromeScript(args) {
|
|
24
|
+
const scriptPathWin = deployScript();
|
|
10
25
|
const quoted = args.map((arg) => `"${arg.replace(/"/g, '""')}"`).join(" ");
|
|
11
|
-
const command = `powershell.exe -ExecutionPolicy Bypass -File "${scriptPathWin
|
|
26
|
+
const command = `powershell.exe -ExecutionPolicy Bypass -File "${scriptPathWin}" ${quoted}`;
|
|
12
27
|
try {
|
|
13
28
|
return execSync(command, { stdio: ["ignore", "pipe", "pipe"] })
|
|
14
29
|
.toString()
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"windows",
|
|
9
9
|
"wsl"
|
|
10
10
|
],
|
|
11
|
-
"version": "1.1.
|
|
11
|
+
"version": "1.1.1",
|
|
12
12
|
"type": "module",
|
|
13
13
|
"files": [
|
|
14
14
|
"dist"
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
"chrome-recording": "dist/cli.js"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "rm -rf dist && tsc && cp src/chrome.ps1 dist/"
|
|
21
|
-
"postinstall": "node dist/postinstall.js"
|
|
20
|
+
"build": "rm -rf dist && tsc && cp src/chrome.ps1 dist/"
|
|
22
21
|
},
|
|
23
22
|
"devDependencies": {
|
|
24
23
|
"@eslint/js": "^10.0.1",
|
package/dist/postinstall.d.ts
DELETED
package/dist/postinstall.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { copyFileSync, mkdirSync } from "fs";
|
|
3
|
-
import { dirname, resolve } from "path";
|
|
4
|
-
import { fileURLToPath } from "url";
|
|
5
|
-
import { execSync } from "child_process";
|
|
6
|
-
import pkg from "../package.json" with { type: "json" };
|
|
7
|
-
const [scope, pkgName] = pkg.name.replace(/^@/, "").split("/");
|
|
8
|
-
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
|
9
|
-
const ps1Src = resolve(scriptDir, "chrome.ps1");
|
|
10
|
-
const localAppDataWin = execSync("powershell.exe -Command '$env:LOCALAPPDATA'")
|
|
11
|
-
.toString()
|
|
12
|
-
.trim();
|
|
13
|
-
const localAppDataLinux = execSync(`wslpath -u "${localAppDataWin}"`)
|
|
14
|
-
.toString()
|
|
15
|
-
.trim();
|
|
16
|
-
const destDir = resolve(localAppDataLinux, scope ?? pkg.name, pkgName ?? "");
|
|
17
|
-
mkdirSync(destDir, { recursive: true });
|
|
18
|
-
copyFileSync(ps1Src, resolve(destDir, "chrome.ps1"));
|
|
19
|
-
console.log(`Installed chrome.ps1 to ${destDir}`);
|