A CLI for scaffolding ATProto web applications

chore(templates): dynamically add scripts and dependencies to template package.json #6

merged opened by besaid.zone targeting main from chore/common-files

some cleanup

Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:qttsv4e7pu2jl3ilanfgc3zn/sh.tangled.repo.pull/3mf6iw3khq622
+30 -19
Diff #0
+5
.changeset/forty-jokes-kick.md
··· 1 + --- 2 + "@nulfrost/create-atproto-app": patch 3 + --- 4 + 5 + dynamically add scripts and dependencies to template package.json
+22
src/commands/init.ts
··· 22 22 existsSync, 23 23 mkdirSync, 24 24 readdirSync, 25 + readFileSync, 25 26 rmSync, 26 27 statSync, 28 + writeFileSync, 27 29 } from "node:fs"; 28 30 import { join, resolve } from "node:path"; 29 31 import { fileURLToPath } from "node:url"; ··· 173 175 const destinationTemplateFiles = resolve(root, file); 174 176 copy(sourceTemplateFiles, destinationTemplateFiles); 175 177 } 178 + 179 + // add atproto related scripts and packages to package.json 180 + const pkg = JSON.parse(readFileSync(join(root, "package.json"), "utf-8")); 181 + pkg.name = projectName; 182 + pkg.dependencies = { 183 + ...pkg.dependencies, 184 + "@atproto/lex": "0.0.16", 185 + }; 186 + 187 + pkg.scripts = { 188 + ...pkg.scripts, 189 + "update-lexicons": "lex install --update --save", 190 + postinstall: "lex install --ci", 191 + prebuild: "lex build --out ./src/__generated__", 192 + }; 193 + 194 + writeFileSync( 195 + join(root, "package.json"), 196 + JSON.stringify(pkg, null, 2) + "\n", 197 + ); 176 198 177 199 appendFileSync( 178 200 join(root, ".gitignore"),
+1 -5
templates/react-ts/package.json
··· 6 6 "scripts": { 7 7 "dev": "vite", 8 8 "build": "tsc -b && vite build", 9 - "preview": "vite preview", 10 - "update-lexicons": "lex install --update --save", 11 - "postinstall": "lex install --ci", 12 - "prebuild": "lex build --out ./src/__generated__" 9 + "preview": "vite preview" 13 10 }, 14 11 "dependencies": { 15 - "@atproto/lex": "0.0.16", 16 12 "react": "^19.2.4", 17 13 "react-dom": "^19.2.4" 18 14 },
+1 -7
templates/svelte-ts/package.json
··· 7 7 "dev": "vite", 8 8 "build": "vite build", 9 9 "preview": "vite preview", 10 - "check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json", 11 - "update-lexicons": "lex install --update --save", 12 - "postinstall": "lex install --ci", 13 - "prebuild": "lex build --out ./src/__generated__" 14 - }, 15 - "dependencies": { 16 - "@atproto/lex": "^0.0.16" 10 + "check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json" 17 11 }, 18 12 "devDependencies": { 19 13 "@sveltejs/vite-plugin-svelte": "^6.2.1",
+1 -7
templates/vanilla/package.json
··· 6 6 "scripts": { 7 7 "dev": "vite", 8 8 "build": "vite build", 9 - "preview": "vite preview", 10 - "update-lexicons": "lex install --update --save", 11 - "postinstall": "lex install --ci", 12 - "prebuild": "lex build --out ./src/__generated__" 13 - }, 14 - "dependencies": { 15 - "@atproto/lex": "^0.0.16" 9 + "preview": "vite preview" 16 10 }, 17 11 "devDependencies": { 18 12 "vite": "^7.3.1"

History

1 round 0 comments
sign up or login to add to the discussion
besaid.zone submitted #0
2 commits
expand
chore(templates): dynamically add scripts and dependencies to template package.json
chore: changeset
expand 0 comments
pull request successfully merged