@m2c2kit/cli 0.3.9 → 0.3.11

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Scott T. Yabiku
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -19,4 +19,4 @@ This package contains the command line interface (CLI) for developing m2c2kit ap
19
19
  - [Website](https://m2c2-project.github.io/m2c2kit/)
20
20
  - [Live Examples](https://m2c2-project.github.io/m2c2kit/docs/category/examples)
21
21
  - [Getting Started](https://m2c2-project.github.io/m2c2kit/docs/getting-started)
22
- - [Interactive Tutorial](https://m2c2-project.github.io/m2c2kit/docs/tutorial-fundamentals/fundamentals)
22
+ - [Interactive Tutorials](https://m2c2-project.github.io/m2c2kit/docs/category/tutorials)
package/dist/index.d.ts CHANGED
@@ -2,15 +2,14 @@
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/b674bd2c3c3e63693881ba502493bc803a820772/packages/angular_devkit/schematics_cli/bin/schematics.ts
6
- *
5
+ * https://github.com/angular/angular-cli/blob/e1d6ee2b5cc5ee34e4e5b67aaa8c34662a315007/packages/angular_devkit/schematics_cli/bin/schematics.ts
7
6
  * The license for that code is as follows:
8
7
  *
9
- * The MIT License
10
- * Copyright (c) 2010-2023 Google LLC. http://angular.io/license
11
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
+ * @license
9
+ * Copyright Google LLC All Rights Reserved.
10
+ *
11
+ * Use of this source code is governed by an MIT-style license that can be
12
+ * found in the LICENSE file at https://angular.io/license
14
13
  */
15
14
  import "symbol-observable";
16
15
  import { ProcessOutput } from "@angular-devkit/core/node";
@@ -20,3 +19,16 @@ export interface MainOptions {
20
19
  stderr?: ProcessOutput;
21
20
  }
22
21
  export declare function main({ args, stdout, stderr, }: MainOptions): Promise<0 | 1>;
22
+ /**
23
+ * This uses a dynamic import to load a module which may be ESM.
24
+ * CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
25
+ * will currently, unconditionally downlevel dynamic import into a require call.
26
+ * require calls cannot load ESM code and will result in a runtime error. To workaround
27
+ * this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
28
+ * Once TypeScript provides support for keeping the dynamic import this workaround can
29
+ * be dropped.
30
+ *
31
+ * @param modulePath The path of the module to load.
32
+ * @returns A Promise that resolves to the dynamically imported module.
33
+ */
34
+ export declare function loadEsmModule<T>(modulePath: string | URL): Promise<T>;
package/dist/index.js CHANGED
@@ -3,15 +3,14 @@
3
3
  /**
4
4
  * The code in this file is adapted from a reference CLI implementation from
5
5
  * the Angular devkit repository:
6
- * https://github.com/angular/angular-cli/blob/b674bd2c3c3e63693881ba502493bc803a820772/packages/angular_devkit/schematics_cli/bin/schematics.ts
7
- *
6
+ * https://github.com/angular/angular-cli/blob/e1d6ee2b5cc5ee34e4e5b67aaa8c34662a315007/packages/angular_devkit/schematics_cli/bin/schematics.ts
8
7
  * The license for that code is as follows:
9
8
  *
10
- * The MIT License
11
- * Copyright (c) 2010-2023 Google LLC. http://angular.io/license
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
13
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9
+ * @license
10
+ * Copyright Google LLC All Rights Reserved.
11
+ *
12
+ * Use of this source code is governed by an MIT-style license that can be
13
+ * found in the LICENSE file at https://angular.io/license
15
14
  */
16
15
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
17
16
  if (k2 === undefined) k2 = k;
@@ -37,7 +36,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
37
36
  return result;
38
37
  };
39
38
  Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.main = void 0;
39
+ exports.loadEsmModule = exports.main = void 0;
41
40
  // symbol polyfill must go first
42
41
  require("symbol-observable");
43
42
  const core_1 = require("@angular-devkit/core");
@@ -46,7 +45,6 @@ const schematics_1 = require("@angular-devkit/schematics");
46
45
  const tools_1 = require("@angular-devkit/schematics/tools");
47
46
  const ansiColors = __importStar(require("ansi-colors"));
48
47
  const fs_1 = require("fs");
49
- const inquirer = __importStar(require("inquirer"));
50
48
  const path = __importStar(require("path"));
51
49
  const yargs_parser_1 = __importStar(require("yargs-parser"));
52
50
  /**
@@ -88,7 +86,7 @@ function _listSchematics(workflow, collectionName, logger) {
88
86
  return 0;
89
87
  }
90
88
  function _createPromptProvider() {
91
- return (definitions) => {
89
+ return async (definitions) => {
92
90
  const questions = definitions.map((definition) => {
93
91
  const question = {
94
92
  name: definition.id,
@@ -147,6 +145,7 @@ function _createPromptProvider() {
147
145
  return { ...question, type: definition.type };
148
146
  }
149
147
  });
148
+ const { default: inquirer } = await loadEsmModule("inquirer");
150
149
  return inquirer.prompt(questions);
151
150
  };
152
151
  }
@@ -333,7 +332,7 @@ async function main({ args, stdout = process.stdout, stderr = process.stderr, })
333
332
  logger.fatal("The Schematic workflow failed. See above.");
334
333
  }
335
334
  else if (debug && err instanceof Error) {
336
- logger.fatal(`An error occured:\n${err.stack}`);
335
+ logger.fatal(`An error occurred:\n${err.stack}`);
337
336
  }
338
337
  else {
339
338
  logger.fatal(`Error: ${err instanceof Error ? err.message : err}`);
@@ -444,3 +443,24 @@ if (require.main === module) {
444
443
  throw e;
445
444
  });
446
445
  }
446
+ /**
447
+ * Lazily compiled dynamic import loader function.
448
+ */
449
+ let load;
450
+ /**
451
+ * This uses a dynamic import to load a module which may be ESM.
452
+ * CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
453
+ * will currently, unconditionally downlevel dynamic import into a require call.
454
+ * require calls cannot load ESM code and will result in a runtime error. To workaround
455
+ * this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
456
+ * Once TypeScript provides support for keeping the dynamic import this workaround can
457
+ * be dropped.
458
+ *
459
+ * @param modulePath The path of the module to load.
460
+ * @returns A Promise that resolves to the dynamically imported module.
461
+ */
462
+ function loadEsmModule(modulePath) {
463
+ load ?? (load = new Function("modulePath", `return import(modulePath);`));
464
+ return load(modulePath);
465
+ }
466
+ exports.loadEsmModule = loadEsmModule;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@m2c2kit/cli",
3
- "version": "0.3.9",
4
- "description": "m2c2kit command line interface",
3
+ "version": "0.3.11",
4
+ "description": "Command line interface to create new m2c2kit apps",
5
5
  "files": [
6
6
  "dist/**"
7
7
  ],
@@ -13,21 +13,33 @@
13
13
  "compile": "tsc",
14
14
  "clean": "rimraf dist"
15
15
  },
16
- "author": "",
17
16
  "license": "MIT",
17
+ "author": {
18
+ "name": "Scott T. Yabiku",
19
+ "email": "syabiku@gmail.com"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/m2c2-project/m2c2kit.git",
24
+ "directory": "packages/cli"
25
+ },
26
+ "homepage": "https://m2c2-project.github.io/m2c2kit",
18
27
  "dependencies": {
19
- "@angular-devkit/core": "^16.1.0",
20
- "@angular-devkit/schematics": "^16.1.0",
28
+ "@angular-devkit/core": "^17.0.5",
29
+ "@angular-devkit/schematics": "^17.0.5",
21
30
  "@m2c2kit/schematics": "^0.1.0",
22
- "@schematics/angular": "^16.1.0",
31
+ "@schematics/angular": "^17.0.5",
23
32
  "ansi-colors": "4.1.3",
24
- "inquirer": "8.2.4",
33
+ "inquirer": "9.2.12",
25
34
  "symbol-observable": "4.0.0",
26
35
  "yargs-parser": "21.1.1"
27
36
  },
28
37
  "devDependencies": {
29
- "@types/inquirer": "8.2.6",
30
- "rimraf": "5.0.1",
31
- "typescript": "5.1.3"
38
+ "@types/inquirer": "9.0.7",
39
+ "rimraf": "5.0.5",
40
+ "typescript": "5.3.2"
41
+ },
42
+ "engines": {
43
+ "node": ">=18"
32
44
  }
33
45
  }