@lakutata/cli 2.12.1 → 2.14.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/CHANGELOG.md CHANGED
@@ -3,6 +3,54 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.14.0](https://github.com/lakutata/lakutata-packages/compare/@lakutata/cli@2.13.0...@lakutata/cli@2.14.0) (2025-07-11)
7
+
8
+
9
+ ### Features
10
+
11
+ * **cli:** refactor template management and DTO conversion ([7072c41](https://github.com/lakutata/lakutata-packages/commit/7072c4100419db43f00dc49cdfd9e48e0ec4cb0f))
12
+
13
+
14
+
15
+
16
+
17
+ # 2.13.0 (2025-07-11)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **cli:** remove commented code in OnlineLatestVersion.ts ([8820c2b](https://github.com/lakutata/lakutata-packages/commit/8820c2bb9fb501f5139b1a8ad0e05d8bdc2ee02c))
23
+ * Fix import statements in CLIApp.ts and Information.ts ([bff006b](https://github.com/lakutata/lakutata-packages/commit/bff006b9adb51fc95bc0d018950d9b88493d60ad))
24
+
25
+
26
+ ### Features
27
+
28
+ * Add import statement for 'latest-version' package in OnlineLatestVersion.ts ([503a8af](https://github.com/lakutata/lakutata-packages/commit/503a8af2c748b2bc5f5090e44a202f04f5363baf))
29
+ * add initOnly parameter to checkTargetDirectoryIsEmpty method in Creator.ts ([bcd304c](https://github.com/lakutata/lakutata-packages/commit/bcd304c957ae93651e4dc8d1cdbc8b5d2be13fee))
30
+ * Add shx library for shell commands and update tsconfig ([5de4135](https://github.com/lakutata/lakutata-packages/commit/5de4135143d1e9b0d3c1249e52e625ef9deb7c34))
31
+ * **cli:** add 'templates' command to list available project templates ([c04ba99](https://github.com/lakutata/lakutata-packages/commit/c04ba9923d78623418aeb519c952ed5e0ec7d969))
32
+ * **cli:** add 'templates' command to list available project templates ([8e05895](https://github.com/lakutata/lakutata-packages/commit/8e05895a6e44ea471484b1f7d10a74d267e2f8d7))
33
+ * **cli:** add clean, build, and rebuild scripts ([8d145cf](https://github.com/lakutata/lakutata-packages/commit/8d145cf70b753975c0e204b772074a2786887dbb))
34
+ * **cli:** add create and info command ([670a1fc](https://github.com/lakutata/lakutata-packages/commit/670a1fcfbd38f39e6395647ffacb3867011882d7))
35
+ * **cli:** Add description and usage information to README.md file ([a4d288b](https://github.com/lakutata/lakutata-packages/commit/a4d288b9dd34549f147481d5aa36cd43620707be))
36
+ * **cli:** add initialization step after project creation ([5843178](https://github.com/lakutata/lakutata-packages/commit/5843178bfb91f1420921717fc1f63b7f11dfd48a))
37
+ * **cli:** add interactive project creation and refactor CLI ([a810d0b](https://github.com/lakutata/lakutata-packages/commit/a810d0be2bea962a61dd4223ddd97aa2c1a0d23b))
38
+ * **cli:** add template selection for project creation ([4835107](https://github.com/lakutata/lakutata-packages/commit/4835107d86bd70738a6508529e9d60efa807c356))
39
+ * **cli:** update dependencies and improve installation process ([fd70167](https://github.com/lakutata/lakutata-packages/commit/fd70167d37b3f9af738272ac2e8599d45bc26347))
40
+ * **cli:** update initOnly option to overwrite option ([9822407](https://github.com/lakutata/lakutata-packages/commit/982240776987ee281ed95e5a507ceac884146a75))
41
+ * **cli:** update log-update package import in Spinner component ([4137ffb](https://github.com/lakutata/lakutata-packages/commit/4137ffb164e1197354443e0fc997bf5c66a8486d))
42
+ * **cli:** update log-update package to version 6.1.0 ([ddf9559](https://github.com/lakutata/lakutata-packages/commit/ddf9559e8f7cca167ad3a22e58a03dbd983ccdc4))
43
+ * **cli:** update Spinner component initialization ([8d5c3c8](https://github.com/lakutata/lakutata-packages/commit/8d5c3c857c291a42f35a6d1a7b738291113706c6))
44
+ * **creator:** add project information filling ([b230861](https://github.com/lakutata/lakutata-packages/commit/b23086112dce8a5992f3e337c9f96dae8d69d5ec))
45
+ * Implement log-update in Spinner component ([ceaf657](https://github.com/lakutata/lakutata-packages/commit/ceaf6570770fce60c0fda4a46957994350f3965b))
46
+ * Update lakutata package to version 2.0.2 ([e3c0b22](https://github.com/lakutata/lakutata-packages/commit/e3c0b22e65ae250f396e8b71137f41c61049df5b))
47
+ * Update Spinner component ([fad870c](https://github.com/lakutata/lakutata-packages/commit/fad870cbcd912340c8eb9ae50286c805ca4079dd))
48
+ * Update Spinner.ts to use arrow function in setInterval ([ec3df2e](https://github.com/lakutata/lakutata-packages/commit/ec3df2e26ced10af012ed9cf6e50e108ac8205cc))
49
+
50
+
51
+
52
+
53
+
6
54
  ## [2.12.1](https://github.com/lakutata/lakutata-packages/compare/@lakutata/cli@2.12.0...@lakutata/cli@2.12.1) (2025-02-13)
7
55
 
8
56
  **Note:** Version bump only for package @lakutata/cli
package/dist/CLIApp.js CHANGED
@@ -27,94 +27,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  return (mod && mod.__esModule) ? mod : { "default": mod };
28
28
  };
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
- const commander_1 = require("commander");
31
- const CommandLineController_1 = require("./controllers/CommandLineController");
32
- const Information_1 = require("./lib/providers/Information");
33
- const package_json_1 = require("lakutata/package.json");
34
- const Creator_1 = require("./lib/providers/Creator");
35
- const DeGitPuller_1 = require("./lib/components/DeGitPuller");
36
- const Spinner_1 = require("./lib/components/Spinner");
37
- const cli_spinners_1 = require("cli-spinners");
38
- const lakutata_1 = require("lakutata");
39
- const entrypoint_1 = require("lakutata/com/entrypoint");
40
30
  const console = __importStar(require("node:console"));
41
- const OnlineLatestVersion_1 = require("./lib/providers/OnlineLatestVersion");
42
- const TemplateManager_1 = require("./lib/providers/TemplateManager");
43
31
  const node_path_1 = __importDefault(require("node:path"));
44
- lakutata_1.Application
45
- .alias({
46
- '@packageJson': node_path_1.default.resolve(__dirname, '../package.json'),
47
- '@data': node_path_1.default.resolve(__dirname, '../node_modules/.data')
48
- }, true)
49
- .run(async () => ({
50
- id: 'cli.lakutata.app',
51
- name: 'Lakutata-CLI',
52
- components: {
53
- puller: {
54
- class: DeGitPuller_1.DeGitPuller,
55
- cache: false,
56
- verbose: true,
57
- force: true,
58
- baseRepo: 'lakutata/lakutata-template'
59
- },
60
- spinner: {
61
- class: Spinner_1.Spinner,
62
- style: cli_spinners_1.dots
63
- },
64
- entrypoint: (0, entrypoint_1.BuildEntrypoints)({
65
- controllers: [CommandLineController_1.CommandLineController],
66
- cli: (0, entrypoint_1.BuildCLIEntrypoint)((module, cliMap, handler, registerDestroy) => {
67
- const CLIProgram = new commander_1.Command();
68
- cliMap.forEach((dtoJsonSchema, command) => {
69
- const cmd = new commander_1.Command(command).description(dtoJsonSchema.description);
70
- for (const property in dtoJsonSchema.properties) {
71
- const attr = dtoJsonSchema.properties[property];
72
- const optionsArgs = [`--${property} <${attr.type}>`, attr.description];
73
- if (Array.isArray(dtoJsonSchema.required) && dtoJsonSchema.required.includes(property)) {
74
- optionsArgs[1] = `(required) ${optionsArgs[1]}`;
75
- cmd.requiredOption(...optionsArgs);
76
- }
77
- else {
78
- cmd.option(...optionsArgs);
79
- }
80
- }
81
- cmd.action(async (args) => await handler(new entrypoint_1.CLIContext({
82
- command: command,
83
- data: args
84
- })));
85
- CLIProgram.addCommand(cmd);
86
- });
87
- CLIProgram.parse();
88
- })
89
- })
90
- },
91
- providers: {
92
- creator: {
93
- class: Creator_1.Creator
94
- },
95
- info: {
96
- class: Information_1.Information,
97
- name: package_json_1.name,
98
- version: package_json_1.version,
99
- description: package_json_1.description,
100
- license: package_json_1.license,
101
- currentDirectory: __dirname,
102
- workingDirectory: process.cwd()
103
- },
104
- onlineVersion: {
105
- class: OnlineLatestVersion_1.OnlineLatestVersion,
106
- name: package_json_1.name,
107
- version: package_json_1.version
108
- },
109
- templateManager: {
110
- class: TemplateManager_1.TemplateManager,
111
- apiHost: 'https://api.github.com',
112
- repoPrefix: 'lakutata-template'
113
- }
114
- },
115
- bootstrap: ['entrypoint']
116
- }))
117
- .onUncaughtException((error) => {
118
- console.error(`error: ${error.message}`);
119
- return process.exit(1);
120
- });
32
+ const ListTemplateNames_1 = require("./lib/ListTemplateNames");
33
+ const node_process_1 = __importDefault(require("node:process"));
34
+ const dataDir = node_path_1.default.resolve(__dirname, '../node_modules/.data');
35
+ const localDataFilename = node_path_1.default.resolve(dataDir, 'templates.db');
36
+ (0, ListTemplateNames_1.ListTemplateNames)(localDataFilename).then(async (templateNames) => {
37
+ node_process_1.default.env.LAKUTATA_TEMPLATE_NAMES = JSON.stringify(templateNames);
38
+ const { Config } = require('./config/Config');
39
+ const { Application } = await import('lakutata');
40
+ Application
41
+ .alias({
42
+ '@packageJson': node_path_1.default.resolve(__dirname, '../package.json'),
43
+ '@data': dataDir,
44
+ '@localDataFilename': localDataFilename
45
+ }, true)
46
+ .env({
47
+ LAKUTATA_TEMPLATE_NAMES: JSON.stringify(templateNames)
48
+ })
49
+ .run(Config)
50
+ .onUncaughtException((error) => {
51
+ console.error(`error: ${error.message}`);
52
+ return node_process_1.default.exit(1);
53
+ });
54
+ }).catch(() => node_process_1.default.exit(1));
@@ -0,0 +1,3 @@
1
+ import { ApplicationOptions } from 'lakutata';
2
+ export declare function Config(): Promise<ApplicationOptions>;
3
+ //# sourceMappingURL=Config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/config/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,UAAU,CAAA;AAkB3C,wBAAsB,MAAM,IAAI,OAAO,CAAC,kBAAkB,CAAC,CA+C1D"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Config = void 0;
4
+ const DeGitPuller_1 = require("../lib/components/DeGitPuller");
5
+ const Spinner_1 = require("../lib/components/Spinner");
6
+ const cli_spinners_1 = require("cli-spinners");
7
+ const entrypoint_1 = require("lakutata/com/entrypoint");
8
+ const CommandLineController_1 = require("../controllers/CommandLineController");
9
+ const Creator_1 = require("../lib/providers/Creator");
10
+ const Information_1 = require("../lib/providers/Information");
11
+ const package_json_1 = require("lakutata/package.json");
12
+ const TemplateManager_1 = require("../lib/providers/TemplateManager");
13
+ const OnlineLatestVersion_1 = require("../lib/providers/OnlineLatestVersion");
14
+ const SetupCLIEntrypoint_1 = require("./SetupCLIEntrypoint");
15
+ async function Config() {
16
+ return {
17
+ id: 'cli.lakutata.app',
18
+ name: 'Lakutata-CLI',
19
+ components: {
20
+ puller: {
21
+ class: DeGitPuller_1.DeGitPuller,
22
+ cache: false,
23
+ verbose: true,
24
+ force: true,
25
+ baseRepo: 'lakutata/lakutata-template'
26
+ },
27
+ spinner: {
28
+ class: Spinner_1.Spinner,
29
+ style: cli_spinners_1.dots
30
+ },
31
+ entrypoint: (0, entrypoint_1.BuildEntrypoints)({
32
+ controllers: [CommandLineController_1.CommandLineController],
33
+ cli: (0, SetupCLIEntrypoint_1.SetupCLIEntrypoint)()
34
+ })
35
+ },
36
+ providers: {
37
+ creator: {
38
+ class: Creator_1.Creator
39
+ },
40
+ info: {
41
+ class: Information_1.Information,
42
+ name: package_json_1.name,
43
+ version: package_json_1.version,
44
+ description: package_json_1.description,
45
+ license: package_json_1.license,
46
+ currentDirectory: __dirname,
47
+ workingDirectory: process.cwd()
48
+ },
49
+ onlineVersion: {
50
+ class: OnlineLatestVersion_1.OnlineLatestVersion,
51
+ name: package_json_1.name,
52
+ version: package_json_1.version
53
+ },
54
+ templateManager: {
55
+ class: TemplateManager_1.TemplateManager,
56
+ apiHost: 'https://api.github.com',
57
+ repoPrefix: 'lakutata-template'
58
+ }
59
+ },
60
+ bootstrap: ['entrypoint']
61
+ };
62
+ }
63
+ exports.Config = Config;
@@ -0,0 +1,3 @@
1
+ import { CLIEntrypoint } from 'lakutata/com/entrypoint';
2
+ export declare function SetupCLIEntrypoint(): CLIEntrypoint;
3
+ //# sourceMappingURL=SetupCLIEntrypoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SetupCLIEntrypoint.d.ts","sourceRoot":"","sources":["../../src/config/SetupCLIEntrypoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,aAAa,EAA+B,MAAM,yBAAyB,CAAA;AAInH,wBAAgB,kBAAkB,IAAI,aAAa,CAuBlD"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SetupCLIEntrypoint = void 0;
4
+ const entrypoint_1 = require("lakutata/com/entrypoint");
5
+ const commander_1 = require("commander");
6
+ function SetupCLIEntrypoint() {
7
+ return (0, entrypoint_1.BuildCLIEntrypoint)((module, cliMap, handler) => {
8
+ const CLIProgram = new commander_1.Command();
9
+ cliMap.forEach((dtoJsonSchema, command) => {
10
+ const cmd = new commander_1.Command(command).description(dtoJsonSchema.description);
11
+ for (const property in dtoJsonSchema.properties) {
12
+ const attr = dtoJsonSchema.properties[property];
13
+ const optionsArgs = [`--${property} <${attr.type}>`, attr.description];
14
+ if (Array.isArray(dtoJsonSchema.required) && dtoJsonSchema.required.includes(property)) {
15
+ optionsArgs[1] = `(required) ${optionsArgs[1]}`;
16
+ cmd.requiredOption(...optionsArgs);
17
+ }
18
+ else {
19
+ cmd.option(...optionsArgs);
20
+ }
21
+ }
22
+ cmd.action(async (args) => await handler(new entrypoint_1.CLIContext({
23
+ command: command,
24
+ data: args
25
+ })));
26
+ CLIProgram.addCommand(cmd);
27
+ });
28
+ CLIProgram.parse();
29
+ });
30
+ }
31
+ exports.SetupCLIEntrypoint = SetupCLIEntrypoint;
@@ -1,5 +1,3 @@
1
- import { CreateProjectOptions } from '../options/CreateProjectOptions';
2
- import { LakutataInfoOptions } from '../options/LakutataInfoOptions';
3
1
  import { Information } from '../lib/providers/Information';
4
2
  import { Creator } from '../lib/providers/Creator';
5
3
  import { type ActionPattern } from 'lakutata';
@@ -12,9 +10,8 @@ export declare class CommandLineController extends Controller {
12
10
  protected readonly templateManager: TemplateManager;
13
11
  /**
14
12
  * Create project
15
- * @param inp
16
13
  */
17
- create(inp: ActionPattern<CreateProjectOptions>): Promise<void>;
14
+ create(): Promise<void>;
18
15
  /**
19
16
  * List templates
20
17
  * @param inp
@@ -22,8 +19,7 @@ export declare class CommandLineController extends Controller {
22
19
  templates(inp: ActionPattern<ListTemplatesOptions>): Promise<void>;
23
20
  /**
24
21
  * Show framework info
25
- * @param inp
26
22
  */
27
- info(inp: ActionPattern<LakutataInfoOptions>): Promise<void>;
23
+ info(): Promise<void>;
28
24
  }
29
25
  //# sourceMappingURL=CommandLineController.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CommandLineController.d.ts","sourceRoot":"","sources":["../../src/controllers/CommandLineController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAC,mBAAmB,EAAC,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAC,OAAO,EAAC,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAC,KAAK,aAAa,EAAC,MAAM,UAAU,CAAA;AAG3C,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAA;AAClD,OAAO,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAC,eAAe,EAAC,MAAM,kCAAkC,CAAA;AAEhE,qBAAa,qBAAsB,SAAQ,UAAU;IAGjD,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAA;IAG1C,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAA;IAG7C,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAA;IAEnD;;;OAGG;IAEU,MAAM,CAAC,GAAG,EAAE,aAAa,CAAC,oBAAoB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5E;;;OAGG;IAEU,SAAS,CAAC,GAAG,EAAE,aAAa,CAAC,oBAAoB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/E;;;OAGG;IAEU,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,mBAAmB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAG5E"}
1
+ {"version":3,"file":"CommandLineController.d.ts","sourceRoot":"","sources":["../../src/controllers/CommandLineController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAC,OAAO,EAAC,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAC,KAAK,aAAa,EAAM,MAAM,UAAU,CAAA;AAGhD,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAA;AAClD,OAAO,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAC,eAAe,EAAC,MAAM,kCAAkC,CAAA;AAIhE,qBAAa,qBAAsB,SAAQ,UAAU;IAGjD,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAA;IAG1C,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAA;IAG7C,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAA;IAEnD;;OAEG;IAEU,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAIpC;;;OAGG;IAEU,SAAS,CAAC,GAAG,EAAE,aAAa,CAAC,oBAAoB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/E;;OAEG;IAEU,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAGrC"}
@@ -10,22 +10,22 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CommandLineController = void 0;
13
- const CreateProjectOptions_1 = require("../options/CreateProjectOptions");
14
- const LakutataInfoOptions_1 = require("../options/LakutataInfoOptions");
15
13
  const Information_1 = require("../lib/providers/Information");
16
14
  const Creator_1 = require("../lib/providers/Creator");
15
+ const lakutata_1 = require("lakutata");
17
16
  const di_1 = require("lakutata/decorator/di");
18
17
  const ctrl_1 = require("lakutata/decorator/ctrl");
19
18
  const entrypoint_1 = require("lakutata/com/entrypoint");
20
19
  const ListTemplatesOptions_1 = require("../options/ListTemplatesOptions");
21
20
  const TemplateManager_1 = require("../lib/providers/TemplateManager");
21
+ const CreateProjectOptions_1 = require("../options/CreateProjectOptions");
22
+ const ConvertDTO2Inquirer_1 = require("../lib/ConvertDTO2Inquirer");
22
23
  class CommandLineController extends entrypoint_1.Controller {
23
24
  /**
24
25
  * Create project
25
- * @param inp
26
26
  */
27
- async create(inp) {
28
- await this.projectCreator.create(inp);
27
+ async create() {
28
+ await this.projectCreator.create(await (0, ConvertDTO2Inquirer_1.ConvertDTO2Inquirer)(CreateProjectOptions_1.CreateProjectOptions));
29
29
  }
30
30
  /**
31
31
  * List templates
@@ -36,9 +36,8 @@ class CommandLineController extends entrypoint_1.Controller {
36
36
  }
37
37
  /**
38
38
  * Show framework info
39
- * @param inp
40
39
  */
41
- async info(inp) {
40
+ async info() {
42
41
  await this.frameworkInfo.print();
43
42
  }
44
43
  }
@@ -56,14 +55,13 @@ __decorate([
56
55
  __metadata("design:type", TemplateManager_1.TemplateManager
57
56
  /**
58
57
  * Create project
59
- * @param inp
60
58
  */
61
59
  )
62
60
  ], CommandLineController.prototype, "templateManager", void 0);
63
61
  __decorate([
64
- (0, ctrl_1.CLIAction)('create', CreateProjectOptions_1.CreateProjectOptions.description('create a Lakutata project')),
62
+ (0, ctrl_1.CLIAction)('create', lakutata_1.DTO.description('create a Lakutata project')),
65
63
  __metadata("design:type", Function),
66
- __metadata("design:paramtypes", [Object]),
64
+ __metadata("design:paramtypes", []),
67
65
  __metadata("design:returntype", Promise)
68
66
  ], CommandLineController.prototype, "create", null);
69
67
  __decorate([
@@ -73,8 +71,8 @@ __decorate([
73
71
  __metadata("design:returntype", Promise)
74
72
  ], CommandLineController.prototype, "templates", null);
75
73
  __decorate([
76
- (0, ctrl_1.CLIAction)('info', LakutataInfoOptions_1.LakutataInfoOptions.description('show Lakutata framework info')),
74
+ (0, ctrl_1.CLIAction)('info', lakutata_1.DTO.description('show Lakutata framework info')),
77
75
  __metadata("design:type", Function),
78
- __metadata("design:paramtypes", [Object]),
76
+ __metadata("design:paramtypes", []),
79
77
  __metadata("design:returntype", Promise)
80
78
  ], CommandLineController.prototype, "info", null);
@@ -0,0 +1,3 @@
1
+ import { ActionPattern, DTO } from 'lakutata';
2
+ export declare function ConvertDTO2Inquirer<InputDTO extends typeof DTO>(dto: InputDTO): Promise<ActionPattern<any>>;
3
+ //# sourceMappingURL=ConvertDTO2Inquirer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConvertDTO2Inquirer.d.ts","sourceRoot":"","sources":["../../src/lib/ConvertDTO2Inquirer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,GAAG,EAAC,MAAM,UAAU,CAAA;AAG3C,wBAAsB,mBAAmB,CAAC,QAAQ,SAAS,OAAO,GAAG,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAmDjH"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ConvertDTO2Inquirer = void 0;
7
+ const inquirer_1 = __importDefault(require("inquirer"));
8
+ async function ConvertDTO2Inquirer(dto) {
9
+ const jsonSchema = dto.toOpenAPIJsonSchema();
10
+ const prompts = [];
11
+ for (const propertyName in jsonSchema.properties) {
12
+ const propertyInfo = jsonSchema.properties[propertyName];
13
+ const propertyRequired = Array.isArray(jsonSchema.required) && jsonSchema.required.includes(propertyName);
14
+ switch (propertyInfo.type) {
15
+ case 'boolean':
16
+ {
17
+ prompts.push({
18
+ name: propertyName,
19
+ type: 'confirm',
20
+ message: propertyInfo.description || '',
21
+ default: propertyInfo.default,
22
+ required: propertyRequired
23
+ });
24
+ }
25
+ break;
26
+ case 'string':
27
+ default: {
28
+ if (propertyInfo.enum) {
29
+ const enums = propertyInfo.enum;
30
+ prompts.push({
31
+ name: propertyName,
32
+ type: 'list',
33
+ message: propertyInfo.description || '',
34
+ required: propertyRequired,
35
+ choices: enums.map((value) => ({
36
+ name: value,
37
+ value: value
38
+ })),
39
+ validate: (input) => enums.includes(input)
40
+ });
41
+ }
42
+ else {
43
+ prompts.push({
44
+ name: propertyName,
45
+ type: 'input',
46
+ message: propertyInfo.description || '',
47
+ default: propertyInfo.default,
48
+ required: propertyRequired,
49
+ validate: (input) => {
50
+ if (propertyInfo.pattern) {
51
+ return new RegExp(propertyInfo.pattern).test(input);
52
+ }
53
+ return true;
54
+ }
55
+ });
56
+ }
57
+ }
58
+ }
59
+ }
60
+ return inquirer_1.default.prompt(prompts);
61
+ }
62
+ exports.ConvertDTO2Inquirer = ConvertDTO2Inquirer;
@@ -0,0 +1,2 @@
1
+ export declare function ListTemplateNames(localDataFilename: string): Promise<string[]>;
2
+ //# sourceMappingURL=ListTemplateNames.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListTemplateNames.d.ts","sourceRoot":"","sources":["../../src/lib/ListTemplateNames.ts"],"names":[],"mappings":"AAIA,wBAAsB,iBAAiB,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAWpF"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ListTemplateNames = void 0;
4
+ const helper_1 = require("lakutata/helper");
5
+ const lakutata_1 = require("lakutata");
6
+ const promises_1 = require("node:fs/promises");
7
+ async function ListTemplateNames(localDataFilename) {
8
+ const isLocalDataExists = await (0, helper_1.IsExists)(localDataFilename);
9
+ let cache = {
10
+ templates: [],
11
+ updatedAt: lakutata_1.Time.now()
12
+ };
13
+ if (isLocalDataExists) {
14
+ cache = JSON.parse(await (0, promises_1.readFile)(localDataFilename, { encoding: 'utf-8' }));
15
+ }
16
+ if (!cache)
17
+ return [];
18
+ return cache.templates.map(template => template.name);
19
+ }
20
+ exports.ListTemplateNames = ListTemplateNames;
@@ -103,7 +103,7 @@ class Creator extends lakutata_1.Provider {
103
103
  table.push([{ content: ansis_1.default.bold.cyan('Project Creation Information'), colSpan: 2, hAlign: 'center' }], [ansis_1.default.blue('APP ID & Project Name'), appId], [ansis_1.default.blue('APP Name'), appName], [ansis_1.default.blue('APP Description'), appDescription], [ansis_1.default.blue('Project Create Target Path'), targetPath], [ansis_1.default.blue('Project Create Mode'), options.overwrite ? ansis_1.default.yellow('Initialize project in an existing directory') : ansis_1.default.green('Create a new folder for the project')], [ansis_1.default.blue('Project Author Name'), authorName], [ansis_1.default.blue('Project License'), licenseName], [ansis_1.default.blue('Project Template Repository'), this.puller.getGitSource(appTemplate)]);
104
104
  console.log(table.toString());
105
105
  await new Promise(resolve => {
106
- let timeLeft = 15;
106
+ let timeLeft = 10;
107
107
  const interval = setInterval(() => {
108
108
  timeLeft -= 1;
109
109
  if (!timeLeft) {
@@ -14,11 +14,6 @@ export declare class TemplateManager extends Provider {
14
14
  protected readonly apiHost: string;
15
15
  protected readonly repoPrefix: string;
16
16
  protected readonly localDataFilename: string;
17
- /**
18
- * Initializer
19
- * @protected
20
- */
21
- protected init(): Promise<void>;
22
17
  /**
23
18
  * Fetch template repository list from remote
24
19
  * @protected
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateManager.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/TemplateManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAO,QAAQ,EAAO,MAAM,UAAU,CAAA;AACzD,OAAO,EAAC,oBAAoB,EAAC,MAAM,oCAAoC,CAAA;AAQvE,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAE1C,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAA;AAG7C,KAAK,YAAY,GAAG;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;CACrB,CAAA;AAQD,qBAAa,eAAgB,SAAQ,QAAQ;IAGzC,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAA;IAGnC,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IAG9B,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IAGnC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAGlC,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAErC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAwC;IAEpF;;;OAGG;cACa,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrC;;;OAGG;cACa,kBAAkB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IA0B7D;;;OAGG;IAEU,IAAI,CAAC,OAAO,EAAE,oBAAoB;IAyB/C;;;;;OAKG;IACH,SAAS,CAAC,cAAc,CAAC,aAAa,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;CAmBnF"}
1
+ {"version":3,"file":"TemplateManager.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/TemplateManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAO,QAAQ,EAAO,MAAM,UAAU,CAAA;AACzD,OAAO,EAAC,oBAAoB,EAAC,MAAM,oCAAoC,CAAA;AAQvE,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAE1C,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAA;AAG7C,KAAK,YAAY,GAAG;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;CACrB,CAAA;AAQD,qBAAa,eAAgB,SAAQ,QAAQ;IAGzC,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAA;IAGnC,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IAG9B,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IAGnC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAGlC,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAErC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAqC;IAEjF;;;OAGG;cACa,kBAAkB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IA0B7D;;;OAGG;IAEU,IAAI,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAyB/D;;;;;OAKG;IACH,SAAS,CAAC,cAAc,CAAC,aAAa,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;CAmBnF"}
@@ -52,13 +52,7 @@ const promises_1 = require("node:fs/promises");
52
52
  class TemplateManager extends lakutata_1.Provider {
53
53
  constructor() {
54
54
  super(...arguments);
55
- this.localDataFilename = node_path_1.default.resolve('@data', 'templates.db');
56
- }
57
- /**
58
- * Initializer
59
- * @protected
60
- */
61
- async init() {
55
+ this.localDataFilename = node_path_1.default.resolve('@localDataFilename');
62
56
  }
63
57
  /**
64
58
  * Fetch template repository list from remote
@@ -1 +1 @@
1
- {"version":3,"file":"CreateProjectOptions.d.ts","sourceRoot":"","sources":["../../src/options/CreateProjectOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,UAAU,CAAA;AAG5B;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,GAAG;IASlC,IAAI,EAAE,MAAM,CAAA;IASZ,EAAE,EAAE,MAAM,CAAA;IAQV,QAAQ,EAAE,MAAM,CAAA;IAShB,IAAI,EAAE,MAAM,CAAA;IAUZ,SAAS,EAAE,OAAO,CAAA;IASlB,WAAW,EAAE,MAAM,CAAA;IASnB,MAAM,EAAE,MAAM,CAAA;IASd,OAAO,EAAE,MAAM,CAAA;CACzB"}
1
+ {"version":3,"file":"CreateProjectOptions.d.ts","sourceRoot":"","sources":["../../src/options/CreateProjectOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,UAAU,CAAA;AAQ5B;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,GAAG;IAQlC,IAAI,EAAE,MAAM,CAAA;IASZ,EAAE,EAAE,MAAM,CAAA;IAUV,QAAQ,EAAE,MAAM,CAAA;IAShB,IAAI,EAAE,MAAM,CAAA;IAUZ,SAAS,EAAE,OAAO,CAAA;IASlB,WAAW,EAAE,MAAM,CAAA;IASnB,MAAM,EAAE,MAAM,CAAA;IASd,OAAO,EAAE,MAAM,CAAA;CACzB"}
@@ -8,10 +8,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.CreateProjectOptions = void 0;
13
16
  const lakutata_1 = require("lakutata");
14
17
  const dto_1 = require("lakutata/decorator/dto");
18
+ const node_process_1 = __importDefault(require("node:process"));
19
+ function templateNames() {
20
+ return node_process_1.default.env.LAKUTATA_TEMPLATE_NAMES ? JSON.parse(node_process_1.default.env.LAKUTATA_TEMPLATE_NAMES) : [];
21
+ }
15
22
  /**
16
23
  * Create project options
17
24
  */
@@ -23,7 +30,7 @@ __decorate([
23
30
  .String()
24
31
  .required()
25
32
  .pattern(/^(\w+\.?)*\w+$/)
26
- .description('specify the name of the project and application')),
33
+ .description('Specify the name of the application')),
27
34
  __metadata("design:type", String)
28
35
  ], CreateProjectOptions.prototype, "name", void 0);
29
36
  __decorate([
@@ -31,22 +38,24 @@ __decorate([
31
38
  .String()
32
39
  .required()
33
40
  .pattern(/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/) //Match package json name regex
34
- .description('specify the ID of the application')),
41
+ .description('Specify the ID of the application')),
35
42
  __metadata("design:type", String)
36
43
  ], CreateProjectOptions.prototype, "id", void 0);
37
44
  __decorate([
38
45
  (0, dto_1.Expect)(lakutata_1.DTO
39
46
  .String()
40
47
  .required()
41
- .description('choose a template for this project')),
48
+ .allow(...templateNames())
49
+ .only()
50
+ .description('Choose a template for this project')),
42
51
  __metadata("design:type", String)
43
52
  ], CreateProjectOptions.prototype, "template", void 0);
44
53
  __decorate([
45
54
  (0, dto_1.Expect)(lakutata_1.DTO
46
55
  .String()
47
56
  .optional()
48
- .default(process.cwd())
49
- .description(`specify the path for creating the project (default: "${process.cwd()}")`)),
57
+ .default(node_process_1.default.cwd())
58
+ .description('Specify the path for creating the project')),
50
59
  __metadata("design:type", String)
51
60
  ], CreateProjectOptions.prototype, "path", void 0);
52
61
  __decorate([
@@ -55,7 +64,7 @@ __decorate([
55
64
  .strict(false)
56
65
  .optional()
57
66
  .default(false)
58
- .description('initialize the project within an existing folder (default: false)')),
67
+ .description('Initialize the project within an existing folder')),
59
68
  __metadata("design:type", Boolean)
60
69
  ], CreateProjectOptions.prototype, "overwrite", void 0);
61
70
  __decorate([
@@ -63,7 +72,7 @@ __decorate([
63
72
  .String()
64
73
  .optional()
65
74
  .default('none')
66
- .description('specify the description of the application (default: "none")')),
75
+ .description('Specify the description of the application')),
67
76
  __metadata("design:type", String)
68
77
  ], CreateProjectOptions.prototype, "description", void 0);
69
78
  __decorate([
@@ -71,7 +80,7 @@ __decorate([
71
80
  .String()
72
81
  .optional()
73
82
  .default('Anonymous')
74
- .description('specify the name of the author of the application (default: "Anonymous")')),
83
+ .description('Specify the name of the author of the application')),
75
84
  __metadata("design:type", String)
76
85
  ], CreateProjectOptions.prototype, "author", void 0);
77
86
  __decorate([
@@ -79,6 +88,6 @@ __decorate([
79
88
  .String()
80
89
  .optional()
81
90
  .default('UNLICENSED')
82
- .description('specify the name of the license for the application (default: "UNLICENSED")')),
91
+ .description('Specify the name of the license for the application')),
83
92
  __metadata("design:type", String)
84
93
  ], CreateProjectOptions.prototype, "license", void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lakutata/cli",
3
- "version": "2.12.1",
3
+ "version": "2.14.0",
4
4
  "description": "Lakutata CLI tool",
5
5
  "keywords": [
6
6
  "lakutata",
@@ -24,9 +24,10 @@
24
24
  "clean": "shx rm -rf ./dist",
25
25
  "build": "tsc",
26
26
  "rebuild": "npm run clean && npm run build",
27
- "test:info": "tsx src/CLIApp.ts info",
28
- "test:templates": "tsx src/CLIApp.ts templates",
29
- "test:create": "tsx src/CLIApp.ts create --help"
27
+ "test": "bun src/CLIApp.ts",
28
+ "test:info": "bun src/CLIApp.ts info",
29
+ "test:templates": "bun src/CLIApp.ts templates",
30
+ "test:create": "bun src/CLIApp.ts create"
30
31
  },
31
32
  "bugs": {
32
33
  "url": "https://github.com/lakutata/lakutata-packages/issues"
@@ -38,6 +39,7 @@
38
39
  "commander": "^12.0.0",
39
40
  "degit": "^2.8.4",
40
41
  "execa": "^8.0.1",
42
+ "inquirer": "^12.7.0",
41
43
  "lakutata": "^2.0.13",
42
44
  "latest-version": "^9.0.0",
43
45
  "log-update": "^6.1.0",
@@ -48,5 +50,5 @@
48
50
  "devDependencies": {
49
51
  "@types/degit": "^2.8.6"
50
52
  },
51
- "gitHead": "7fe4789e1ca4923ef5ad7bb747f94347786bf879"
53
+ "gitHead": "dd63eb76227cfa240247f8f2edf368fa9f327091"
52
54
  }