Skip to content

Commit 5ed766b

Browse files
authored
fix: fix 6 issues (#103)
* fix(toolkit-pro): fix incorrect command options of ng template remove command options of mock and local server for ng template fix #94; fix #98 * fix(toolkit-pro/eggjs): fix the error of eggjs template when run `npm start` fix #99 * fix(toolkit-pro): change the tips for starting the local server of spring cloud because starting the spring cloud that is not support by run `npm run dev` fix #102 * docs(toolkit-pro/springcloud): remove the link of ces 1.0 because ces 1.0 is no longer supported by huawei cloud fix #101 * fix(cli-devkit): optimize the cwd of installing and the message optimize the cwd of install to the options. And optimize the prompting after input error package in update. fix #97 * docs(toolkit-pro): add change log
1 parent 9639f3f commit 5ed766b

6 files changed

Lines changed: 44 additions & 22 deletions

File tree

packages/cli/devkit/src/module/locale/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default {
1919
autoUpdateZ: '检查到您本地版本为 {localVersion} , 自动为您升级到兼容版本 {autoZVersion} 中...',
2020
autoInstall: '本地尚未安装 {name} ,正在执行自动安装...',
2121
// install-one.js
22-
importPkgError: '您传入的包名有误,请输入正确的包名,如: @opentiny/cli-toolkit-xxx,@opentiny/cli-plugin-xxx',
22+
importPkgError: '您传入的包名有误,请输入正确的包名,如: @opentiny/tiny-toolkit-xxx,@opentiny/tiny-plugin-xxx',
2323
installSuccess: '{name} 安装成功',
2424
updateSuccess: '{name} 更新成功',
2525
// utils.js
@@ -32,7 +32,7 @@ export default {
3232
recommendInstall: '请执行 {icon} {installTip} 来升级模块',
3333
includeUpdate: '包含以下更新:',
3434
installError: '{name} 安装报错,请确认该package是否存在!',
35-
getModuleErr: '{modulePath} 文件运行失败,请检查,错误信息如下:'
35+
getModuleErr: '{modulePath} 文件运行失败,请检查,错误信息如下:',
3636
},
3737
en: {
3838
autoUpdate: '{name} has set an automatic update and is excuting an update operation...',
@@ -41,7 +41,7 @@ export default {
4141
autoInstall: '{name} has not been installed, performing an automatic installation...',
4242
// install-one.js
4343
importPkgError:
44-
'Package name is incorrect. Please re-enter the correct package nameeg: @opentiny/cli-toolkit-xxx @opentiny/cli-plugin-xxx',
44+
'Package name is incorrect. Please re-enter the correct package name, eg: @opentiny/tiny-toolkit-xxx, @opentiny/tiny-plugin-xxx',
4545
installSuccess: '{name} install completed',
4646
updateSuccess: '{name} update completed',
4747
// utils.js
@@ -54,6 +54,6 @@ export default {
5454
recommendInstall: 'Please execute {icon} {installTip} to upgrade the module',
5555
includeUpdate: 'Include the following updates:',
5656
installError: 'Install {name} package error, please confirm whether the package exists!',
57-
getModuleErr: '{modulePath} failed to run, more details:'
58-
}
57+
getModuleErr: '{modulePath} failed to run, more details:',
58+
},
5959
};

packages/cli/devkit/src/npm/index.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const TIMEOUT = 5000;
2727
// 未配置cnpmrc时默认使用淘宝镜像源
2828
const defaultRegistries = {
2929
registry: 'https://registry.npmmirror.com/',
30-
'@opentiny:registry': 'https://registry.npmmirror.com/'
30+
'@opentiny:registry': 'https://registry.npmmirror.com/',
3131
};
3232

3333
/**
@@ -154,14 +154,14 @@ export function setCnpmrc(config: any) {
154154
* 获取安装器
155155
*/
156156
export function getInstaller() {
157-
return require.resolve('npminstall/bin/install.js')
157+
return require.resolve('npminstall/bin/install.js');
158158
}
159159

160160
/**
161161
* 获取卸载器
162162
*/
163163
export function getUnInstaller() {
164-
return require.resolve('npminstall/bin/uninstall.js')
164+
return require.resolve('npminstall/bin/uninstall.js');
165165
}
166166

167167
/**
@@ -200,14 +200,14 @@ export async function installDependencies(options?: NpmOption) {
200200
* @param options
201201
*/
202202
export async function runInstall(installer: string, paths: any, options?: NpmOption) {
203-
const cwd = process.cwd();
203+
const cwd = (options || {}).cwd || process.cwd();
204204
const cacheDir = getCacheDir();
205205
// npm默认值
206206
const option = _.defaults(options || {}, {
207207
stdio: 'inherit',
208208
registry: getRegistry(),
209209
cwd,
210-
china: true
210+
china: true,
211211
});
212212

213213
// 支持cnpmrc设置缓存目录
@@ -247,8 +247,8 @@ export async function runInstall(installer: string, paths: any, options?: NpmOpt
247247
S: '-save',
248248
D: '-save-dev',
249249
O: '-save-optional',
250-
E: '-save-exact'
251-
}
250+
E: '-save-exact',
251+
},
252252
})
253253
);
254254

