generatesaas 3.34.0 → 3.35.0
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/dist/index.js +8 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import{Command as ed}from"commander";import*as Ns from"@clack/prompts";import{ex
|
|
|
5
5
|
`),R=[u!=="none"?` Payment: ${y.cyan(_t[u].label)} (${O})`:` Payment: ${y.dim("none")}`,` Credits: ${W?y.cyan("Yes"):y.dim("No")}`,` AI features: ${F?y.cyan("Yes"):y.dim("No")}`,...ve?[]:[` Web AI: ${y.dim("No")} (app-first)`],` Email: ${y.cyan(Ot[be].label)}`,` Observability: ${B.length===0?y.dim("none"):y.cyan(B.map(ir=>xt[ir].label).join(", "))}`,` Multi-tenancy: ${oe?y.cyan("Yes"):y.dim("No")}`,` Projects: ${Oe?y.cyan("Yes"):y.dim("No")}`,` Docs app: ${xe?y.cyan("Yes"):y.dim("No")}`,` Desktop app: ${we?y.cyan("Yes"):y.dim("No")}`,` Mobile app: ${v?y.cyan("Yes"):y.dim("No")}`,...L==="none"?[]:[` In-app purch.: ${y.cyan("RevenueCat")}`],` Rev. sharing: ${$?y.cyan("Yes"):y.dim("No")}`].join(`
|
|
6
6
|
`),Ee=[y.bold("Project"),c,"",y.bold("Infrastructure"),d,"",y.bold("Features"),R];if(z.length>0){let ir=z.map(qr=>{let Cs=T[qr.key]?y.green("provided"):y.dim("skipped");return` ${qr.key}: ${Cs}`}).join(`
|
|
7
7
|
`);Ee.push("",y.bold("Credentials"),ir)}f.note(Ee.join(`
|
|
8
|
-
`),"Summary");let Jr=await f.confirm({message:"Proceed with these settings?"});(f.isCancel(Jr)||!Jr)&&(f.cancel("Setup cancelled."),process.exit(0))}return{projectName:n,appName:i,projectDir:o,architecture:k,deploymentTarget:a,databaseProvider:w,cacheProvider:P,paymentProvider:u,emailProvider:be,observability:B,multiTenancy:oe,projects:Oe,docs:xe,desktop:we,mobile:v,mobilePurchases:L,ai:F,webAi:ve,revenueSharing:$,credits:W,defaultCurrency:O,...Object.keys(T).length>0?{credentials:T}:{},...e?.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...ke!==void 0?{demo:ke}:{}}}import{createReadStream as En,existsSync as zs}from"fs";import{mkdir as Js}from"fs/promises";import{join as qs}from"path";import{Readable as Xs}from"stream";import{pipeline as wr}from"stream/promises";import{extract as Zs}from"tar";import{join as Me}from"path";import{homedir as Us}from"os";var pr="https://cli.generatesaas.com",wt=process.env.GENERATESAAS_API_URL??pr,J=".generatesaas",ue=Me(J,"manifest.json"),un="nextjs",dr="nuxt",ur="2.4.1",mn=Me(J,"hashes.json"),Ct=Me(J,"template-hashes.json"),Lt=Me(J,"template"),hn=Me(J,"staging"),fn=Me(J,"staging.json"),me=Me(Us(),".generatesaas");var M=class extends Error{constructor(r,n,i){super(n);this.status=r;this.body=i}status;body;name="ApiError"};function he(e){return{apiKey:e,baseUrl:wt}}async function Se(e,t,r){let n=`${e.baseUrl}${t}`,i=await fetch(n,{...r,headers:{...r?.headers,Authorization:`Bearer ${e.apiKey}`,"User-Agent":"generatesaas-cli/3.
|
|
8
|
+
`),"Summary");let Jr=await f.confirm({message:"Proceed with these settings?"});(f.isCancel(Jr)||!Jr)&&(f.cancel("Setup cancelled."),process.exit(0))}return{projectName:n,appName:i,projectDir:o,architecture:k,deploymentTarget:a,databaseProvider:w,cacheProvider:P,paymentProvider:u,emailProvider:be,observability:B,multiTenancy:oe,projects:Oe,docs:xe,desktop:we,mobile:v,mobilePurchases:L,ai:F,webAi:ve,revenueSharing:$,credits:W,defaultCurrency:O,...Object.keys(T).length>0?{credentials:T}:{},...e?.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...ke!==void 0?{demo:ke}:{}}}import{createReadStream as En,existsSync as zs}from"fs";import{mkdir as Js}from"fs/promises";import{join as qs}from"path";import{Readable as Xs}from"stream";import{pipeline as wr}from"stream/promises";import{extract as Zs}from"tar";import{join as Me}from"path";import{homedir as Us}from"os";var pr="https://cli.generatesaas.com",wt=process.env.GENERATESAAS_API_URL??pr,J=".generatesaas",ue=Me(J,"manifest.json"),un="nextjs",dr="nuxt",ur="2.4.1",mn=Me(J,"hashes.json"),Ct=Me(J,"template-hashes.json"),Lt=Me(J,"template"),hn=Me(J,"staging"),fn=Me(J,"staging.json"),me=Me(Us(),".generatesaas");var M=class extends Error{constructor(r,n,i){super(n);this.status=r;this.body=i}status;body;name="ApiError"};function he(e){return{apiKey:e,baseUrl:wt}}async function Se(e,t,r){let n=`${e.baseUrl}${t}`,i=await fetch(n,{...r,headers:{...r?.headers,Authorization:`Bearer ${e.apiKey}`,"User-Agent":"generatesaas-cli/3.35.0"}});if(!i.ok){let o,s;try{s=await i.json(),o=s.error??`API ${i.status}: ${t}`}catch{o=`API ${i.status}: ${t}`}throw new M(i.status,o,s)}return i}import{existsSync as Fs,mkdirSync as Vs,readFileSync as Bs,writeFileSync as Gs}from"fs";import{dirname as Ks}from"path";import*as Pe from"@clack/prompts";function vt(){if(!Fs(me))return null;try{let e=JSON.parse(Bs(me,"utf-8"));return e.apiKey?e.apiKey:(e.token&&!e.apiKey&&Pe.log.warning(`Found old GitHub token in ${me}. Run 'generatesaas init' to set up your API key.`),null)}catch{return null}}function Ue(e){let t=process.env.GENERATESAAS_API_URL;t&&t.replace(/\/+$/,"")!==pr||(Vs(Ks(me),{recursive:!0}),Gs(me,`${JSON.stringify({apiKey:e},null," ")}
|
|
9
9
|
`,{mode:384}))}async function at(e){if(e?.apiKey)return e.apiKey;let t=process.env.GENERATESAAS_API_KEY;if(t)return t;let r=vt();if(r)return r;if(!e?.prompt)throw new Error("API key not found. Set GENERATESAAS_API_KEY or run 'generatesaas init' to configure.");return kt()}async function kt(){let e=await Pe.text({message:"Enter your GenerateSaaS API key:",placeholder:"gs_live_...",validate:t=>{if(!t?.trim())return"API key is required."}});return Pe.isCancel(e)&&(Pe.cancel("Setup cancelled."),process.exit(0)),e.trim()}import{readFile as Hs}from"fs/promises";async function Ae(e){let t=process.env.GENERATESAAS_VERSION_INDEX;return t?JSON.parse(await Hs(t,"utf-8")):process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{latest:"0.0.0-ci",versions:[{version:"0.0.0-ci",date:new Date().toISOString(),breaking:!1}],entitlements:null}:await(await Se(e,"/versions")).json()}async function gn(e,t){if(process.env.GENERATESAAS_OFFLINE_LICENSE==="1")return null;try{return await(await Se(e,`/changelog/${encodeURIComponent(t)}`)).text()}catch(r){if(r instanceof M&&r.status===404)return null;throw r}}async function yn(e,t){return process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{skills:{"generatesaas-update":{skillMd:`# Offline skill stub
|
|
10
10
|
`,scripts:{},references:{}}}}:await(await Se(e,`/skills/${encodeURIComponent(t)}`)).json()}function $t(e){if(!(e instanceof M)||e.status!==403)return null;let t=e.body;return!t||t.code!=="update_window_expired"?null:{message:e.message,lastAllowedVersion:t.lastAllowedVersion??null}}var mr="nextjs";function bn(e){return{frontend:mr,architecture:e.architecture,deployTarget:e.deploymentTarget,database:e.databaseProvider,cache:e.cacheProvider,payment:e.paymentProvider,email:e.emailProvider,multiTenancy:e.multiTenancy,blog:!0,docs:e.docs,desktop:e.desktop,mobile:e.mobile,runner:!1,credits:e.credits,revenueSharing:e.revenueSharing,currency:e.defaultCurrency}}async function hr(e,t){return process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{token:"offline-test-token",licenseId:"offline-test-license-id",installId:t.installId}:await(await Se(e,"/license/sign",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json()}async function wn(e,t){return process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?{token:t.currentToken}:await(await Se(e,"/license/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json()}async function fr(e,t){let r=await fetch(`${e}/license/verify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`Verification service returned ${r.status}`);return await r.json()}async function vn(e,t,r){let n=await fetch(`${e}/license/inspect`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(r)});if(!n.ok){let i=await n.json().catch(()=>null);throw new Error(i?.error??`Inspect endpoint returned ${n.status}`)}return await n.json()}var gr=new Set([".git","node_modules",".pnpm-store",".env",".env.test",".turbo",".data","dist",".next",".next-e2e-web",".next-e2e-desktop",".svelte-kit",".wrangler",".devcontainer","playwright-report","test-results",".drive-out",".mastra"]),yr=new Set(["pnpm-lock.yaml","widget-documents.generated.ts"]);function ct(e){if(br(e))return!0;for(let t of e.split("/"))if(yr.has(t))return!0;return!1}var Ys=new Set(["data","mksaas","references","scripts",".cursor",".agents",".codex",".generatesaas",".vscode",".mcp.json","vitest.config.ts","README.md","TODO.md","OVERVIEW.md","HANDOFF.md"]),kn=["scripts/docs-lint.ts"],Ws=["docs/superpowers","packages/cli","packages/cli-api","packages/database/tests/no-migration-history.test.ts","infra/docker-compose.yml",".claude/commands",".claude/skills/web-port",".claude/skills/web-port-workspace",".claude/settings.local.json",".claude/worktrees"];function br(e){let t=e.split("/");for(let r of t)if(gr.has(r))return!0;if(kn.includes(e)||kn.some(r=>r.startsWith(`${e}/`)))return!1;if(Ys.has(t[0]))return!0;for(let r of Ws)if(e===r||e.startsWith(`${r}/`))return!0;return!1}async function jt(e,t,r){await Js(r,{recursive:!0});let n=process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR;if(n){let a=qs(n,`v${t}.tar.gz`);if(!zs(a))throw new Error(`GENERATESAAS_TEMPLATE_TARBALL_DIR is set but ${a} does not exist.`);await wr(En(a),vr(r));return}let i=process.env.GENERATESAAS_TEMPLATE_TARBALL;if(i){await wr(En(i),vr(r));return}let o=await Se(e,`/template/${encodeURIComponent(t)}`);if(!o.body)throw new Error("Empty response body");let s=Xs.fromWeb(o.body);await wr(s,vr(r))}function vr(e){return Zs({cwd:e,strip:1,filter:t=>{let r=t.replace(/^[^/]+\//,"");return r?!br(r):!0},sync:!1})}import{readdir as Mt,readFile as lt,rm as Pn,rmdir as Qs,writeFile as Et}from"fs/promises";import{join as K}from"path";async function An(e){let t;try{t=await Mt(e,{withFileTypes:!0})}catch{return!1}let r=!1;for(let n of t){let i=K(e,n.name);if(n.isDirectory()){await An(i)&&(r=!0);continue}if(n.name.startsWith("_")){r=!0;continue}await Pn(i,{force:!0})}return r||await Qs(e).catch(()=>{}),r}async function In(e){let t=K(e,"packages/content"),r=[];try{r=(await Mt(t,{withFileTypes:!0})).filter(s=>s.isDirectory()).map(s=>s.name)}catch{return}let n=new Set;for(let s of r){let a=K(t,s),p;try{p=(await Mt(a,{withFileTypes:!0})).filter(h=>h.isDirectory())}catch{continue}for(let h of p)n.add(h.name),await An(K(a,h.name))}let i=await no(e),o=new Set([...n].filter(s=>i===void 0||i.has(s)));await Promise.all([...o].map(s=>Pn(K(e,"apps/web/public/images",s),{recursive:!0,force:!0}))),await so(e,o)}var eo="packages/config/src/index.ts",to=/\bcontent:\s*\{[\s\S]*?\bsections:\s*\[([\s\S]*?)\]/,ro=/\bslug:\s*"([^"]+)"/g;async function no(e){let t;try{t=await lt(K(e,eo),"utf-8")}catch{return}let r=to.exec(t)?.[1];if(r===void 0)return;let n=[...r.matchAll(ro)].map(i=>i[1]).filter(i=>i!==void 0);return n.length>0?new Set(n):void 0}var io="packages/translate/.meta/mdx-translation-meta.json";async function so(e,t){if(t.size===0)return;let r=K(e,io),n;try{n=JSON.parse(await lt(r,"utf-8"))}catch{return}if(typeof n!="object"||n===null)return;let i=n;if(typeof i.locales!="object"||i.locales===null)return;let o={};for(let[s,a]of Object.entries(i.locales)){if(typeof a!="object"||a===null)continue;let p={};for(let[h,g]of Object.entries(a)){let k=h.split("/"),w=k.length>1?k[0]:void 0,P=k[k.length-1]?.startsWith("_")===!0;w!==void 0&&t.has(w)&&!P||(p[h]=g)}o[s]=p}await Et(r,`${JSON.stringify({...i,locales:o},null," ")}
|
|
11
11
|
`)}var oo="packages/config/src/blog.ts";async function Tn(e){let t=K(e,oo),r=await lt(t,"utf-8"),n=Sn(Sn(r,"blogCategories",t),"blogAuthors",t);await Et(t,n)}function Sn(e,t,r){let n=new RegExp(`(export const ${t}\\b[^=]*=\\s*)\\[[\\s\\S]*?\\];`);if(!n.test(e))throw new Error(`emptyBlogConfig: could not find the \`export const ${t} = [...]\` declaration in ${r}. The boilerplate blog config may have been renamed or restructured; update the CLI strip in cleanup.ts.`);return e.replace(n,"$1[];")}async function Rn(e){let t=K(e,"packages/i18n/translations"),r;try{r=await Mt(t)}catch{return}for(let n of r){let i=K(t,n,"web.json"),o;try{o=await lt(i,"utf-8")}catch{continue}let s=JSON.parse(o);!s.content?.categories||s.content.categories.blog===void 0||(s.content.categories.blog={},await Et(i,`${JSON.stringify(s,null," ")}
|
|
@@ -462,6 +462,7 @@ export * from "./nav-active";
|
|
|
462
462
|
export * from "./notification-types";
|
|
463
463
|
export * from "./password";
|
|
464
464
|
export * from "./pricing";
|
|
465
|
+
export * from "./product-analytics";
|
|
465
466
|
export * from "./projects";
|
|
466
467
|
export * from "./robots";
|
|
467
468
|
export * from "./roles";
|
|
@@ -1184,22 +1185,11 @@ export async function withMutex<T>(
|
|
|
1184
1185
|
`),r++;r+=2;continue}if(n==='"'||n==="'"||n==="`"){let o=n;for(r++;r<e.length&&e[r]!==o;)e[r]==="\\"?r++:e[r]===`
|
|
1185
1186
|
`&&(t+=`
|
|
1186
1187
|
`),r++;r++;continue}t+=n,r++}return t}async function Qn(e){let t=`import { config } from "@repo/config";
|
|
1187
|
-
`,r=await _r(e,"utf-8");if(!r.includes(t))return;let n=r.replace(t,""),i=ha(n);/\bconfig\b/.test(i)||await l(e,n)}var Ye="stripMobileObservability",ei=["apps/mobile/lib/observability.ts","apps/mobile/types/env.d.ts","apps/mobile/tests/settings-privacy-screen.test.tsx"],ti="apps/mobile/tests/observability.test.ts",ga="mobile-obs-any",ya=["apps/mobile/tests/settings-privacy-screen.test.tsx"],Ht={sentry:["@sentry/react-native","@sentry/cli"],posthog:[
|
|
1188
|
-
...sentryExpoPlugin()`,wa=["apps/mobile/app.config.ts"],va="|@sentry/react-native",ka
|
|
1189
|
-
* halves at once so dev and the test suite exercise both. A generated project carries only the
|
|
1190
|
-
* providers its \`observability\` manifest option names: the CLI removes the other one's marked region
|
|
1191
|
-
* from this file, its SDK from \`apps/mobile/package.json\` and, for Sentry, its Expo config plugin
|
|
1192
|
-
* from \`app.config.ts\` - the same "an unselected provider costs nothing" contract the server, the
|
|
1193
|
-
* browser and the desktop app already keep.
|
|
1194
|
-
*
|
|
1195
|
-
* THE RULE THAT KEEPS THAT WORKING: a surviving region may never reference a stripped one. Every
|
|
1196
|
-
* cross-provider \`{@link}\` and every paragraph about one provider's credentials sits INSIDE that
|
|
1197
|
-
* provider's own region, and what is left between them is provider-neutral - the {@link PROVIDERS}
|
|
1198
|
-
* list and the two exported entry points that walk it, which is what a project generated with
|
|
1199
|
-
* \`observability: []\` keeps and starts nothing with.`,Ea='import { readPrivacySettings, type PrivacySettings } from "@/lib/privacy";',Sa='import type { PrivacySettings } from "@/lib/privacy";';function Pa(e){let t=e.map(n=>n==="sentry"?"Sentry":"PostHog").join(" and ");return`${e.length===0?` * Your project was generated with observability OFF, so this app received no reporting adapter
|
|
1188
|
+
`,r=await _r(e,"utf-8");if(!r.includes(t))return;let n=r.replace(t,""),i=ha(n);/\bconfig\b/.test(i)||await l(e,n)}var Ye="stripMobileObservability",ei=["apps/mobile/lib/observability.ts","apps/mobile/types/env.d.ts","apps/mobile/tests/settings-privacy-screen.test.tsx"],ti="apps/mobile/tests/observability.test.ts",ga="mobile-obs-any",ya=["apps/mobile/tests/settings-privacy-screen.test.tsx"],Ht={sentry:["@sentry/react-native","@sentry/cli"],posthog:[]},ba=`,
|
|
1189
|
+
...sentryExpoPlugin()`,wa=["apps/mobile/app.config.ts"],va="|@sentry/react-native",ka=" * DUAL-PROVIDER, the way `packages/observability` is. This repo carries the Sentry and the PostHog\n * halves at once so dev and the test suite exercise both. A generated project carries only the\n * providers its `observability` manifest option names: the CLI removes the other one's marked region\n * from this file and, for Sentry, its SDK from `apps/mobile/package.json` and its Expo config plugin\n * from `app.config.ts`. PostHog's SDK stays whatever this choice says, because product analytics\n * (`lib/product-analytics.ts`) runs on it too. Otherwise this is the same \"an unselected provider\n * costs nothing\" contract the server, the browser and the desktop app already keep.\n *\n * THE RULE THAT KEEPS THAT WORKING: a surviving region may never reference a stripped one. Every\n * cross-provider `{@link}` and every paragraph about one provider's credentials sits INSIDE that\n * provider's own region, and what is left between them is provider-neutral - the {@link PROVIDERS}\n * list and the two exported entry points that walk it, which is what a project generated with\n * `observability: []` keeps and starts nothing with.",Ea='import { readPrivacySettings, type PrivacySettings } from "@/lib/privacy";',Sa='import type { PrivacySettings } from "@/lib/privacy";';function Pa(e){let t=e.map(n=>n==="sentry"?"Sentry":"PostHog").join(" and ");return`${e.length===0?` * Your project was generated with observability OFF, so this app received no reporting adapter
|
|
1200
1190
|
* and no reporting SDK: {@link PROVIDERS} is empty, and both functions below are no-ops that load
|
|
1201
|
-
* nothing and send nothing.`:` * This app reports to ${t}. No other provider's start
|
|
1202
|
-
*
|
|
1191
|
+
* nothing and send nothing.`:` * This app reports to ${t}. No other provider's start or Expo config plugin was generated,
|
|
1192
|
+
* so there is nothing here for Metro to fold away.`}
|
|
1203
1193
|
*
|
|
1204
1194
|
* To change providers, edit \`observability\` in .generatesaas/manifest.json and run
|
|
1205
1195
|
* \`generatesaas update\`: re-shaping brings that provider's half of this file, its SDK and its env
|
|
@@ -1742,7 +1732,7 @@ function posthogConfigured(): boolean {
|
|
|
1742
1732
|
${k}`:s.message))}else i()})})}async function is(e){if(!Re("pnpm"))return _.log.warn("pnpm not found. Skipping lockfile regeneration."),!1;try{return await Te("pnpm",["install","--lockfile-only","--no-frozen-lockfile"],e),!0}catch(t){let r=t instanceof Error?t.message:String(t);return _.log.warn(`Lockfile regeneration failed: ${r}`),_.log.warn("Deploys using --frozen-lockfile may fail."),!1}}async function ss(e){if(!Re("pnpm"))return _.log.warn("pnpm not found. Skipping dependency installation."),_.log.info("Install pnpm: https://pnpm.io/installation"),!1;let t=_.spinner();t.start("Installing dependencies (this may take a minute)...");try{return await Te("pnpm",["install"],e),t.stop("Dependencies installed."),!0}catch(r){t.stop("Dependency installation failed.");let n=r instanceof Error?r.message:String(r);return _.log.warn(`pnpm install failed: ${n}`),_.log.warn("You can run it manually later."),!1}}async function os(e){if(!Re("pnpm"))return!1;let t=_.spinner();t.start("Generating baseline database migration...");try{return await Te("pnpm",["-F","@repo/database","generate"],e),t.stop("Baseline migration generated."),!0}catch(r){t.stop("Baseline migration generation failed.");let n=r instanceof Error?r.message:String(r);return _.log.warn(`Could not generate baseline migration: ${n}`),_.log.warn("Run 'pnpm -F @repo/database generate' before your first deploy."),!1}}async function as(e){if(!Re("pnpm"))return!1;try{await Gr(Qt(e,"packages/mcp-widgets"))}catch{return!1}let t=_.spinner();t.start("Building the MCP widgets...");try{return await Te("pnpm",["-F","@repo/mcp-widgets","widgets:build"],e),t.stop("MCP widgets built."),!0}catch(r){t.stop("MCP widget build failed.");let n=r instanceof Error?r.message:String(r);return _.log.warn(`Could not build the MCP widgets: ${n}`),_.log.warn("Run 'pnpm -F @repo/mcp-widgets widgets:build' and commit the result."),!1}}async function cs(e){try{return await Gr(Qt(e,".git")),_.log.info("Git repository already exists, skipping init."),!0}catch{}if(!Re("git"))return _.log.warn("git not found. Skipping repository initialization."),!1;let t=_.spinner();t.start("Initializing git repository...");try{return await Te("git",["init"],e),await Te("git",["add","-A"],e),await Te("git",["commit","--no-verify","-m","Initial commit from GenerateSaaS"],e),t.stop("Git repository initialized."),!0}catch{return t.stop("Git initialization failed."),_.log.warn("You can run git init manually later."),!1}}async function ls(e){if(!Re("pnpm"))return!1;try{await Gr(Qt(e,".git"))}catch{return!1}try{let t=JSON.parse(await pp(Qt(e,"package.json"),"utf-8")),r=!!t.devDependencies?.["simple-git-hooks"],n=!!t["simple-git-hooks"];if(!r||!n)return!1}catch{return!1}try{return await Te("pnpm",["exec","simple-git-hooks"],e),!0}catch{return _.log.warn("Could not install git hooks. Run 'pnpm exec simple-git-hooks' manually."),!1}}import*as Je from"@clack/prompts";import H from"picocolors";function ps(e,t){let r=rt(e);t.dockerAvailable||Je.log.warn("Docker not found. Install Docker to run local services: https://docs.docker.com/get-docker/"),t.baselineMigrationMissing&&Je.log.warn("No database migration was generated (the install did not complete). Run `pnpm install` then `pnpm --filter @repo/database generate` and commit the result BEFORE deploying - otherwise your first deploy pushes the schema untracked.");let n=[];n.push(`cd ${e.projectDir}`),t.pnpmInstalled||n.push("pnpm install"),t.mcpWidgetsUnbuilt&&n.push(`pnpm -F @repo/mcp-widgets widgets:build ${H.dim("# then commit the rebuilt widget document")}`),n.push(`pnpm infra ${H.dim(`# ${r.map(a=>Qr[a].label).join(", ")}`)}`),n.push(`pnpm dev ${H.dim("# http://localhost:3000")}`),t.skippedCredentials.length>0&&(n.push(""),n.push(H.dim("Fill in remaining TODO values in .env"))),Je.note(n.join(`
|
|
1743
1733
|
`),H.yellow("Start Development"));let i=[];i.push(`App ${H.cyan("http://localhost:3000")}`),e.architecture==="separate"&&i.push(`API ${H.cyan("http://localhost:3010")}`),r.includes("mailpit")&&i.push(`Mailpit ${H.cyan("http://localhost:8025")}`),r.includes("inngest")&&i.push(`Inngest ${H.cyan("http://localhost:8288")}`),Je.note(i.join(`
|
|
1744
1734
|
`),H.yellow("Dev Tools"));let o=[],s=dp(e);s.length>0&&o.push(`Set in production: ${H.dim(s.join(", "))}`),o.push("pnpm db:setup # Apply the database schema"),o.push(up(e)),Je.note(o.join(`
|
|
1745
|
-
`),H.yellow("Deployment"))}function dp(e){let t=["DATABASE_URL","BETTER_AUTH_SECRET","INNGEST_APP_ID","INNGEST_EVENT_KEY","INNGEST_SIGNING_KEY"];return e.cacheProvider==="upstash"?t.push("UPSTASH_REDIS_REST_URL","UPSTASH_REDIS_REST_TOKEN"):t.push("REDIS_URL"),e.paymentProvider==="stripe"?t.push("STRIPE_SECRET_KEY","STRIPE_WEBHOOK_SECRET"):e.paymentProvider==="polar"&&t.push("POLAR_ACCESS_TOKEN","POLAR_WEBHOOK_SECRET"),e.emailProvider==="ses"?t.push("AMAZON_SES_REGION","AMAZON_SES_KEY","AMAZON_SES_SECRET"):e.emailProvider==="resend"?t.push("RESEND_API_KEY"):t.push("SMTP_HOST","SMTP_PORT"),t}function up(e){switch(e.deploymentTarget){case"node":return"Deploy with Docker or your preferred Node.js host";case"vercel":return"vercel deploy # Deploy to Vercel"}}function ht(e){let r=(e.startsWith("v")?e.slice(1):e).match(/^(\d+)\.(\d+)\.(\d+)$/);return r?[Number(r[1]),Number(r[2]),Number(r[3])]:null}function _e(e,t){let r=ht(e),n=ht(t);if(!r||!n)return 0;for(let i=0;i<3;i++)if(r[i]!==n[i])return r[i]-n[i];return 0}function er(e,t){return e.versions.find(r=>r.version===t)?.cli}function ds(e){return process.env.GENERATESAAS_TEMPLATE_TARBALL||process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR||process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?!0:ht(e)===null}function tr(e,t,r="3.
|
|
1735
|
+
`),H.yellow("Deployment"))}function dp(e){let t=["DATABASE_URL","BETTER_AUTH_SECRET","INNGEST_APP_ID","INNGEST_EVENT_KEY","INNGEST_SIGNING_KEY"];return e.cacheProvider==="upstash"?t.push("UPSTASH_REDIS_REST_URL","UPSTASH_REDIS_REST_TOKEN"):t.push("REDIS_URL"),e.paymentProvider==="stripe"?t.push("STRIPE_SECRET_KEY","STRIPE_WEBHOOK_SECRET"):e.paymentProvider==="polar"&&t.push("POLAR_ACCESS_TOKEN","POLAR_WEBHOOK_SECRET"),e.emailProvider==="ses"?t.push("AMAZON_SES_REGION","AMAZON_SES_KEY","AMAZON_SES_SECRET"):e.emailProvider==="resend"?t.push("RESEND_API_KEY"):t.push("SMTP_HOST","SMTP_PORT"),t}function up(e){switch(e.deploymentTarget){case"node":return"Deploy with Docker or your preferred Node.js host";case"vercel":return"vercel deploy # Deploy to Vercel"}}function ht(e){let r=(e.startsWith("v")?e.slice(1):e).match(/^(\d+)\.(\d+)\.(\d+)$/);return r?[Number(r[1]),Number(r[2]),Number(r[3])]:null}function _e(e,t){let r=ht(e),n=ht(t);if(!r||!n)return 0;for(let i=0;i<3;i++)if(r[i]!==n[i])return r[i]-n[i];return 0}function er(e,t){return e.versions.find(r=>r.version===t)?.cli}function ds(e){return process.env.GENERATESAAS_TEMPLATE_TARBALL||process.env.GENERATESAAS_TEMPLATE_TARBALL_DIR||process.env.GENERATESAAS_OFFLINE_LICENSE==="1"?!0:ht(e)===null}function tr(e,t,r="3.35.0"){if(ds(r))return{ok:!0};let n=er(e,e.latest);return!n||ht(n)===null?{ok:!0}:_e(r,n)>=0?{ok:!0}:{ok:!1,message:`Your installed generatesaas CLI (v${r}) is too old for template v${e.latest}, which needs CLI v${n} or newer. Run npx generatesaas@latest ${t} so npm fetches the current CLI. If the release happened minutes ago, npm may still be propagating it - retry shortly.`}}function us(e,t,r="3.35.0"){if(ds(r))return{ok:!0};let n=er(e,t);return!n||ht(n)===null?{ok:!0}:_e(r,n)===0?{ok:!0}:{ok:!1,message:`Template v${t} must be scaffolded by CLI v${n} exactly (the CLI whose generators produced that release). Run npx generatesaas@${n} init.`}}import bp from"picocolors";var wp="a10a6fb9d7cadde32e37dad52059d17b5d2b916b08c76d8fbcc99982e9a3d87f";async function vp(e){let t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(`generatesaas-demo:${e}`)),r=[...new Uint8Array(t).subarray(0,16)].map(n=>n.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20,32)}`}function ms(e){e.command("init").description("Scaffold a new GenerateSaaS project").argument("[apiKey]","license key (same as --api-key)").option("-n, --name <name>","project name (lowercase, hyphens, starts with letter)").option("--app-name <name>","display name for the app").option("-l, --location <path>","project directory (default: ./{name})").addOption(new Q("--architecture <type>","fullstack or separate").choices([...nt])).addOption(new Q("--payment <provider>","payment provider").choices([...it])).addOption(new Q("--email <provider>","email provider").choices([...st])).option("--org","enable multi-tenancy (organizations)").option("--no-org","disable multi-tenancy").option("--projects","enable projects (a switcher that scopes a user's work)").option("--no-projects","disable projects").option("--docs","include the docs app (apps/docs, Fumadocs)").option("--no-docs","exclude the docs app").option("--desktop","include the desktop app (apps/desktop, built with Electron)").option("--no-desktop","exclude the desktop app").option("--mobile","include the mobile app (apps/mobile, built with Expo)").option("--no-mobile","exclude the mobile app").addOption(new Q("--mobile-purchases <lane>","in-app purchases in the mobile app: revenuecat adds the store billing lane on top of your web payment provider, none keeps web billing only").choices([...je])).option("--ai","include the AI features (chat, models, automations, integrations)").option("--no-ai","exclude the AI features").option("--web-ai","show the AI features in the web app (the default)").option("--no-web-ai","desktop-first: keep the AI features out of the web app, which is reduced to account, login and billing - the desktop or mobile app is the AI product. Requires --desktop or --mobile, plus --ai").option("--revenue-sharing","enable revenue sharing").option("--no-revenue-sharing","disable revenue sharing").option("--credits","enable credits system").option("--no-credits","disable credits system (subscription-only)").addOption(new Q("--currency <code>","default currency for billing").choices([...ce])).addOption(new Q("--preset <preset>","infrastructure preset: serverless (Vercel + Neon + Upstash) or selfhost (Docker or Node + Postgres + Redis); --deploy/--database/--cache override it piecewise").choices([...$e])).addOption(new Q("--deploy <target>","deployment target").choices([...le])).addOption(new Q("--database <provider>","database provider").choices([...pe])).addOption(new Q("--cache <provider>","cache provider").choices([...de])).option("--observability <providers>",`comma-separated observability providers (${G.join(", ")}); anything unselected ships no SDK`).option("--api-key <key>","API key (skips interactive prompt)").option("--base-url <url>","public base URL (e.g. https://example.com) - bakes into canonical/og/sitemap").option("-y, --yes","accept defaults for unspecified options (non-interactive)").addOption(new Q("--demo","first-party demo build: keep sample content, mark site non-indexable - requires CI API key").hideHelp()).addOption(new Q("--no-db-migration","skip generating the baseline DB migration (internal: demos/CI/playground)").hideHelp()).action(async(t,r)=>{await kp(t?{...r,apiKey:t}:r)})}async function kp(e){let t=performance.now();Xr("3.35.0");let r;try{r=ln(e)}catch(v){E.cancel(N(v)),process.exit(1)}let n=E.spinner(),i;try{i=await at({apiKey:e.apiKey,prompt:!e.yes})}catch(v){E.cancel(N(v)),process.exit(1)}e.demo&&jr(i)!==wp&&(E.cancel("--demo is restricted to first-party demo deployments."),process.exit(1));let o=he(i),s,a=async()=>{s=await Ae(o);let v=tr(s,"init");if(!v.ok)throw new Error(v.message);return{latestVersion:s.latest,selectedVersion:s.latest,desktopAllowed:s.entitlements?.desktopAllowed??!0,mobileAllowed:s.entitlements?.mobileAllowed??!0}};n.start("Verifying access...");let p,h,g=!0,k=!0;try{({latestVersion:p,selectedVersion:h,desktopAllowed:g,mobileAllowed:k}=await a()),n.stop("Access verified."),Ue(i)}catch(v){if(n.stop("Access verification failed."),v instanceof M&&v.status===401){e.yes&&(E.cancel("Invalid API key. Cannot prompt in non-interactive mode."),process.exit(1)),E.log.warning("Invalid API key."),i=await kt(),o=he(i),n.start("Verifying access...");try{({latestVersion:p,selectedVersion:h,desktopAllowed:g,mobileAllowed:k}=await a()),n.stop("Access verified."),Ue(i)}catch(L){n.stop("Access verification failed."),E.cancel(L instanceof M&&L.status===401?"Invalid API key.":N(L)),process.exit(1)}}else E.cancel(N(v)),process.exit(1)}E.log.success(`Latest version: ${p}`),r.desktop===!0&&!g&&(E.cancel("The desktop app is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1)),r.mobile===!0&&!k&&(E.cancel("The mobile app is available on the Pro plan and up. Upgrade your plan at generatesaas.com."),process.exit(1));let w;e.yes?w=pn({...r,...g?{}:{desktop:!1},...k?{}:{mobile:!1}}):w=await dn(r,{desktopAllowed:g,mobileAllowed:k});let P;n.start("Activating license...");try{let v=e.demo&&w.baseUrl?await vp(w.baseUrl):crypto.randomUUID(),L=()=>({frontend:mr,version:h,installId:v,projectName:w.projectName,options:bn(w)}),F;try{F=await hr(o,L())}catch(ve){let $=$t(ve);if(!$?.lastAllowedVersion||!s)throw ve;n.stop("License activation failed.");let W=us(s,$.lastAllowedVersion);if(W.ok||(E.cancel(`${$.message} ${W.message}`),process.exit(1)),e.yes){let z=er(s,$.lastAllowedVersion);E.cancel(`${$.message} Re-run ${z?`npx generatesaas@${z} init`:"init"} without --yes to continue with v${$.lastAllowedVersion} (the last version your license covers).`),process.exit(1)}let ke=await E.confirm({message:`Your update window has ended. Continue with v${$.lastAllowedVersion} (the last version your license covers)?`});(E.isCancel(ke)||!ke)&&(E.cancel("Setup cancelled."),process.exit(0)),h=$.lastAllowedVersion,n.start(`Activating license for v${h}...`),F=await hr(o,L())}P={token:F.token,keyHash:jr(i),installId:F.installId??v},n.stop("License activated.")}catch(v){n.stop("License activation failed."),E.cancel(N(v)),process.exit(1)}let u=yp(w.projectDir);if(mp(u)&&hp(u).length>0)if(e.yes)E.log.info(`Directory ${u} is not empty. Merging (keeping existing files, overwriting conflicts).`);else{let L=await E.select({message:`Directory ${u} is not empty.`,options:[{value:"merge",label:"Merge",hint:"keep existing files, overwrite conflicts"},{value:"overwrite",label:"Overwrite",hint:"delete everything and start fresh"},{value:"cancel",label:"Cancel"}]});(E.isCancel(L)||L==="cancel")&&(E.cancel("Setup cancelled."),process.exit(0)),L==="overwrite"&&fp(u,{recursive:!0,force:!0})}let O={...w,projectDir:u,version:h,...e.demo?{docs:!1}:{}};n.start("Downloading template...");try{await jt(o,h,u),n.stop("Template downloaded.")}catch(v){n.stop("Download failed."),E.cancel(N(v)),process.exit(1)}n.start("Generating project files...");try{if(await Xt(O),!e.demo){let v=await mt(u);await l(gp(u,Ct),`${JSON.stringify(v,null," ")}
|
|
1746
1736
|
`),await es(u,u)}await ns(u),await Zi(O,P),n.stop("Project files generated.")}catch(v){n.stop("Generation failed."),E.cancel(N(v)),process.exit(1)}!await is(u)&&O.demo===!0&&(E.cancel("Lockfile regeneration failed on a demo build - refusing to ship a stale lockfile."),process.exit(1));let B=await ss(u),oe=O.demo!==!0&&e.dbMigration!==!1,Oe=!1;oe&&B&&(await os(u),Oe=!0);let xe=B?await as(u):!1;await cs(u),B&&await ls(u);let De=Re("docker"),Qe=lr(O).map(v=>v.key).filter(v=>!O.credentials?.[v]);ps(O,{pnpmInstalled:B,dockerAvailable:De,skippedCredentials:Qe,baselineMigrationMissing:oe&&!Oe,mcpWidgetsUnbuilt:O.ai&&!xe}),Zr(),E.log.info(bp.dim(`Done in ${((performance.now()-t)/1e3).toFixed(1)}s`))}import{existsSync as rr}from"fs";import{readFile as ws}from"fs/promises";import{join as qe,resolve as Ip}from"path";import*as b from"@clack/prompts";import C from"picocolors";import{mkdtemp as Ep,rm as Sp}from"fs/promises";import{tmpdir as Pp}from"os";import{join as Ap}from"path";async function Kr(e,t,r,n,{olderRelease:i=!1}={}){let o=await Ep(Ap(Pp(),"generatesaas-stage-"));try{await jt(e,t,o);let s=()=>Xt({...r,projectDir:o}),a=[];return i?a=await Zn(s):await s(),await Mr(o,n),a}finally{await Sp(o,{recursive:!0,force:!0})}}function hs(e){return e?"ON":"OFF"}var ft="packages/config/src/index.ts";function fs(e){let t=e.databaseProvider!==void 0&&e.databaseProvider!=="postgres",r=e.cacheProvider!==void 0&&e.cacheProvider!=="redis";return[...e.dockerServices??[]].filter(n=>!(n==="postgres"&&t)&&!(n==="redis"&&r)).sort()}function gs(e){return[...rt({databaseProvider:e.databaseProvider??"postgres",cacheProvider:e.cacheProvider??"redis",emailProvider:e.emailProvider??"smtp"})].sort()}var Hr=[{key:"errorTracking",severity:"warn",normalize:e=>{e.errorTracking===void 0||e.observability!==void 0||(e.observability=e.errorTracking==="none"?[]:[e.errorTracking])},preserved:()=>!0,describe:()=>"Retired option `errorTracking`: it is now `observability`, an array, because a project may run more than one provider at once. Your recorded choice was migrated across automatically."},{key:"companion",severity:"warn",normalize:e=>{e.companion===void 0||e.runner!==void 0||(e.runner=e.companion)},preserved:()=>!0,describe:()=>"Retired option `companion`: it was renamed to `runner`, and that lane has since been removed. Your recorded choice was migrated across automatically so the removal is reported under one name."},{key:"runner",severity:"warn",preserved:e=>e.runner!==!0,describe:()=>"Retired option `runner`: your project recorded the runner ON, and the paired-device lane is GONE - not moved to config, removed. This update deletes the pairing endpoint, the dispatch transport, the relay, the `/runner/*` routes and the Runners page from your project, so machines your users had paired are no longer reachable from it. Chat and automations keep running on your app's own AI backend (`config.ai`); nothing else about them changes."},{key:"companionSource",severity:"warn",preserved:()=>!1,describe:e=>`Retired option \`companionSource\`: your project recorded a \`${String(e.companionSource)}\` daemon source. The paired-device lane that daemon served has been removed from your project, so there is no daemon left to source.`},{key:"companionName",severity:"warn",preserved:()=>!1,describe:e=>`Retired option \`companionName\`: your project recorded a branded daemon called ${e.companionName}. The paired-device lane is gone, so your project no longer ships an install flow to brand. An existing install on a user's machine keeps running; it has nothing left to pair with here.`},{key:"companionRepoUrl",severity:"warn",preserved:()=>!1,describe:e=>`Retired option \`companionRepoUrl\`: your project pointed its install flow at ${e.companionRepoUrl}. The paired-device lane is gone, so there is no install flow left to point anywhere.`},{key:"companionLocalPath",severity:"warn",preserved:e=>(e.companionLocalPath??"").trim()==="",describe:e=>`Retired option \`companionLocalPath\`: your project recorded a local daemon checkout at ${e.companionLocalPath}. The option is gone, and so is the paired-device lane behind it - nothing in your project is built from a local daemon checkout any more.`},{key:"desktopAutoRelease",severity:"warn",applies:e=>e.desktop===!0,preserved:e=>e.desktopAutoRelease!==!0,describe:()=>"Retired option `desktopAutoRelease`: your project recorded automatic desktop releases, but the release trigger is no longer an option - cutting a release publishes signed installers from your repository and spends your Actions minutes, so it is always deliberate now. The staged `.github/workflows/desktop-release.yml` runs on `workflow_dispatch` only (the Actions tab). Add a `workflow_run` block to it if you want the CI-chained trigger back."},{key:"billingScope",severity:"ask",applies:e=>e.multiTenancy===!0,preserved:e=>e.billingScope!=="organization",describe:()=>"Retired option `billingScope`: your project recorded organization-scoped billing, and organization billing is GONE - not moved to config, removed. Money now lives only on a USER: an organization has no balance, no plan and no payment-provider customer of its own, and a workspace is funded by that organization's OWNER, whose personal balance every credit spent in it is drawn from. Payments already in flight are safe - a webhook arriving with old organization metadata is credited to that organization's owner rather than dropped - but a STORED balance is not: the `credits` and `plan` columns an organization holds them in are going away, and this update does NOT migrate them for you. MOVE every paying organization's credits and plan onto its owner BEFORE you take new checkouts, or that balance goes with the columns. How should this update proceed?"},{key:"socialProviders",severity:"warn",preserved:e=>(e.socialProviders??[]).length===0,describe:e=>`Retired option \`socialProviders\`: your project recorded ${(e.socialProviders??[]).join(", ")}, but it is now a plain config value that starts empty. Add those IDs back to \`config.auth.socialProviders\` in ${ft} or their sign-in buttons stop rendering.`},{key:"mcpServer",severity:"warn",preserved:e=>e.mcpServer!==!0,describe:()=>`Retired option \`mcpServer\`: your project recorded the outward MCP server ON, but its code now ships to every project behind a config gate generated OFF. Set \`config.mcpServer.enabled\` to \`true\` in ${ft} to keep your /mcp endpoint and its settings tab.`},{key:"emailTracking",severity:"ask",preserved:e=>e.emailTracking!==!1,describe:()=>`Retired option \`emailTracking\`: your project recorded email open/click tracking OFF, but it is now a plain config value generated ON. Applying this update as-is starts tracking opens and clicks for every user you mail. Put it back by setting \`config.email.tracking.enabled\` to \`false\` in ${ft}. How should this update proceed?`},{key:"aiBuiltin",severity:"warn",normalize:e=>{e.aiBuiltin===void 0&&e.aiByok!==void 0&&(e.aiBuiltin=e.aiByok===!1)},applies:e=>e.ai===!0,preserved:e=>e.aiBuiltin===re(e),describe:e=>`Retired option \`aiBuiltin\`: your project recorded built-in AI models ${hs(e.aiBuiltin)}, but it is now a plain config value generated ${hs(re(e))} for a project ${re(e)?"with":"without"} a payment provider. Set \`config.ai.builtin\` to \`${String(e.aiBuiltin===!0)}\` in ${ft} to keep your choice.`},{key:"aiByok",severity:"warn",applies:e=>e.ai===!0,preserved:e=>e.aiByok!==!1,describe:()=>`Retired option \`aiByok\`: your project recorded bring-your-own-key AI OFF, but it is now a plain config value generated ON. Set \`config.ai.byok\` to \`false\` in ${ft} to keep it off.`},{key:"dockerServices",severity:"warn",preserved:e=>fs(e).join(",")===gs(e).join(","),describe:e=>`Retired option \`dockerServices\`: your project recorded ${fs(e).join(", ")||"no services"}, but the local Docker services are now DERIVED from your stack - postgres when you self-host Postgres, redis when you self-host Redis, mailpit on SMTP, inngest always - so an inconsistent selection is no longer possible. Your regenerated \`infra/docker-compose.yml\` will contain ${gs(e).join(", ")}. Add any extra service back by hand; the file is yours to edit.`},{key:"aiTools",severity:"warn",preserved:e=>(e.aiTools??[]).length===tn.length,describe:e=>`Retired option \`aiTools\`: your project recorded ${(e.aiTools??[]).join(", ")||"no AI tools"}, but the \`generatesaas-update\` skill bundle now ships to every AI-tool root (${ze.join(", ")}) so it is there whichever assistant you switch to. Delete the roots you do not use - they are plain text files with no runtime path.`},{key:"blog",severity:"warn",preserved:e=>e.blog!==!1,describe:()=>`Retired option \`blog\`: your project recorded the blog OFF, but content is no longer an option. This update adds the \`/blog\`, \`/alternatives\` and \`/compare\` route code to your project; every one of them 404s until you add a file under \`packages/content/{locale}/{section}/\`, and none of them appears in your navbar, footer, sitemap or llms.txt while it is empty. Delete an entry from \`config.content.sections\` in ${ft} to drop a section for good.`}],Zf=Hr.map(e=>e.key);function ys(e){for(let t of Hr)t.normalize?.(e)}function bs(e){let t=[];for(let r of Hr){if(r.normalize?.(e),e[r.key]===void 0)continue;(!r.applies||r.applies(e))&&!r.preserved(e)&&t.push({key:r.key,message:r.describe(e),severity:r.severity}),delete e[r.key]}return t}function vs(e){e.command("update").description("Update AI skill files and stage template updates").allowExcessArguments(!0).option("--cwd <path>","project directory (default: current directory)").option("--answer <id=choice>","answer a question that would otherwise prompt (repeatable), e.g. --answer desktop-migration=keep-ai",Tp,[]).action(async(t,r)=>{r.args.length>0&&b.log.warn("`auto` is now the default and the argument is ignored.");let n=Rp(t.answer),i=Ip(t.cwd??process.cwd()),o=qe(i,ue),s;try{s=JSON.parse(await ws(o,"utf-8"))}catch{b.cancel(".generatesaas/manifest.json not found. Run this from a GenerateSaaS project."),process.exit(1)}s.frontend===dr&&(b.cancel(`This project was generated on the Nuxt frontend (\`.generatesaas/manifest.json\` records \`frontend: "${dr}"\`).
|
|
1747
1737
|
|
|
1748
1738
|
v${ur} is the last release that ships a Nuxt frontend, and this CLI cannot update or migrate a Nuxt project to Next.js.
|
|
@@ -1799,7 +1789,7 @@ ${k}`}).join(`
|
|
|
1799
1789
|
`]},{file:"packages/api/src/routes/public/v1/health.ts",removals:[`import { manifest } from "../../../lib/manifest";
|
|
1800
1790
|
`],replacements:[{from:'c.json({ status: "success" as const, version: manifest?.version })',to:'c.json({ status: "success" as const })'}]}];function Xp(){return ze.flatMap(e=>Vr.map(t=>Xe(e,t)))}function Wr(e){return nr(e)?(zp(e,{recursive:!0}),!0):!1}function Zp(e,t,r=[]){if(!nr(e))return!1;let n=zr(e,"utf-8"),i=n;for(let o of t)i=i.replace(o,"");for(let{from:o,to:s}of r)i=i.replace(o,s);return i===n?!1:(xs(e,i,"utf-8"),!0)}function Qp(e){let t=Xe(e,".gitignore");if(!nr(t))return!1;let r=zr(t,"utf-8"),n=r.split(`
|
|
1801
1791
|
`).filter(i=>!i.includes(".generatesaas")).join(`
|
|
1802
|
-
`);return n===r?!1:(xs(t,n,"utf-8"),!0)}function Ds(e){e.command("eject").description("Remove all GenerateSaaS ties - manifest, license, heartbeat, skills").action(async()=>{let t=process.cwd(),r=Xe(t,ue),n;try{n=JSON.parse(zr(r,"utf-8"))}catch{U.cancel("No GenerateSaaS project found in this directory."),process.exit(1)}let i=await U.text({message:'Type "eject" to confirm (this cannot be undone):',validate:a=>{if(a!=="eject")return'Type "eject" to confirm, or press Ctrl+C to cancel.'}});if(U.isCancel(i)&&(U.cancel("Eject cancelled."),process.exit(0)),n.licenseToken)try{await fetch("https://generatesaas.com/api/v1/heartbeat",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.licenseToken}`},body:JSON.stringify({event:"eject",version:n.version,frontend:n.frontend}),signal:AbortSignal.timeout(5e3)}),U.log.info("Recorded the opt-out with generatesaas.com (final event - nothing is sent after this).")}catch{U.log.warn("Could not reach generatesaas.com to record the opt-out. Ejecting anyway.")}let o=[],s=[];for(let a of Xp())Wr(Xe(t,a))&&o.push(a);for(let a of Jp)Wr(Xe(t,a))&&o.push(a);Wr(Xe(t,J))&&o.push(`${J}/`);for(let a of qp){let p=Xe(t,a.file);Zp(p,a.removals,a.replacements)?s.push(a.file):nr(p)&&U.log.warn(`Could not auto-modify ${a.file} - manually remove license/heartbeat references.`)}Qp(t)&&s.push(".gitignore");for(let a of o)U.log.info(`Deleted ${a}`);for(let a of s)U.log.info(`Modified ${a}`);U.log.success("Ejected successfully. This project is now fully standalone.")})}var Ze=new ed().name("generatesaas").description("CLI for scaffolding and managing GenerateSaaS projects").version("3.
|
|
1792
|
+
`);return n===r?!1:(xs(t,n,"utf-8"),!0)}function Ds(e){e.command("eject").description("Remove all GenerateSaaS ties - manifest, license, heartbeat, skills").action(async()=>{let t=process.cwd(),r=Xe(t,ue),n;try{n=JSON.parse(zr(r,"utf-8"))}catch{U.cancel("No GenerateSaaS project found in this directory."),process.exit(1)}let i=await U.text({message:'Type "eject" to confirm (this cannot be undone):',validate:a=>{if(a!=="eject")return'Type "eject" to confirm, or press Ctrl+C to cancel.'}});if(U.isCancel(i)&&(U.cancel("Eject cancelled."),process.exit(0)),n.licenseToken)try{await fetch("https://generatesaas.com/api/v1/heartbeat",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n.licenseToken}`},body:JSON.stringify({event:"eject",version:n.version,frontend:n.frontend}),signal:AbortSignal.timeout(5e3)}),U.log.info("Recorded the opt-out with generatesaas.com (final event - nothing is sent after this).")}catch{U.log.warn("Could not reach generatesaas.com to record the opt-out. Ejecting anyway.")}let o=[],s=[];for(let a of Xp())Wr(Xe(t,a))&&o.push(a);for(let a of Jp)Wr(Xe(t,a))&&o.push(a);Wr(Xe(t,J))&&o.push(`${J}/`);for(let a of qp){let p=Xe(t,a.file);Zp(p,a.removals,a.replacements)?s.push(a.file):nr(p)&&U.log.warn(`Could not auto-modify ${a.file} - manually remove license/heartbeat references.`)}Qp(t)&&s.push(".gitignore");for(let a of o)U.log.info(`Deleted ${a}`);for(let a of s)U.log.info(`Modified ${a}`);U.log.success("Ejected successfully. This project is now fully standalone.")})}var Ze=new ed().name("generatesaas").description("CLI for scaffolding and managing GenerateSaaS projects").version("3.35.0").addHelpText("after",`
|
|
1803
1793
|
Examples:
|
|
1804
1794
|
$ generatesaas init Interactive setup
|
|
1805
1795
|
$ generatesaas init -n my-app -y Quick setup with defaults
|