create-donotdev 0.0.6 → 0.0.7

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/dist/index.js +18 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,22 @@
1
1
  #!/usr/bin/env node
2
- import*as e from"@clack/prompts";import{execSync as o}from"node:child_process";import{join as r}from"node:path";const a=/^[a-zA-Z0-9_-]+$/;function d(n){return a.test(n)&&!n.includes("..")}e.intro("DoNotDev \u2014 Create a new project");const s=e.spinner();s.start("Installing @donotdev/cli globally...");try{o("bun install -g @donotdev/cli@latest",{stdio:"pipe"}),s.stop("CLI installed globally (dndev)")}catch{s.stop("Global install skipped"),e.log.warn("Could not install globally. dndev will still work inside your project via bun run.")}let t=process.argv[2]||"";if(t&&!d(t)&&(e.log.error("Invalid project name. Use only letters, numbers, dashes, underscores."),process.exit(1)),!t){const n=await e.text({message:"Project name?",placeholder:"my-app",validate:i=>{const l=i?.trim();if(!l)return"Project name is required";if(!/^[a-zA-Z0-9_-]+$/.test(l))return"Use only letters, numbers, dashes, underscores"}});e.isCancel(n)&&(e.outro("Cancelled."),process.exit(0)),t=n.trim()}e.log.info(`Scaffolding "${t}"...`);try{try{o(`dndev init ${t}`,{stdio:"inherit",cwd:process.cwd()})}catch{o(`bunx @donotdev/cli@latest init ${t}`,{stdio:"inherit",cwd:process.cwd()})}}catch{e.log.error("Scaffolding failed. Check the output above."),process.exit(1)}const c=r(process.cwd(),t);e.log.step("Installing dependencies...");try{o("bun install",{stdio:"inherit",cwd:c}),e.log.success("Dependencies installed")}catch{e.log.warn(`Dependencies failed to install. Run manually:
3
- cd ${t} && bun install`)}e.note(`cd ${t}
2
+ import*as e from"@clack/prompts";import{execSync as r,execFileSync as a}from"node:child_process";import{join as c}from"node:path";const d=/^[a-zA-Z0-9_-]+$/;function l(t){return d.test(t)&&!t.includes("..")}e.intro("DoNotDev \u2014 Create a new project");const i=e.spinner();i.start("Installing @donotdev/cli globally...");try{r("npm i -g @donotdev/cli@latest",{stdio:"pipe"}),i.stop("CLI installed globally (dndev)")}catch{i.stop("Global install failed");const t=process.platform==="win32",s=process.env.SHELL?.includes("zsh")?"zshrc":"bashrc",o=process.argv[2]||"<project-name>";t?e.log.error(`Run this terminal as Administrator and try again.
3
+
4
+ Or install manually:
5
+ npm i -g @donotdev/cli@latest
6
+ dndev init ${o}`):e.log.error(`Permission issue. Pick one:
7
+
8
+ Option A \u2014 quick:
9
+ sudo npm i -g @donotdev/cli@latest
10
+ dndev init ${o}
11
+
12
+ Option B \u2014 fix once, no sudo ever again:
13
+ mkdir -p ~/.npm-global
14
+ npm config set prefix ~/.npm-global
15
+ echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.${s}
16
+ source ~/.${s}
17
+ npm i -g @donotdev/cli@latest
18
+ dndev init ${o}`),process.exit(1)}let n=process.argv[2]||"";if(n&&!l(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:s=>{const o=s?.trim();if(!o)return"Project name is required";if(!/^[a-zA-Z0-9_-]+$/.test(o))return"Use only letters, numbers, dashes, underscores"}});e.isCancel(t)&&(e.outro("Cancelled."),process.exit(0)),n=t.trim(),l(n)||(e.log.error("Invalid project name. Use only letters, numbers, dashes, underscores."),process.exit(1))}e.log.info(`Scaffolding "${n}"...`);try{a("dndev",["init",n],{stdio:"inherit",cwd:process.cwd()})}catch{e.log.error("Scaffolding failed. Check the output above."),process.exit(1)}const p=c(process.cwd(),n);e.log.step("Installing dependencies...");try{r("bun install",{stdio:"inherit",cwd:p}),e.log.success("Dependencies installed")}catch{e.log.warn(`Dependencies failed to install. Run manually:
19
+ cd ${n} && bun install`)}e.note(`cd ${n}
4
20
  Open your IDE and tell your AI agent:
5
21
 
6
22
  "Read AI.md and build my app"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-donotdev",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Create a new DoNotDev project",
5
5
  "type": "module",
6
6
  "private": false,