@teispace/next-maker 5.1.1 → 5.1.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.1.2](https://github.com/teispace/npm-packages/compare/next-maker-v5.1.1...next-maker-v5.1.2) (2026-09-06)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * move the workspace to Vitest 5 ([#180](https://github.com/teispace/npm-packages/issues/180)) ([3fdd98a](https://github.com/teispace/npm-packages/commit/3fdd98ae8b216aafd186f91a368ac543d256e5f6))
9
+ * **next-maker:** pin starter v2.0.0-alpha.5 ([#182](https://github.com/teispace/npm-packages/issues/182)) ([6c6cb67](https://github.com/teispace/npm-packages/commit/6c6cb67d0b960d54541c28c25e979ee40b7babb6))
10
+
3
11
  ## [5.1.1](https://github.com/teispace/npm-packages/compare/next-maker-v5.1.0...next-maker-v5.1.1) (2026-09-06)
4
12
 
5
13
 
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{Command as Zp}from"commander";var De={name:"@teispace/next-maker",version:"5.1.1",description:"Create and grow Next.js 16 applications from the Teispace starter: composable init, feature-aware setup and doctor, and generators for the server-first data layer.",keywords:["nextjs","react","typescript","tailwindcss","starter","template","redux","zustand","tanstack-query","server-actions","cli"],type:"module",homepage:"https://github.com/teispace/npm-packages/tree/main/packages/next-maker#readme",bugs:{url:"https://github.com/teispace/npm-packages/issues"},license:"MIT",author:"Teispace",files:["dist","README.md","LICENSE","CHANGELOG.md"],bin:"dist/index.js",repository:{type:"git",url:"git+https://github.com/teispace/npm-packages.git",directory:"packages/next-maker"},scripts:{build:"tsx build.ts",start:"node dist/index.js",dev:"tsx --watch src/index.ts",test:"vitest run","test:watch":"vitest","test:cov":"vitest run --coverage","type-check":"tsc --noEmit",clean:"rm -rf dist",prepublishOnly:"yarn clean && yarn build",smoke:"tsx scripts/smoke.ts"},dependencies:{commander:"^15.0.0",degit:"^3.9.0",enquirer:"^2.4.1",ora:"^9.4.1",picocolors:"^1.1.1","png-to-ico":"^3.0.2",sharp:"^0.35.4"},devDependencies:{"@types/degit":"^2.8.6","@types/node":"^26.4.1",esbuild:"^0.28.2",tsx:"^4.23.12",typescript:"^6.0.3",vitest:"^4.1.11"},engines:{node:">=24.0.0"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"}};import{copyFile as ga}from"node:fs/promises";import qe from"node:path";import j from"picocolors";var mn=/@next-maker:([\w-]+)(?::(start|end))?/,ai=/^\s*(?:\{\s*\/\*.*?\*\/\s*\}|\/\*.*?\*\/|<!--.*?-->|\/\/.*|#.*)\s*$/,ci=e=>e.replace(/\s*\{\s*\/\*[^*]*@next-maker:[^*]*\*\/\s*\}\s*$/,"").replace(/\s*\/\*[^*]*@next-maker:[^*]*\*\/\s*$/,"").replace(/\s*<!--[^>]*@next-maker:[^>]*-->\s*$/,"").replace(/^\s*<!--[^>]*@next-maker:[^>]*-->\s*/,"").replace(/\s*\/\/[^\n]*@next-maker:[^\n]*$/,"").replace(/\s*#[^\n]*@next-maker:[^\n]*$/,""),tr=(e,{off:t})=>{let r=e.split(`
2
+ import{Command as Zp}from"commander";var De={name:"@teispace/next-maker",version:"5.1.2",description:"Create and grow Next.js 16 applications from the Teispace starter: composable init, feature-aware setup and doctor, and generators for the server-first data layer.",keywords:["nextjs","react","typescript","tailwindcss","starter","template","redux","zustand","tanstack-query","server-actions","cli"],type:"module",homepage:"https://github.com/teispace/npm-packages/tree/main/packages/next-maker#readme",bugs:{url:"https://github.com/teispace/npm-packages/issues"},license:"MIT",author:"Teispace",files:["dist","README.md","LICENSE","CHANGELOG.md"],bin:"dist/index.js",repository:{type:"git",url:"git+https://github.com/teispace/npm-packages.git",directory:"packages/next-maker"},scripts:{build:"tsx build.ts",start:"node dist/index.js",dev:"tsx --watch src/index.ts",test:"vitest run","test:watch":"vitest","test:cov":"vitest run --coverage","type-check":"tsc --noEmit",clean:"rm -rf dist",prepublishOnly:"yarn clean && yarn build",smoke:"tsx scripts/smoke.ts"},dependencies:{commander:"^15.0.0",degit:"^3.9.0",enquirer:"^2.4.1",ora:"^9.4.1",picocolors:"^1.1.1","png-to-ico":"^3.0.2",sharp:"^0.35.4"},devDependencies:{"@types/degit":"^2.8.6","@types/node":"^26.4.1",esbuild:"^0.28.2",tsx:"^4.23.12",typescript:"^6.0.3",vite:"^8.0.10",vitest:"^5.0.0"},engines:{node:">=24.0.0"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"}};import{copyFile as ga}from"node:fs/promises";import qe from"node:path";import j from"picocolors";var mn=/@next-maker:([\w-]+)(?::(start|end))?/,ai=/^\s*(?:\{\s*\/\*.*?\*\/\s*\}|\/\*.*?\*\/|<!--.*?-->|\/\/.*|#.*)\s*$/,ci=e=>e.replace(/\s*\{\s*\/\*[^*]*@next-maker:[^*]*\*\/\s*\}\s*$/,"").replace(/\s*\/\*[^*]*@next-maker:[^*]*\*\/\s*$/,"").replace(/\s*<!--[^>]*@next-maker:[^>]*-->\s*$/,"").replace(/^\s*<!--[^>]*@next-maker:[^>]*-->\s*/,"").replace(/\s*\/\/[^\n]*@next-maker:[^\n]*$/,"").replace(/\s*#[^\n]*@next-maker:[^\n]*$/,""),tr=(e,{off:t})=>{let r=e.split(`
3
3
  `),n=[];for(let o=0;o<r.length;o++){let s=r[o],i=s.match(mn);if(!i){n.push(s);continue}let[,a,c]=i,m=t.has(a);if(c==="start"){let u=pi(r,o+1,a);m&&(o=u);continue}if(c==="end")continue;let p=ai.test(s);if(m){p&&o++;continue}p||n.push(ci(s))}return n.join(`
4
4
  `)},pi=(e,t,r)=>{for(let n=t;n<e.length;n++){let o=e[n].match(mn);if(o&&o[1]===r&&o[2]==="end")return n}throw new Error(`Anchor @next-maker:${r}:start has no matching :end`)},tt=e=>e.includes("@next-maker:"),un=(e,t)=>{let r=e.split(`
5
5
  `),n=[],o=new RegExp(`^import\\s+${t}\\s+from\\s+['"][^'"]+['"];?\\s*$`),s=/^(import\s+(?:type\s+)?)\{([^}]+)\}(\s+from\s+['"][^'"]+['"];?\s*)$/;for(let i of r){if(o.test(i))continue;let a=i.match(s);if(a){let c=a[2].split(",").map(p=>p.trim()).filter(Boolean),m=c.filter(p=>p.replace(/^type\s+/,"").split(/\s+as\s+/)[0]!==t);if(m.length===0)continue;if(m.length<c.length){n.push(`${a[1]}{ ${m.join(", ")} }${a[3]}`);continue}}n.push(i)}return n.join(`
@@ -8,7 +8,7 @@ import{Command as Zp}from"commander";var De={name:"@teispace/next-maker",version
8
8
  `);return un(u,t)},Pe=(e,t)=>{let r=new RegExp(`\\b${t}\\(`,"g"),n=e,o=r.exec(n);for(;o;){let s=o.index,i=0,a=s+o[0].length-1;for(;a<n.length;a++)if(n[a]==="(")i++;else if(n[a]===")"&&(i--,i===0))break;if(i!==0)throw new Error(`unwrapCall: unbalanced parentheses after ${t}(`);let c=n.slice(s+o[0].length,a);n=n.slice(0,s)+c+n.slice(a+1),r.lastIndex=s,o=r.exec(n)}return n};import{cp as vn,mkdir as gi,mkdtemp as hi,readdir as xn,readFile as Le,rm as nr,rmdir as yi,stat as wi,writeFile as Ue}from"node:fs/promises";import{tmpdir as xi}from"node:os";import _ from"node:path";import{readdir as li}from"node:fs/promises";import Pt from"node:path";var dn=e=>{let t="^";for(let r=0;r<e.length;r++){let n=e[r];n==="*"?e[r+1]==="*"?(r++,e[r+1]==="/"?(r++,t+="(?:.*/)?"):t+=".*"):t+="[^/]*":t+=n.replace(/[.+?^${}()|[\]\\]/g,"\\$&")}return new RegExp(`${t}$`)},mi=new Set(["node_modules",".git",".next","coverage","playwright-report","test-results"]),I=async(e,t=mi)=>{let r=[],n=async o=>{let s;try{s=await li(o,{withFileTypes:!0})}catch{return}for(let i of s)if(i.isDirectory()){if(t.has(i.name))continue;await n(Pt.join(o,i.name))}else i.isFile()&&r.push(Pt.relative(e,Pt.join(o,i.name)).split(Pt.sep).join("/"))};return await n(e),r.sort()},Y=(e,t)=>{let r=dn(t);return e.filter(n=>r.test(n))};import{readFile as fn}from"node:fs/promises";import gn from"node:path";var St="next-maker.json",ae=".next-maker/overlays",hn=1,W=e=>{throw new Error(`Invalid ${St}: ${e}`)},wn=e=>{(typeof e!="object"||e===null)&&W("not an object");let t=e;t.manifestVersion!==hn&&W(`manifestVersion ${String(t.manifestVersion)} is not supported by this CLI (expected ${hn})`),(!t.starter?.name||!t.starter.version)&&W("starter.name and starter.version are required"),(!t.options||typeof t.options!="object")&&W("options is required"),(!t.features||typeof t.features!="object")&&W("features is required"),(!t.packageManagers||typeof t.packageManagers!="object")&&W("packageManagers is required");let r=t.options,n=t.features;for(let[o,s]of Object.entries(r))["choice","boolean","multi"].includes(s.type)||W(`option ${o} has unknown type ${String(s.type)}`),s.type!=="boolean"&&!Array.isArray(s.values)&&W(`option ${o} needs a values array`),s.default===void 0&&W(`option ${o} needs a default`);for(let[o,s]of Object.entries(n)){(!s.when||typeof s.when!="object")&&W(`feature ${o} needs a when`);for(let i of Object.keys(s.when))r[i]||W(`feature ${o} refers to unknown option ${i}`)}return{...t,always:{remove:t.always?.remove??[],anchors:t.always?.anchors??[]}}},rt=async e=>{let t=gn.join(e,St),r;try{r=await fn(t,"utf-8")}catch{throw new Error(`The starter at ${e} has no ${St}. This CLI needs a starter that ships a composition manifest (nextjs-starter 2.x or later).`)}let n=wn(JSON.parse(r));try{let o=JSON.parse(await fn(gn.join(e,"package.json"),"utf-8"));typeof o.version=="string"&&o.version&&(n.starter={...n.starter,version:o.version})}catch{}return n},yn=(e,t)=>e.some(r=>r===t),Et=(e,t,r)=>t===void 0?!1:e?.type==="multi"&&Array.isArray(t)?t.some(n=>yn(r,n)):yn(r,t),de=(e,t,r)=>Object.entries(t.when).every(([n,o])=>Et(e.options[n],r[n],o)),ui=e=>e.type==="boolean"?!1:e.type==="multi"?[]:e.default,di=(e,t,r)=>{if(e.type==="boolean"){if(typeof r=="boolean")return r;if(r==="true")return!0;if(r==="false")return!1;throw new Error(`Option ${t} expects true or false, got ${String(r)}`)}if(e.type==="multi"){let s=(Array.isArray(r)?r:String(r).split(",")).map(i=>String(i).trim()).filter(Boolean);for(let i of s)if(!e.values?.includes(i))throw new Error(`Option ${t} does not accept ${i}; valid: ${e.values?.join(", ")}`);return s}let n=String(r);if(!e.values?.includes(n))throw new Error(`Option ${t} does not accept ${n}; valid: ${e.values?.join(", ")}`);return n},nt=(e,t={})=>{let r={},n=[],o=Object.keys(t).filter(s=>!e.options[s]);for(let[s,i]of Object.entries(e.options)){let a=t[s];r[s]=a===void 0?i.default:di(i,s,a)}for(let[s,i]of Object.entries(e.options))if(i.requires)for(let[a,c]of Object.entries(i.requires)){if(Et(e.options[a],r[a],c))continue;let m=ui(i);r[s]!==m&&JSON.stringify(r[s])!==JSON.stringify(m)&&(n.push({option:s,value:m,reason:`${s} requires ${a} to be ${c.map(String).join(" or ")}`}),r[s]=m)}return{answers:r,forced:n,unknown:o}};var fe=(e,t)=>{switch(e){case"npm":return`npm run ${t}`;case"bun":return`bun run ${t}`;case"yarn":return`yarn ${t}`;default:return`pnpm ${t}`}},fi=e=>{switch(e){case"npm":return[[/\bpnpm install --frozen-lockfile\b/g,"npm ci"],[/\bpnpm install\b/g,"npm install"],[/\bpnpm add -D\b/g,"npm install --save-dev"],[/\bpnpm add\b/g,"npm install"],[/\bpnpm dlx\b/g,"npx"],[/\bpnpm exec\b/g,"npx --no --"],[/\bpnpm ([\w:.-]+)/g,"npm run $1"]];case"yarn":return[[/\bpnpm install --frozen-lockfile\b/g,"yarn install --immutable"],[/\bpnpm install\b/g,"yarn install"],[/\bpnpm add -D\b/g,"yarn add -D"],[/\bpnpm add\b/g,"yarn add"],[/\bpnpm dlx\b/g,"yarn dlx"],[/\bpnpm exec\b/g,"yarn"],[/\bpnpm ([\w:.-]+)/g,"yarn $1"]];case"bun":return[[/\bpnpm install --frozen-lockfile\b/g,"bun install --frozen-lockfile"],[/\bpnpm install\b/g,"bun install"],[/\bpnpm add -D\b/g,"bun add -d"],[/\bpnpm add\b/g,"bun add"],[/\bpnpm dlx\b/g,"bunx"],[/\bpnpm exec\b/g,"bunx"],[/\bpnpm ([\w:.-]+)/g,"bun run $1"]];default:return[]}},Tt=(e,t)=>{if(t==="pnpm")return e;let r=e;for(let[n,o]of fi(t))r=r.replace(n,o);return r},rr=e=>e==="package.json"||e.startsWith(".husky/")||e.endsWith(".md")||e===".lintstagedrc.mjs";var Se=e=>[...new Set(e)],sr=(e,t,r)=>{let n=e.packageManagers[r];if(!n)throw new Error(`This starter does not support ${r}; valid: ${Object.keys(e.packageManagers).join(", ")}`);let o=[],s=[],i=[],a=[],c=[],m=[],p=[];for(let[d,f]of Object.entries(e.features)){let h=de(e,f,t);(h?o:s).push(d);let y=h?f.on:f.off;if(!y)continue;i.push(y);let x=Object.keys(f.when);y.overlay&&!a.some(b=>b.name===y.overlay)&&a.push({name:y.overlay,options:x}),y.remove?.length&&c.push({feature:d,options:x,patterns:y.remove});for(let b of y.unwrapJsx??[])m.push({...b,options:x});for(let b of y.unwrapCall??[])p.push({...b,options:x})}let u=Se([...e.always.remove,...n.remove??[]]);return{answers:t,packageManager:r,pmSpec:n,featuresOn:o,featuresOff:s,pmOverlays:n.overlay?[n.overlay]:[],featureOverlays:a,removePatterns:Se([...u,...c.flatMap(d=>d.patterns)]),unconditionalRemovals:u,featureRemovals:c,anchorsOff:new Set([...e.always.anchors,...i.flatMap(d=>d.anchors??[])]),unwrapJsx:m,unwrapCall:p,packages:Se(i.flatMap(d=>d.packages??[])),devPackages:Se(i.flatMap(d=>d.devPackages??[])),scripts:Se(i.flatMap(d=>d.scripts??[])),env:Se(i.flatMap(d=>d.env??[])),packageJsonKeys:Se(i.flatMap(d=>d.packageJsonKeys??[]))}},bi=new Set([".ts",".tsx",".js",".mjs",".cjs",".css",".json",".yml",".yaml",".md",".sh",".example",".mdx"]),vi=e=>bi.has(_.extname(e))||e.startsWith(".husky/")||e==="Dockerfile",bn=async(e,t,r)=>{let n=_.join(e,r),o=await I(n,new Set);if(o.length===0)throw new Error(`Overlay "${r}" is missing or empty at ${ae}/${r}`);for(let s of o){let i=_.join(t,s);await gi(_.dirname(i),{recursive:!0}),await vn(_.join(n,s),i,{force:!0})}return o},ir=async(e,t=e)=>{let r;try{r=await xn(t,{withFileTypes:!0})}catch{return}for(let n of r)n.isDirectory()&&n.name!=="node_modules"&&n.name!==".git"&&await ir(e,_.join(t,n.name));t!==e&&(await xn(t)).length===0&&await yi(t)},kn=(e,t)=>{let r=t.split("."),n=e;for(let s of r.slice(0,-1)){let i=n?.[s];if(typeof i!="object"||i===null)return;n=i}let o=r[r.length-1];if(n&&o in n&&delete n[o],r.length>1){let s=r.slice(0,-1).join("."),i=r.slice(0,-1).reduce((a,c)=>a?.[c],e);i&&typeof i=="object"&&Object.keys(i).length===0&&kn(e,s)}},ki=async(e,t,r)=>{let n=_.join(e,"package.json"),o=JSON.parse(await Le(n,"utf-8"));for(let i of t.packages)delete o.dependencies?.[i];for(let i of t.devPackages)delete o.devDependencies?.[i];for(let i of t.scripts)delete o.scripts?.[i];for(let i of t.packageJsonKeys)kn(o,i);let s=r.validateScript;if(s&&o.scripts?.[s.name]){let i=s.steps.filter(a=>o.scripts[a]);o.scripts[s.name]=i.map(a=>fe(t.packageManager,a)).join(" && ")}if(o.scripts)for(let[i,a]of Object.entries(o.scripts))typeof a=="string"&&(o.scripts[i]=Tt(a,t.packageManager));if(t.pmSpec.packageManager?o.packageManager=t.pmSpec.packageManager:delete o.packageManager,o.engines){for(let i of Object.keys(r.packageManagers))delete o.engines[i];Object.assign(o.engines,t.pmSpec.engines??{})}await Ue(n,`${JSON.stringify(o,null,2)}
9
9
  `,"utf-8")},$i=async(e,t)=>{let r=_.join(e,".env.example"),n;try{n=await Le(r,"utf-8")}catch{return}for(let o of t)n=n.replace(new RegExp(`^${o}=.*\\n?`,"gm"),"");await Ue(r,n.replace(/\n{3,}/g,`
10
10
 
11
- `),"utf-8")},ar=async(e,t,r)=>{let n={removed:[],overlaid:[],anchored:[],unwrapped:[]},o=_.join(e,ae),s=await hi(_.join(xi(),"next-maker-overlays-"));try{await or(o)&&await vn(o,s,{recursive:!0});for(let m of r.pmOverlays)n.overlaid.push(...await bn(s,e,m));let a=await I(e),c=new Set(r.removePatterns.flatMap(m=>Y(a,m)));for(let m of c)await nr(_.join(e,m),{force:!0}),n.removed.push(m);for(let m of r.featureOverlays){let p=await bn(s,e,m.name),u=[...r.unconditionalRemovals,...r.featureRemovals.filter(f=>!f.options.some(h=>m.options.includes(h))).flatMap(f=>f.patterns)],d=new Set(u.flatMap(f=>Y(p,f)));for(let f of d)await nr(_.join(e,f),{force:!0}),n.removed.push(f);n.overlaid.push(...p.filter(f=>!d.has(f)))}}finally{await nr(s,{recursive:!0,force:!0})}await ir(e);let i=await I(e);for(let a of i){if(!vi(a))continue;let c=_.join(e,a),m=await Le(c,"utf-8");tt(m)&&(await Ue(c,tr(m,{off:r.anchorsOff}),"utf-8"),n.anchored.push(a))}for(let{file:a,tag:c}of r.unwrapJsx){let m=_.join(e,a);if(!await or(m))continue;let p=await Le(m,"utf-8"),u=$e(p,c);u!==p&&(await Ue(m,u,"utf-8"),n.unwrapped.push(`${a}:<${c}>`))}for(let{file:a,name:c}of r.unwrapCall){let m=_.join(e,a);if(!await or(m))continue;let p=await Le(m,"utf-8"),u=Pe(p,c);u!==p&&(await Ue(m,u,"utf-8"),n.unwrapped.push(`${a}:${c}()`))}if(await ki(e,r,t),await $i(e,r.env),r.packageManager!=="pnpm")for(let a of await I(e)){if(!rr(a)||a==="package.json")continue;let c=_.join(e,a),m=await Le(c,"utf-8"),p=Tt(m,r.packageManager);p!==m&&await Ue(c,p,"utf-8")}return n},or=async e=>{try{return await wi(e),!0}catch{return!1}};import{readFile as Pi}from"node:fs/promises";import Si from"node:path";var cr=async e=>{let t=Si.resolve(process.cwd(),e),r;try{r=await Pi(t,"utf-8")}catch{throw new Error(`Config file not found: ${t}`)}let n=JSON.parse(r);if(typeof n!="object"||n===null||Array.isArray(n))throw new Error(`Config file ${t} must contain a JSON object`);if(n.options!==void 0&&(typeof n.options!="object"||n.options===null))throw new Error(`Config file ${t}: "options" must be an object`);return n},Ee=e=>{let t={};for(let r of e??[]){let n=r.indexOf("=");if(n<=0)throw new Error(`--set expects key=value, got "${r}"`);t[r.slice(0,n).trim()]=r.slice(n+1).trim()}return t};var pr={default:{description:"Manifest defaults: Redux, fetch, i18n, dark mode, unit + e2e tests, hooks",answers:{}},minimal:{description:"No state store, no i18n, no dark mode, no tests, no hooks",answers:{state:"none",i18n:!1,darkMode:!1,tests:!1,e2e:!1,hooks:!1,commitizen:!1}},full:{description:"Everything on: WebSocket, both HTTP adapters, Docker, CI, analyzer, OpenAPI, templates",answers:{ws:!0,http:"both",docker:!0,ci:!0,analyzer:!0,openapi:!0,githubTemplates:!0,communityFiles:["CODE_OF_CONDUCT.md","CONTRIBUTING.md","SECURITY.md"]}},zustand:{description:"Defaults with Zustand instead of Redux",answers:{state:"zustand"}},spa:{description:"Client-heavy app: Zustand, Axios, no i18n, Docker and CI on",answers:{state:"zustand",http:"axios",i18n:!1,docker:!0,ci:!0}}},Be=()=>Object.keys(pr),Ge=e=>{let t=pr[e];if(!t)throw new Error(`Unknown preset "${e}". Valid: ${Be().join(", ")}.`);return{...t.answers}};var ot=new Set;function Rt(e){return ot.add(e),()=>ot.delete(e)}function $n(e){let{logger:t=c=>console.error(c),exitOnCancel:r=process.env.NODE_ENV!=="test"}=e??{},n=!1,o=async()=>{let c=[...ot];ot.clear();for(let m of c)try{await m()}catch(p){t(`Cleanup failed: ${p instanceof Error?p.message:String(p)}`)}},s=()=>{if(n){r&&process.exit(130);return}n=!0;let c=ot.size>0;o().then(()=>{console.log(""),t("Setup cancelled by user"),console.log(""),r&&process.exit(c?130:0)})},i=c=>{if(c!==null&&typeof c=="object"&&"code"in c&&c.code==="ERR_USE_AFTER_CLOSE"){s();return}if(c instanceof Error){t(`Uncaught exception: ${c.message}`);return}t(`Uncaught exception: ${String(c)}`)},a=c=>{if(c instanceof Error){t(`Unhandled promise rejection: ${c.message}`);return}t(`Unhandled promise rejection: ${String(c)}`)};return process.on("SIGINT",s),process.on("SIGTERM",s),process.on("uncaughtException",i),process.on("unhandledRejection",a),()=>{process.off("SIGINT",s),process.off("SIGTERM",s),process.off("uncaughtException",i),process.off("unhandledRejection",a)}}import Q from"picocolors";var Ei={reset:e=>e,red:Q.red,green:Q.green,yellow:Q.yellow,blue:Q.blue,cyan:Q.cyan,magenta:Q.magenta,white:Q.white,gray:Q.gray,bright:Q.bold,dim:Q.dim};function ge(e,t="reset"){let r=Ei[t]??(n=>n);console.log(r(e))}function jt(e){ge(`\u2716 ${e}`,"red")}var v=jt;function Pn(e){ge(`\u26A0 ${e}`,"yellow")}function l(e){ge(e)}function Ct(){console.log(""),ge("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557","cyan"),ge("\u2551 \u2551","cyan"),ge("\u2551 \u{1F680} Create Teispace Next.js App \u{1F680} \u2551","cyan"),ge("\u2551 \u2551","cyan"),ge("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D","cyan"),console.log("")}import Ti from"ora";function Ot(e="",t){let r=Ti({text:e,...t});return r.start(),r}var Ri=e=>e.charAt(0).toUpperCase()+e.slice(1),V=e=>e.replace(/-([a-z])/g,(t,r)=>r.toUpperCase()),$=e=>Ri(V(e));import ji from"ora";var g=ji();import{execFile as Ci}from"node:child_process";import{cp as Sn,mkdir as Oi,stat as Ai}from"node:fs/promises";import st from"node:path";import{promisify as Ii}from"node:util";import Ni from"degit";var Fi=Ii(Ci),En="teispace/nextjs-starter",At="v2.0.0-alpha.4",Mi="NEXT_MAKER_STARTER_PATH",_i=(e=At)=>e==="main"?En:`${En}#${e}`,z=(e={})=>{let t=e.starterPath??process.env[Mi];return t?{kind:"local",location:st.resolve(t)}:{kind:"remote",location:_i(e.ref)}},Di=new Set(["node_modules",".git",".next","coverage","playwright-report","test-results",".env"]),It=async(e,t={})=>{let r=t.source??z();if(r.kind==="local"){try{if(!(await Ai(r.location)).isDirectory())throw new Error("not a directory")}catch{throw new Error(`Starter path ${r.location} is not a directory`)}return await Li(r.location,e),r}return await Ni(r.location,{cache:!1,force:!0,verbose:t.verbose??!1}).clone(e),r},Li=async(e,t)=>{let r=null;try{let{stdout:n}=await Fi("git",["-C",e,"ls-files","-z","--cached","--others","--exclude-standard"],{maxBuffer:67108864});r=n.split("\0").filter(Boolean)}catch{r=null}if(r===null){await Sn(e,t,{recursive:!0,filter:n=>!Di.has(st.basename(n))});return}for(let n of r){let o=st.join(t,n);await Oi(st.dirname(o),{recursive:!0});try{await Sn(st.join(e,n),o)}catch{}}};import{existsSync as lr}from"node:fs";import it from"node:fs/promises";import Ui from"node:path";var O=async e=>it.readFile(e,"utf-8"),R=async(e,t)=>{await it.mkdir(Ui.dirname(e),{recursive:!0}),await it.writeFile(e,t,"utf-8")};var Tn=async e=>{lr(e)&&await it.unlink(e)},at=async e=>{lr(e)&&await it.rm(e,{recursive:!0,force:!0})},Rn=async(e,t)=>{let r=await O(e),n=JSON.parse(r),o=t(n);await R(e,JSON.stringify(o,null,2))},w=e=>lr(e);import{execFile as Bi}from"node:child_process";import{promisify as Gi}from"node:util";var Vi=Gi(Bi),ce=(e,t)=>Vi("git",e,t?{cwd:t}:void 0);function Hi(e){let t=e.trim();if(!t||t.startsWith("-"))throw new Error(`Invalid git remote "${e}".`);if(!(/^https?:\/\/\S+$/.test(t)||/^git@[\w.-]+:\S+$/.test(t)||/^ssh:\/\/\S+$/.test(t)||/^[\w.-]+\/[\w.-]+$/.test(t)))throw new Error(`Invalid git remote "${e}". Expected an https/ssh URL or "owner/repo".`)}var Nt=async(e,t,r)=>{try{if(await ce(["init"],e),await ce(["add","."],e),await ce(["commit","-m","Initial commit from @teispace/next-maker"],e),t&&(Hi(t),await ce(["remote","add","origin",t],e),r)){await ce(["fetch","origin"],e);let n="main";try{await ce(["show-branch","origin/main"],e)}catch{try{await ce(["show-branch","origin/master"],e),n="master"}catch{n="main"}}await ce(["merge",`origin/${n}`,"--allow-unrelated-histories","-X","ours"],e),await ce(["push","origin",`HEAD:${n}`],e)}}catch(n){console.warn("Failed to initialize git repository",n)}};import{execFile as qi}from"node:child_process";import{promisify as Ji}from"node:util";var Wi=Ji(qi),jn=(e,t,r)=>Wi(e,t,{cwd:r,maxBuffer:64*1024*1024}),zi=e=>{let t=e;return(`${t.stdout??""}
11
+ `),"utf-8")},ar=async(e,t,r)=>{let n={removed:[],overlaid:[],anchored:[],unwrapped:[]},o=_.join(e,ae),s=await hi(_.join(xi(),"next-maker-overlays-"));try{await or(o)&&await vn(o,s,{recursive:!0});for(let m of r.pmOverlays)n.overlaid.push(...await bn(s,e,m));let a=await I(e),c=new Set(r.removePatterns.flatMap(m=>Y(a,m)));for(let m of c)await nr(_.join(e,m),{force:!0}),n.removed.push(m);for(let m of r.featureOverlays){let p=await bn(s,e,m.name),u=[...r.unconditionalRemovals,...r.featureRemovals.filter(f=>!f.options.some(h=>m.options.includes(h))).flatMap(f=>f.patterns)],d=new Set(u.flatMap(f=>Y(p,f)));for(let f of d)await nr(_.join(e,f),{force:!0}),n.removed.push(f);n.overlaid.push(...p.filter(f=>!d.has(f)))}}finally{await nr(s,{recursive:!0,force:!0})}await ir(e);let i=await I(e);for(let a of i){if(!vi(a))continue;let c=_.join(e,a),m=await Le(c,"utf-8");tt(m)&&(await Ue(c,tr(m,{off:r.anchorsOff}),"utf-8"),n.anchored.push(a))}for(let{file:a,tag:c}of r.unwrapJsx){let m=_.join(e,a);if(!await or(m))continue;let p=await Le(m,"utf-8"),u=$e(p,c);u!==p&&(await Ue(m,u,"utf-8"),n.unwrapped.push(`${a}:<${c}>`))}for(let{file:a,name:c}of r.unwrapCall){let m=_.join(e,a);if(!await or(m))continue;let p=await Le(m,"utf-8"),u=Pe(p,c);u!==p&&(await Ue(m,u,"utf-8"),n.unwrapped.push(`${a}:${c}()`))}if(await ki(e,r,t),await $i(e,r.env),r.packageManager!=="pnpm")for(let a of await I(e)){if(!rr(a)||a==="package.json")continue;let c=_.join(e,a),m=await Le(c,"utf-8"),p=Tt(m,r.packageManager);p!==m&&await Ue(c,p,"utf-8")}return n},or=async e=>{try{return await wi(e),!0}catch{return!1}};import{readFile as Pi}from"node:fs/promises";import Si from"node:path";var cr=async e=>{let t=Si.resolve(process.cwd(),e),r;try{r=await Pi(t,"utf-8")}catch{throw new Error(`Config file not found: ${t}`)}let n=JSON.parse(r);if(typeof n!="object"||n===null||Array.isArray(n))throw new Error(`Config file ${t} must contain a JSON object`);if(n.options!==void 0&&(typeof n.options!="object"||n.options===null))throw new Error(`Config file ${t}: "options" must be an object`);return n},Ee=e=>{let t={};for(let r of e??[]){let n=r.indexOf("=");if(n<=0)throw new Error(`--set expects key=value, got "${r}"`);t[r.slice(0,n).trim()]=r.slice(n+1).trim()}return t};var pr={default:{description:"Manifest defaults: Redux, fetch, i18n, dark mode, unit + e2e tests, hooks",answers:{}},minimal:{description:"No state store, no i18n, no dark mode, no tests, no hooks",answers:{state:"none",i18n:!1,darkMode:!1,tests:!1,e2e:!1,hooks:!1,commitizen:!1}},full:{description:"Everything on: WebSocket, both HTTP adapters, Docker, CI, analyzer, OpenAPI, templates",answers:{ws:!0,http:"both",docker:!0,ci:!0,analyzer:!0,openapi:!0,githubTemplates:!0,communityFiles:["CODE_OF_CONDUCT.md","CONTRIBUTING.md","SECURITY.md"]}},zustand:{description:"Defaults with Zustand instead of Redux",answers:{state:"zustand"}},spa:{description:"Client-heavy app: Zustand, Axios, no i18n, Docker and CI on",answers:{state:"zustand",http:"axios",i18n:!1,docker:!0,ci:!0}}},Be=()=>Object.keys(pr),Ge=e=>{let t=pr[e];if(!t)throw new Error(`Unknown preset "${e}". Valid: ${Be().join(", ")}.`);return{...t.answers}};var ot=new Set;function Rt(e){return ot.add(e),()=>ot.delete(e)}function $n(e){let{logger:t=c=>console.error(c),exitOnCancel:r=process.env.NODE_ENV!=="test"}=e??{},n=!1,o=async()=>{let c=[...ot];ot.clear();for(let m of c)try{await m()}catch(p){t(`Cleanup failed: ${p instanceof Error?p.message:String(p)}`)}},s=()=>{if(n){r&&process.exit(130);return}n=!0;let c=ot.size>0;o().then(()=>{console.log(""),t("Setup cancelled by user"),console.log(""),r&&process.exit(c?130:0)})},i=c=>{if(c!==null&&typeof c=="object"&&"code"in c&&c.code==="ERR_USE_AFTER_CLOSE"){s();return}if(c instanceof Error){t(`Uncaught exception: ${c.message}`);return}t(`Uncaught exception: ${String(c)}`)},a=c=>{if(c instanceof Error){t(`Unhandled promise rejection: ${c.message}`);return}t(`Unhandled promise rejection: ${String(c)}`)};return process.on("SIGINT",s),process.on("SIGTERM",s),process.on("uncaughtException",i),process.on("unhandledRejection",a),()=>{process.off("SIGINT",s),process.off("SIGTERM",s),process.off("uncaughtException",i),process.off("unhandledRejection",a)}}import Q from"picocolors";var Ei={reset:e=>e,red:Q.red,green:Q.green,yellow:Q.yellow,blue:Q.blue,cyan:Q.cyan,magenta:Q.magenta,white:Q.white,gray:Q.gray,bright:Q.bold,dim:Q.dim};function ge(e,t="reset"){let r=Ei[t]??(n=>n);console.log(r(e))}function jt(e){ge(`\u2716 ${e}`,"red")}var v=jt;function Pn(e){ge(`\u26A0 ${e}`,"yellow")}function l(e){ge(e)}function Ct(){console.log(""),ge("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557","cyan"),ge("\u2551 \u2551","cyan"),ge("\u2551 \u{1F680} Create Teispace Next.js App \u{1F680} \u2551","cyan"),ge("\u2551 \u2551","cyan"),ge("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D","cyan"),console.log("")}import Ti from"ora";function Ot(e="",t){let r=Ti({text:e,...t});return r.start(),r}var Ri=e=>e.charAt(0).toUpperCase()+e.slice(1),V=e=>e.replace(/-([a-z])/g,(t,r)=>r.toUpperCase()),$=e=>Ri(V(e));import ji from"ora";var g=ji();import{execFile as Ci}from"node:child_process";import{cp as Sn,mkdir as Oi,stat as Ai}from"node:fs/promises";import st from"node:path";import{promisify as Ii}from"node:util";import Ni from"degit";var Fi=Ii(Ci),En="teispace/nextjs-starter",At="v2.0.0-alpha.5",Mi="NEXT_MAKER_STARTER_PATH",_i=(e=At)=>e==="main"?En:`${En}#${e}`,z=(e={})=>{let t=e.starterPath??process.env[Mi];return t?{kind:"local",location:st.resolve(t)}:{kind:"remote",location:_i(e.ref)}},Di=new Set(["node_modules",".git",".next","coverage","playwright-report","test-results",".env"]),It=async(e,t={})=>{let r=t.source??z();if(r.kind==="local"){try{if(!(await Ai(r.location)).isDirectory())throw new Error("not a directory")}catch{throw new Error(`Starter path ${r.location} is not a directory`)}return await Li(r.location,e),r}return await Ni(r.location,{cache:!1,force:!0,verbose:t.verbose??!1}).clone(e),r},Li=async(e,t)=>{let r=null;try{let{stdout:n}=await Fi("git",["-C",e,"ls-files","-z","--cached","--others","--exclude-standard"],{maxBuffer:67108864});r=n.split("\0").filter(Boolean)}catch{r=null}if(r===null){await Sn(e,t,{recursive:!0,filter:n=>!Di.has(st.basename(n))});return}for(let n of r){let o=st.join(t,n);await Oi(st.dirname(o),{recursive:!0});try{await Sn(st.join(e,n),o)}catch{}}};import{existsSync as lr}from"node:fs";import it from"node:fs/promises";import Ui from"node:path";var O=async e=>it.readFile(e,"utf-8"),R=async(e,t)=>{await it.mkdir(Ui.dirname(e),{recursive:!0}),await it.writeFile(e,t,"utf-8")};var Tn=async e=>{lr(e)&&await it.unlink(e)},at=async e=>{lr(e)&&await it.rm(e,{recursive:!0,force:!0})},Rn=async(e,t)=>{let r=await O(e),n=JSON.parse(r),o=t(n);await R(e,JSON.stringify(o,null,2))},w=e=>lr(e);import{execFile as Bi}from"node:child_process";import{promisify as Gi}from"node:util";var Vi=Gi(Bi),ce=(e,t)=>Vi("git",e,t?{cwd:t}:void 0);function Hi(e){let t=e.trim();if(!t||t.startsWith("-"))throw new Error(`Invalid git remote "${e}".`);if(!(/^https?:\/\/\S+$/.test(t)||/^git@[\w.-]+:\S+$/.test(t)||/^ssh:\/\/\S+$/.test(t)||/^[\w.-]+\/[\w.-]+$/.test(t)))throw new Error(`Invalid git remote "${e}". Expected an https/ssh URL or "owner/repo".`)}var Nt=async(e,t,r)=>{try{if(await ce(["init"],e),await ce(["add","."],e),await ce(["commit","-m","Initial commit from @teispace/next-maker"],e),t&&(Hi(t),await ce(["remote","add","origin",t],e),r)){await ce(["fetch","origin"],e);let n="main";try{await ce(["show-branch","origin/main"],e)}catch{try{await ce(["show-branch","origin/master"],e),n="master"}catch{n="main"}}await ce(["merge",`origin/${n}`,"--allow-unrelated-histories","-X","ours"],e),await ce(["push","origin",`HEAD:${n}`],e)}}catch(n){console.warn("Failed to initialize git repository",n)}};import{execFile as qi}from"node:child_process";import{promisify as Ji}from"node:util";var Wi=Ji(qi),jn=(e,t,r)=>Wi(e,t,{cwd:r,maxBuffer:64*1024*1024}),zi=e=>{let t=e;return(`${t.stdout??""}
12
12
  ${t.stderr??""}`.trim()||(t.message??String(e))).split(`
13
13
  `).filter(Boolean).slice(-12).join(`
14
14
  `)},Ki=e=>{switch(e){case"pnpm":return["install","--no-frozen-lockfile"];case"yarn":return["install","--no-immutable"];default:return["install"]}},he=async(e,t)=>{try{await jn(t,Ki(t),e)}catch(r){throw new Error(`Failed to install dependencies with ${t}:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teispace/next-maker",
3
- "version": "5.1.1",
3
+ "version": "5.1.2",
4
4
  "description": "Create and grow Next.js 16 applications from the Teispace starter: composable init, feature-aware setup and doctor, and generators for the server-first data layer.",
5
5
  "keywords": [
6
6
  "nextjs",
@@ -61,7 +61,8 @@
61
61
  "esbuild": "^0.28.2",
62
62
  "tsx": "^4.23.12",
63
63
  "typescript": "^6.0.3",
64
- "vitest": "^4.1.11"
64
+ "vite": "^8.0.10",
65
+ "vitest": "^5.0.0"
65
66
  },
66
67
  "engines": {
67
68
  "node": ">=24.0.0"