@teispace/next-maker 5.0.3 → 5.0.4
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 +7 -0
- package/dist/index.js +6 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.0.4](https://github.com/teispace/npm-packages/compare/next-maker-v5.0.3...next-maker-v5.0.4) (2026-09-06)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **next-maker:** keep generated placeholders free of empty object types ([#168](https://github.com/teispace/npm-packages/issues/168)) ([b0b3d40](https://github.com/teispace/npm-packages/commit/b0b3d40f6d9d8e3ea8966143527be58f8bbdf2e1))
|
|
9
|
+
|
|
3
10
|
## [5.0.3](https://github.com/teispace/npm-packages/compare/next-maker-v5.0.2...next-maker-v5.0.3) (2026-09-06)
|
|
4
11
|
|
|
5
12
|
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{Command as Fp}from"commander";var Ae={name:"@teispace/next-maker",version:"5.0.
|
|
2
|
+
import{Command as Fp}from"commander";var Ae={name:"@teispace/next-maker",version:"5.0.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.",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.8.0",enquirer:"^2.4.1",ora:"^9.4.1",picocolors:"^1.1.1","png-to-ico":"^3.0.2",sharp:"^0.35.3"},devDependencies:{"@types/degit":"^2.8.6","@types/node":"^26.2.0",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 ea}from"node:fs/promises";import At from"node:path";import I from"picocolors";var sn=/@next-maker:([\w-]+)(?::(start|end))?/,Ys=/^\s*(?:\{\s*\/\*.*?\*\/\s*\}|\/\*.*?\*\/|\/\/.*|#.*)\s*$/,Qs=e=>e.replace(/\s*\{\s*\/\*[^*]*@next-maker:[^*]*\*\/\s*\}\s*$/,"").replace(/\s*\/\*[^*]*@next-maker:[^*]*\*\/\s*$/,"").replace(/\s*\/\/[^\n]*@next-maker:[^\n]*$/,"").replace(/\s*#[^\n]*@next-maker:[^\n]*$/,""),Xt=(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(sn);if(!i){n.push(s);continue}let[,a,c]=i,l=t.has(a);if(c==="start"){let u=Zs(r,o+1,a);l&&(o=u);continue}if(c==="end")continue;let p=Ys.test(s);if(l){p&&o++;continue}p||n.push(Qs(s))}return n.join(`
|
|
4
4
|
`)},Zs=(e,t,r)=>{for(let n=t;n<e.length;n++){let o=e[n].match(sn);if(o&&o[1]===r&&o[2]==="end")return n}throw new Error(`Anchor @next-maker:${r}:start has no matching :end`)},ze=e=>e.includes("@next-maker:"),an=(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),l=c.filter(p=>p.replace(/^type\s+/,"").split(/\s+as\s+/)[0]!==t);if(l.length===0)continue;if(l.length<c.length){n.push(`${a[1]}{ ${l.join(", ")} }${a[3]}`);continue}}n.push(i)}return n.join(`
|
|
@@ -263,7 +263,8 @@ export interface ${t}State {
|
|
|
263
263
|
error: string | null;
|
|
264
264
|
}
|
|
265
265
|
`:`export interface ${t}Props {
|
|
266
|
-
|
|
266
|
+
/** Extra classes for the root element. Add this feature's own props here. */
|
|
267
|
+
className?: string;
|
|
267
268
|
}
|
|
268
269
|
`};var so=e=>{let{componentName:t,camelName:r,typesImportPath:n}=e;return`import type { StateCreator } from 'zustand';
|
|
269
270
|
|
|
@@ -574,7 +575,8 @@ export default function ${e.componentName}Error({
|
|
|
574
575
|
import { createContext, useContext, useMemo } from 'react';
|
|
575
576
|
|
|
576
577
|
type ${n} = {
|
|
577
|
-
|
|
578
|
+
/** Replace with this provider's own fields. */
|
|
579
|
+
ready: boolean;
|
|
578
580
|
};
|
|
579
581
|
|
|
580
582
|
const ${o} = createContext<${n} | null>(null);
|
|
@@ -588,7 +590,7 @@ export const ${s} = (): ${n} => {
|
|
|
588
590
|
};
|
|
589
591
|
|
|
590
592
|
export const ${t} = ({ children }: { children: React.ReactNode }) => {
|
|
591
|
-
const value = useMemo<${n}>(() => ({}), []);
|
|
593
|
+
const value = useMemo<${n}>(() => ({ ready: true }), []);
|
|
592
594
|
return <${o}.Provider value={value}>{children}</${o}.Provider>;
|
|
593
595
|
};
|
|
594
596
|
`},xo=e=>yo(e,"Provider");var Ba=/^[A-Za-z][A-Za-z0-9-]*$/,Va=e=>e.includes("-")?$(e):e.charAt(0).toUpperCase()+e.slice(1),Tr=async e=>{let{name:t,projectPath:r}=e;if(!Ba.test(t))throw new Error(`Invalid provider name "${t}". Use kebab-case or PascalCase letters and digits only.`);let n=Va(t).replace(/Provider$/,""),o=xo(n),s=o,i=Er.join(r,C.PROVIDERS),a=Er.join(i,`${s}.tsx`);if(w(a))throw new Error(`Provider already exists at ${Er.relative(r,a)}.`);return await Ga(i,{recursive:!0}),await P(a,wo({baseName:n})),{componentName:o,fileBaseName:s,providerFile:a}};import pt from"node:path";var oe=async e=>{let{projectPath:t,sourceFile:r,kind:n,symbolName:o}=e,s=pt.dirname(r),i=pt.basename(r).replace(/\.(tsx?|jsx?)$/i,""),a=n==="component"?".tsx":".ts",c=pt.join(s,`${i}.test${a}`),l=`./${i}`,p=Ha(s,pt.join(t,"test","test-utils")),u;return n==="component"?u=Mt({componentName:o,sourceImportPath:l,testUtilsImportPath:p,hasState:!!e.hasState,hasI18n:!!e.hasI18n}):n==="hook"?u=co({hookName:o,sourceImportPath:l,withStore:!!e.hookUsesStore,testUtilsImportPath:e.hookUsesStore?p:void 0}):u=po({camelName:o,sourceImportPath:l}),await P(c,u),c},Ha=(e,t)=>{let r=pt.relative(e,t).replace(/\\/g,"/");return r.startsWith(".")?r:`./${r}`};import{readFile as qa,writeFile as Ja}from"node:fs/promises";import za from"node:path";var Ge=(e,t)=>{let r=/import\s+.*\s+from\s+['"].*['"];?\n/g,n=e.match(r);if(n&&n.length>0){let o=n[n.length-1],s=e.lastIndexOf(o);return e.slice(0,s+o.length)+t+`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teispace/next-maker",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.4",
|
|
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",
|