@htyf-mp/cli 0.3.12-alpha.8 → 0.4.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/package.json +2 -2
- package/src/config.mjs +4 -0
- package/src/constants.mjs +1 -0
- package/src/project-initializer.mjs +7 -0
- package/src/template-processor.mjs +11 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@htyf-mp/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "红糖云服app小程序模板-cli",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"publishConfig": {
|
|
83
83
|
"access": "public"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "c1e6aa38bbfda7957c3270cb34a2fa03a37ff533"
|
|
86
86
|
}
|
package/src/config.mjs
CHANGED
package/src/constants.mjs
CHANGED
|
@@ -202,6 +202,8 @@ export class ProjectInitializer {
|
|
|
202
202
|
appType = 'web';
|
|
203
203
|
} else if (templateType === CONSTANTS.TEMPLATE_TYPES.APP_TEMPLATE) {
|
|
204
204
|
appType = 'app';
|
|
205
|
+
} else if (templateType === CONSTANTS.TEMPLATE_TYPES.TARO_TEMPLATE) {
|
|
206
|
+
appType = 'app';
|
|
205
207
|
}
|
|
206
208
|
projectConfig.type = appType;
|
|
207
209
|
// 写入配置文件
|
|
@@ -281,6 +283,11 @@ export class ProjectInitializer {
|
|
|
281
283
|
|
|
282
284
|
if (templateType === CONSTANTS.TEMPLATE_TYPES.GAME_TEMPLATE) {
|
|
283
285
|
commands.push(chalk.white(' npm install'));
|
|
286
|
+
} else if (templateType === CONSTANTS.TEMPLATE_TYPES.TARO_TEMPLATE) {
|
|
287
|
+
commands.push(
|
|
288
|
+
chalk.white(' npm install'),
|
|
289
|
+
chalk.white(' npm run dev:htyf')
|
|
290
|
+
);
|
|
284
291
|
} else {
|
|
285
292
|
commands.push(
|
|
286
293
|
chalk.white(' npm install'),
|
|
@@ -3,7 +3,6 @@ import path from 'path';
|
|
|
3
3
|
import fse from 'fs-extra';
|
|
4
4
|
import { execa } from 'execa';
|
|
5
5
|
import { Logger } from './logger.mjs';
|
|
6
|
-
import { CONSTANTS } from './constants.mjs';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* 模板处理器类
|
|
@@ -46,18 +45,17 @@ export class TemplateProcessor {
|
|
|
46
45
|
path.join(tmpdir, 'README.md')
|
|
47
46
|
];
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
);
|
|
48
|
+
const cliTemplatesDir = path.join(tmpdir, 'packages/cli');
|
|
49
|
+
const selectedTemplate = this.config.templates[templateType];
|
|
50
|
+
if (selectedTemplate) {
|
|
51
|
+
const selectedPath = path.join(cliTemplatesDir, selectedTemplate.tempPath);
|
|
52
|
+
Object.values(this.config.templates).forEach((template) => {
|
|
53
|
+
const templatePath = path.join(cliTemplatesDir, template.tempPath);
|
|
54
|
+
if (templatePath !== selectedPath) {
|
|
55
|
+
pathsToRemove.push(templatePath);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
pathsToRemove.push(path.join(selectedPath, '.git'));
|
|
61
59
|
}
|
|
62
60
|
|
|
63
61
|
pathsToRemove.forEach(pathToRemove => {
|