@nitrostack/cli 1.0.7 → 1.0.8
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/commands/init.d.ts +3 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +21 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/package.json +1 -1
package/dist/commands/init.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAoDA,UAAU,WAAW;IACnB,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAoDA,UAAU,WAAW;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAsB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,WAAW,iBA4NtF"}
|
package/dist/commands/init.js
CHANGED
|
@@ -77,7 +77,7 @@ export async function initCommand(projectName, options) {
|
|
|
77
77
|
}
|
|
78
78
|
fs.removeSync(targetDir);
|
|
79
79
|
}
|
|
80
|
-
// Prompt for template and details
|
|
80
|
+
// Prompt for template and details if not provided via flags
|
|
81
81
|
const answers = await inquirer.prompt([
|
|
82
82
|
{
|
|
83
83
|
type: 'list',
|
|
@@ -98,40 +98,51 @@ export async function initCommand(projectName, options) {
|
|
|
98
98
|
},
|
|
99
99
|
],
|
|
100
100
|
default: 'typescript-starter',
|
|
101
|
+
when: !options.template,
|
|
101
102
|
},
|
|
102
103
|
{
|
|
103
104
|
type: 'input',
|
|
104
105
|
name: 'description',
|
|
105
106
|
message: chalk.white('Description:'),
|
|
106
107
|
default: 'My awesome MCP server',
|
|
108
|
+
when: !options.description,
|
|
107
109
|
},
|
|
108
110
|
{
|
|
109
111
|
type: 'input',
|
|
110
112
|
name: 'author',
|
|
111
113
|
message: chalk.white('Author:'),
|
|
112
114
|
default: '',
|
|
115
|
+
when: !options.author,
|
|
113
116
|
},
|
|
114
117
|
]);
|
|
118
|
+
// Merge flag values with prompt answers
|
|
119
|
+
const finalTemplate = options.template || answers.template || 'typescript-starter';
|
|
120
|
+
const finalDescription = options.description || answers.description || 'My awesome MCP server';
|
|
121
|
+
const finalAuthor = options.author || answers.author || '';
|
|
115
122
|
spacer();
|
|
116
123
|
spinner = new NitroSpinner('Creating project structure...').start();
|
|
117
124
|
// Create project directory
|
|
118
125
|
fs.mkdirSync(targetDir, { recursive: true });
|
|
119
126
|
// Get template path - templates are in the CLI package root
|
|
120
|
-
const templateDir = path.join(__dirname, '../../templates',
|
|
127
|
+
const templateDir = path.join(__dirname, '../../templates', finalTemplate);
|
|
121
128
|
// Copy template files
|
|
122
129
|
if (fs.existsSync(templateDir)) {
|
|
123
130
|
fs.copySync(templateDir, targetDir);
|
|
124
131
|
}
|
|
125
132
|
else {
|
|
126
|
-
await createProjectFromScratch(targetDir, finalProjectName,
|
|
133
|
+
await createProjectFromScratch(targetDir, finalProjectName, {
|
|
134
|
+
template: finalTemplate,
|
|
135
|
+
description: finalDescription,
|
|
136
|
+
author: finalAuthor,
|
|
137
|
+
});
|
|
127
138
|
}
|
|
128
139
|
// Update package.json
|
|
129
140
|
const packageJsonPath = path.join(targetDir, 'package.json');
|
|
130
141
|
if (fs.existsSync(packageJsonPath)) {
|
|
131
142
|
const packageJson = fs.readJSONSync(packageJsonPath);
|
|
132
143
|
packageJson.name = finalProjectName;
|
|
133
|
-
packageJson.description =
|
|
134
|
-
packageJson.author =
|
|
144
|
+
packageJson.description = finalDescription;
|
|
145
|
+
packageJson.author = finalAuthor;
|
|
135
146
|
fs.writeJSONSync(packageJsonPath, packageJson, { spaces: 2 });
|
|
136
147
|
}
|
|
137
148
|
spinner.succeed('Project created');
|
|
@@ -150,7 +161,7 @@ export async function initCommand(projectName, options) {
|
|
|
150
161
|
}
|
|
151
162
|
}
|
|
152
163
|
// Handle widgets
|
|
153
|
-
if (!options.skipInstall && ['typescript-starter', 'typescript-pizzaz', 'typescript-oauth'].includes(
|
|
164
|
+
if (!options.skipInstall && ['typescript-starter', 'typescript-pizzaz', 'typescript-oauth'].includes(finalTemplate)) {
|
|
154
165
|
const fromNpm = isNitrostackFromNpm();
|
|
155
166
|
const isLocalDev = isLocalDevelopment();
|
|
156
167
|
if (isLocalDev && !fromNpm) {
|
|
@@ -192,7 +203,7 @@ export async function initCommand(projectName, options) {
|
|
|
192
203
|
spacer();
|
|
193
204
|
console.log(createSuccessBox('Project Ready', [
|
|
194
205
|
`Name: ${finalProjectName}`,
|
|
195
|
-
`Template: ${
|
|
206
|
+
`Template: ${finalTemplate}`,
|
|
196
207
|
`Path: ${targetDir}`,
|
|
197
208
|
]));
|
|
198
209
|
// Next steps
|
|
@@ -202,16 +213,16 @@ export async function initCommand(projectName, options) {
|
|
|
202
213
|
if (options.skipInstall) {
|
|
203
214
|
steps.push('npm install');
|
|
204
215
|
}
|
|
205
|
-
if (
|
|
216
|
+
if (finalTemplate === 'typescript-oauth') {
|
|
206
217
|
steps.push('cp .env.example .env # Configure OAuth');
|
|
207
218
|
}
|
|
208
219
|
steps.push('npm run dev');
|
|
209
220
|
nextSteps(steps);
|
|
210
221
|
// Template-specific tips
|
|
211
|
-
if (
|
|
222
|
+
if (finalTemplate === 'typescript-oauth') {
|
|
212
223
|
console.log(chalk.dim(' OAuth Setup: See OAUTH_SETUP.md for provider guides\n'));
|
|
213
224
|
}
|
|
214
|
-
else if (
|
|
225
|
+
else if (finalTemplate === 'typescript-pizzaz') {
|
|
215
226
|
console.log(chalk.dim(' Mapbox (optional): Get free key from mapbox.com\n'));
|
|
216
227
|
}
|
|
217
228
|
console.log(chalk.dim(' Happy coding! 🎉\n'));
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,wBAAgB,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,wBAAgB,aAAa,YAgE5B;AAGD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,9 @@ export function createProgram() {
|
|
|
20
20
|
.command('init')
|
|
21
21
|
.description('Initialize a new NitroStack project')
|
|
22
22
|
.argument('[project-name]', 'Name of the project')
|
|
23
|
-
.option('--template <template>', 'Template to use (typescript, typescript-
|
|
23
|
+
.option('--template <template>', 'Template to use (typescript-starter, typescript-pizzaz, typescript-oauth)', 'typescript-starter')
|
|
24
|
+
.option('--description <description>', 'Description of the project')
|
|
25
|
+
.option('--author <author>', 'Author of the project')
|
|
24
26
|
.option('--skip-install', 'Skip installing dependencies')
|
|
25
27
|
.action(initCommand);
|
|
26
28
|
program
|