@@ -281,7 +281,7 @@ export async function has(name: string, options?: NpmOption) {
281281
const registry = getRegistry(name);
282282
options = {
283283
registry,
284-
...options
284+
...options,
285285
};
286286
const url = `${options.registry}${encodeURIComponent(name)}/latest`;
287287
log.debug('check module has =%s', url);
@@ -323,7 +323,7 @@ export async function latest(name: string, options?: NpmOption): Promise<Package
323323
options = {
324324
registry,
325325
version: 'latest',
326-
...options
326+
...options,
327327
};
328328
const url = `${options.registry}${encodeURIComponent(name)}/${options.version}`;
329329
let data = null;
@@ -352,5 +352,5 @@ export default {
352352
has,
353353
getCnpmrc,
354354
setCnpmrc,
355-
runInstall
355+
runInstall,
356356
};

packages/toolkits/pro/package.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opentiny/tiny-toolkit-pro",
3-
"version": "1.0.10",
3+
"version": "1.0.15",
44
"description": "TinyPro 开箱即用的中后台前端/设计解决方案",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",
@@ -101,6 +101,20 @@
101101
]
102102
},
103103
"changeLog": [
104+
{
105+
"version": "1.0.15",
106+
"log": [
107+
"fix: 修复体验类问题5个"
108+
]
109+
},
110+
{
111+
"version": "1.0.14",
112+
"log": [
113+
"fix: 修复vue模板不能正常启动的问题",
114+
"fix: 菜单是否显示优化",
115+
"fix: 优化国际化词条"
116+
]
117+
},
104118
{
105119
"version": "1.0.2",
106120
"log": [

packages/toolkits/pro/src/lib/init.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ const getProjectInfo = (): Promise<ProjectInfo> => {
6868
{ name: '暂不配置服务端', value: false },
6969
],
7070
prefix: '*',
71-
when: (answers) => answers.serverFramework !== ServerFrameworks.Skip,
71+
when: (answers) =>
72+
answers.framework === VUE_TEMPLATE_PATH &&
73+
answers.serverFramework !== ServerFrameworks.Skip,
7274
},
7375
{
7476
type: 'list',
@@ -255,6 +257,11 @@ const createProjectSync = (answers: ProjectInfo) => {
255257
log.error('配置项目信息创失败');
256258
}
257259

260+
// ng模板不开启mock以及服务
261+
if (templatePath === NG_TEMPLATE_PATH) {
262+
return;
263+
}
264+
258265
// 如果不对接服务端,全部接口采用mock
259266
if (!serverConfirm) {
260267
try {
@@ -316,7 +323,9 @@ export const installDependencies = (answers: ProjectInfo) => {
316323
console.log(
317324
chalk.green(
318325
`${chalk.yellow(
319-
`$ cd ${name}/${serverFramework} && npm run dev`
326+
serverFramework === ServerFrameworks.SpringCloud
327+
? `请查看 ${name}/${serverFramework}/README_CN.md `
328+
: `$ cd ${name}/${serverFramework} && npm run dev`
320329
)} # 开启server开发环境`
321330
)
322331
);

packages/toolkits/pro/template/server/eggJs/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"scripts": {
1010
"start": "npm run stop && npm run tsc && egg-scripts start --title=egg-server-tgc-trace-server --ignore-stderr",
11-
"stop": "ets clean && egg-scripts stop --title=egg-server-tgc-trace-server",
11+
"stop": "tsc -b --clean && egg-scripts stop --title=egg-server-tgc-trace-server",
1212
"dev": "egg-bin dev --host 127.0.0.1 --port 7001",
1313
"debug": "egg-bin debug",
1414
"test-local": "egg-bin test",
@@ -18,7 +18,7 @@
1818
"ci": "npm run lint && npm run cov && npm run tsc",
1919
"autod": "autod",
2020
"lint": "eslint . --ext .ts",
21-
"clean": "ets clean"
21+
"clean": "tsc -b --clean"
2222
},
2323
"dependencies": {
2424
"bcrypt": "^5.1.0",
@@ -41,7 +41,7 @@
4141
"eslint": "^6.7.2",
4242
"eslint-config-egg": "^8.0.0",
4343
"tslib": "^1.9.0",
44-
"typescript": "^3.0.0"
44+
"typescript": "^4.9.4"
4545
},
4646
"engines": {
4747
"node": ">=8.9.0"

packages/toolkits/pro/template/server/springCloud/CSE-ENV_CN.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
有两种方式可供选择:
33

44
* 通过下载安装本地简化版 CSE 搭建本地开发环境,下载链接:
5-
* [CSE 1.0](https://support.huaweicloud.com/devg-servicestage/ss-devg-0034.html)下载完成,一键启动start.bat;
65
* [CSE 2.0](https://support.huaweicloud.com/devg-cse/cse_devg_0036.html),下载完成,一键启动cse.exe
76

87
* 使用[华为云微服务引擎(CSE)](https://support.huaweicloud.com/qs-cse/cse_qs_0002.html)

0 commit comments

Comments
 (0)