layero 0.6.1 → 0.6.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/README.md CHANGED
@@ -71,6 +71,12 @@ Run `layero <cmd> --help` for full options.
71
71
  uses that explicit path. Use this for CI flows that build in the
72
72
  pipeline, Webflow / Framer exports, or whenever you don't want the
73
73
  platform to run install/build for you.
74
+ - `--root <dir>` — monorepo: tell the builder the app lives in a
75
+ subdirectory of the repo (e.g. `--root apps/web`). Saved on the
76
+ project; future GitHub-push and hook triggers use the same value.
77
+ CLI auto-detect honours it: framework signals are looked up inside
78
+ `<cwd>/<root>` so a `package.json` workspace at the repo root
79
+ doesn't shadow the real app's stack.
74
80
  - `--name <name>` — project name (only on first deploy).
75
81
  - `--project <id_or_slug>` — deploy into an existing project, ignoring
76
82
  `./.layero/project.json` (useful for CI).
@@ -92,6 +98,7 @@ Run `layero <cmd> --help` for full options.
92
98
  | `gatsby` dep | gatsby | `npm run build` | `public` |
93
99
  | `astro` dep / `astro.config.*` | astro | `npm run build` | `dist` |
94
100
  | `@docusaurus/core` dep / `docusaurus.config.*` | docusaurus | `npm run build` | `build` |
101
+ | `@storybook/*` dep / `scripts.build-storybook` / `.storybook/main.*` | storybook | `npm run build-storybook` (or `npx storybook build`) | `storybook-static` |
95
102
  | `vitepress` dep / `.vitepress/config.*` / `docs/.vitepress/config.*` | vitepress | `npm run docs:build` (or `npx vitepress build`) | `.vitepress/dist` or `docs/.vitepress/dist` |
96
103
  | `vite` dep / `vite.config.*` | vite | `npm run build` | `dist` |
97
104
  | `react-scripts` dep | cra | `npm run build` | `build` |
