From 049e6cb1d0540eb60802a78564aebebd1200801d Mon Sep 17 00:00:00 2001 From: gengyang Date: Sat, 22 Feb 2020 20:27:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20modify=20repo=20config?= =?UTF-8?q?=20&=20template=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add several config files to repo & template --- .editorconfig | 13 ++++++++++++ .prettierignore | 2 ++ .prettierrc | 7 ++++--- README.md | 47 ++++++++++++++++-------------------------- package.json | 6 ++++-- templates/package.json | 4 +++- 6 files changed, 44 insertions(+), 35 deletions(-) create mode 100644 .editorconfig create mode 100644 .prettierignore diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..9a48fcf35 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +# http://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +quote_type = single + +[*.md] +trim_trailing_whitespace = false \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..ff599a25a --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +**/test/**/*.ts +**/test/**/*.js \ No newline at end of file diff --git a/.prettierrc b/.prettierrc index cfb30e46b..dc75c8a80 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,6 @@ { + "trailingComma": "all", + "tabWidth": 2, "semi": true, - "singleQuote": true, - "trailingComma": "es5" -} \ No newline at end of file + "singleQuote": true +} diff --git a/README.md b/README.md index 2867acfe4..76abb3381 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,44 @@ -Ali Lowcode Engine(阿里低代码引擎) ---- +## Ali Lowcode Engine(阿里低代码引擎) [Lerna](https://github.com/lerna/lerna) + [TS](https://www.typescriptlang.org/) -## 准备 - -```bash -npm login --registry http://registry.npm.alibaba-inc.com --scope @ali -``` - -```bash -tnpm i -g git-cz -``` - ## 开发 #### 创建新包: - - `./create.sh ` +- `./create.sh ` #### 跑起来: - - `tnpm i` - - `npm run boot` - - `npm run build` +- `tnpm i` +- `npm run boot` +- `npm run build` #### Link & unlink - - `cd packages/ && tnpm link -g` - - `tnpm link @ali/` +- `cd packages/ && tnpm link -g` +- `tnpm link @ali/` - - `tnpm unlink @ali/` +- `tnpm unlink @ali/` #### 开发过程中: - - `git add ` - - `git cz` +- `git add ` +- `npm run commit` ## 发布 - - `npm run pub` +- `npm run pub` ## 注意 - - Commit 动作尽量使用 `git cz`,方便按语义化版本自动递增,以及自动生成 `CHANGELOG.md` - - `packages` 工程里一些开发时公共依赖(比如:`typescript`、`ava` 等)会放到工程顶层 - - 工程里的 `.md`、`test/` 等文件修改不会产生新的发布 - - 当工程里存在多个 ts 文件的目录时,最终产生的文件会按文件夹形式放到 `lib` 下 +- Commit 动作尽量使用 `npm run commit`,其内部调用了 `git cz`,方便按语义化版本自动递增,以及自动生成 `CHANGELOG.md` +- `packages` 工程里一些开发时公共依赖(比如:`typescript`、`ava` 等)会放到工程顶层 +- 工程里的 `.md`、`test/` 等文件修改不会产生新的发布 +- 当工程里存在多个 ts 文件的目录时,最终产生的文件会按文件夹形式放到 `lib` 下 ## 包权限管理 - - `npm owner ls @ali/ --registry http://registry.npm.alibaba-inc.com` - - `npm owner add @ali/ --registry http://registry.npm.alibaba-inc.com` - - `npm owner rm @ali/ --registry http://registry.npm.alibaba-inc.com ` +- `npm owner ls @ali/ --registry http://registry.npm.alibaba-inc.com` +- `npm owner add @ali/ --registry http://registry.npm.alibaba-inc.com` +- `npm owner rm @ali/ --registry http://registry.npm.alibaba-inc.com` diff --git a/package.json b/package.json index 556aca8c7..0fab04a27 100644 --- a/package.json +++ b/package.json @@ -2,13 +2,15 @@ "name": "ali-lowcode-engine", "private": true, "scripts": { - "boot": "lerna bootstrap --registry http://registry.npm.alibaba-inc.com", + "boot": "lerna bootstrap --registry http://registry.npm.alibaba-inc.com --hoist", "clean": "rimraf ./packages/*/lib ./packages/*/node_modules", "pub": "npm run test && lerna publish --registry http://registry.npm.alibaba-inc.com", "lint": "tslint -p tsconfig.json", "lint:fix": "tslint --fix -p tsconfig.json", "build": "lerna run build", - "test": "lerna run test" + "test": "lerna run test", + "test:snapshot": "lerna run test:snapshot", + "commit": "git-cz" }, "devDependencies": { "@types/node": "^10.12.18", diff --git a/templates/package.json b/templates/package.json index 4a796fc8a..f5691c9ea 100644 --- a/templates/package.json +++ b/templates/package.json @@ -8,10 +8,12 @@ ], "scripts": { "build": "tsc", - "test": "ava" + "test": "ava", + "test:snapshot": "ava --update-snapshots" }, "ava": { "compileEnhancements": false, + "snapshotDir": "test/fixtures/__snapshots__", "extensions": [ "ts" ],