@uns-kit/cli 0.0.23 → 0.0.24
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/README.md +12 -0
- package/dist/index.js +112 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -24,6 +24,7 @@ pnpm run dev
|
|
|
24
24
|
## Commands
|
|
25
25
|
|
|
26
26
|
- `uns-kit create <name>` – create a new UNS project in the specified directory.
|
|
27
|
+
- `uns-kit configure [path] [features...]` – run multiple configure templates in sequence (`--all` applies every template).
|
|
27
28
|
- `uns-kit configure-devops [path]` – add Azure DevOps tooling (dependencies, script, config) to an existing project.
|
|
28
29
|
- `uns-kit configure-vscode [path]` – copy VS Code launch/workspace files into an existing project.
|
|
29
30
|
- `uns-kit configure-codegen [path]` – scaffold GraphQL code generation and UNS refresh scripts.
|
|
@@ -33,6 +34,17 @@ pnpm run dev
|
|
|
33
34
|
- `uns-kit configure-python [path]` – copy Python gateway client scaffolding (no npm dependency required).
|
|
34
35
|
- `uns-kit help` – display usage information.
|
|
35
36
|
|
|
37
|
+
### Configure multiple features at once
|
|
38
|
+
|
|
39
|
+
Chain several add-ons without running each subcommand manually:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
uns-kit configure --all
|
|
43
|
+
uns-kit configure ./apps/gateway devops vscode codegen
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Mix and match feature names after an optional target directory. Use `--all` to apply every available template in one shot.
|
|
47
|
+
|
|
36
48
|
### Configure Azure DevOps
|
|
37
49
|
|
|
38
50
|
Run inside a scaffolded project to add the Azure DevOps pull-request tooling:
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,17 @@ async function main() {
|
|
|
23
23
|
printHelp();
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
+
if (command === "configure") {
|
|
27
|
+
const configureArgs = args.slice(1);
|
|
28
|
+
try {
|
|
29
|
+
await runConfigureCommand(configureArgs);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
console.error(error.message);
|
|
33
|
+
process.exitCode = 1;
|
|
34
|
+
}
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
26
37
|
if (command === "configure-devops") {
|
|
27
38
|
const targetPath = args[1];
|
|
28
39
|
try {
|
|
@@ -125,6 +136,7 @@ function printHelp() {
|
|
|
125
136
|
"\nUsage: uns-kit <command> [options]\n" +
|
|
126
137
|
"\nCommands:\n" +
|
|
127
138
|
" create <name> Scaffold a new UNS application\n" +
|
|
139
|
+
" configure [dir] [features...] Configure multiple templates (--all for everything)\n" +
|
|
128
140
|
" configure-devops [dir] Configure Azure DevOps tooling in an existing project\n" +
|
|
129
141
|
" configure-vscode [dir] Add VS Code workspace configuration files\n" +
|
|
130
142
|
" configure-codegen [dir] Copy GraphQL codegen template and dependencies\n" +
|
|
@@ -392,6 +404,106 @@ async function configurePython(targetPath) {
|
|
|
392
404
|
label: "UNS Python client",
|
|
393
405
|
});
|
|
394
406
|
}
|
|
407
|
+
const configureFeatureHandlers = {
|
|
408
|
+
devops: configureDevops,
|
|
409
|
+
vscode: configureVscode,
|
|
410
|
+
codegen: configureCodegen,
|
|
411
|
+
api: configureApi,
|
|
412
|
+
cron: configureCron,
|
|
413
|
+
temporal: configureTemporal,
|
|
414
|
+
python: configurePython,
|
|
415
|
+
};
|
|
416
|
+
const AVAILABLE_CONFIGURE_FEATURES = Object.keys(configureFeatureHandlers);
|
|
417
|
+
const configureFeatureLabels = {
|
|
418
|
+
devops: "Azure DevOps tooling",
|
|
419
|
+
vscode: "VS Code workspace",
|
|
420
|
+
codegen: "GraphQL codegen tooling",
|
|
421
|
+
api: "UNS API resources",
|
|
422
|
+
cron: "UNS cron resources",
|
|
423
|
+
temporal: "UNS Temporal resources",
|
|
424
|
+
python: "Python client scaffolding",
|
|
425
|
+
};
|
|
426
|
+
async function runConfigureCommand(args) {
|
|
427
|
+
const { targetPath, features } = parseConfigureArgs(args);
|
|
428
|
+
if (!features.length) {
|
|
429
|
+
throw new Error("No features specified. Provide feature names or pass --all.");
|
|
430
|
+
}
|
|
431
|
+
const location = targetPath ?? ".";
|
|
432
|
+
const featureSummary = features.map((feature) => configureFeatureLabels[feature]).join(", ");
|
|
433
|
+
console.log(`Configuring ${featureSummary} in ${location}`);
|
|
434
|
+
for (const feature of features) {
|
|
435
|
+
const handler = configureFeatureHandlers[feature];
|
|
436
|
+
await handler(targetPath);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
function parseConfigureArgs(args) {
|
|
440
|
+
let targetPath;
|
|
441
|
+
let includeAll = false;
|
|
442
|
+
const featureInputs = [];
|
|
443
|
+
for (const arg of args) {
|
|
444
|
+
if (arg === "--all") {
|
|
445
|
+
includeAll = true;
|
|
446
|
+
continue;
|
|
447
|
+
}
|
|
448
|
+
if (arg.startsWith("--")) {
|
|
449
|
+
throw new Error(`Unknown option ${arg}.`);
|
|
450
|
+
}
|
|
451
|
+
const normalized = arg.trim().toLowerCase();
|
|
452
|
+
if (configureFeatureAliases[normalized]) {
|
|
453
|
+
featureInputs.push(arg);
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
if (!targetPath) {
|
|
457
|
+
targetPath = arg;
|
|
458
|
+
continue;
|
|
459
|
+
}
|
|
460
|
+
featureInputs.push(arg);
|
|
461
|
+
}
|
|
462
|
+
const featureOrder = [];
|
|
463
|
+
const featureSet = new Set();
|
|
464
|
+
const addFeature = (feature) => {
|
|
465
|
+
if (!featureSet.has(feature)) {
|
|
466
|
+
featureSet.add(feature);
|
|
467
|
+
featureOrder.push(feature);
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
if (includeAll) {
|
|
471
|
+
for (const feature of AVAILABLE_CONFIGURE_FEATURES) {
|
|
472
|
+
addFeature(feature);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
for (const input of featureInputs) {
|
|
476
|
+
addFeature(resolveConfigureFeatureName(input));
|
|
477
|
+
}
|
|
478
|
+
return { targetPath, features: featureOrder };
|
|
479
|
+
}
|
|
480
|
+
const configureFeatureAliases = {
|
|
481
|
+
devops: "devops",
|
|
482
|
+
"configure-devops": "devops",
|
|
483
|
+
vscode: "vscode",
|
|
484
|
+
"configure-vscode": "vscode",
|
|
485
|
+
codegen: "codegen",
|
|
486
|
+
"configure-codegen": "codegen",
|
|
487
|
+
api: "api",
|
|
488
|
+
"configure-api": "api",
|
|
489
|
+
cron: "cron",
|
|
490
|
+
"configure-cron": "cron",
|
|
491
|
+
temporal: "temporal",
|
|
492
|
+
"configure-temporal": "temporal",
|
|
493
|
+
python: "python",
|
|
494
|
+
"configure-python": "python",
|
|
495
|
+
};
|
|
496
|
+
function resolveConfigureFeatureName(input) {
|
|
497
|
+
if (typeof input !== "string") {
|
|
498
|
+
throw new Error(`Invalid feature value ${JSON.stringify(input)}. Expected a string from: ${AVAILABLE_CONFIGURE_FEATURES.join(", ")}.`);
|
|
499
|
+
}
|
|
500
|
+
const normalized = input.trim().toLowerCase();
|
|
501
|
+
const feature = configureFeatureAliases[normalized];
|
|
502
|
+
if (!feature) {
|
|
503
|
+
throw new Error(`Unknown feature "${input}". Available features: ${AVAILABLE_CONFIGURE_FEATURES.join(", ")}.`);
|
|
504
|
+
}
|
|
505
|
+
return feature;
|
|
506
|
+
}
|
|
395
507
|
async function ensureGitRepository(dir) {
|
|
396
508
|
try {
|
|
397
509
|
const { stdout } = await execFileAsync("git", ["rev-parse", "--is-inside-work-tree"], {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uns-kit/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"description": "Command line scaffolding tool for UNS applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"azure-devops-node-api": "^15.1.1",
|
|
29
|
-
"@uns-kit/core": "0.0.
|
|
29
|
+
"@uns-kit/core": "0.0.25"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "tsc -p tsconfig.build.json",
|