package/dist/api.js CHANGED
@@ -68,6 +68,9 @@ export class ApiClient {
68
68
  completeSetup(projectId, input) {
69
69
  return this.request("POST", `/projects/${projectId}/setup`, input);
70
70
  }
71
+ updateProject(projectId, input) {
72
+ return this.request("PATCH", `/projects/${projectId}`, input);
73
+ }
71
74
  triggerDeploy(projectId, input) {
72
75
  return this.request("POST", `/projects/${projectId}/deploy`, input);
73
76
  }
@@ -154,12 +154,13 @@ async function main() {
154
154
  program
155
155
  .command("deploy")
156
156
  .description("Pack the current directory and deploy it. Framework, build command and output directory are auto-detected.")
157
- .option("-t, --type <preset>", "framework override (vite | vitepress | next | astro | cra | sveltekit | nuxt | gatsby | docusaurus | eleventy | hugo | static)")
157
+ .option("-t, --type <preset>", "framework override (vite | vitepress | next | astro | cra | sveltekit | nuxt | gatsby | docusaurus | storybook | eleventy | hugo | static)")
158
158
  .option("--name <name>", "project name (only used on first deploy)")
159
159
  .option("--project <id_or_slug>", "deploy into an existing project, ignoring local config")
160
160
  .option("-y, --yes", "non-interactive: accept defaults and skip --prod confirmation")
161
161
  .option("--config", "(legacy alias of the default behaviour — auto-detect + .layero/project.json values)")
162
162
  .option("--prebuilt [dir]", "ship an already-built artifact directory (default auto-pick: dist/build/public/out/_site/...)")
163
+ .option("--root <dir>", "monorepo: subdirectory inside the repo that the builder treats as the app root (saved on the project; future GitHub-push and hook triggers use the same value)")
163
164
  .option("--prod", "deploy to production (replaces apex_hostname's active deploy). Without this flag, deploys go to the project's CLI preview pseudo-branch.")
164
165
  .option("--branch <name>", "deploy to a specific branch's environment. Wins over --prod.")
165
166
  .option("--org <slug>", "Layero organization slug for first-time project creation. Defaults to personal; required when you're a member of multiple orgs and want a non-personal home.")
@@ -26,6 +26,7 @@ const VALID_TYPES = new Set([
26
26
  "eleventy",
27
27
  "11ty",
28
28
  "vitepress",
29
+ "storybook",
29
30
  ]);
30
31
  function dashboardOrigin(apiUrl) {
31
32
  const override = process.env.LAYERO_DASHBOARD_URL;
@@ -201,7 +202,11 @@ async function resolvePrebuiltDir(cwd, raw) {
201
202
  // Resolve the framework / build / output config to send to completeSetup.
202
203
  // Precedence: explicit CLI args > .layero/project.json > auto-detect.
203
204
  async function resolveSetupConfig(cwd, opts, existing) {
204
- const detected = await detectProject(cwd);
205
+ // Honour --root when auto-detecting: the framework signals live in the
206
+ // monorepo subdir, not the repo root. Without this the detector sees
207
+ // a bare workspace package.json and falls through to "static".
208
+ const detectCwd = opts.root ? path.join(cwd, opts.root) : cwd;
209
+ const detected = await detectProject(detectCwd);
205
210
  emit({
206
211
  event: "detected",
207
212
  framework: detected.framework_hint,
@@ -298,9 +303,15 @@ export async function deployCmd(opts) {
298
303
  output_dir: setup.output_dir,
299
304
  analytics_enabled: persistedCfg.analytics_enabled ?? false,
300
305
  env_vars: persistedCfg.env_vars ?? {},
306
+ root_directory: opts.root ?? null,
301
307
  });
302
308
  emit({ event: "setup_applied" });
303
309
  }
310
+ else if (opts.root !== undefined) {
311
+ // Active project: --root patches the existing row so the *next*
312
+ // GitHub-pushed or hook-triggered build uses the new subdir.
313
+ project = await api.updateProject(project.id, { root_directory: opts.root });
314
+ }
304
315
  let upload = null;
305
316
  try {
306
317
  upload = await packAndUpload(api, cwd, project, prebuiltDir);
package/dist/detect.js CHANGED
@@ -115,6 +115,46 @@ export async function detectProject(cwd) {
115
115
  confident: true,
116
116
  };
117
117
  }
118
+ // Storybook before Vite/CRA: Storybook 7+ uses Vite or webpack
119
+ // internally, so `vite` / `react-scripts` is in deps. Without
120
+ // listing it first the SPA Vite path would output_dir=dist, which
121
+ // doesn't exist after `build-storybook`.
122
+ const storybookDeps = [
123
+ "@storybook/cli",
124
+ "@storybook/react",
125
+ "@storybook/react-vite",
126
+ "@storybook/react-webpack5",
127
+ "@storybook/vue",
128
+ "@storybook/vue3",
129
+ "@storybook/vue3-vite",
130
+ "@storybook/svelte",
131
+ "@storybook/svelte-vite",
132
+ "@storybook/web-components",
133
+ "@storybook/web-components-vite",
134
+ "@storybook/preact",
135
+ "@storybook/angular",
136
+ "@storybook/nextjs",
137
+ "@storybook/html",
138
+ "@storybook/html-vite",
139
+ "storybook",
140
+ ];
141
+ const hasStorybookDep = storybookDeps.some((d) => hasDep(pkg, d));
142
+ const hasStorybookScript = pkg.scripts?.["build-storybook"] !== undefined
143
+ || Object.values(pkg.scripts ?? {}).some((s) => typeof s === "string" && s.includes("storybook build"));
144
+ const hasStorybookDir = await fileExists(cwd, ".storybook/main.js", ".storybook/main.ts", ".storybook/main.cjs", ".storybook/main.mjs");
145
+ if (hasStorybookDep || hasStorybookScript || hasStorybookDir) {
146
+ const cmd = pkg.scripts?.["build-storybook"]
147
+ ? "npm run build-storybook"
148
+ : (pkg.scripts?.build && pkg.scripts.build.includes("storybook"))
149
+ ? "npm run build"
150
+ : "npx storybook build";
151
+ return {
152
+ framework_hint: "storybook",
153
+ build_cmd: cmd,
154
+ output_dir: "storybook-static",
155
+ confident: true,
156
+ };
157
+ }
118
158
  // VitePress before generic Vite: VitePress repos often pull `vite`
119
159
  // transitively, and the SPA Vite path would set output_dir=dist —
120
160
  // wrong for VitePress, which writes to `.vitepress/dist/` (or
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "layero",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Layero CLI — publish a local site with one command. No git, no GitHub, agent-friendly (Cursor, Claude Code).",
5
5
  "license": "MIT",
6
6
  "type": "module",