@teispace/next-maker 0.0.1-alpha.20251127105113
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 +0 -0
- package/README.md +184 -0
- package/dist/build.d.ts +2 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +7 -0
- package/dist/src/commands/app.d.ts +3 -0
- package/dist/src/commands/app.d.ts.map +1 -0
- package/dist/src/commands/feature.d.ts +3 -0
- package/dist/src/commands/feature.d.ts.map +1 -0
- package/dist/src/commands/index.d.ts +3 -0
- package/dist/src/commands/index.d.ts.map +1 -0
- package/dist/src/config/constants.d.ts +1 -0
- package/dist/src/config/constants.d.ts.map +1 -0
- package/dist/src/config/errorHandlers.d.ts +7 -0
- package/dist/src/config/errorHandlers.d.ts.map +1 -0
- package/dist/src/config/index.d.ts +4 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/output.d.ts +10 -0
- package/dist/src/config/output.d.ts.map +1 -0
- package/dist/src/config/spinner.d.ts +12 -0
- package/dist/src/config/spinner.d.ts.map +1 -0
- package/dist/src/config/utils.d.ts +1 -0
- package/dist/src/config/utils.d.ts.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/prompts/create-app.prompt.d.ts +3 -0
- package/dist/src/prompts/create-app.prompt.d.ts.map +1 -0
- package/dist/src/prompts/feature.prompt.d.ts +2 -0
- package/dist/src/prompts/feature.prompt.d.ts.map +1 -0
- package/package.json +59 -0
package/CHANGELOG.md
ADDED
|
File without changes
|
package/README.md
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# @teispace/next-maker
|
|
2
|
+
|
|
3
|
+
A powerful CLI tool to scaffold Next.js applications and generate boilerplate code for features, Redux slices, and API services.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### Using npx (Recommended)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx @teispace/next-maker <command> [name] [options]
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Global Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g @teispace/next-maker
|
|
17
|
+
next-maker <command> [name] [options]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Commands
|
|
21
|
+
|
|
22
|
+
### 1. Create a New App (Default)
|
|
23
|
+
|
|
24
|
+
Generate a complete Next.js application with your preferred configuration.
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx @teispace/next-maker [project-name]
|
|
28
|
+
# or just
|
|
29
|
+
npx @teispace/next-maker
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Interactive prompts:**
|
|
33
|
+
|
|
34
|
+
- TypeScript configuration
|
|
35
|
+
- Tailwind CSS setup
|
|
36
|
+
- Redux Toolkit integration
|
|
37
|
+
- i18n (internationalization) support
|
|
38
|
+
|
|
39
|
+
**Example:**
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx @teispace/next-maker my-awesome-app
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
### 2. Generate a Feature Module
|
|
48
|
+
|
|
49
|
+
Create a feature module with components, hooks, and utilities.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npx @teispace/next-maker feature user-dashboard
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Interactive prompts:**
|
|
56
|
+
|
|
57
|
+
- Include test files
|
|
58
|
+
- Include Storybook stories
|
|
59
|
+
- Include CSS module
|
|
60
|
+
|
|
61
|
+
**Generated structure:**
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
src/features/user-dashboard/
|
|
65
|
+
├── components/
|
|
66
|
+
├── hooks/
|
|
67
|
+
├── utils/
|
|
68
|
+
├── __tests__/ (optional)
|
|
69
|
+
├── stories/ (optional)
|
|
70
|
+
└── index.ts
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Usage Examples
|
|
76
|
+
|
|
77
|
+
### Create a new app with all features
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npx @teispace/next-maker my-project
|
|
81
|
+
# Follow the interactive prompts
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Generate a feature
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Create a feature
|
|
88
|
+
npx @teispace/next-maker feature user-profile
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Get help
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# General help
|
|
95
|
+
npx @teispace/next-maker --help
|
|
96
|
+
|
|
97
|
+
# Feature command help
|
|
98
|
+
npx @teispace/next-maker feature --help
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Command-Line Arguments
|
|
104
|
+
|
|
105
|
+
All commands support the following pattern:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
next-maker <command> [name] [options]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
- `<command>`: Required. One of: `app`, `feature`, `slice`, `service`
|
|
112
|
+
- `[name]`: Optional. The name of what you're creating (will prompt if not provided)
|
|
113
|
+
- `[options]`: Optional flags like `--help`
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Features
|
|
118
|
+
|
|
119
|
+
✨ **Interactive Prompts** - Guided setup with sensible defaults
|
|
120
|
+
🎨 **Multiple Generators** - App, features, slices, and services
|
|
121
|
+
📦 **Modern Stack** - Next.js, TypeScript, Redux Toolkit, Tailwind CSS
|
|
122
|
+
🧪 **Test-Ready** - Optional test file generation
|
|
123
|
+
📚 **Well-Structured** - Follows best practices and conventions
|
|
124
|
+
🚀 **Fast Setup** - Get started in seconds
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Development
|
|
129
|
+
|
|
130
|
+
### Setup
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
git clone <repository-url>
|
|
134
|
+
cd next-maker
|
|
135
|
+
npm install
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Build
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
npm run build
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Test Locally
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
npx .
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Link for Global Testing
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npm link
|
|
154
|
+
next-maker app test-project
|
|
155
|
+
npm unlink -g
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Tech Stack
|
|
161
|
+
|
|
162
|
+
- **TypeScript** - Type-safe development
|
|
163
|
+
- **esbuild** - Fast bundling
|
|
164
|
+
- **Commander.js** - Professional CLI framework
|
|
165
|
+
- **enquirer** - Interactive prompts
|
|
166
|
+
- **Node.js** - Runtime environment
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## License
|
|
171
|
+
|
|
172
|
+
MIT
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Contributing
|
|
177
|
+
|
|
178
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Support
|
|
183
|
+
|
|
184
|
+
For issues and questions, please visit our [GitHub Issues](https://github.com/teispace/nextjs-starter/issues).
|
package/dist/build.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../build.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{Command as F}from"commander";import a from"picocolors";var v={reset:e=>e,red:a.red,green:a.green,yellow:a.yellow,blue:a.blue,cyan:a.cyan,magenta:a.magenta,white:a.white,gray:a.gray,bright:a.bold,dim:a.dim};function i(e,o="reset"){let r=v[o]??(s=>s);console.log(r(e))}function g(e){console.log(""),i("\u2550".repeat(60),"cyan"),i(` ${e}`,"bright"),i("\u2550".repeat(60),"cyan"),console.log("")}function p(e){i(`\u2716 ${e}`,"red")}function n(e){i(e)}function u(){console.log(""),i("\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"),i("\u2551 \u2551","cyan"),i("\u2551 \u{1F680} Create Teispace Next.js App \u{1F680} \u2551","cyan"),i("\u2551 \u2551","cyan"),i("\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("")}function l(e){let{logger:o=t=>console.error(t),exitOnCancel:r=process.env.NODE_ENV!=="test"}=e??{},s=()=>{console.log(""),console.log(""),o("Setup cancelled by user"),console.log(""),r&&process.exit(0)},c=t=>{if(t!==null&&typeof t=="object"&&"code"in t&&t.code==="ERR_USE_AFTER_CLOSE"){s();return}if(t instanceof Error){o(`Uncaught exception: ${t.message}`);return}o(`Uncaught exception: ${String(t)}`)},m=t=>{if(t instanceof Error){o(`Unhandled promise rejection: ${t.message}`);return}o(`Unhandled promise rejection: ${String(t)}`)};return process.on("SIGINT",s),process.on("SIGTERM",s),process.on("uncaughtException",c),process.on("unhandledRejection",m),()=>{process.off("SIGINT",s),process.off("SIGTERM",s),process.off("uncaughtException",c),process.off("unhandledRejection",m)}}import I from"ora";import b from"enquirer";var{prompt:d}=b,f=async()=>(await d({type:"input",name:"projectName",message:"What is the project name?",initial:"my-app"})).projectName,y=async()=>(await d({type:"select",name:"packageManager",message:"Which package manager would you like to use?",choices:["yarn","npm","pnpm","bun"],initial:0})).packageManager;var x=e=>{e.argument("[name]","Project name").option("--package-manager <packageManager>","Package manager to use (npm|yarn|pnpm)","npm").action(async(o,r)=>{await S({name:o,options:r})})},S=async e=>{u(),n("Welcome to the Teispace Next.js App Creator!"),n(""),n("This tool will help you create a new Next.js application"),n("with best practices and modern tooling."),n(""),g("\u{1F4E6} Project Setup"),e.name||(e.name=await f());let o=await y();n(""),n(`Creating a new Next.js app in folder: ${e.name}`),n(`Using package manager: ${o}`),n(`Options: ${JSON.stringify(e.options)}`),n("")};import{InvalidArgumentError as N}from"commander";import j from"enquirer";var{prompt:O}=j,h=async()=>(await O({type:"input",name:"featureName",message:"What is the feature name?",initial:"my-feature"})).featureName;var w=e=>{e.command("feature [name]").description("Generate a new feature module").option("--tests","Include test files",!0).option("--stories","Include Storybook stories",!1).option("--css","Include CSS module",!0).option("-p, --path <path>","Custom path for feature","src/features").option("-t, --template <template>","Template to use (basic|advanced|minimal)",o=>{let r=["basic","advanced","minimal"];if(!r.includes(o))throw new N(`Template must be one of: ${r.join(", ")}`);return o},"basic").option("--author <name>","Author name for file headers").action(async(o,r)=>{await k({name:o,options:r})})},k=async e=>{n("\u{1F3A8} Creating a new feature..."),e.name||(e.name=await h()),n(`Feature name is ${e.name}`),n(`Options: ${JSON.stringify(e.options)}`)};var C=e=>{x(e),w(e)};async function P(){l({logger:o=>p(o)});let e=new F;e.name("next-maker").description("Teispace Next.js Project Generator").version("1.0.0"),C(e),e.parse()}P().catch(e=>{let o=e&&typeof e=="object"&&"message"in e?e.message:String(e);p(`Unexpected error: ${o}`)});
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts", "../src/config/output.ts", "../src/config/errorHandlers.ts", "../src/config/spinner.ts", "../src/prompts/create-app.prompt.ts", "../src/commands/app.ts", "../src/commands/feature.ts", "../src/prompts/feature.prompt.ts", "../src/commands/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport { registerCommands } from './commands/index';\nimport { error, setupCancellationHandlers } from './config';\n\nasync function main() {\n setupCancellationHandlers({ logger: (m: string) => error(m) });\n\n const program = new Command();\n\n program.name('next-maker').description('Teispace Next.js Project Generator').version('1.0.0');\n\n registerCommands(program);\n\n program.parse();\n}\n\nmain().catch((err) => {\n const message =\n err && typeof err === 'object' && 'message' in err ? (err as Error).message : String(err);\n error(`Unexpected error: ${message}`);\n});\n", "import pc from 'picocolors';\n\n// Define a type for allowed colors explicitly\nexport type Color =\n | 'reset'\n | 'red'\n | 'green'\n | 'yellow'\n | 'blue'\n | 'cyan'\n | 'magenta'\n | 'white'\n | 'gray'\n | 'bright'\n | 'dim';\n\nconst colorMap: Record<Color, (s: string) => string> = {\n reset: (s: string) => s,\n red: pc.red,\n green: pc.green,\n yellow: pc.yellow,\n blue: pc.blue,\n cyan: pc.cyan,\n magenta: pc.magenta,\n white: pc.white,\n gray: pc.gray,\n bright: pc.bold,\n dim: pc.dim,\n};\n\n// Print with color\nexport function print(message: string, color: Color = 'reset'): void {\n const colorFn = colorMap[color] ?? ((text: string) => text);\n console.log(colorFn(message));\n}\n\n// Print section header\nexport function printHeader(title: string): void {\n console.log('');\n print('\u2550'.repeat(60), 'cyan');\n print(` ${title}`, 'bright');\n print('\u2550'.repeat(60), 'cyan');\n console.log('');\n}\n\n// Print success message\nexport function success(message: string): void {\n print(`\u2713 ${message}`, 'green');\n}\n\n// Print error message\nexport function error(message: string): void {\n print(`\u2716 ${message}`, 'red');\n}\n\n// Print warning message\nexport function warning(message: string): void {\n print(`\u26A0 ${message}`, 'yellow');\n}\n\n// Print info message\nexport function info(message: string): void {\n print(`\u2139 ${message}`, 'cyan');\n}\n\nexport function log(message: string): void {\n print(message);\n}\n\n// Print banner\nexport function printBanner(): void {\n console.log('');\n print('\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');\n print('\u2551 \u2551', 'cyan');\n print('\u2551 \uD83D\uDE80 Create Teispace Next.js App \uD83D\uDE80 \u2551', 'cyan');\n print('\u2551 \u2551', 'cyan');\n print('\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');\n console.log('');\n}\n", "export type SetupOptions = {\n logger?: (msg: string) => void;\n exitOnCancel?: boolean;\n};\n\nexport function setupCancellationHandlers(options?: SetupOptions): () => void {\n const {\n logger = (m: string) => console.error(m),\n exitOnCancel = process.env.NODE_ENV !== 'test',\n } = options ?? {};\n\n const onCancel = (): void => {\n console.log('');\n console.log('');\n logger('Setup cancelled by user');\n console.log('');\n if (exitOnCancel) process.exit(0);\n };\n\n const onUncaught = (err: unknown): void => {\n if (err !== null && typeof err === 'object' && 'code' in err) {\n const maybeErrWithCode = err as { code?: unknown };\n if (maybeErrWithCode.code === 'ERR_USE_AFTER_CLOSE') {\n onCancel();\n return;\n }\n }\n\n // Log uncaught exceptions instead of throwing so the CLI can report\n // the error and exit gracefully when appropriate.\n if (err instanceof Error) {\n logger(`Uncaught exception: ${err.message}`);\n return;\n }\n logger(`Uncaught exception: ${String(err)}`);\n };\n\n const onRejection = (reason: unknown): void => {\n // Log unhandled promise rejections rather than letting them crash the\n // process. This converts the reason to a readable string safely.\n if (reason instanceof Error) {\n logger(`Unhandled promise rejection: ${reason.message}`);\n return;\n }\n logger(`Unhandled promise rejection: ${String(reason)}`);\n };\n\n process.on('SIGINT', onCancel);\n process.on('SIGTERM', onCancel);\n process.on('uncaughtException', onUncaught);\n process.on('unhandledRejection', onRejection as (...args: unknown[]) => void);\n\n // Return a cleanup function to remove listeners (useful in tests).\n return (): void => {\n process.off('SIGINT', onCancel);\n process.off('SIGTERM', onCancel);\n process.off('uncaughtException', onUncaught);\n process.off('unhandledRejection', onRejection as (...args: unknown[]) => void);\n };\n}\n\nexport default setupCancellationHandlers;\n", "import ora, { Ora, Options } from 'ora';\n\n// Create and start a spinner\nexport function startSpinner(text = '', options?: Options): Ora {\n const spinner = ora({ text, ...options });\n spinner.start();\n return spinner;\n}\n\n// Stop a spinner without changing its status\nexport function stopSpinner(spinner: Ora): void {\n spinner.stop();\n}\n\n// Mark spinner as succeeded\nexport function succeedSpinner(spinner: Ora, text?: string): void {\n spinner.succeed(text);\n}\n\n// Mark spinner as failed\nexport function failSpinner(spinner: Ora, text?: string): void {\n spinner.fail(text);\n}\n\n// Run an async function while showing a spinner; auto-succeed/fail\nexport async function withSpinner<T>(\n text: string,\n fn: () => Promise<T>,\n {\n successText,\n failText,\n options,\n }: { successText?: string; failText?: string; options?: Options } = {},\n): Promise<T> {\n const spinner = startSpinner(text, options);\n try {\n const result = await fn();\n spinner.succeed(successText ?? 'Done');\n return result;\n } catch (err) {\n spinner.fail(failText ?? 'Failed');\n throw err;\n }\n}\n\nexport default startSpinner;\n", "import Enquirer from 'enquirer';\nconst { prompt } = Enquirer;\n\nexport const promptForProjectName = async (): Promise<string> => {\n const response = await prompt<{ projectName: string }>({\n type: 'input',\n name: 'projectName',\n message: 'What is the project name?',\n initial: 'my-app',\n });\n\n return response.projectName;\n};\n\nexport const promptForPackageManager = async (): Promise<string> => {\n const response = await prompt<{ packageManager: string }>({\n type: 'select',\n name: 'packageManager',\n message: 'Which package manager would you like to use?',\n choices: ['yarn', 'npm', 'pnpm', 'bun'],\n initial: 0,\n });\n return response.packageManager;\n};\n", "import { Command } from 'commander';\nimport { log, printBanner, printHeader } from '../config';\nimport { promptForProjectName, promptForPackageManager } from '../prompts/create-app.prompt';\n\ninterface AppOptions {\n packageManager: 'npm' | 'yarn' | 'pnpm';\n}\n\ninterface CreateAppParams {\n name?: string;\n options?: AppOptions;\n}\n\nexport const registerAppCommand = (program: Command) => {\n program\n .argument('[name]', 'Project name')\n .option('--package-manager <packageManager>', 'Package manager to use (npm|yarn|pnpm)', 'npm')\n .action(async (name, options) => {\n await createApp({ name, options });\n });\n};\n\nconst createApp = async (params: CreateAppParams): Promise<void> => {\n printBanner();\n\n log('Welcome to the Teispace Next.js App Creator!');\n log('');\n log('This tool will help you create a new Next.js application');\n log('with best practices and modern tooling.');\n log('');\n\n printHeader('\uD83D\uDCE6 Project Setup');\n\n // Prompt for project name if not provided\n if (!params.name) {\n params.name = await promptForProjectName();\n }\n\n // Prompt for package manager\n const packageManager = await promptForPackageManager();\n\n log('');\n log(`Creating a new Next.js app in folder: ${params.name}`);\n log(`Using package manager: ${packageManager}`);\n log(`Options: ${JSON.stringify(params.options)}`);\n log('');\n};\n", "import { Command, InvalidArgumentError } from 'commander';\nimport { log } from '../config';\nimport { promptForFeatureName } from '../prompts/feature.prompt';\n\ninterface FeatureOptions {\n tests: boolean;\n stories: boolean;\n css: boolean;\n path: string;\n template: 'basic' | 'advanced' | 'minimal';\n author?: string;\n}\n\ninterface CreateFeatureParams {\n name?: string;\n options?: FeatureOptions;\n}\n\nexport const registerFeatureCommand = (program: Command) => {\n program\n .command('feature [name]')\n .description('Generate a new feature module')\n .option('--tests', 'Include test files', true)\n .option('--stories', 'Include Storybook stories', false)\n .option('--css', 'Include CSS module', true)\n .option('-p, --path <path>', 'Custom path for feature', 'src/features')\n .option(\n '-t, --template <template>',\n 'Template to use (basic|advanced|minimal)',\n (value) => {\n const valid = ['basic', 'advanced', 'minimal'];\n if (!valid.includes(value)) {\n throw new InvalidArgumentError(`Template must be one of: ${valid.join(', ')}`);\n }\n return value;\n },\n 'basic',\n )\n .option('--author <name>', 'Author name for file headers')\n .action(async (name, options) => {\n await createFeature({ name, options });\n });\n};\n\nconst createFeature = async (params: CreateFeatureParams): Promise<void> => {\n log('\uD83C\uDFA8 Creating a new feature...');\n\n // Prompt for feature name if not provided\n if (!params.name) {\n params.name = await promptForFeatureName();\n }\n\n // Log the received values\n log(`Feature name is ${params.name}`);\n log(`Options: ${JSON.stringify(params.options)}`);\n};\n", "import Enquirer from 'enquirer';\nconst { prompt } = Enquirer;\n\nexport const promptForFeatureName = async (): Promise<string> => {\n const response = await prompt<{ featureName: string }>({\n type: 'input',\n name: 'featureName',\n message: 'What is the feature name?',\n initial: 'my-feature',\n });\n return response.featureName;\n};\n", "import { Command } from 'commander';\nimport { registerAppCommand } from './app';\nimport { registerFeatureCommand } from './feature';\n\nexport const registerCommands = (program: Command) => {\n registerAppCommand(program);\n registerFeatureCommand(program);\n};\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAS,WAAAA,MAAe,YCAxB,OAAOC,MAAQ,aAgBf,IAAMC,EAAiD,CACrD,MAAQC,GAAcA,EACtB,IAAKF,EAAG,IACR,MAAOA,EAAG,MACV,OAAQA,EAAG,OACX,KAAMA,EAAG,KACT,KAAMA,E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C,EAAE,CAClD,EEnDO,IAAMG,EAAoBC,GAAqB,CACpDC,EAAmBD,CAAO,EAC1BE,EAAuBF,CAAO,CAChC,ERHA,eAAeG,GAAO,CACpBC,EAA0B,CAAE,OAASC,GAAcC,EAAMD,CAAC,CAAE,CAAC,EAE7D,IAAME,EAAU,IAAIC,EAEpBD,EAAQ,KAAK,YAAY,EAAE,YAAY,oCAAoC,EAAE,QAAQ,OAAO,EAE5FE,EAAiBF,CAAO,EAExBA,EAAQ,MAAM,CAChB,CAEAJ,EAAK,EAAE,MAAOO,GAAQ,CACpB,IAAMC,EACJD,GAAO,OAAOA,GAAQ,UAAY,YAAaA,EAAOA,EAAc,QAAU,OAAOA,CAAG,EAC1FJ,EAAM,qBAAqBK,CAAO,EAAE,CACtC,CAAC",
|
|
6
|
+
"names": ["Command", "pc", "colorMap", "s", "print", "message", "color", "colorFn", "text", "printHeader", "title", "error", "message", "print", "log", "message", "print", "printBanner", "setupCancellationHandlers", "options", "logger", "m", "exitOnCancel", "onCancel", "onUncaught", "err", "onRejection", "reason", "ora", "Enquirer", "prompt", "promptForProjectName", "promptForPackageManager", "registerAppCommand", "program", "name", "options", "createApp", "params", "printBanner", "log", "printHeader", "promptForProjectName", "packageManager", "promptForPackageManager", "InvalidArgumentError", "Enquirer", "prompt", "promptForFeatureName", "registerFeatureCommand", "program", "value", "valid", "InvalidArgumentError", "name", "options", "createFeature", "params", "log", "promptForFeatureName", "registerCommands", "program", "registerAppCommand", "registerFeatureCommand", "main", "setupCancellationHandlers", "m", "error", "program", "Command", "registerCommands", "err", "message"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/commands/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,eAAO,MAAM,kBAAkB,GAAI,SAAS,OAAO,SAOlD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../../src/commands/feature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAwB,MAAM,WAAW,CAAC;AAkB1D,eAAO,MAAM,sBAAsB,GAAI,SAAS,OAAO,SAwBtD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,gBAAgB,GAAI,SAAS,OAAO,SAGhD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/config/constants.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type SetupOptions = {
|
|
2
|
+
logger?: (msg: string) => void;
|
|
3
|
+
exitOnCancel?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare function setupCancellationHandlers(options?: SetupOptions): () => void;
|
|
6
|
+
export default setupCancellationHandlers;
|
|
7
|
+
//# sourceMappingURL=errorHandlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorHandlers.d.ts","sourceRoot":"","sources":["../../../src/config/errorHandlers.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,IAAI,CAsD5E;AAED,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type Color = 'reset' | 'red' | 'green' | 'yellow' | 'blue' | 'cyan' | 'magenta' | 'white' | 'gray' | 'bright' | 'dim';
|
|
2
|
+
export declare function print(message: string, color?: Color): void;
|
|
3
|
+
export declare function printHeader(title: string): void;
|
|
4
|
+
export declare function success(message: string): void;
|
|
5
|
+
export declare function error(message: string): void;
|
|
6
|
+
export declare function warning(message: string): void;
|
|
7
|
+
export declare function info(message: string): void;
|
|
8
|
+
export declare function log(message: string): void;
|
|
9
|
+
export declare function printBanner(): void;
|
|
10
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../src/config/output.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,KAAK,GACb,OAAO,GACP,KAAK,GACL,OAAO,GACP,QAAQ,GACR,MAAM,GACN,MAAM,GACN,SAAS,GACT,OAAO,GACP,MAAM,GACN,QAAQ,GACR,KAAK,CAAC;AAiBV,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,KAAe,GAAG,IAAI,CAGnE;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAM/C;AAGD,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAGD,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE3C;AAGD,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAGD,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEzC;AAGD,wBAAgB,WAAW,IAAI,IAAI,CAQlC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Ora, Options } from 'ora';
|
|
2
|
+
export declare function startSpinner(text?: string, options?: Options): Ora;
|
|
3
|
+
export declare function stopSpinner(spinner: Ora): void;
|
|
4
|
+
export declare function succeedSpinner(spinner: Ora, text?: string): void;
|
|
5
|
+
export declare function failSpinner(spinner: Ora, text?: string): void;
|
|
6
|
+
export declare function withSpinner<T>(text: string, fn: () => Promise<T>, { successText, failText, options, }?: {
|
|
7
|
+
successText?: string;
|
|
8
|
+
failText?: string;
|
|
9
|
+
options?: Options;
|
|
10
|
+
}): Promise<T>;
|
|
11
|
+
export default startSpinner;
|
|
12
|
+
//# sourceMappingURL=spinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/config/spinner.ts"],"names":[],"mappings":"AAAA,OAAY,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAGxC,wBAAgB,YAAY,CAAC,IAAI,SAAK,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,GAAG,CAI9D;AAGD,wBAAgB,WAAW,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI,CAE9C;AAGD,wBAAgB,cAAc,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAEhE;AAGD,wBAAgB,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAE7D;AAGD,wBAAsB,WAAW,CAAC,CAAC,EACjC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,EACE,WAAW,EACX,QAAQ,EACR,OAAO,GACR,GAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GACrE,OAAO,CAAC,CAAC,CAAC,CAUZ;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/config/utils.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-app.prompt.d.ts","sourceRoot":"","sources":["../../../src/prompts/create-app.prompt.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,QAAa,OAAO,CAAC,MAAM,CAS3D,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAAa,OAAO,CAAC,MAAM,CAS9D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature.prompt.d.ts","sourceRoot":"","sources":["../../../src/prompts/feature.prompt.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,QAAa,OAAO,CAAC,MAAM,CAQ3D,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@teispace/next-maker",
|
|
3
|
+
"version": "0.0.1-alpha.20251127105113",
|
|
4
|
+
"description": "Create a new Teispace Next.js application with interactive setup.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"nextjs",
|
|
7
|
+
"react",
|
|
8
|
+
"typescript",
|
|
9
|
+
"tailwindcss",
|
|
10
|
+
"starter",
|
|
11
|
+
"template",
|
|
12
|
+
"redux"
|
|
13
|
+
],
|
|
14
|
+
"type": "module",
|
|
15
|
+
"homepage": "https://github.com/teispace/npm-packages/tree/main/packages/next-maker#readme",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/teispace/npm-packages/issues"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": "Teispace",
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"README.md",
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"CHANGELOG.md"
|
|
26
|
+
],
|
|
27
|
+
"main": "dist/index.js",
|
|
28
|
+
"types": "dist/index.d.ts",
|
|
29
|
+
"bin": "dist/index.js",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/teispace/npm-packages.git",
|
|
33
|
+
"directory": "packages/next-maker"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsx build.ts && ../../node_modules/.bin/tsc --emitDeclarationOnly --outDir dist",
|
|
37
|
+
"start": "node dist/index.js",
|
|
38
|
+
"dev": "tsx --watch src/index.ts",
|
|
39
|
+
"test": "jest"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"commander": "^14.0.2",
|
|
43
|
+
"enquirer": "^2.4.1",
|
|
44
|
+
"ora": "^9.0.0",
|
|
45
|
+
"picocolors": "^1.1.1"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^24.10.1",
|
|
49
|
+
"esbuild": "^0.27.0",
|
|
50
|
+
"tsx": "^4.20.6"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=20.0.0"
|
|
54
|
+
},
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public",
|
|
57
|
+
"registry": "https://registry.npmjs.org/"
|
|
58
|
+
}
|
|
59
|
+
}
|