@lakutata/cli 2.12.0 → 2.13.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 +45 -0
- package/dist/CLIApp.js +2 -79
- package/dist/config/Config.d.ts +3 -0
- package/dist/config/Config.d.ts.map +1 -0
- package/dist/config/Config.js +63 -0
- package/dist/config/SetupCLIEntrypoint.d.ts +3 -0
- package/dist/config/SetupCLIEntrypoint.d.ts.map +1 -0
- package/dist/config/SetupCLIEntrypoint.js +31 -0
- package/dist/controllers/CommandLineController.d.ts +2 -6
- package/dist/controllers/CommandLineController.d.ts.map +1 -1
- package/dist/controllers/CommandLineController.js +35 -12
- package/dist/lib/ConvertDTO2Inquirer.d.ts +3 -0
- package/dist/lib/ConvertDTO2Inquirer.d.ts.map +1 -0
- package/dist/lib/ConvertDTO2Inquirer.js +62 -0
- package/dist/lib/providers/Creator.js +1 -1
- package/dist/lib/providers/TemplateManager.d.ts +1 -0
- package/dist/lib/providers/TemplateManager.d.ts.map +1 -1
- package/dist/lib/providers/TemplateManager.js +15 -0
- package/dist/options/CreateProjectOptions.d.ts.map +1 -1
- package/dist/options/CreateProjectOptions.js +15 -9
- package/package.json +8 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,51 @@
|
|
|
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.13.0 (2025-07-11)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **cli:** remove commented code in OnlineLatestVersion.ts ([8820c2b](https://github.com/lakutata/lakutata-packages/commit/8820c2bb9fb501f5139b1a8ad0e05d8bdc2ee02c))
|
|
12
|
+
* Fix import statements in CLIApp.ts and Information.ts ([bff006b](https://github.com/lakutata/lakutata-packages/commit/bff006b9adb51fc95bc0d018950d9b88493d60ad))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* Add import statement for 'latest-version' package in OnlineLatestVersion.ts ([503a8af](https://github.com/lakutata/lakutata-packages/commit/503a8af2c748b2bc5f5090e44a202f04f5363baf))
|
|
18
|
+
* add initOnly parameter to checkTargetDirectoryIsEmpty method in Creator.ts ([bcd304c](https://github.com/lakutata/lakutata-packages/commit/bcd304c957ae93651e4dc8d1cdbc8b5d2be13fee))
|
|
19
|
+
* Add shx library for shell commands and update tsconfig ([5de4135](https://github.com/lakutata/lakutata-packages/commit/5de4135143d1e9b0d3c1249e52e625ef9deb7c34))
|
|
20
|
+
* **cli:** add 'templates' command to list available project templates ([c04ba99](https://github.com/lakutata/lakutata-packages/commit/c04ba9923d78623418aeb519c952ed5e0ec7d969))
|
|
21
|
+
* **cli:** add 'templates' command to list available project templates ([8e05895](https://github.com/lakutata/lakutata-packages/commit/8e05895a6e44ea471484b1f7d10a74d267e2f8d7))
|
|
22
|
+
* **cli:** add clean, build, and rebuild scripts ([8d145cf](https://github.com/lakutata/lakutata-packages/commit/8d145cf70b753975c0e204b772074a2786887dbb))
|
|
23
|
+
* **cli:** add create and info command ([670a1fc](https://github.com/lakutata/lakutata-packages/commit/670a1fcfbd38f39e6395647ffacb3867011882d7))
|
|
24
|
+
* **cli:** Add description and usage information to README.md file ([a4d288b](https://github.com/lakutata/lakutata-packages/commit/a4d288b9dd34549f147481d5aa36cd43620707be))
|
|
25
|
+
* **cli:** add initialization step after project creation ([5843178](https://github.com/lakutata/lakutata-packages/commit/5843178bfb91f1420921717fc1f63b7f11dfd48a))
|
|
26
|
+
* **cli:** add interactive project creation and refactor CLI ([a810d0b](https://github.com/lakutata/lakutata-packages/commit/a810d0be2bea962a61dd4223ddd97aa2c1a0d23b))
|
|
27
|
+
* **cli:** add template selection for project creation ([4835107](https://github.com/lakutata/lakutata-packages/commit/4835107d86bd70738a6508529e9d60efa807c356))
|
|
28
|
+
* **cli:** update dependencies and improve installation process ([fd70167](https://github.com/lakutata/lakutata-packages/commit/fd70167d37b3f9af738272ac2e8599d45bc26347))
|
|
29
|
+
* **cli:** update initOnly option to overwrite option ([9822407](https://github.com/lakutata/lakutata-packages/commit/982240776987ee281ed95e5a507ceac884146a75))
|
|
30
|
+
* **cli:** update log-update package import in Spinner component ([4137ffb](https://github.com/lakutata/lakutata-packages/commit/4137ffb164e1197354443e0fc997bf5c66a8486d))
|
|
31
|
+
* **cli:** update log-update package to version 6.1.0 ([ddf9559](https://github.com/lakutata/lakutata-packages/commit/ddf9559e8f7cca167ad3a22e58a03dbd983ccdc4))
|
|
32
|
+
* **cli:** update Spinner component initialization ([8d5c3c8](https://github.com/lakutata/lakutata-packages/commit/8d5c3c857c291a42f35a6d1a7b738291113706c6))
|
|
33
|
+
* **creator:** add project information filling ([b230861](https://github.com/lakutata/lakutata-packages/commit/b23086112dce8a5992f3e337c9f96dae8d69d5ec))
|
|
34
|
+
* Implement log-update in Spinner component ([ceaf657](https://github.com/lakutata/lakutata-packages/commit/ceaf6570770fce60c0fda4a46957994350f3965b))
|
|
35
|
+
* Update lakutata package to version 2.0.2 ([e3c0b22](https://github.com/lakutata/lakutata-packages/commit/e3c0b22e65ae250f396e8b71137f41c61049df5b))
|
|
36
|
+
* Update Spinner component ([fad870c](https://github.com/lakutata/lakutata-packages/commit/fad870cbcd912340c8eb9ae50286c805ca4079dd))
|
|
37
|
+
* Update Spinner.ts to use arrow function in setInterval ([ec3df2e](https://github.com/lakutata/lakutata-packages/commit/ec3df2e26ced10af012ed9cf6e50e108ac8205cc))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## [2.12.1](https://github.com/lakutata/lakutata-packages/compare/@lakutata/cli@2.12.0...@lakutata/cli@2.12.1) (2025-02-13)
|
|
44
|
+
|
|
45
|
+
**Note:** Version bump only for package @lakutata/cli
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
6
51
|
# [2.12.0](https://github.com/lakutata/lakutata-packages/compare/@lakutata/cli@2.11.1...@lakutata/cli@2.12.0) (2024-08-08)
|
|
7
52
|
|
|
8
53
|
|
package/dist/CLIApp.js
CHANGED
|
@@ -27,93 +27,16 @@ 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
30
|
const lakutata_1 = require("lakutata");
|
|
39
|
-
const entrypoint_1 = require("lakutata/com/entrypoint");
|
|
40
31
|
const console = __importStar(require("node:console"));
|
|
41
|
-
const OnlineLatestVersion_1 = require("./lib/providers/OnlineLatestVersion");
|
|
42
|
-
const TemplateManager_1 = require("./lib/providers/TemplateManager");
|
|
43
32
|
const node_path_1 = __importDefault(require("node:path"));
|
|
33
|
+
const Config_1 = require("./config/Config");
|
|
44
34
|
lakutata_1.Application
|
|
45
35
|
.alias({
|
|
46
36
|
'@packageJson': node_path_1.default.resolve(__dirname, '../package.json'),
|
|
47
37
|
'@data': node_path_1.default.resolve(__dirname, '../node_modules/.data')
|
|
48
38
|
}, true)
|
|
49
|
-
.run(
|
|
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
|
-
}))
|
|
39
|
+
.run(Config_1.Config)
|
|
117
40
|
.onUncaughtException((error) => {
|
|
118
41
|
console.error(`error: ${error.message}`);
|
|
119
42
|
return process.exit(1);
|
|
@@ -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 @@
|
|
|
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(
|
|
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(
|
|
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,
|
|
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;AAKhE,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;IAKpC;;;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"}
|
|
@@ -1,31 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
2
18
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
19
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
20
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
21
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
22
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
23
|
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
+
if (mod && mod.__esModule) return mod;
|
|
26
|
+
var result = {};
|
|
27
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
+
__setModuleDefault(result, mod);
|
|
29
|
+
return result;
|
|
30
|
+
};
|
|
8
31
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
32
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
33
|
};
|
|
11
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
35
|
exports.CommandLineController = void 0;
|
|
13
|
-
const CreateProjectOptions_1 = require("../options/CreateProjectOptions");
|
|
14
|
-
const LakutataInfoOptions_1 = require("../options/LakutataInfoOptions");
|
|
15
36
|
const Information_1 = require("../lib/providers/Information");
|
|
16
37
|
const Creator_1 = require("../lib/providers/Creator");
|
|
38
|
+
const lakutata_1 = require("lakutata");
|
|
17
39
|
const di_1 = require("lakutata/decorator/di");
|
|
18
40
|
const ctrl_1 = require("lakutata/decorator/ctrl");
|
|
19
41
|
const entrypoint_1 = require("lakutata/com/entrypoint");
|
|
20
42
|
const ListTemplatesOptions_1 = require("../options/ListTemplatesOptions");
|
|
21
43
|
const TemplateManager_1 = require("../lib/providers/TemplateManager");
|
|
44
|
+
const CreateProjectOptions_1 = require("../options/CreateProjectOptions");
|
|
45
|
+
const ConvertDTO2Inquirer_1 = require("../lib/ConvertDTO2Inquirer");
|
|
46
|
+
const process = __importStar(require("node:process"));
|
|
22
47
|
class CommandLineController extends entrypoint_1.Controller {
|
|
23
48
|
/**
|
|
24
49
|
* Create project
|
|
25
|
-
* @param inp
|
|
26
50
|
*/
|
|
27
|
-
async create(
|
|
28
|
-
await this.
|
|
51
|
+
async create() {
|
|
52
|
+
process.env.LAKUTATA_TEMPLATE_NAMES = JSON.stringify(await this.templateManager.listNames());
|
|
53
|
+
await this.projectCreator.create(await (0, ConvertDTO2Inquirer_1.ConvertDTO2Inquirer)(CreateProjectOptions_1.CreateProjectOptions));
|
|
29
54
|
}
|
|
30
55
|
/**
|
|
31
56
|
* List templates
|
|
@@ -36,9 +61,8 @@ class CommandLineController extends entrypoint_1.Controller {
|
|
|
36
61
|
}
|
|
37
62
|
/**
|
|
38
63
|
* Show framework info
|
|
39
|
-
* @param inp
|
|
40
64
|
*/
|
|
41
|
-
async info(
|
|
65
|
+
async info() {
|
|
42
66
|
await this.frameworkInfo.print();
|
|
43
67
|
}
|
|
44
68
|
}
|
|
@@ -56,14 +80,13 @@ __decorate([
|
|
|
56
80
|
__metadata("design:type", TemplateManager_1.TemplateManager
|
|
57
81
|
/**
|
|
58
82
|
* Create project
|
|
59
|
-
* @param inp
|
|
60
83
|
*/
|
|
61
84
|
)
|
|
62
85
|
], CommandLineController.prototype, "templateManager", void 0);
|
|
63
86
|
__decorate([
|
|
64
|
-
(0, ctrl_1.CLIAction)('create',
|
|
87
|
+
(0, ctrl_1.CLIAction)('create', lakutata_1.DTO.description('create a Lakutata project')),
|
|
65
88
|
__metadata("design:type", Function),
|
|
66
|
-
__metadata("design:paramtypes", [
|
|
89
|
+
__metadata("design:paramtypes", []),
|
|
67
90
|
__metadata("design:returntype", Promise)
|
|
68
91
|
], CommandLineController.prototype, "create", null);
|
|
69
92
|
__decorate([
|
|
@@ -73,8 +96,8 @@ __decorate([
|
|
|
73
96
|
__metadata("design:returntype", Promise)
|
|
74
97
|
], CommandLineController.prototype, "templates", null);
|
|
75
98
|
__decorate([
|
|
76
|
-
(0, ctrl_1.CLIAction)('info',
|
|
99
|
+
(0, ctrl_1.CLIAction)('info', lakutata_1.DTO.description('show Lakutata framework info')),
|
|
77
100
|
__metadata("design:type", Function),
|
|
78
|
-
__metadata("design:paramtypes", [
|
|
101
|
+
__metadata("design:paramtypes", []),
|
|
79
102
|
__metadata("design:returntype", Promise)
|
|
80
103
|
], CommandLineController.prototype, "info", null);
|
|
@@ -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.toJsonSchema();
|
|
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.const) {
|
|
29
|
+
const enums = propertyInfo.const();
|
|
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;
|
|
@@ -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 =
|
|
106
|
+
let timeLeft = 10;
|
|
107
107
|
const interval = setInterval(() => {
|
|
108
108
|
timeLeft -= 1;
|
|
109
109
|
if (!timeLeft) {
|
|
@@ -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;
|
|
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,GAAG,OAAO,CAAC,IAAI,CAAC;IAyBlD,SAAS;IAetB;;;;;OAKG;IACH,SAAS,CAAC,cAAc,CAAC,aAAa,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;CAmBnF"}
|
|
@@ -117,6 +117,21 @@ class TemplateManager extends lakutata_1.Provider {
|
|
|
117
117
|
}
|
|
118
118
|
this.printTemplates(cache.templates, cache.updatedAt);
|
|
119
119
|
}
|
|
120
|
+
async listNames() {
|
|
121
|
+
const { version } = JSON.parse(await (0, promises_1.readFile)(node_path_1.default.resolve('@packageJson'), { encoding: 'utf-8' }));
|
|
122
|
+
const isLocalDataExists = await (0, helper_1.IsExists)(this.localDataFilename);
|
|
123
|
+
let cache = {
|
|
124
|
+
templates: [],
|
|
125
|
+
version: version,
|
|
126
|
+
updatedAt: lakutata_1.Time.now()
|
|
127
|
+
};
|
|
128
|
+
if (isLocalDataExists) {
|
|
129
|
+
cache = JSON.parse(await (0, promises_1.readFile)(this.localDataFilename, { encoding: 'utf-8' }));
|
|
130
|
+
}
|
|
131
|
+
if (!cache)
|
|
132
|
+
return [];
|
|
133
|
+
return cache.templates.map(template => template.name);
|
|
134
|
+
}
|
|
120
135
|
/**
|
|
121
136
|
* Print template information to console
|
|
122
137
|
* @param templateInfos
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"CreateProjectOptions.d.ts","sourceRoot":"","sources":["../../src/options/CreateProjectOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,UAAU,CAAA;AAI5B;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,GAAG;IASlC,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,14 @@ 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"));
|
|
15
19
|
/**
|
|
16
20
|
* Create project options
|
|
17
21
|
*/
|
|
@@ -23,7 +27,7 @@ __decorate([
|
|
|
23
27
|
.String()
|
|
24
28
|
.required()
|
|
25
29
|
.pattern(/^(\w+\.?)*\w+$/)
|
|
26
|
-
.description('
|
|
30
|
+
.description('Specify the name of the application')),
|
|
27
31
|
__metadata("design:type", String)
|
|
28
32
|
], CreateProjectOptions.prototype, "name", void 0);
|
|
29
33
|
__decorate([
|
|
@@ -31,22 +35,24 @@ __decorate([
|
|
|
31
35
|
.String()
|
|
32
36
|
.required()
|
|
33
37
|
.pattern(/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/) //Match package json name regex
|
|
34
|
-
.description('
|
|
38
|
+
.description('Specify the ID of the application')),
|
|
35
39
|
__metadata("design:type", String)
|
|
36
40
|
], CreateProjectOptions.prototype, "id", void 0);
|
|
37
41
|
__decorate([
|
|
38
42
|
(0, dto_1.Expect)(lakutata_1.DTO
|
|
39
43
|
.String()
|
|
40
44
|
.required()
|
|
41
|
-
.
|
|
45
|
+
.allow(() => ([...JSON.parse(node_process_1.default.env.LAKUTATA_TEMPLATE_NAMES)]))
|
|
46
|
+
.only()
|
|
47
|
+
.description('Choose a template for this project')),
|
|
42
48
|
__metadata("design:type", String)
|
|
43
49
|
], CreateProjectOptions.prototype, "template", void 0);
|
|
44
50
|
__decorate([
|
|
45
51
|
(0, dto_1.Expect)(lakutata_1.DTO
|
|
46
52
|
.String()
|
|
47
53
|
.optional()
|
|
48
|
-
.default(
|
|
49
|
-
.description(
|
|
54
|
+
.default(node_process_1.default.cwd())
|
|
55
|
+
.description('Specify the path for creating the project')),
|
|
50
56
|
__metadata("design:type", String)
|
|
51
57
|
], CreateProjectOptions.prototype, "path", void 0);
|
|
52
58
|
__decorate([
|
|
@@ -55,7 +61,7 @@ __decorate([
|
|
|
55
61
|
.strict(false)
|
|
56
62
|
.optional()
|
|
57
63
|
.default(false)
|
|
58
|
-
.description('
|
|
64
|
+
.description('Initialize the project within an existing folder')),
|
|
59
65
|
__metadata("design:type", Boolean)
|
|
60
66
|
], CreateProjectOptions.prototype, "overwrite", void 0);
|
|
61
67
|
__decorate([
|
|
@@ -63,7 +69,7 @@ __decorate([
|
|
|
63
69
|
.String()
|
|
64
70
|
.optional()
|
|
65
71
|
.default('none')
|
|
66
|
-
.description('
|
|
72
|
+
.description('Specify the description of the application')),
|
|
67
73
|
__metadata("design:type", String)
|
|
68
74
|
], CreateProjectOptions.prototype, "description", void 0);
|
|
69
75
|
__decorate([
|
|
@@ -71,7 +77,7 @@ __decorate([
|
|
|
71
77
|
.String()
|
|
72
78
|
.optional()
|
|
73
79
|
.default('Anonymous')
|
|
74
|
-
.description('
|
|
80
|
+
.description('Specify the name of the author of the application')),
|
|
75
81
|
__metadata("design:type", String)
|
|
76
82
|
], CreateProjectOptions.prototype, "author", void 0);
|
|
77
83
|
__decorate([
|
|
@@ -79,6 +85,6 @@ __decorate([
|
|
|
79
85
|
.String()
|
|
80
86
|
.optional()
|
|
81
87
|
.default('UNLICENSED')
|
|
82
|
-
.description('
|
|
88
|
+
.description('Specify the name of the license for the application')),
|
|
83
89
|
__metadata("design:type", String)
|
|
84
90
|
], CreateProjectOptions.prototype, "license", void 0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lakutata/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.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
|
|
28
|
-
"test:
|
|
29
|
-
"test:
|
|
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,7 +39,8 @@
|
|
|
38
39
|
"commander": "^12.0.0",
|
|
39
40
|
"degit": "^2.8.4",
|
|
40
41
|
"execa": "^8.0.1",
|
|
41
|
-
"
|
|
42
|
+
"inquirer": "^12.7.0",
|
|
43
|
+
"lakutata": "^2.0.13",
|
|
42
44
|
"latest-version": "^9.0.0",
|
|
43
45
|
"log-update": "^6.1.0",
|
|
44
46
|
"node-fetch-native": "^1.6.4",
|
|
@@ -48,5 +50,5 @@
|
|
|
48
50
|
"devDependencies": {
|
|
49
51
|
"@types/degit": "^2.8.6"
|
|
50
52
|
},
|
|
51
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "ae705dd1a753c70ae3de9e72846cf9d7a5ddbb5f"
|
|
52
54
|
}
|