goosetools-worker 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 +5 -2
  2. package/worker/cli.js +27 -6
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "goosetools-worker",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "The Goose Tools carousel worker — your computer drafts and renders carousel slides for goosetools.com using your own Claude account.",
5
- "repository": "github:ernkerr/carousel-maker",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/ernkerr/carousel-maker.git"
8
+ },
6
9
  "files": [
7
10
  "worker",
8
11
  "src",
package/worker/cli.js CHANGED
@@ -4,6 +4,8 @@
4
4
  // browser if missing, then starts the worker loop.
5
5
 
6
6
  import { execFileSync, execSync } from "node:child_process";
7
+ import { existsSync } from "node:fs";
8
+ import { createRequire } from "node:module";
7
9
  import { dirname, join, resolve } from "node:path";
8
10
  import { fileURLToPath } from "node:url";
9
11
 
@@ -32,14 +34,33 @@ if (!has("claude")) {
32
34
  }
33
35
 
34
36
  // Make sure the rendering browser is present (quiet no-op when it is).
37
+ // Run the playwright CLI that ships with our own dependencies via node —
38
+ // going through `npx playwright` instead prints a scary warning box.
35
39
  try {
36
40
  console.log("Checking the rendering browser (first run can take a minute)…");
37
- execFileSync("npx", ["--yes", "playwright", "install", "chromium"], {
38
- cwd: ROOT,
39
- stdio: "inherit",
40
- shell: process.platform === "win32",
41
- });
42
- } catch {
41
+ const require = createRequire(join(ROOT, "package.json"));
42
+ const playwrightCli = join(
43
+ dirname(require.resolve("playwright/package.json")),
44
+ "cli.js",
45
+ );
46
+ if (existsSync(playwrightCli)) {
47
+ // Quiet on success — playwright's CLI prints a misleading "run npm
48
+ // install first" box in the npx cache layout. Its output is only shown
49
+ // (via the catch below) when the install genuinely fails.
50
+ execFileSync(process.execPath, [playwrightCli, "install", "chromium"], {
51
+ cwd: ROOT,
52
+ stdio: ["ignore", "pipe", "pipe"],
53
+ });
54
+ } else {
55
+ execFileSync("npx", ["--yes", "playwright", "install", "chromium"], {
56
+ cwd: ROOT,
57
+ stdio: "inherit",
58
+ shell: process.platform === "win32",
59
+ });
60
+ }
61
+ } catch (err) {
62
+ const detail = err?.stderr?.toString().trim();
63
+ if (detail) console.error(detail);
43
64
  console.error("Couldn't install the rendering browser — check your internet connection and retry.");
44
65
  process.exit(1);
45
66
  }