@crossdelta/platform-sdk 0.3.9 → 0.3.11
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 +2 -1
- package/bin/cli.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -166,10 +166,11 @@ my-platform/
|
|
|
166
166
|
|
|
167
167
|
| Command | Description |
|
|
168
168
|
|---------|-------------|
|
|
169
|
+
| `pf new` | Interactive mode - choose project type and options |
|
|
169
170
|
| `pf new workspace <name>` | Scaffold a complete platform workspace |
|
|
170
171
|
| `pf new hono-micro <path>` | Generate a lightweight Hono microservice |
|
|
171
172
|
| `pf new nest-micro <path>` | Generate a NestJS microservice |
|
|
172
|
-
| `pf new hono-micro <path> --ai` | Generate with AI assistance |
|
|
173
|
+
| `pf new hono-micro <path> --ai -d "..."` | Generate with AI assistance |
|
|
173
174
|
| `pf setup --ai` | Configure AI provider (OpenAI/Anthropic) |
|
|
174
175
|
| `pf dev` | Start dev environment with watch mode |
|
|
175
176
|
| `pf dev --no-watch` | Start without file watching |
|
package/bin/cli.js
CHANGED
|
@@ -302,7 +302,7 @@ ${E.bold(`cd ${t} && ${i} run dev`)}`).breakLine().log("Happy shipping with Hono
|
|
|
302
302
|
`)),console.log(E.dim("Next steps:")),console.log(E.dim(` 1. ${E.cyan(`cd ${s}`)}`)),console.log(E.dim(` 2. ${E.cyan("bun install")}`)),console.log(E.dim(` 3. ${E.cyan("bun run start:dev")}`)),console.log())}catch(a){console.log(E.red.bold(`
|
|
303
303
|
\u274C Error: ${a.message}
|
|
304
304
|
`)),process.exit(1)}}var DI=mi({name:"nest-micro",description:"Create a new NestJS microservice with the Crossdelta setup. Use --ai for AI-powered generation.",arguments:[["[name]","Name or path of the service"]],options:[["-P, --package-manager <manager>","Specify the package manager (e.g., npm, yarn, pnpm, bun)"],["-y, --yes","Skip all prompts and use default values"],["--ai","Use AI to generate service code based on a description"],["-d, --description <description>","Service description for AI generation (requires --ai)"]],exampleUsage:'platform new nest-micro my-service --ai -d "User authentication service"',buildContext:(t,e)=>{let r=(t.name??"services/my-nest-service").trim(),n=pt(r),i=e.packageManager??(e.yes&&Dt()),s=e.packageManager==="bun",o=Er(),a=e.yes?Ta():[];return{cwd:n,projectName:r,shouldInstallBun:s,packageManager:i,availableIntegrations:o,selectedIntegrations:a,serviceType:"nest",elapsedTime:0,userConfirmed:!!e.yes,removeDir:!!e.yes}},shouldSkipWorkflow:(t,e)=>!!e.ai,onSkipWorkflow:(t,e)=>vae(t.name,e),prompts:[$a,La,Ma,ja,pd,Pa],actions:[Na,Ia,hI,hd,pI,md,sP,dd,Dd],onComplete:({projectName:t,packageManager:e,selectedIntegrations:r,assignedPort:n})=>{H.breakLine().log(E.bold.green("NestJS Microservice created successfully!")),id(r),sd((0,mI.basename)(t),n??3e3),H.breakLine().log(`To start the project, run:
|
|
305
|
-
${E.bold(`cd ${t} && ${e} run start:dev`)}`).breakLine().log("Happy coding! \u{1F389}").breakLine()}});var qt=require("node:fs"),Mi=require("node:path"),gI=P(Qd()),_ae=()=>{let t=[(0,Mi.join)(__dirname,"templates","workspace"),(0,Mi.join)(__dirname,"..","workspace","templates")];for(let e of t)if((0,qt.existsSync)(e))return e;throw new Error(`Workspace templates directory not found. Searched in: ${t.join(", ")}`)},Aae=(t,e)=>{let r=(0,qt.readFileSync)(t,"utf-8");return gI.default.compile(r)(e)},Bae=[{template:"package.json.hbs",output:"package.json"},{template:"biome.json.hbs",output:"biome.json"},{template:"turbo.json.hbs",output:"turbo.json"},{template:"bunfig.toml.hbs",output:"bunfig.toml"},{template:"gitignore.hbs",output:".gitignore"},{template:"editorconfig.hbs",output:".editorconfig"},{template:"npmrc.hbs",output:".npmrc"},{template:"infra/package.json.hbs",output:"infra/package.json"},{template:"infra/index.ts.hbs",output:"infra/index.ts"},{template:"infra/tsconfig.json.hbs",output:"infra/tsconfig.json"},{template:"infra/Pulumi.yaml.hbs",output:"infra/Pulumi.yaml"},{template:"infra/Pulumi.dev.yaml.hbs",output:"infra/Pulumi.dev.yaml"},{template:"infra/services/example.ts.hbs",output:"infra/services/example.ts"},{template:"apps/.gitkeep",output:"apps/.gitkeep",isStatic:!0},{template:"services/.gitkeep",output:"services/.gitkeep",isStatic:!0},{template:"packages/.gitkeep",output:"packages/.gitkeep",isStatic:!0},{template:"docs/.gitkeep",output:"docs/.gitkeep",isStatic:!0},{template:".github/copilot-instructions.md.hbs",output:".github/copilot-instructions.md"},{template:".github/README.md",output:".github/README.md",isStatic:!0,isGitHubCI:!0},{template:".github/dependabot.yml",output:".github/dependabot.yml",isStatic:!0,isGitHubCI:!0},{template:".github/workflows/lint-and-tests.yml.hbs",output:".github/workflows/lint-and-tests.yml",isGitHubCI:!0},{template:".github/workflows/build-and-deploy.yml.hbs",output:".github/workflows/build-and-deploy.yml",isGitHubCI:!0},{template:".github/workflows/publish-packages.yml",output:".github/workflows/publish-packages.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/setup-bun-install/action.yml.hbs",output:".github/actions/setup-bun-install/action.yml",isGitHubCI:!0},{template:".github/actions/check-image-tag-exists/action.yml",output:".github/actions/check-image-tag-exists/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/check-image-tag-exists/index.js",output:".github/actions/check-image-tag-exists/index.js",isStatic:!0,isGitHubCI:!0},{template:".github/actions/check-path-changes/action.yml",output:".github/actions/check-path-changes/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/check-path-changes/index.js",output:".github/actions/check-path-changes/index.js",isStatic:!0,isGitHubCI:!0},{template:".github/actions/detect-skipped-services/action.yml",output:".github/actions/detect-skipped-services/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/generate-scope-matrix/action.yml",output:".github/actions/generate-scope-matrix/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/generate-scope-matrix/index.js",output:".github/actions/generate-scope-matrix/index.js",isStatic:!0,isGitHubCI:!0},{template:".github/actions/prepare-build-context/action.yml",output:".github/actions/prepare-build-context/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/resolve-scope-tags/action.yml",output:".github/actions/resolve-scope-tags/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/resolve-scope-tags/index.js",output:".github/actions/resolve-scope-tags/index.js",isStatic:!0,isGitHubCI:!0}],xI={title:"Creating workspace structure",task:async(t,e)=>{if((0,qt.existsSync)(t.cwd)){e.title="Workspace directory already exists, skipping...";return}let r=_ae(),n=t.includeGitHubCI??!0,i={projectName:t.projectName,githubOwner:t.githubOwner||"",pulumiStackBase:t.pulumiStackBase||t.projectName},s=Bae.filter(o=>!(o.isGitHubCI&&!n));for(let o of s){let a=(0,Mi.join)(t.cwd,o.output),u=(0,Mi.dirname)(a);if((0,qt.existsSync)(u)||(0,qt.mkdirSync)(u,{recursive:!0}),o.isStatic){let c=(0,Mi.join)(r,o.template);(0,qt.existsSync)(c)?(0,qt.writeFileSync)(a,(0,qt.readFileSync)(c)):(0,qt.writeFileSync)(a,"")}else{let c=(0,Mi.join)(r,o.template),l=Aae(c,i);(0,qt.writeFileSync)(a,l)}}e.title="Workspace structure created"}};var yI=mi({name:"workspace",description:"Create a new workspace with infrastructure setup",arguments:[["[name]","Name or path of the workspace"]],options:[["-P, --package-manager <manager>","Specify the package manager (e.g., npm, yarn, pnpm, bun)"],["-y, --yes","Skip all prompts and use default values"],["-o, --github-owner <owner>","GitHub organization or username"],["-s, --pulumi-stack <name>","Pulumi stack base name (org/project)"],["--no-github","Skip GitHub CI/CD workflows"]],exampleUsage:"pf new workspace my-platform -o my-org",buildContext:(t,e)=>{let r=(t.name??"my-platform").trim(),n=pt(r),i=e.packageManager??(e.yes?Dt():void 0),s=e.packageManager==="bun",o=!!e.yes,a=e.githubOwner??(o?"my-org":void 0),u=e.pulumiStack??(o?`${a}/${r}`:void 0),c=e.github!==void 0?e.github:o?!0:void 0;return{cwd:n,projectName:r,shouldInstallBun:s,packageManager:i,elapsedTime:0,userConfirmed:o,removeDir:o,githubOwner:a,pulumiStackBase:u,includeGitHubCI:c}},prompts:[$a,La,oP,aP,uP,Ma,ja,Pa],actions:[Na,Ia,xI,md,iP],onComplete:({projectName:t,includeGitHubCI:e})=>{H.breakLine().log(E.bold.green("Workspace created successfully!")),H.breakLine().log(E.bold("Next steps:")).log(` 1. ${E.cyan(`cd ${t}`)}`).log(` 2. ${E.cyan("bun pulumi login")}`).log(` 3. ${E.cyan("bun pulumi up --stack dev")}`),e&&H.breakLine().log(E.bold("GitHub Setup:")).log(" Configure these secrets in your GitHub repository:").log(` \u2022 ${E.yellow("PULUMI_ACCESS_TOKEN")} - Pulumi Cloud access token`).log(` \u2022 ${E.yellow("DIGITALOCEAN_TOKEN")} - DigitalOcean API token`).log(` \u2022 ${E.yellow("NPM_TOKEN")} - (optional) NPM token for private packages`),H.breakLine().log(E.bold("Structure created:")).log(" apps/ # Frontend applications").log(" services/ # Backend microservices").log(" packages/ # Shared libraries").log(" infra/").log(" \u251C\u2500\u2500 index.ts # Pulumi entry point").log(" \u251C\u2500\u2500 services/ # Service configs").log(" \u251C\u2500\u2500 Pulumi.yaml # Pulumi project config").log(" \u2514\u2500\u2500 Pulumi.dev.yaml # Dev stack config"),e&&H.log(" .github/").log(" \u251C\u2500\u2500 workflows/ # CI/CD workflows").log(" \u2514\u2500\u2500 actions/ # Custom actions"),H.breakLine().log("Happy coding! \u{1F389}").breakLine()}});var Dl=[{name:"Hono Microservice",value:"hono-micro",command:sI,supportsAi:!0},{name:"Nest Microservice",value:"nest-micro",command:DI,supportsAi:!0},{name:"Workspace (Infrastructure)",value:"workspace",command:yI,supportsAi:!1}],bI=()=>{let t=mi({name:"new",description:"Create a new project",arguments:[["[type]","Type of the project (e.g., nest-micro, shopware-plugin)"]],exampleUsage:"platform new nest-micro test-project",buildContext:e=>({projectType:e.type??"",useAi:!1,aiDescription:"",elapsedTime:0,cwd:process.cwd()}),prompts:[{enabled:e=>!e.projectType,task:async(e,r)=>{let n=await r.prompt(Ie).run({type:"select",message:"Select Project type",choices:Dl});e.projectType=Dl.find(i=>i.name===n)?.value||"",r.title=`Using ${E.bold(n)}`}},{enabled:e=>!!Dl.find(n=>n.value===e.projectType)?.supportsAi&&Da().valid,task:async(e,r)=>{let n=await r.prompt(Ie).run({type:"toggle",message:"Use AI to generate service code?",enabled:"Yes",disabled:"No",initial:!1});e.useAi=n,r.title=n?E.cyan("\u{1F916} AI-powered generation"):"Standard scaffolding"}},{enabled:e=>e.useAi,task:async(e,r)=>{let n=await r.prompt(Ie).run({type:"input",message:"\u{1F4E6} Service path (e.g., services/my-service):",initial:"services/my-hono-service"});e.servicePath=n.trim(),r.title=`Path: ${E.dim(n)}`}},{enabled:e=>e.useAi,task:async(e,r)=>{let n=await r.prompt(Ie).run({type:"input",message:"Describe what this service should do:"});e.aiDescription=n,r.title=`Description: ${E.dim(n.slice(0,50))}${n.length>50?"...":""}`}}],actions:[],onComplete:async e=>{Dl.find(s=>s.value===e.projectType)||t.error(E.red(`Project type ${e.projectType} is not supported.`));let r=t.commands.find(s=>s.name()===e.projectType),n={},i=[];e.useAi&&(n.ai=!0,n.description=e.aiDescription,e.servicePath&&i.push("servicePath")),await QO(r,e,n,i)}});for(let e of Dl)t.addCommand(e.command);return t};var bn=require("node:fs"),op=require("node:path");var CI=300,Tae=1e3,FI=["infra/services"],EI=["services","apps"],gl=null,xl=!1,Li=t=>{process.stdout.write(`${t}
|
|
305
|
+
${E.bold(`cd ${t} && ${e} run start:dev`)}`).breakLine().log("Happy coding! \u{1F389}").breakLine()}});var qt=require("node:fs"),Mi=require("node:path"),gI=P(Qd()),_ae=()=>{let t=[(0,Mi.join)(__dirname,"templates","workspace"),(0,Mi.join)(__dirname,"..","workspace","templates")];for(let e of t)if((0,qt.existsSync)(e))return e;throw new Error(`Workspace templates directory not found. Searched in: ${t.join(", ")}`)},Aae=(t,e)=>{let r=(0,qt.readFileSync)(t,"utf-8");return gI.default.compile(r)(e)},Bae=[{template:"package.json.hbs",output:"package.json"},{template:"biome.json.hbs",output:"biome.json"},{template:"turbo.json.hbs",output:"turbo.json"},{template:"bunfig.toml.hbs",output:"bunfig.toml"},{template:"gitignore.hbs",output:".gitignore"},{template:"editorconfig.hbs",output:".editorconfig"},{template:"npmrc.hbs",output:".npmrc"},{template:"infra/package.json.hbs",output:"infra/package.json"},{template:"infra/index.ts.hbs",output:"infra/index.ts"},{template:"infra/tsconfig.json.hbs",output:"infra/tsconfig.json"},{template:"infra/Pulumi.yaml.hbs",output:"infra/Pulumi.yaml"},{template:"infra/Pulumi.dev.yaml.hbs",output:"infra/Pulumi.dev.yaml"},{template:"infra/services/example.ts.hbs",output:"infra/services/example.ts"},{template:"apps/.gitkeep",output:"apps/.gitkeep",isStatic:!0},{template:"services/.gitkeep",output:"services/.gitkeep",isStatic:!0},{template:"packages/.gitkeep",output:"packages/.gitkeep",isStatic:!0},{template:"docs/.gitkeep",output:"docs/.gitkeep",isStatic:!0},{template:".github/copilot-instructions.md.hbs",output:".github/copilot-instructions.md"},{template:".github/README.md",output:".github/README.md",isStatic:!0,isGitHubCI:!0},{template:".github/dependabot.yml",output:".github/dependabot.yml",isStatic:!0,isGitHubCI:!0},{template:".github/workflows/lint-and-tests.yml.hbs",output:".github/workflows/lint-and-tests.yml",isGitHubCI:!0},{template:".github/workflows/build-and-deploy.yml.hbs",output:".github/workflows/build-and-deploy.yml",isGitHubCI:!0},{template:".github/workflows/publish-packages.yml",output:".github/workflows/publish-packages.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/setup-bun-install/action.yml.hbs",output:".github/actions/setup-bun-install/action.yml",isGitHubCI:!0},{template:".github/actions/check-image-tag-exists/action.yml",output:".github/actions/check-image-tag-exists/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/check-image-tag-exists/index.js",output:".github/actions/check-image-tag-exists/index.js",isStatic:!0,isGitHubCI:!0},{template:".github/actions/check-path-changes/action.yml",output:".github/actions/check-path-changes/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/check-path-changes/index.js",output:".github/actions/check-path-changes/index.js",isStatic:!0,isGitHubCI:!0},{template:".github/actions/detect-skipped-services/action.yml",output:".github/actions/detect-skipped-services/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/generate-scope-matrix/action.yml",output:".github/actions/generate-scope-matrix/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/generate-scope-matrix/index.js",output:".github/actions/generate-scope-matrix/index.js",isStatic:!0,isGitHubCI:!0},{template:".github/actions/prepare-build-context/action.yml",output:".github/actions/prepare-build-context/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/resolve-scope-tags/action.yml",output:".github/actions/resolve-scope-tags/action.yml",isStatic:!0,isGitHubCI:!0},{template:".github/actions/resolve-scope-tags/index.js",output:".github/actions/resolve-scope-tags/index.js",isStatic:!0,isGitHubCI:!0}],xI={title:"Creating workspace structure",task:async(t,e)=>{if((0,qt.existsSync)(t.cwd)){e.title="Workspace directory already exists, skipping...";return}let r=_ae(),n=t.includeGitHubCI??!0,i={projectName:t.projectName,githubOwner:t.githubOwner||"",pulumiStackBase:t.pulumiStackBase||t.projectName},s=Bae.filter(o=>!(o.isGitHubCI&&!n));for(let o of s){let a=(0,Mi.join)(t.cwd,o.output),u=(0,Mi.dirname)(a);if((0,qt.existsSync)(u)||(0,qt.mkdirSync)(u,{recursive:!0}),o.isStatic){let c=(0,Mi.join)(r,o.template);(0,qt.existsSync)(c)?(0,qt.writeFileSync)(a,(0,qt.readFileSync)(c)):(0,qt.writeFileSync)(a,"")}else{let c=(0,Mi.join)(r,o.template),l=Aae(c,i);(0,qt.writeFileSync)(a,l)}}e.title="Workspace structure created"}};var yI=mi({name:"workspace",description:"Create a new workspace with infrastructure setup",arguments:[["[name]","Name or path of the workspace"]],options:[["-P, --package-manager <manager>","Specify the package manager (e.g., npm, yarn, pnpm, bun)"],["-y, --yes","Skip all prompts and use default values"],["-o, --github-owner <owner>","GitHub organization or username"],["-s, --pulumi-stack <name>","Pulumi stack base name (org/project)"],["--no-github","Skip GitHub CI/CD workflows"]],exampleUsage:"pf new workspace my-platform -o my-org",buildContext:(t,e)=>{let r=(t.name??"my-platform").trim(),n=pt(r),i=e.packageManager??(e.yes?Dt():void 0),s=e.packageManager==="bun",o=!!e.yes,a=e.githubOwner??(o?"my-org":void 0),u=e.pulumiStack??(o?`${a}/${r}`:void 0),c=e.github!==void 0?e.github:o?!0:void 0;return{cwd:n,projectName:r,shouldInstallBun:s,packageManager:i,elapsedTime:0,userConfirmed:o,removeDir:o,githubOwner:a,pulumiStackBase:u,includeGitHubCI:c}},prompts:[$a,La,oP,aP,uP,Ma,ja,Pa],actions:[Na,Ia,xI,md,iP],onComplete:({projectName:t,includeGitHubCI:e})=>{H.breakLine().log(E.bold.green("Workspace created successfully!")),H.breakLine().log(E.bold("Next steps:")).log(` 1. ${E.cyan(`cd ${t}`)}`).log(` 2. ${E.cyan("bun pulumi login")}`).log(` 3. ${E.cyan("bun pulumi up --stack dev")}`),e&&H.breakLine().log(E.bold("GitHub Setup:")).log(" Configure these secrets in your GitHub repository:").log(` \u2022 ${E.yellow("PULUMI_ACCESS_TOKEN")} - Pulumi Cloud access token`).log(` \u2022 ${E.yellow("DIGITALOCEAN_TOKEN")} - DigitalOcean API token`).log(` \u2022 ${E.yellow("NPM_TOKEN")} - (optional) NPM token for private packages`),H.breakLine().log(E.bold("Structure created:")).log(" apps/ # Frontend applications").log(" services/ # Backend microservices").log(" packages/ # Shared libraries").log(" infra/").log(" \u251C\u2500\u2500 index.ts # Pulumi entry point").log(" \u251C\u2500\u2500 services/ # Service configs").log(" \u251C\u2500\u2500 Pulumi.yaml # Pulumi project config").log(" \u2514\u2500\u2500 Pulumi.dev.yaml # Dev stack config"),e&&H.log(" .github/").log(" \u251C\u2500\u2500 workflows/ # CI/CD workflows").log(" \u2514\u2500\u2500 actions/ # Custom actions"),H.breakLine().log("Happy coding! \u{1F389}").breakLine()}});var Dl=[{name:"Hono Microservice",value:"hono-micro",command:sI,supportsAi:!0},{name:"Nest Microservice",value:"nest-micro",command:DI,supportsAi:!0},{name:"Workspace (Infrastructure)",value:"workspace",command:yI,supportsAi:!1}],bI=()=>{let t=mi({name:"new",description:"Create a new project",arguments:[["[type]","Type of the project (e.g., nest-micro, shopware-plugin)"]],exampleUsage:"platform new nest-micro test-project",buildContext:e=>({projectType:e.type??"",useAi:!1,aiDescription:"",elapsedTime:0,cwd:process.cwd()}),prompts:[{enabled:e=>!e.projectType,task:async(e,r)=>{let n=await r.prompt(Ie).run({type:"select",message:"Select Project type",choices:Dl});e.projectType=Dl.find(i=>i.name===n)?.value||"",r.title=`Using ${E.bold(n)}`}},{enabled:e=>!!Dl.find(n=>n.value===e.projectType)?.supportsAi&&Da().valid,task:async(e,r)=>{let n=await r.prompt(Ie).run({type:"toggle",message:"Use AI to generate service code?",enabled:"Yes",disabled:"No",initial:!1});e.useAi=n,r.title=n?E.cyan("\u{1F916} AI-powered generation"):"Standard scaffolding"}},{enabled:e=>e.useAi,task:async(e,r)=>{let n=await r.prompt(Ie).run({type:"input",message:"\u{1F4E6} Service path (e.g., services/my-service):",initial:"services/my-hono-service"});e.servicePath=n.trim(),r.title=`Path: ${E.dim(n)}`}},{enabled:e=>e.useAi,task:async(e,r)=>{let n=await r.prompt(Ie).run({type:"input",message:"Describe what this service should do:"});e.aiDescription=n,r.title=`Description: ${E.dim(n.slice(0,50))}${n.length>50?"...":""}`}}],actions:[],onComplete:async e=>{Dl.find(s=>s.value===e.projectType)||t.error(E.red(`Project type ${e.projectType} is not supported.`));let r=t.commands.find(s=>s.name()===e.projectType),n={},i=[];e.useAi&&(n.ai=!0,n.yes=!0,n.description=e.aiDescription,e.servicePath&&i.push("servicePath")),await QO(r,e,n,i)}});for(let e of Dl)t.addCommand(e.command);return t};var bn=require("node:fs"),op=require("node:path");var CI=300,Tae=1e3,FI=["infra/services"],EI=["services","apps"],gl=null,xl=!1,Li=t=>{process.stdout.write(`${t}
|
|
306
306
|
`)},kae=t=>new Promise(e=>setTimeout(e,t)),wI=(t,e)=>{let r=null;return(...n)=>{r&&clearTimeout(r),r=setTimeout(()=>t(...n),e)}},Oae=()=>{process.stdout.write("\x1B[2J\x1B[0f")},Pae=t=>{let e=(0,op.join)(t,"package.json");try{let r=(0,bn.readFileSync)(e,"utf-8"),n=JSON.parse(r);return{watchDirs:n.pf?.dev?.watchDirs??FI,watchPackages:n.pf?.dev?.watchPackages??EI}}catch{return{watchDirs:FI,watchPackages:EI}}},SI=async()=>{if(gl?.pid){try{process.kill(-gl.pid,"SIGTERM")}catch{try{gl.kill("SIGTERM")}catch{}}gl=null,await kae(Tae)}},vI=t=>{gl=yk("turbo",["start:dev","--continue"],{cwd:t,envFile:".env.local",onStderr:e=>{xl||process.stderr.write(e)},onExit:e=>{xl||(Li(`
|
|
307
307
|
Turbo exited with code ${e}`),process.exit(e??0))}})},_I=async t=>{Li("\u{1F4DD} Generating .env.local..."),await Yt("bun",["run","generate-env"],{cwd:t,quiet:!0})},Rae=async t=>{Li("\u{1F4E6} Installing dependencies..."),await Yt("bun",["install"],{cwd:t,quiet:!0})},Iae=t=>{for(let e of Object.keys(require.cache))t.some(r=>e.includes(r))&&delete require.cache[e]},AI=async(t,e,r,n=!1)=>{if(!xl){xl=!0;try{Iae(r),await SI(),Oae(),Li(`\u{1F504} Detected change in ${E.cyan(t.replace(/ /g,""))}, restarting...`),n&&await Rae(e),await _I(e),vI(e)}catch(i){Li(`\u274C Failed to restart: ${i}`)}finally{xl=!1}}},Mae=(t,e)=>{for(let r of t){let n=(0,op.join)(e,r),i=wI(s=>AI(s,e,t),CI);(0,bn.watch)(n,{recursive:!0},(s,o)=>{o?.endsWith(".ts")&&i(o)})}},Lae=(t,e,r)=>{for(let n of t){let i=(0,op.join)(e,n);if(!(0,bn.existsSync)(i))continue;let s=new Set((0,bn.readdirSync)(i,{withFileTypes:!0}).filter(a=>a.isDirectory()).map(a=>a.name)),o=wI(async()=>{let a=new Set((0,bn.readdirSync)(i,{withFileTypes:!0}).filter(l=>l.isDirectory()).map(l=>l.name)),u=[...a].filter(l=>!s.has(l)),c=[...s].filter(l=>!a.has(l));if(u.length>0||c.length>0){let l=[...u.map(f=>`+${f}`),...c.map(f=>`-${f}`)].join(", ");s=a,await AI(`${n}/ [${l}]`,e,r,!0)}},CI);(0,bn.watch)(i,{recursive:!1},()=>o())}},Nae=()=>{let t=async()=>{Li(`
|
|
308
308
|
\u{1F44B} Shutting down...`),await SI(),process.exit(0)};process.on("SIGINT",t),process.on("SIGTERM",t)},BI=new ut("dev").description("Start development environment with hot reload").option("--no-watch","Disable watching for changes").action(async t=>{let e=Kc(),r=Pae(e);if(await _I(e),vI(e),!t.watch){Li(`
|