Skip to content

Commit

Permalink
refactor: move to pnpm (#745)
Browse files Browse the repository at this point in the history
fix #635
  • Loading branch information
jackson-yyy committed Feb 14, 2022
1 parent 4dfe2b2 commit 9a970de
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 41 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
24 changes: 12 additions & 12 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ trigger:
pool:
vmImage: 'ubuntu-latest'

variables:
install_packages: 'npm add -g pnpm && pnpm install'

stages:
- stage: env
jobs:
Expand All @@ -26,9 +29,8 @@ stages:
jobs:
- job: lint_packages
steps:
- task: Npm@1
inputs:
command: 'install'
- script: $(install_packages)
displayName: 'Install packages'

- script: npm run lint
displayName: 'Run lint'
Expand All @@ -38,9 +40,9 @@ stages:
jobs:
- job: test_packages
steps:
- task: Npm@1
inputs:
command: 'install'
- script: $(install_packages)
displayName: 'Install packages'

- script: npm run test
displayName: 'Run test'

Expand Down Expand Up @@ -72,9 +74,8 @@ stages:
- job: build_site
condition: eq(variables['Build.Reason'], 'PullRequest')
steps:
- task: Npm@1
inputs:
command: 'install'
- script: $(install_packages)
displayName: 'Install packages'

- script: npm run build
displayName: 'Run build'
Expand All @@ -90,9 +91,8 @@ stages:
- job: publish_artifacts
condition: ne(variables['Build.Reason'], 'PullRequest')
steps:
- task: Npm@1
inputs:
command: 'install'
- script: $(install_packages)
displayName: 'Install packages'

- script: npm run build
displayName: 'Run build'
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"
}
}
}
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"gen": "ts-node scripts/gen/generate.ts",
"less-variable-update": "ts-node scripts/gen/style-variable/update.ts",
"prepare": "husky install",
"postinstall": "lerna bootstrap",
"preinstall": "npx only-allow pnpm",
"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 @@ -43,17 +43,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 @@ -63,6 +52,8 @@
"@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/bluebird": "^3.5.36",
"@types/figlet": "^1.5.4",
"@types/fs-extra": "^9.0.12",
"@types/gulp": "^4.0.9",
Expand All @@ -71,6 +62,7 @@
"@types/less": "^3.0.3",
"@types/lodash-es": "^4.17.4",
"@types/marked": "^4.0.0",
"@types/node": "^17.0.17",
"@types/parse5": "^6.0.1",
"@types/prismjs": "^1.16.6",
"@types/svgo": "^2.6.1",
Expand All @@ -80,9 +72,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 @@ -116,17 +113,20 @@
"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",
"stylelint-config-standard": "^24.0.0",
"svgo": "^2.8.0",
"ts-jest": "^27.1.0",
"ts-node": "^10.4.0",
"ts-toolbelt": "^9.6.0",
"tslib": "^2.3.1",
"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.
11 changes: 10 additions & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
"scripts": {},
"dependencies": {
"@idux/cdk": "^1.0.0-alpha.4",
"date-fns": "^2.27.0"
"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"
}
}
7 changes: 6 additions & 1 deletion packages/pro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
"scripts": {},
"dependencies": {
"@idux/cdk": "^1.0.0-alpha.4",
"@idux/components": "^1.0.0-alpha.5"
"@idux/components": "^1.0.0-alpha.5",
"lodash-es": "^4.17.21",
"vue-types": "^3.0.0"
},
"peerDependencies": {
"vue": "^3.2.29"
}
}
5 changes: 4 additions & 1 deletion packages/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"@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"
"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

0 comments on commit 9a970de

Please sign in to comment.