@gridland/demo 0.2.8 → 0.2.10

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/bin/cli.mjs +31 -1
  2. package/package.json +1 -1
package/bin/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { execSync, spawnSync } from "node:child_process";
3
- import { mkdtempSync, rmSync } from "node:fs";
3
+ import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
4
4
  import { tmpdir } from "node:os";
5
5
  import { join } from "node:path";
6
6
 
@@ -61,6 +61,36 @@ try {
61
61
 
62
62
  const repoDir = join(workDir, "gridland");
63
63
 
64
+ // Trim workspaces and strip build-only deps to keep install fast and small.
65
+ // Avoids Next.js/@next/swc which fails on Alpine/musl containers.
66
+ const pkgPath = join(repoDir, "package.json");
67
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
68
+ pkg.workspaces = ["packages/web", "packages/ui", "packages/testing", "packages/docs"];
69
+ delete pkg.devDependencies;
70
+ writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
71
+
72
+ // Deps only needed for building, not for running demos
73
+ const STRIP = new Set([
74
+ "tsup", "typescript", "vite", "esbuild", "postcss", "tailwindcss",
75
+ "@vitejs/plugin-react", "@happy-dom/global-registrator",
76
+ "@tailwindcss/postcss",
77
+ "@types/bun", "@types/node", "@types/react", "@types/react-dom",
78
+ "next", "fumadocs-core", "fumadocs-mdx", "fumadocs-ui",
79
+ "lucide-react", "react-dom",
80
+ ]);
81
+ for (const ws of pkg.workspaces) {
82
+ const wsPkgPath = join(repoDir, ws, "package.json");
83
+ if (!existsSync(wsPkgPath)) continue;
84
+ const wsPkg = JSON.parse(readFileSync(wsPkgPath, "utf8"));
85
+ for (const field of ["dependencies", "devDependencies"]) {
86
+ if (!wsPkg[field]) continue;
87
+ for (const dep of Object.keys(wsPkg[field])) {
88
+ if (STRIP.has(dep)) delete wsPkg[field][dep];
89
+ }
90
+ }
91
+ writeFileSync(wsPkgPath, JSON.stringify(wsPkg, null, 2) + "\n");
92
+ }
93
+
64
94
  if (useBun) {
65
95
  execSync("bun install", { cwd: repoDir, stdio: ["ignore", "ignore", "inherit"] });
66
96
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridland/demo",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "Run gridland component demos from anywhere",
5
5
  "bin": {
6
6
  "gridland-demo": "./bin/cli.mjs"