@lakutata/cli 2.7.0 → 2.8.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 +16 -0
- package/dist/lib/providers/Creator.d.ts +5 -0
- package/dist/lib/providers/Creator.d.ts.map +1 -1
- package/dist/lib/providers/Creator.js +26 -1
- package/dist/lib/providers/OnlineLatestVersion.d.ts.map +1 -1
- package/dist/lib/providers/OnlineLatestVersion.js +0 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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.8.0](https://github.com/lakutata/lakutata-packages/compare/@lakutata/cli@2.7.0...@lakutata/cli@2.8.0) (2024-08-02)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **cli:** remove commented code in OnlineLatestVersion.ts ([8820c2b](https://github.com/lakutata/lakutata-packages/commit/8820c2bb9fb501f5139b1a8ad0e05d8bdc2ee02c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **creator:** add project information filling ([b230861](https://github.com/lakutata/lakutata-packages/commit/b23086112dce8a5992f3e337c9f96dae8d69d5ec))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [2.7.0](https://github.com/lakutata/lakutata-packages/compare/@lakutata/cli@2.6.1...@lakutata/cli@2.7.0) (2024-08-02)
|
|
7
23
|
|
|
8
24
|
|
|
@@ -31,6 +31,11 @@ export declare class Creator extends Provider {
|
|
|
31
31
|
* @protected
|
|
32
32
|
*/
|
|
33
33
|
protected checkTargetDirectoryIsEmpty(targetDirectory: string): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* project information filling
|
|
36
|
+
* @protected
|
|
37
|
+
*/
|
|
38
|
+
protected projectInformationFilling(targetPath: string, fields: Record<string, string>): Promise<void>;
|
|
34
39
|
/**
|
|
35
40
|
* Exec create
|
|
36
41
|
* @param options
|
|
@@ -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,IAAI,CAAC;IASlF;;;;OAIG;cACa,2BAA2B,CAAC,eAAe,EA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,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;CA2DpE"}
|
|
@@ -71,6 +71,22 @@ class Creator extends lakutata_1.Provider {
|
|
|
71
71
|
}
|
|
72
72
|
this.log.info(`${SpecialChar_js_1.charCheck} The target directory is empty.`);
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* project information filling
|
|
76
|
+
* @protected
|
|
77
|
+
*/
|
|
78
|
+
async projectInformationFilling(targetPath, fields) {
|
|
79
|
+
const items = await (0, helper_1.Glob)(node_path_1.default.resolve(targetPath, '**/*'));
|
|
80
|
+
for (const item of items) {
|
|
81
|
+
const stats = await (0, promises_1.stat)(item);
|
|
82
|
+
if (!stats.isFile())
|
|
83
|
+
continue;
|
|
84
|
+
const rawContent = await (0, promises_1.readFile)(item, { encoding: 'utf-8' });
|
|
85
|
+
const filledContent = (0, helper_1.Templating)(rawContent, fields, { ignoreMissing: true });
|
|
86
|
+
if (rawContent !== filledContent)
|
|
87
|
+
await (0, promises_1.writeFile)(item, filledContent, { flag: 'w' });
|
|
88
|
+
}
|
|
89
|
+
}
|
|
74
90
|
/**
|
|
75
91
|
* Exec create
|
|
76
92
|
* @param options
|
|
@@ -107,8 +123,17 @@ class Creator extends lakutata_1.Provider {
|
|
|
107
123
|
await this.puller.pull(branch, targetPath);
|
|
108
124
|
this.spinner.stop();
|
|
109
125
|
this.log.info(`${SpecialChar_js_1.charCheck} Template pulled.`);
|
|
126
|
+
this.spinner.start('Filling information');
|
|
127
|
+
await this.projectInformationFilling(targetPath, {
|
|
128
|
+
$APP_NAME: appName,
|
|
129
|
+
$APP_ID: appId,
|
|
130
|
+
$APP_DESC: appDescription,
|
|
131
|
+
$APP_AUTHOR: authorName,
|
|
132
|
+
$APP_LICENSE: licenseName
|
|
133
|
+
});
|
|
134
|
+
this.spinner.stop();
|
|
135
|
+
this.log.info(`${SpecialChar_js_1.charCheck} Project information filling completed.`);
|
|
110
136
|
this.spinner.start('Installing');
|
|
111
|
-
//TODO 将项目内的内容进行初始化
|
|
112
137
|
const { execa } = await import('execa');
|
|
113
138
|
await execa('npm', ['install'], { cwd: targetPath });
|
|
114
139
|
await execa('npm', ['install', `${this.onlineVersion.getName()}@${await this.onlineVersion.getVersion()}`], { cwd: targetPath });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnlineLatestVersion.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/OnlineLatestVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,UAAU,CAAA;AAIjC,qBAAa,mBAAoB,SAAQ,QAAQ;IAG7C,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAGlC,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAE/B;;OAEG;IACI,OAAO,IAAI,MAAM;IAIxB;;OAEG;IACU,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"OnlineLatestVersion.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/OnlineLatestVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,UAAU,CAAA;AAIjC,qBAAa,mBAAoB,SAAQ,QAAQ;IAG7C,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAGlC,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAE/B;;OAEG;IACI,OAAO,IAAI,MAAM;IAIxB;;OAEG;IACU,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;CAY7C"}
|
|
@@ -28,11 +28,9 @@ class OnlineLatestVersion extends lakutata_1.Provider {
|
|
|
28
28
|
const prereleaseInfo = (0, semver_1.prerelease)(this.version);
|
|
29
29
|
const latestVersionPackage = await import('latest-version');
|
|
30
30
|
if (prereleaseInfo && prereleaseInfo[0]) {
|
|
31
|
-
// onlineLatestVersion = await require('latest-version').default(this.name, {version: prereleaseInfo[0].toString()})
|
|
32
31
|
onlineLatestVersion = await latestVersionPackage.default(this.name, { version: prereleaseInfo[0].toString() });
|
|
33
32
|
}
|
|
34
33
|
else {
|
|
35
|
-
// onlineLatestVersion = await require('latest-version').default(this.name)
|
|
36
34
|
onlineLatestVersion = await latestVersionPackage.default(this.name);
|
|
37
35
|
}
|
|
38
36
|
return (0, semver_1.gt)(onlineLatestVersion, this.version) ? onlineLatestVersion : this.version;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lakutata/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.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": "
|
|
49
|
+
"gitHead": "9a5c04cb03525af8a2d7885c5db7fabebeb546fc"
|
|
50
50
|
}
|