From 34d8ec31a19281e1337c49d9308af2c3259997ad Mon Sep 17 00:00:00 2001 From: hexqi Date: Mon, 3 Jul 2023 08:41:36 +0800 Subject: [PATCH] docs: fix some docs error --- docs/tool-design.md | 11 ++++------- docs/use-cli.md | 2 +- packages/cli/commands/src/config.ts | 4 ++-- packages/cli/devkit/src/error/handle-default.ts | 4 ---- packages/cli/devkit/src/error/handle-eaddrinuse.ts | 1 - packages/cli/devkit/src/error/handle-enoent.ts | 3 --- packages/cli/devkit/src/error/locale/index.ts | 4 ++-- packages/cli/devkit/src/git/index.ts | 2 +- 8 files changed, 10 insertions(+), 21 deletions(-) diff --git a/docs/tool-design.md b/docs/tool-design.md index 87945174..dd73149a 100644 --- a/docs/tool-design.md +++ b/docs/tool-design.md @@ -22,8 +22,7 @@ 基于以上的场景,大致描绘一下一个工程化工具的一些功能。 -![](https://raw.githubusercontent.com/opentiny/tiny-vue/blob/main/docs/images/feature_2012x914.png) - +![](https://raw.githubusercontent.com/opentiny/tiny-cli/dev/docs/images/feature_2012x914.png) ### 套件 @@ -70,7 +69,7 @@ module.exports = { tasks: { init: [{ // 清除临时文件 - command: 'clearn' + command: 'node tools/clean.js' }, { // 安装依赖 @@ -91,12 +90,12 @@ module.exports = { }], build: [{ // 基于webpack构建 - command: 'webpack2', + command: 'webpack', }, ], test: [{ // 执行eslint - command: 'lint', + command: 'eslint', }, ], }, @@ -124,8 +123,6 @@ cli本身不具备任何工程化能力,cli只是提供了一个让你写套 基于上面的思考,我们参考DDD的思维模式,将域能力划分出来,将cli的整体框架理清晰。 -![image.png](http://image.huawei.com/tiny-lts/v1/images/bcaed973d9deccf67381b6fc06c3d67c_1418x1248.png) - ### 包函数说明 diff --git a/docs/use-cli.md b/docs/use-cli.md index c328ed4f..d784787d 100644 --- a/docs/use-cli.md +++ b/docs/use-cli.md @@ -36,7 +36,7 @@ tiny 使用帮助: $ tiny [command] [options] $ tiny init [toolkitName] ``` -其中`toolkitName`表示套件的名字。一般的套件名格式为:`tiny-toolkit-{toolkitName}`。如DEV套件:[tiny-toolkit-dev](http://git.huawei.com/tiny/tiny-toolkit-dev),若要使用该套件可直接初始化: +其中`toolkitName`表示套件的名字。一般的套件名格式为:`tiny-toolkit-{toolkitName}`。如DEV套件:[tiny-toolkit-dev](http://github.com/opentiny/tiny-cli/tree/dev/packages/toolkits/dev),若要使用该套件可直接初始化: ```bash $ tiny init dev diff --git a/packages/cli/commands/src/config.ts b/packages/cli/commands/src/config.ts index 9f3695a6..d0d96e36 100644 --- a/packages/cli/commands/src/config.ts +++ b/packages/cli/commands/src/config.ts @@ -11,7 +11,7 @@ */ /** * 设置cnpmrc - * 类似于 $ npm config set registry http://cmc-cd-mirror.rnd.huawei.com/npm + * 类似于 $ npm config set registry https://registry.npmmirror.com/ */ import * as path from 'path'; import os from 'os'; @@ -52,7 +52,7 @@ export default async (argv) => { log.warn(`config 参数不正确,用法举例: # 设置.cnpmrc 文件,写入registry -${bin} config set registry http://cmc-cd-mirror.rnd.huawei.com/npm/ +${bin} config set registry https://registry.npmmirror.com/ # 获取.cnpmrc 文件中registry的值 ${bin} config get registry diff --git a/packages/cli/devkit/src/error/handle-default.ts b/packages/cli/devkit/src/error/handle-default.ts index 9b886b04..eb00a50f 100644 --- a/packages/cli/devkit/src/error/handle-default.ts +++ b/packages/cli/devkit/src/error/handle-default.ts @@ -9,10 +9,6 @@ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. * */ -/** - * Created by hugo on 16/11/16. - */ - import logs from '../log/index'; import message from './locale/index'; import Intl from '../intl/index'; diff --git a/packages/cli/devkit/src/error/handle-eaddrinuse.ts b/packages/cli/devkit/src/error/handle-eaddrinuse.ts index 48d48f45..e99e34a1 100644 --- a/packages/cli/devkit/src/error/handle-eaddrinuse.ts +++ b/packages/cli/devkit/src/error/handle-eaddrinuse.ts @@ -10,7 +10,6 @@ * */ /** - * Created by hugo on 17/4/21. * 端口被占用时的错误处理 */ import logs from '../log/index'; diff --git a/packages/cli/devkit/src/error/handle-enoent.ts b/packages/cli/devkit/src/error/handle-enoent.ts index bc88d7d9..12c1dbdc 100644 --- a/packages/cli/devkit/src/error/handle-enoent.ts +++ b/packages/cli/devkit/src/error/handle-enoent.ts @@ -9,9 +9,6 @@ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. * */ -/** - * Created by hugo on 16/11/16. - */ import _ from 'lodash'; import logs from '../log/index'; import Intl from '../intl/index'; diff --git a/packages/cli/devkit/src/error/locale/index.ts b/packages/cli/devkit/src/error/locale/index.ts index f33c25df..56346a24 100644 --- a/packages/cli/devkit/src/error/locale/index.ts +++ b/packages/cli/devkit/src/error/locale/index.ts @@ -16,7 +16,7 @@ export default { zh: { // handle-default.js - intranetTips: '运行报错, 请在issue中反馈问题:https://codehub-g.huawei.com/Tiny/opentiny/opentiny-cli/issues/new', + intranetTips: '运行报错, 请在issue中反馈问题:https://github.com/opentiny/tiny-cli/issues/new', winPidTips: ` # 看下是哪个PID占用的端口 $ lsof -i :{port} # 杀进程 @@ -47,7 +47,7 @@ export default { en: { // handle-default.js intranetTips: - 'Runtime Error, please report the issue: https://codehub-g.huawei.com/Tiny/opentiny/opentiny-cli/issues/new', + 'Runtime Error, please report the issue: https://github.com/opentiny/tiny-cli/issues/new', winPidTips: ` # Look up for the PID which occupies the port $ lsof -i :{port} # Kill process diff --git a/packages/cli/devkit/src/git/index.ts b/packages/cli/devkit/src/git/index.ts index a2014cc6..33af94cb 100644 --- a/packages/cli/devkit/src/git/index.ts +++ b/packages/cli/devkit/src/git/index.ts @@ -117,7 +117,7 @@ git.repository = function (cwd?: string) { shelljs.exec('git config --get remote.origin.url', { silent: true, cwd }).stdout.toString() || '' ).trim(); // 有些git的url是http开头的,需要格式化为git@格式,方便统一处理 - const match = repository.match(/^(http|https):\/\/(.*huawei\.com|github\.com)\/(.*)/); + const match = repository.match(/^(http|https):\/\/(.*?\.com)\/(.*)/); if (match && match.length > 3) { repository = `git@${match[2]}:${match[3]}`; }