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.
- package/dist/index.js +16 -3
- 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
|
|
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
|
-
|
|
5
|
-
|
|
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
|
|