Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlin88 committed Jan 5, 2022
0 parents commit ed270b7
Show file tree
Hide file tree
Showing 80 changed files with 56,532 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
extends: ['alloy'],
env: {
node: true,
es6: true,
// mocha: true,
// jest: true,
// jquery: true
},
globals: {},
rules: {},
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.eslintcache
.changelog
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no -- commitlint --edit "$1"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install lint-staged
4 changes: 4 additions & 0 deletions .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

exec < /dev/tty && node_modules/.bin/git-cz --hook || true
40 changes: 40 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exports = {
// 一行最多 120 字符
printWidth: 120,
// 使用 2 个空格缩进
tabWidth: 2,
// 不使用缩进符,而使用空格
useTabs: false,
// 行尾不需要分号
semi: false,
// 使用单引号
singleQuote: true,
// 对象的 key 仅在必要时用引号
quoteProps: 'as-needed',
// jsx 不使用单引号,而使用双引号
// 末尾需要有逗号
trailingComma: 'all',
// 大括号内的首尾需要空格
bracketSpacing: true,
// jsx 标签的反尖括号需要换行
bracketSameLine: false,
// 箭头函数,只有一个参数的时候,也需要括号
arrowParens: 'avoid',
// 每个文件格式化的范围是文件的全部内容
rangeStart: 0,
rangeEnd: Infinity,
// 不需要写文件开头的 @prettier
requirePragma: false,
// 不需要自动在文件开头插入 @prettier
insertPragma: false,
// 使用默认的折行标准
proseWrap: 'preserve',
// 根据显示样式决定 html 要不要折行
htmlWhitespaceSensitivity: 'css',
// vue 文件中的 script 和 style 内不用缩进
vueIndentScriptAndStyle: false,
// 换行符使用 lf
endOfLine: 'lf',
// 格式化嵌入的内容
embeddedLanguageFormatting: 'auto',
}
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# iwis-cli

这是一个前端工程化的学习向的项目:从基础到复杂,逐步构建一个脚手架。

项目参照了 vue-cli 等,此项目迭代是一个边实现、边总结的过程,会在代码注释中加入自己的理解和疑问

## 使用方法

```bash
npm install -g @iwis/cli
iwis create my-project
```

## 贡献方法

贡献需要使用 yarn,因为本项目的 monorepo 架构依赖于[yarn workspace](https://classic.yarnpkg.com/blog/2017/08/02/introducing-workspaces/)[lerna](https://www.lernajs.cn/)
其中 yarn 用于管理 package 依赖、lerna 用于版本管理与发布 publish。

1. fork 本项目至你的 github
2. git clone 你的仓库
3. `yarn`
4. `git checkout -b <new-branch-name>`:在新分支上修改代码
5. `cd packages/@iwis/cli`
6. `yarn link`:将脚手架命令链接到本地全局环境
7. 本地测试完成后发起一个 Pull Request
8. 等待 Code Review 通过后 merge
9. 贡献成功~

## 升级计划

- [x] 支持选择 yarn/npm
- [x] 支持切换源为淘宝源
- [x] 改为 monorepo 架构
- [x] 支持 git commit eslint/prettier 校验
- [x] 支持 git commit message 格式校验
- [ ] 支持动态生成 webpack 配置
- [ ] 升级至 ESM
- [ ] 替换 webpack 为 vite
- [ ] ...
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] }
30 changes: 30 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"npmClient": "yarn",
"useWorkspaces": true,
"packages": [
"packages/@iwis/*"
],
"version": "1.0.3",
"command": {
"publish": {
"ignoreChanges": [
"*.md"
],
"verifyAccess": false,
"verifyRegistry": false,
"message": "chore(release): publish"
}
},
"changelog": {
"repo": "davidlin88/iwis-cli",
"labels": {
"PR: New Feature": ":rocket: New Features",
"PR: Breaking Change": ":boom: Breaking Changes",
"PR: Bug Fix": ":bug: Bug Fix",
"PR: Documentation": ":memo: Documentation",
"PR: Internal": ":house: Internal",
"PR: Underlying Tools": ":hammer: Underlying Tools"
},
"cacheDir": ".changelog"
}
}
Loading

0 comments on commit ed270b7

Please sign in to comment.