create-donotdev 0.0.3 → 0.0.4
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 +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import*as e from"@clack/prompts";import{execSync as l,execFileSync as r}from"node:child_process";const
|
|
2
|
+
import*as e from"@clack/prompts";import{execSync as l,execFileSync as r}from"node:child_process";const a=/^[a-zA-Z0-9_-]+$/;function d(t){return a.test(t)&&!t.includes("..")}e.intro("DoNotDev \u2014 Create a new project");const o=e.spinner();o.start("Installing @donotdev/cli@latest globally...");try{l("npm install -g @donotdev/cli@latest",{stdio:"pipe"}),o.stop("CLI installed globally")}catch{o.stop("Needs elevated permissions"),e.log.warn("Could not install globally (likely needs sudo)."),e.note(`Run these two commands:
|
|
3
3
|
|
|
4
4
|
sudo npm install -g @donotdev/cli@latest
|
|
5
|
-
npx create-donotdev`,"Manual step needed"),process.exit(1)}let
|
|
6
|
-
cd ${
|
|
5
|
+
npx create-donotdev`,"Manual step needed"),process.exit(1)}let n=process.argv[2]||"";if(n&&!d(n)&&(e.log.error("Invalid project name. Use only letters, numbers, dashes, underscores."),process.exit(1)),!n){const t=await e.text({message:"Project name?",placeholder:"my-app",validate:i=>{const s=i?.trim();if(!s)return"Project name is required";if(!/^[a-zA-Z0-9_-]+$/.test(s))return"Use only letters, numbers, dashes, underscores"}});e.isCancel(t)&&(e.outro("Cancelled."),process.exit(0)),n=t.trim()}e.log.info(`Scaffolding "${n}"...`);try{r("dndev",["init",n],{stdio:"inherit",cwd:process.cwd()})}catch{e.log.error("Scaffolding failed. Check the output above."),process.exit(1)}const c=`${process.cwd()}/${n}`;e.log.step("Installing dependencies...");try{l("bun install",{stdio:"inherit",cwd:c}),e.log.success("Dependencies installed")}catch{e.log.warn(`Dependencies failed to install. Run manually:
|
|
6
|
+
cd ${n} && bun install`)}e.note(`cd ${n}
|
|
7
7
|
Open your IDE and tell your AI agent:
|
|
8
8
|
|
|
9
9
|
"Read AI.md and build my app"
|