@m2c2kit/cli 0.3.15 → 0.3.16
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/index.d.ts +1 -1
- package/dist/index.js +15 -24
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* The code in this file is adapted from a reference CLI implementation from
|
|
4
4
|
* the Angular devkit repository:
|
|
5
|
-
* https://github.com/angular/angular-cli/blob/
|
|
5
|
+
* https://github.com/angular/angular-cli/blob/f5c250ab48e22c5aff31d8ebd35fb9a88e380fd7/packages/angular_devkit/schematics_cli/bin/schematics.ts
|
|
6
6
|
* The license for that code is as follows:
|
|
7
7
|
* @license
|
|
8
8
|
* Copyright Google LLC All Rights Reserved.
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
/* eslint-disable no-case-declarations */
|
|
4
3
|
/**
|
|
5
4
|
* The code in this file is adapted from a reference CLI implementation from
|
|
6
5
|
* the Angular devkit repository:
|
|
7
|
-
* https://github.com/angular/angular-cli/blob/
|
|
6
|
+
* https://github.com/angular/angular-cli/blob/f5c250ab48e22c5aff31d8ebd35fb9a88e380fd7/packages/angular_devkit/schematics_cli/bin/schematics.ts
|
|
8
7
|
* The license for that code is as follows:
|
|
9
8
|
* @license
|
|
10
9
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -39,7 +38,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
38
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
39
|
};
|
|
41
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.main =
|
|
41
|
+
exports.main = main;
|
|
43
42
|
// symbol polyfill must go first
|
|
44
43
|
require("symbol-observable");
|
|
45
44
|
const node_1 = require("@angular-devkit/core/node");
|
|
@@ -76,6 +75,9 @@ function parseSchematicName(str) {
|
|
|
76
75
|
}
|
|
77
76
|
return { collection, schematic };
|
|
78
77
|
}
|
|
78
|
+
function removeLeadingSlash(value) {
|
|
79
|
+
return value[0] === "/" ? value.slice(1) : value;
|
|
80
|
+
}
|
|
79
81
|
function _listSchematics(workflow, collectionName, logger) {
|
|
80
82
|
try {
|
|
81
83
|
const collection = workflow.engine.createCollection(collectionName);
|
|
@@ -105,8 +107,10 @@ function _createPromptProvider() {
|
|
|
105
107
|
if (!definition.items?.length) {
|
|
106
108
|
continue;
|
|
107
109
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
answers[definition.id] = await (definition.multiselect ? prompts.checkbox : prompts.select)({
|
|
111
|
+
message: definition.message,
|
|
112
|
+
default: definition.default,
|
|
113
|
+
choices: definition.items.map((item) => typeof item == "string"
|
|
110
114
|
? {
|
|
111
115
|
name: item,
|
|
112
116
|
value: item,
|
|
@@ -114,15 +118,10 @@ function _createPromptProvider() {
|
|
|
114
118
|
: {
|
|
115
119
|
name: item.label,
|
|
116
120
|
value: item.value,
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
answers[definition.id] = await (definition.multiselect ? prompts.checkbox : prompts.select)({
|
|
120
|
-
message: definition.message,
|
|
121
|
-
default: definition.default,
|
|
122
|
-
choices,
|
|
121
|
+
}),
|
|
123
122
|
});
|
|
124
123
|
break;
|
|
125
|
-
case "input":
|
|
124
|
+
case "input": {
|
|
126
125
|
let finalValue;
|
|
127
126
|
answers[definition.id] = await prompts.input({
|
|
128
127
|
message: definition.message,
|
|
@@ -162,6 +161,7 @@ function _createPromptProvider() {
|
|
|
162
161
|
answers[definition.id] = finalValue;
|
|
163
162
|
}
|
|
164
163
|
break;
|
|
164
|
+
}
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
return answers;
|
|
@@ -266,16 +266,11 @@ async function main({ args, stdout = process.stdout, stderr = process.stderr, })
|
|
|
266
266
|
workflow.reporter.subscribe((event) => {
|
|
267
267
|
nothingDone = false;
|
|
268
268
|
// Strip leading slash to prevent confusion.
|
|
269
|
-
const eventPath = event.path
|
|
270
|
-
? event.path.slice(1)
|
|
271
|
-
: event.path;
|
|
269
|
+
const eventPath = removeLeadingSlash(event.path);
|
|
272
270
|
switch (event.kind) {
|
|
273
271
|
case "error":
|
|
274
272
|
error = true;
|
|
275
|
-
|
|
276
|
-
? "already exists"
|
|
277
|
-
: "does not exist";
|
|
278
|
-
logger.error(`ERROR! ${eventPath} ${desc}.`);
|
|
273
|
+
logger.error(`ERROR! ${eventPath} ${event.description == "alreadyExist" ? "already exists" : "does not exist"}.`);
|
|
279
274
|
break;
|
|
280
275
|
case "update":
|
|
281
276
|
loggingQueue.push(`${colors.cyan("UPDATE")} ${eventPath} (${event.content.length} bytes)`);
|
|
@@ -287,10 +282,7 @@ async function main({ args, stdout = process.stdout, stderr = process.stderr, })
|
|
|
287
282
|
loggingQueue.push(`${colors.yellow("DELETE")} ${eventPath}`);
|
|
288
283
|
break;
|
|
289
284
|
case "rename":
|
|
290
|
-
|
|
291
|
-
? event.to.slice(1)
|
|
292
|
-
: event.to;
|
|
293
|
-
loggingQueue.push(`${colors.blue("RENAME")} ${eventPath} => ${eventToPath}`);
|
|
285
|
+
loggingQueue.push(`${colors.blue("RENAME")} ${eventPath} => ${removeLeadingSlash(event.to)}`);
|
|
294
286
|
break;
|
|
295
287
|
}
|
|
296
288
|
});
|
|
@@ -356,7 +348,6 @@ async function main({ args, stdout = process.stdout, stderr = process.stderr, })
|
|
|
356
348
|
return 1;
|
|
357
349
|
}
|
|
358
350
|
}
|
|
359
|
-
exports.main = main;
|
|
360
351
|
/**
|
|
361
352
|
* Get usage of the CLI tool.
|
|
362
353
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m2c2kit/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.16",
|
|
4
4
|
"description": "Command line interface to create new m2c2kit apps",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**"
|
|
@@ -25,19 +25,19 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://m2c2-project.github.io/m2c2kit",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@angular-devkit/core": "^18.0
|
|
29
|
-
"@angular-devkit/schematics": "^18.0
|
|
30
|
-
"@inquirer/prompts": "5.
|
|
31
|
-
"@m2c2kit/schematics": "
|
|
32
|
-
"@schematics/angular": "^18.0
|
|
28
|
+
"@angular-devkit/core": "^18.1.0",
|
|
29
|
+
"@angular-devkit/schematics": "^18.1.0",
|
|
30
|
+
"@inquirer/prompts": "5.1.3",
|
|
31
|
+
"@m2c2kit/schematics": "0.1.16",
|
|
32
|
+
"@schematics/angular": "^18.1.0",
|
|
33
33
|
"ansi-colors": "4.1.3",
|
|
34
34
|
"symbol-observable": "4.0.0",
|
|
35
35
|
"yargs-parser": "21.1.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/inquirer": "9.0.7",
|
|
39
|
-
"rimraf": "
|
|
40
|
-
"typescript": "5.
|
|
39
|
+
"rimraf": "6.0.1",
|
|
40
|
+
"typescript": "5.5.3"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=18"
|