zerostarter 0.0.8 → 0.0.9
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/bin/index.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
2
|
+
import{i as e,n as t,r as n,t as r}from"../convert-HqQouyr9.mjs";import{basename as i,join as a,resolve as o}from"node:path";import{existsSync as s,readdirSync as c}from"node:fs";import{createInterface as l}from"node:readline/promises";import{parseArgs as u}from"node:util";import{execFileSync as d}from"node:child_process";import{randomBytes as f}from"node:crypto";var p={name:`zerostarter`,version:`0.0.9`,description:`Go from zero to a production-ready SaaS, rebranded and ready to ship.`,keywords:[`cli`,`saas`,`scaffold`,`starter`,`template`,`zerostarter`],homepage:`https://github.com/nrjdalal/zerostarter#readme`,bugs:`https://github.com/nrjdalal/zerostarter/issues`,license:`MIT`,author:{name:`Neeraj Dalal`,email:`admin@nrjdalal.com`,url:`https://nrjdalal.com`},repository:`nrjdalal/zerostarter`,funding:`https://github.com/sponsors/nrjdalal`,bin:{zerostarter:`dist/bin/index.mjs`},files:[`dist`],type:`module`,types:`./dist/index.d.mts`,exports:`./dist/index.mjs`,scripts:{build:`tsdown`,"check-types":`tsc --noEmit`,dev:`tsdown --watch`,test:`bun test`},devDependencies:{"@packages/config":`workspace:*`,"@types/bun":`catalog:`,"@types/node":`catalog:`,tsdown:`catalog:`,typescript:`catalog:`}};const m=()=>!!(process.stdin.isTTY&&process.stdout.isTTY),h=(e,t=e)=>process.stdout.isTTY?`\x1b]8;;${e}\x07${t}\x1b]8;;\x07`:e,g=(e,t=process.stdout)=>n=>t.isTTY?`\x1b[${e}m${n}\x1b[0m`:n,_=g(`38;5;208`),v=g(`38;2;63;185;80`),y=g(`38;2;210;153;34`),b=g(`38;2;248;81;73`,process.stderr),x=async(e,t=``)=>{let n=l({input:process.stdin,output:process.stdout});try{return(await n.question(`${e}${t?` (${t})`:``}: `)).trim()||t}finally{n.close()}},S=async(e,t=!0)=>{let n=l({input:process.stdin,output:process.stdout});try{let r=(await n.question(`${e} (${t?`Y/n`:`y/N`}) `)).trim().toLowerCase();return r?r===`y`||r===`yes`:t}finally{n.close()}},C=(e,t,n)=>d(e,t,{cwd:n,encoding:`utf8`,maxBuffer:1<<26,stdio:[`ignore`,`pipe`,`pipe`]}),w=(e,t,n)=>{d(e,t,{cwd:n,stdio:`inherit`})},T=()=>{try{return d(`docker`,[`info`],{stdio:`ignore`}),!0}catch{return!1}},E=r=>{let i=a(r,`.env`);if(!t(i)){let o=a(r,`.env.example`);e(i,t(o)?n(o):``)}return i},D=(e,t)=>{let r=`${t}=`,i=n(e).split(`
|
|
3
|
+
`).find(e=>e.startsWith(r));return i?i.slice(r.length).trim():``},O=(t,r,i)=>{let a=`${r}=`,o=n(t).split(`
|
|
4
|
+
`),s=o.findIndex(e=>e.startsWith(a));if(s>=0)o[s]=`${a}${i}`;else{for(;o.length&&o[o.length-1]===``;)o.pop();o.push(`${a}${i}`,``)}e(t,o.join(`
|
|
5
|
+
`))},k=e=>{let t=E(e);D(t,`BETTER_AUTH_SECRET`)||O(t,`BETTER_AUTH_SECRET`,f(32).toString(`base64`))},A=e=>{let n=a(e,`.env`);return t(n)&&D(n,`POSTGRES_URL`)!==``},j=e=>{let t=C(`bunx`,[`pglaunch@5.5.7`,`-k`],e).match(/postgres(?:ql)?:\/\/[\w.:@\-/%?=&]+/);if(!t)throw Error(`pglaunch did not print a connection URL`);return t[0]},M=e=>{O(E(e),`POSTGRES_URL`,j(e)),w(`bun`,[`run`,`db:migrate`],e)},N=(e,t,n)=>d(e,t,{cwd:n,encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]}),P=(e,t=`main`)=>{N(`bunx`,[`gitpick@5.4.1`,`https://github.com/nrjdalal/zerostarter/tree/${t}`,e])},F=e=>{N(`bun`,[`install`],e)},I=e=>{N(`git`,[`init`,`-q`,`-b`,`canary`],e)},L=(e,t)=>{N(`git`,[`add`,`-A`],e);try{N(`git`,[`commit`,`--no-verify`,`-q`,`-m`,t],e)}catch{}},R=e=>!s(e)||c(e).filter(e=>e!==`.git`).length===0,z=e=>t(a(e,`packages/config/src/site.ts`)),B=async e=>{let{positionals:n,values:s}=u({allowPositionals:!0,args:e,options:{db:{type:`boolean`},"dry-run":{type:`boolean`},help:{short:`h`,type:`boolean`},yes:{short:`y`,type:`boolean`}}});if(s.help){console.log(`Usage:
|
|
3
6
|
$ zerostarter init [dir] [options]
|
|
4
7
|
|
|
5
8
|
Scaffold ZeroStarter into dir (default .) as a fresh product. The author's
|
|
@@ -10,15 +13,16 @@ latest ZeroStarter is fetched into it first.
|
|
|
10
13
|
|
|
11
14
|
Options:
|
|
12
15
|
-y, --yes Skip prompts; fail instead of prompting when input is needed
|
|
16
|
+
--db Provision a local Postgres (pglaunch) and migrate; needs Docker
|
|
13
17
|
--dry-run Print the plan without writing anything
|
|
14
|
-
-h, --help Display help`);return}let
|
|
15
|
-
Make it yours:`);for(let[e,t]of
|
|
16
|
-
${
|
|
18
|
+
-h, --help Display help`);return}let c=m()&&!s.yes,l=n[0]??`.`,d=o(l),f=z(d);if(!f&&!R(d)){if(!c)throw Error(`Target directory is not empty. Pass an empty target dir, for example: zerostarter init my-product`);let e=await x(`Target directory is not empty. New project directory`);if(!e)throw Error(`No directory name provided.`);l=e}let p=o(l),h=i(p),g={name:h};if(s[`dry-run`]){console.log(`zerostarter init (dry run)`),console.log(` target: ${p}`),console.log(` name: ${h}`),console.log(` mode: ${z(p)?`in place`:`fetch first`}`);return}if(f&&c&&!await S(y(`Convert ${p} in place? This rewrites files and commits.`),!1)){console.log(`Aborted.`);return}z(p)||(console.log(`Fetching the latest ZeroStarter ...`),P(p)),t(a(p,`.git`))||(I(p),L(p,`chore: scaffold from zerostarter`)),console.log(`Removing starter content and rebranding ...`),r(p,g),console.log(`Installing dependencies ...`),F(p),L(p,`chore: re-baseline as ${h}`),console.log(`Setting up .env (copied from .env.example, with a generated BETTER_AUTH_SECRET) ...`),k(p);let b=!1,C=T(),w=A(p),E=!1;if(w?s.db&&console.log(y(` --db ignored: POSTGRES_URL is already set in .env.`)):s.db?(E=C,C||console.log(y(` --db ignored: Docker is not running.`))):c&&C&&(E=await S(`Docker detected. Provision a local database and run migrations now?`,!0)),E)try{console.log(`Provisioning a local database with pglaunch and migrating ...`),M(p),b=!0}catch(e){let t=e instanceof Error?e.message:String(e);console.log(y(` Skipped database setup (${t}); set it up later with pglaunch + db:migrate.`))}let D=[[`packages/config/src/site.ts`,`your brand: name, tagline, links`],[`web/next/content`,`your docs and blog`],[`web/next/public`,`your logo and assets`]];console.log(`\n${v(`✓`)} ${h} is ready.\n`),console.log(`Next steps:`),p!==process.cwd()&&console.log(` ${_(`cd ${l}`)}`),b||(console.log(` ${_(`bunx pglaunch -k`)} # start Postgres, set POSTGRES_URL in .env`),console.log(` ${_(`bun run db:migrate`)}`)),console.log(` ${_(`bun dev`)}`),console.log(`
|
|
19
|
+
Make it yours:`);for(let[e,t]of D)console.log(` ${e.padEnd(29)} ${t}`)},V=async e=>{console.log(`zerostarter sync is not implemented yet.`),console.log(`Planned: a gitpick overlay of the latest zerostarter onto an existing fork, then a`),console.log(`prune of starter-only artifacts while preserving the fork's product and branding.`)},{author:H,name:U,version:W}=p,G=`Version:
|
|
20
|
+
${U}@${W}
|
|
17
21
|
|
|
18
22
|
Go from zero to a production-ready SaaS, rebranded and ready to ship.
|
|
19
23
|
|
|
20
24
|
Usage:
|
|
21
|
-
$ ${
|
|
25
|
+
$ ${U} <command> [options]
|
|
22
26
|
|
|
23
27
|
Commands:
|
|
24
28
|
init [dir] Scaffold ZeroStarter into dir (default .) as a fresh product.
|
|
@@ -30,4 +34,4 @@ Options:
|
|
|
30
34
|
-h, --help Display help
|
|
31
35
|
|
|
32
36
|
Author:
|
|
33
|
-
${
|
|
37
|
+
${H.name} <${H.email}> (${h(H.url)})`;(async()=>{try{let e=process.argv.slice(2),t=e[0],n=e.slice(1);switch(t){case`init`:return await B(n);case`sync`:return await V(n);case void 0:case`-h`:case`--help`:console.log(G);return;case`-v`:case`--version`:console.log(`${U}@${W}`);return;default:console.error(b(`Unknown command: ${t}\n`)),console.log(G),process.exit(1)}}catch(e){console.error(b(e instanceof Error?e.message:String(e))),process.exit(1)}})();export{};
|
|
@@ -107,4 +107,4 @@ export const newsreader = localFont({
|
|
|
107
107
|
variable: "--font-newsreader",
|
|
108
108
|
weight: "200 800",
|
|
109
109
|
})
|
|
110
|
-
`,``]]);if(!n||!r)throw Error(`fonts.ts: caveat/newsreader exports not found, but their woff2 files were removed (template drift). Update packages/cli/src/convert.ts.`);if(!t)throw Error(`navbar/home.tsx: /hire entry not found (template drift). Update packages/cli/src/convert.ts.`)},O=(e,t)=>{l(S(e,`packages/config/src/site.ts`),m(t));let n=S(e,`package.json`),r=d(n);r.name=C(t.name),r.version=`0.0.0`,delete r.homepage,delete r.bugs,delete r.license,delete r.author,delete r.repository,delete r.funding,f(n,r)},k=(e,t)=>{for(let t of[...w,...T])u(S(e,t));E(e),D(e),O(e,t)};export{s as n,k as t};
|
|
110
|
+
`,``]]);if(!n||!r)throw Error(`fonts.ts: caveat/newsreader exports not found, but their woff2 files were removed (template drift). Update packages/cli/src/convert.ts.`);if(!t)throw Error(`navbar/home.tsx: /hire entry not found (template drift). Update packages/cli/src/convert.ts.`)},O=(e,t)=>{l(S(e,`packages/config/src/site.ts`),m(t));let n=S(e,`package.json`),r=d(n);r.name=C(t.name),r.version=`0.0.0`,delete r.homepage,delete r.bugs,delete r.license,delete r.author,delete r.repository,delete r.funding,f(n,r)},k=(e,t)=>{for(let t of[...w,...T])u(S(e,t));E(e),D(e),O(e,t)};export{l as i,s as n,c as r,k as t};
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./convert-
|
|
1
|
+
import{t as e}from"./convert-HqQouyr9.mjs";export{e as convertRepo};
|