@ciwergrp/nuxid 1.3.0 → 1.4.0
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/console/request.mjs +19 -2
- package/dist/module.json +1 -1
- package/package.json +1 -1
package/console/request.mjs
CHANGED
|
@@ -233,6 +233,7 @@ async function run() {
|
|
|
233
233
|
if (globalArgs.includes('--help') || globalArgs.includes('-h')) {
|
|
234
234
|
console.log('\nUsage: pnpm nuxid make:request [options]\n');
|
|
235
235
|
console.log('Options:');
|
|
236
|
+
console.log(' -a, --app <name> Target app under ./apps/<name>');
|
|
236
237
|
console.log(' -p, --prefix <dir> Override the target prefix (default: project\'s config or \'app\')');
|
|
237
238
|
console.log(' -h, --help Show this help message\n');
|
|
238
239
|
console.log('Examples:');
|
|
@@ -288,9 +289,22 @@ async function run() {
|
|
|
288
289
|
const fileName = `${camelCaseName}Request.ts`;
|
|
289
290
|
|
|
290
291
|
const argv = process.argv.slice(2);
|
|
292
|
+
let appName;
|
|
291
293
|
let cliPrefix;
|
|
292
294
|
for (let i = 0; i < argv.length; i++) {
|
|
293
295
|
const a = argv[i];
|
|
296
|
+
if (a.startsWith('--app=')) {
|
|
297
|
+
appName = a.split('=')[1];
|
|
298
|
+
}
|
|
299
|
+
if (a === '--app' && argv[i + 1] !== undefined) {
|
|
300
|
+
appName = argv[i + 1];
|
|
301
|
+
}
|
|
302
|
+
if (a.startsWith('-a=')) {
|
|
303
|
+
appName = a.split('=')[1];
|
|
304
|
+
}
|
|
305
|
+
if (a === '-a' && argv[i + 1] !== undefined) {
|
|
306
|
+
appName = argv[i + 1];
|
|
307
|
+
}
|
|
294
308
|
if (a.startsWith('--prefix=')) {
|
|
295
309
|
cliPrefix = a.split('=')[1];
|
|
296
310
|
break;
|
|
@@ -312,11 +326,14 @@ async function run() {
|
|
|
312
326
|
const configuredPrefix = loadPrefixFromProjectConfig();
|
|
313
327
|
const prefix = cliPrefix !== undefined ? cliPrefix : (typeof configuredPrefix === 'string' ? configuredPrefix : 'app');
|
|
314
328
|
|
|
315
|
-
const baseDir =
|
|
316
|
-
const
|
|
329
|
+
const baseDir = appName ? path.join(cwd(), 'apps', appName) : cwd();
|
|
330
|
+
const targetRoot = prefix === '' ? baseDir : path.join(baseDir, prefix);
|
|
331
|
+
const targetDir = path.join(targetRoot, 'requests');
|
|
317
332
|
const targetPath = path.join(targetDir, fileName);
|
|
318
333
|
|
|
319
334
|
const shownPrefix = prefix === '' ? '(project root)' : prefix;
|
|
335
|
+
const shownApp = appName ? `apps/${appName}` : '(project root)';
|
|
336
|
+
console.log(`${colors.dim}App: ${colors.cyan}${shownApp}${colors.reset}`);
|
|
320
337
|
console.log(`${colors.dim}Using prefix: ${colors.cyan}${shownPrefix}${colors.reset} -> ${colors.dim}${path.relative(cwd(), targetDir) || '.'}${colors.reset}`);
|
|
321
338
|
|
|
322
339
|
const writeFileAndLint = () => {
|
package/dist/module.json
CHANGED