Skip to content

Commit

Permalink
refactor: move to pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
jackson-yyy committed Feb 4, 2022
1 parent 9340796 commit 8acb264
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 35 deletions.
3 changes: 1 addition & 2 deletions .github/idux-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ issue:
- Upgrade Dependencies
replay: |
Hello @{user}.
- If you use npm, please try `rm -rf node_modules && npm install` to upgrade all your dependencies.
- If you use yarn, you may need `yarn upgrade`.
- please try `rm -rf node_modules && pnpm install` to upgrade all your dependencies.
<img src="https://cloud.githubusercontent.com/assets/465125/26667345/4bcc8f10-46d7-11e7-8c72-32a0c68ea7ca.jpg" width="500" height="300">
- labels:
Expand Down
4 changes: 1 addition & 3 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
"registry": "https://registry.npmjs.org"
},
"bootstrap": {
"ignore": "",
"hoist": true,
"npmClientArgs": ["--no-package-lock"]
"npmClient": "pnpm"
}
}
}
20 changes: 8 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"icons": "gulp icons --gulpfile ./scripts/gulp/gulpfile.ts",
"gen": "ts-node scripts/gen/generate.ts",
"prepare": "husky install",
"postinstall": "lerna bootstrap",
"version": "lerna version --conventional-commits",
"test": "jest",
"lint": "npm run ls-lint && npm run eslint && npm run stylelint && npm run markdownlint",
Expand Down Expand Up @@ -42,17 +41,6 @@
"path": "./node_modules/cz-conventional-changelog"
}
},
"dependencies": {
"@juggle/resize-observer": "^3.3.1",
"@popperjs/core": "^2.9.3",
"axios": "^0.21.1",
"codesandbox": "^2.2.3",
"date-fns": "^2.27.0",
"lodash-es": "^4.17.21",
"vue": "^3.2.6",
"vue-router": "^4.0.0",
"vue-types": "^3.0.0"
},
"devDependencies": {
"@babel/core": "^7.16.0",
"@babel/preset-env": "^7.16.0",
Expand All @@ -62,6 +50,7 @@
"@ls-lint/ls-lint": "^1.10.0",
"@rollup/plugin-node-resolve": "^13.1.0",
"@rollup/plugin-replace": "^3.0.0",
"@rollup/pluginutils": "^4.1.2",
"@types/figlet": "^1.5.4",
"@types/fs-extra": "^9.0.12",
"@types/gulp": "^4.0.9",
Expand All @@ -79,9 +68,14 @@
"@vitejs/plugin-vue": "^1.10.0",
"@vitejs/plugin-vue-jsx": "^1.3.0",
"@vue/babel-plugin-jsx": "^1.1.1",
"@vue/compiler-dom": "^3.2.29",
"@vue/compiler-sfc": "^3.2.6",
"@vue/eslint-config-prettier": "^7.0.0",
"@vue/eslint-config-typescript": "^10.0.0",
"@vue/reactivity": "^3.2.29",
"@vue/runtime-core": "^3.2.29",
"@vue/runtime-dom": "^3.2.29",
"@vue/shared": "^3.2.29",
"@vue/test-utils": "2.0.0-rc.17",
"babel-jest": "^27.4.0",
"chalk": "^4.0.0",
Expand Down Expand Up @@ -115,6 +109,7 @@
"prismjs": "^1.25.0",
"remark": "^13.0.0",
"resolve-bin": "^1.0.0",
"rollup": "^2.62.0",
"rollup-plugin-typescript2": "^0.31.1",
"stylelint": "^14.0.0",
"stylelint-config-prettier": "^9.0.0",
Expand All @@ -126,6 +121,7 @@
"typescript": "^4.5.0",
"unplugin-vue-components": "^0.17.0",
"vite": "^2.7.0",
"vue": "^3.2.29",
"vue3-jest": "^27.0.0-alpha.2",
"yaml-front-matter": "^4.1.1"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/cdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@
"@popperjs/core": "^2.9.3",
"lodash-es": "^4.17.21",
"vue-types": "^3.0.0"
},
"peerDependencies": {
"vue": "^3.2.29"
}
}
File renamed without changes.
13 changes: 11 additions & 2 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,16 @@
},
"scripts": {},
"dependencies": {
"@idux/cdk": "^1.0.0-alpha.4",
"date-fns": "^2.27.0"
"@idux/cdk": "workspace:*",
"date-fns": "^2.27.0",
"lodash-es": "^4.17.21",
"vue-types": "^3.0.0"
},
"devDependencies": {
"axios": "^0.25.0",
"vue-router": "^4.0.12"
},
"peerDependencies": {
"vue": "^3.2.29"
}
}
9 changes: 7 additions & 2 deletions packages/pro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
"style": "./default.css",
"scripts": {},
"dependencies": {
"@idux/cdk": "^1.0.0-alpha.4",
"@idux/components": "^1.0.0-alpha.5"
"@idux/cdk": "workspace:*",
"@idux/components": "workspace:*",
"lodash-es": "^4.17.21",
"vue-types": "^3.0.0"
},
"peerDependencies": {
"vue": "^3.2.29"
}
}
11 changes: 7 additions & 4 deletions packages/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
"build": "vite build"
},
"dependencies": {
"@idux/cdk": "^1.0.0-alpha.4",
"@idux/components": "^1.0.0-alpha.5",
"@idux/pro": "^1.0.0-alpha.5",
"codesandbox": "^2.2.3"
"@idux/cdk": "workspace:*",
"@idux/components": "workspace:*",
"@idux/pro": "workspace:*",
"codesandbox": "^2.2.3",
"lodash-es": "^4.17.21",
"vue": "^3.2.29",
"vue-router": "^4.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/site/src/docs/Contributing.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ The `IDuxFE` team will pay attention to all Pull Requests. We will review and me
## Development Process

- clone the fork repository;
- install dependencies with `npm i` or `yarn`;
- install dependencies with `pnpm install`;
- commonly used commands:
- `npm start` Run the documentation website locally;
- `npm run lint` Check code style(tips: run `npm run lint-fix` Can fix simple format errors);
Expand Down
3 changes: 2 additions & 1 deletion packages/site/src/docs/Contributing.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ order: 11
## 开发流程

- clone fork 后的仓库
- 安装依赖:`npm install``yarn`
- 安装依赖:`pnpm install`
- 常用的命令:
- `npm start` 在本地运行文档网站。
- `npm run lint` 检查代码风格(tips: 使用 `npm run lint-fix` 可以修复简单格式错误)。
Expand All @@ -75,6 +75,7 @@ order: 11
## 代码风格

我们使用了 `eslint`, `stylelint`, `markdownlint` 以及 `ls-lint` 来保证整体的代码风格一致。并且在 commit hooks 中配置了自动格式化和 lint, 只要提交通过即可。

## Commit

对于如何提交 git commit message,我们有非常精确的规则。我们希望所有的 commit message 更具可读性,这样在查看项目历史记录会变得容易,同时我们使用 commit message 生成 Changelog.
Expand Down
9 changes: 3 additions & 6 deletions packages/site/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import { transformIndexPlugin } from './plugins/transformIndexPlugin'

export default defineConfig(({ command }) => {
const isBuild = command === 'build'
const cdkResolve = isBuild ? '../../dist/cdk' : '../cdk'
const componentsResolve = isBuild ? '../../dist/components' : '../components'
const proResolve = isBuild ? '../../dist/pro' : '../pro'

return {
plugins: [
Expand All @@ -27,9 +24,9 @@ export default defineConfig(({ command }) => {
],
resolve: {
alias: [
{ find: '@idux/cdk', replacement: resolve(__dirname, cdkResolve) },
{ find: '@idux/components', replacement: resolve(__dirname, componentsResolve) },
{ find: '@idux/pro', replacement: resolve(__dirname, proResolve) },
{ find: '@idux/cdk', replacement: resolve(__dirname, '../cdk') },
{ find: '@idux/components', replacement: resolve(__dirname, '../components') },
{ find: '@idux/pro', replacement: resolve(__dirname, '../pro') },
{ find: '@idux/site', replacement: resolve(__dirname, './src') },
],
},
Expand Down
2 changes: 2 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages:
- 'packages/**'
2 changes: 1 addition & 1 deletion scripts/gulp/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const buildComponents = series(
clean(componentsDistDirname),
buildPackage(componentsOptions),
async () => {
await copyFile(join(icon.assetsDirname, '../bin.js'), join(componentsDistDirname, 'bin.js'))
await copyFile(join(componentsDirname, 'bin.js'), join(componentsDistDirname, 'bin.js'))
await copy(icon.assetsDirname, join(componentsDistDirname, 'icon/svg'))
},
buildIndex(componentsOptions),
Expand Down
2 changes: 1 addition & 1 deletion scripts/gulp/site/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const init: TaskFunction = done => {

const start: TaskFunction = done => execNodeTask('vite', ['--host'])(done)

const build: TaskFunction = done => execNodeTask('lerna', ['run', 'build', '--scope', '@idux/site'])(done)
const build: TaskFunction = done => execNodeTask('pnpm', ['run', 'build', '--filter', '@idux/site'])(done)

export const siteStart = series(iconsCopy, init, start)
export const siteBuild = series(iconsCopy, init, build)

0 comments on commit 8acb264

Please sign in to comment.