@lakutata/cli 2.8.0 → 2.9.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,17 @@
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.9.0](https://github.com/lakutata/lakutata-packages/compare/@lakutata/cli@2.8.0...@lakutata/cli@2.9.0) (2024-08-03)
7
+
8
+
9
+ ### Features
10
+
11
+ * **cli:** add template selection for project creation ([4835107](https://github.com/lakutata/lakutata-packages/commit/4835107d86bd70738a6508529e9d60efa807c356))
12
+
13
+
14
+
15
+
16
+
6
17
  # [2.8.0](https://github.com/lakutata/lakutata-packages/compare/@lakutata/cli@2.7.0...@lakutata/cli@2.8.0) (2024-08-02)
7
18
 
8
19
 
package/dist/CLIApp.js CHANGED
@@ -45,7 +45,7 @@ lakutata_1.Application.run(async () => ({
45
45
  cache: false,
46
46
  verbose: true,
47
47
  force: true,
48
- repo: 'lakutata/lakutata-template'
48
+ baseRepo: 'lakutata/lakutata-template'
49
49
  },
50
50
  spinner: {
51
51
  class: Spinner_1.Spinner,
@@ -3,12 +3,12 @@ export declare class DeGitPuller extends Component {
3
3
  protected readonly cache: boolean;
4
4
  protected readonly verbose: boolean;
5
5
  protected readonly force: boolean;
6
- protected readonly repo: string;
6
+ protected readonly baseRepo: string;
7
7
  /**
8
8
  * get git source
9
- * @param branch
9
+ * @param template
10
10
  */
11
- getGitSource(branch: string): string;
11
+ getGitSource(template: string): string;
12
12
  /**
13
13
  * Exec pull
14
14
  * @param branch
@@ -1 +1 @@
1
- {"version":3,"file":"DeGitPuller.d.ts","sourceRoot":"","sources":["../../../src/lib/components/DeGitPuller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAM,MAAM,UAAU,CAAA;AAGvC,qBACa,WAAY,SAAQ,SAAS;IAGtC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAQ;IAGzC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAO;IAG1C,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAO;IAGxC,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAE/B;;;OAGG;IACI,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAI3C;;;;OAIG;IACU,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAOxE"}
1
+ {"version":3,"file":"DeGitPuller.d.ts","sourceRoot":"","sources":["../../../src/lib/components/DeGitPuller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAM,MAAM,UAAU,CAAA;AAGvC,qBACa,WAAY,SAAQ,SAAS;IAGtC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAQ;IAGzC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAO;IAG1C,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAO;IAGxC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IAEnC;;;OAGG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAI7C;;;;OAIG;IACU,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAOxE"}
@@ -25,10 +25,10 @@ let DeGitPuller = class DeGitPuller extends lakutata_1.Component {
25
25
  }
26
26
  /**
27
27
  * get git source
28
- * @param branch
28
+ * @param template
29
29
  */
30
- getGitSource(branch) {
31
- return `${this.repo}#${branch}`;
30
+ getGitSource(template) {
31
+ return `${this.baseRepo}-${template}`;
32
32
  }
33
33
  /**
34
34
  * Exec pull
@@ -59,7 +59,7 @@ __decorate([
59
59
  __decorate([
60
60
  (0, di_1.Configurable)(lakutata_1.DTO.String().required()),
61
61
  __metadata("design:type", String)
62
- ], DeGitPuller.prototype, "repo", void 0);
62
+ ], DeGitPuller.prototype, "baseRepo", void 0);
63
63
  exports.DeGitPuller = DeGitPuller = __decorate([
64
64
  (0, di_1.Singleton)()
65
65
  ], DeGitPuller);
@@ -1 +1 @@
1
- {"version":3,"file":"Creator.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/Creator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAC,OAAO,EAAC,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAC,oBAAoB,EAAC,MAAM,uCAAuC,CAAA;AAM1E,OAAO,EAAC,WAAW,EAAE,QAAQ,EAAC,MAAM,UAAU,CAAA;AAE9C,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAK1C,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAA;AAEzD,qBAAa,OAAQ,SAAQ,QAAQ;IAGjC,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,MAAM,EAAE,WAAW,CAAA;IAGtC,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAA;IAG7C,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,mBAAmB,CAAA;IAErD;;;;;OAKG;cACa,wBAAwB,CAAC,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAUnG;;;;OAIG;cACa,0BAA0B,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC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OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAUnG;;;;OAIG;cACa,0BAA0B,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASlF;;;;OAIG;cACa,2BAA2B,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASnF;;;OAGG;cACa,yBAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAW5G;;;OAGG;IAEU,MAAM,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;CAyDpE"}
@@ -17,7 +17,6 @@ const Information_js_1 = require("./Information.js");
17
17
  const DeGitPuller_js_1 = require("../components/DeGitPuller.js");
18
18
  const Spinner_js_1 = require("../components/Spinner.js");
19
19
  const CreateProjectOptions_js_1 = require("../../options/CreateProjectOptions.js");
20
- const ProjectTypeConfig_js_1 = require("../ProjectTypeConfig.js");
21
20
  const node_path_1 = __importDefault(require("node:path"));
22
21
  const promises_1 = require("node:fs/promises");
23
22
  const SpecialChar_js_1 = require("../SpecialChar.js");
@@ -95,14 +94,12 @@ class Creator extends lakutata_1.Provider {
95
94
  const appName = options.name;
96
95
  const appId = options.id;
97
96
  const appDescription = options.description;
98
- // const packageName: string = appId
99
97
  const authorName = options.author;
100
98
  const licenseName = options.license;
101
- const appType = options.type;
99
+ const appTemplate = options.template;
102
100
  const targetPath = options.overwrite ? node_path_1.default.resolve(options.path) : node_path_1.default.resolve(options.path, options.name);
103
- const { branch } = ProjectTypeConfig_js_1.ProjectTypeConfig[appType];
104
101
  const table = new cli_table3_1.default();
105
- 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 Branch'), this.puller.getGitSource(branch)]);
102
+ 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 Branch'), this.puller.getGitSource(appTemplate)]);
106
103
  console.log(table.toString());
107
104
  await new Promise(resolve => {
108
105
  let timeLeft = 15;
@@ -120,7 +117,7 @@ class Creator extends lakutata_1.Provider {
120
117
  await this.checkTargetPathIsDirectory(targetPath);
121
118
  await this.checkTargetDirectoryIsEmpty(targetPath);
122
119
  this.spinner.start('Pulling');
123
- await this.puller.pull(branch, targetPath);
120
+ await this.puller.pull(appTemplate, targetPath);
124
121
  this.spinner.stop();
125
122
  this.log.info(`${SpecialChar_js_1.charCheck} Template pulled.`);
126
123
  this.spinner.start('Filling information');
@@ -5,7 +5,7 @@ import { DTO } from 'lakutata';
5
5
  export declare class CreateProjectOptions extends DTO {
6
6
  name: string;
7
7
  id: string;
8
- type: string;
8
+ template: string;
9
9
  path: string;
10
10
  overwrite: boolean;
11
11
  description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"CreateProjectOptions.d.ts","sourceRoot":"","sources":["../../src/options/CreateProjectOptions.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,UAAU,CAAA;AAG5B;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,GAAG;IASlC,IAAI,EAAE,MAAM,CAAA;IASZ,EAAE,EAAE,MAAM,CAAA;IASV,IAAI,EAAE,MAAM,CAAA;IASZ,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":"AACA,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"}
@@ -10,7 +10,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CreateProjectOptions = void 0;
13
- const ProjectTypeConfig_1 = require("../lib/ProjectTypeConfig");
14
13
  const lakutata_1 = require("lakutata");
15
14
  const dto_1 = require("lakutata/decorator/dto");
16
15
  /**
@@ -39,10 +38,9 @@ __decorate([
39
38
  (0, dto_1.Expect)(lakutata_1.DTO
40
39
  .String()
41
40
  .required()
42
- .valid(...Object.keys(ProjectTypeConfig_1.ProjectTypeConfig))
43
- .description(`select the type of the project (choices: ${Object.keys(ProjectTypeConfig_1.ProjectTypeConfig).map((type) => `"${type}"`).join(',')})`)),
41
+ .description('choose a template for this project')),
44
42
  __metadata("design:type", String)
45
- ], CreateProjectOptions.prototype, "type", void 0);
43
+ ], CreateProjectOptions.prototype, "template", void 0);
46
44
  __decorate([
47
45
  (0, dto_1.Expect)(lakutata_1.DTO
48
46
  .String()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lakutata/cli",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "Lakutata CLI tool",
5
5
  "keywords": [
6
6
  "lakutata",
@@ -46,5 +46,5 @@
46
46
  "devDependencies": {
47
47
  "@types/degit": "^2.8.6"
48
48
  },
49
- "gitHead": "9a5c04cb03525af8a2d7885c5db7fabebeb546fc"
49
+ "gitHead": "3b365ebc61075aa8983aa47365b95ff72d8442be"
50
50
  }