create-donotdev 0.0.5 → 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 +16 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,8 +1,21 @@
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 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:
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
3
 
4
- sudo npm install -g @donotdev/cli@latest
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:
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:
6
19
  cd ${n} && bun install`)}e.note(`cd ${n}
7
20
  Open your IDE and tell your AI agent:
8
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-donotdev",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Create a new DoNotDev project",
5
5
  "type": "module",
6
6
  "private": false,