Skip to content

Commit

Permalink
refactor: replace yarn with pnpm (element-plus#3571)
Browse files Browse the repository at this point in the history
* refactor: replace yarn with pnpm

* chore: install pnpm

* chore: disable cache

* ignore pnpm-lock.yaml

* resolve deps

* setup pnpm
  • Loading branch information
sxzz authored Sep 23, 2021
1 parent 53a5194 commit f9e1925
Show file tree
Hide file tree
Showing 39 changed files with 12,224 additions and 15,235 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
dist
packages/*/es
packages/*/lib
pnpm-lock.yaml
20 changes: 11 additions & 9 deletions .github/workflows/master-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,32 @@ jobs:
with:
node-version: '16'

- name: Install dependencies
run: yarn bootstrap
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 6.15.1

- name: Init docs
run: cd docs && yarn
- name: Install dependencies
run: pnpm bootstrap

- name: Fetch Crowdin token for pulling languages
run: yarn docs:crowdin
run: pnpm docs:crowdin
env:
CROWDIN_TOKEN: ${{secrets.CROWDIN_TOKEN}}

- name: Pull Crowdin translations
run: cd docs && yarn crowdin download
run: cd docs && pnpx crowdin download

- name: Generate common locale
run: yarn docs:gen-locale
run: pnpm docs:gen-locale

- name: Build website
run: yarn docs:build
run: pnpm docs:build
env:
DOC_ENV: production

# - name: Build Indices
# run: yarn build:indices
# run: pnpm build:indices
# env:
# ALGOLIA_KEY: ${{secrets.ALGOLIA_KEY}}

Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/preview-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,22 @@ jobs:
node-version: '16'
registry-url: https://registry.npmjs.com/

- name: Install dependencies
run: yarn bootstrap
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 6.15.1

- name: Init docs
run: cd docs && yarn
- name: Install dependencies
run: pnpm bootstrap

- name: Generate common locale
run: yarn docs:gen-locale
run: pnpm docs:gen-locale

- name: Build Element Plus
run: sh scripts/build.sh

- name: Build website
run: yarn docs:build
run: pnpm docs:build
env:
DOC_ENV: preview

Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 6.15.1
- name: Install dependencies
run: yarn bootstrap
run: pnpm bootstrap
- name: Lint
run: yarn lint
run: pnpm lint
- name: Test
run: yarn test
run: pnpm test

publish:
needs: test
Expand All @@ -29,12 +33,16 @@ jobs:
with:
node-version: '14'
registry-url: https://registry.npmjs.com/
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 6.15.1
- name: Get version
run: echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Get git head
run: echo "GIT_HEAD=${GITHUB_SHA}" >> $GITHUB_ENV
- name: Gen npmrc
run: echo "//registry.npmjs.com/:_authToken=${{ secrets.NPM_PUBLISH_TOKEN }}" > ./.npmrc
run: echo "//registry.npmjs.com/:_authToken=${{ secrets.NPM_PUBLISH_TOKEN }}" >> ./.npmrc
- name: Build&publish
run: sh ./scripts/publish.sh
env:
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/staging-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,33 @@ jobs:
with:
node-version: '16'

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 6.15.1

- name: Install dependencies
run: yarn bootstrap
run: pnpm bootstrap

- name: Compile Element Plus
run: sh scripts/build.sh

- name: Init docs
run: cd docs && yarn

- name: Init Crowdin token
run: yarn docs:crowdin
run: pnpm docs:crowdin
env:
CROWDIN_TOKEN: ${{secrets.CROWDIN_TOKEN}}

- name: Upload source files
run: cd docs && yarn crowdin upload sources
run: cd docs && pnpx crowdin upload sources

- name: Pull Crowdin translations
run: cd docs && yarn crowdin download
run: cd docs && pnpx crowdin download

- name: Generate common locale
run: yarn docs:gen-locale
run: pnpm docs:gen-locale

- name: Build website
run: yarn docs:build
run: pnpm docs:build
env:
DOC_ENV: staging

Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@ jobs:
node-name: 'Latest'
steps:
- uses: actions/checkout@v2
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 6.15.1
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
cache: 'pnpm'
- name: Install dependencies
run: yarn bootstrap
run: pnpm bootstrap
- name: Lint
run: yarn lint
run: pnpm lint
- name: Test
run: yarn test
run: pnpm test
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@

# Package Manager
node_modules
lerna-debug.json
lerna-debug.log
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# System
.DS_Store
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist = true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
packages/*/es
packages/*/lib
coverage
pnpm-lock.yaml
4 changes: 2 additions & 2 deletions DEV_FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ Here are the problems that are easy to encounter in development.
## If you encounter dependency related issues

```bash
yarn bootstrap
pnpm bootstrap
```

## Test suite failed to run (jest)

Can not run `yarn test xxx`
Can not run `pnpm test xxx`

```bash
rm -rf dist
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,17 @@ You can find the breaking change list here: [Breaking Change List](https://githu
With command

```bash
$ yarn bootstrap
$ pnpm bootstrap
```

the project will install all dependencies and run `lerna bootstrap` to initialize the project
the project will install all dependencies

## Website preview

With command

```bash
$ yarn docs:dev
$ pnpm docs:dev
```

the project will launch website for you to preview all existing component
Expand All @@ -97,7 +97,7 @@ the project will launch website for you to preview all existing component
1. With command

```shell
$ yarn dev
$ pnpm dev
```

will start the local development environment
Expand Down Expand Up @@ -132,7 +132,7 @@ Modify `play.vue` file per your needs to get things work.
With command

```bash
$ yarn gen component-name
$ pnpm gen component-name
```

Note the `component-name` must be in `kebab-case`, combining words by replacing each space with a dash.
Expand All @@ -142,7 +142,7 @@ Note the `component-name` must be in `kebab-case`, combining words by replacing
With command

```bash
yarn cz
pnpm cz
```

Example
Expand Down
3 changes: 2 additions & 1 deletion build/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function pathsRewriter(id: string) {

async function buildComponents() {
const componentPaths = await getComponents()
const external = await getExternals({ full: false })

const builds = componentPaths.map(
async ({ path: p, name: componentName }) => {
Expand All @@ -72,7 +73,7 @@ async function buildComponents() {
const rollupConfig = {
input: entry,
plugins,
external: getExternals({ full: false }),
external,
}
const bundle = await rollup.rollup(rollupConfig)

Expand Down
2 changes: 1 addition & 1 deletion build/full-bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { getExternals } from './utils'
'process.env.NODE_ENV': JSON.stringify('production'),
}),
],
external: getExternals({ full: true }),
external: await getExternals({ full: true }),
}

console.log(chalk.cyan('Start generating full bundle'))
Expand Down
1 change: 1 addition & 0 deletions build/gen-dts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const genVueTypes = async (
'tests',
'css',
'.DS_Store',
'node_modules',
]
const filePaths = globSync('**/*', {
cwd: root,
Expand Down
67 changes: 0 additions & 67 deletions build/rollup.config.ts

This file was deleted.

Loading

0 comments on commit f9e1925

Please sign in to comment.