Skip to content

Commit 55722c8

Browse files
committed
chore: replace yarn with pnpm
1 parent 77ce923 commit 55722c8

File tree

5 files changed

+28
-23
lines changed

5 files changed

+28
-23
lines changed

.github/workflows/CI.yml

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,42 @@ jobs:
1717
- name: Checkout code
1818
uses: actions/checkout@v4
1919

20-
- name: Cache yarn.lock
20+
- name: Install pnpm
21+
run: npm install -g pnpm
22+
23+
- name: Set pnpm registry
24+
run: pnpm config set registry https://registry.npmmirror.com/
25+
26+
- name: Cache pnpm-lock.yaml
2127
uses: actions/cache@v4
2228
with:
2329
path: package-temp-dir
2430
key: lock-${{ github.sha }}
2531

26-
- name: Create yarn.lock
27-
run: yarn generate-lock-entry
28-
2932
- name: Hack for single file
3033
run: |
3134
if [ ! -d "package-temp-dir" ]; then
3235
mkdir package-temp-dir
3336
fi
34-
cp yarn.lock package-temp-dir
37+
cp pnpm-lock.yaml package-temp-dir
3538
- name: Cache node_modules
3639
id: node_modules_cache_id
3740
uses: actions/cache@v4
3841
with:
3942
path: node_modules
40-
key: node_modules-${{ hashFiles('**/package-temp-dir/yarn.lock') }}
43+
key: node_modules-${{ hashFiles('**/package-temp-dir/pnpm-lock.yaml') }}
4144

4245
- name: Install dependencies
4346
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
44-
run: yarn
47+
run: pnpm install
4548

4649
prettier:
4750
needs: [setup]
4851
runs-on: ubuntu-latest
4952
steps:
5053
- uses: actions/checkout@v2
5154

52-
- name: Restore cache from yarn.lock
55+
- name: Restore cache from pnpm-lock.yaml
5356
uses: actions/cache@v4
5457
with:
5558
path: package-temp-dir
@@ -59,18 +62,18 @@ jobs:
5962
uses: actions/cache@v4
6063
with:
6164
path: node_modules
62-
key: node_modules-${{ hashFiles('**/package-temp-dir/yarn.lock') }}
65+
key: node_modules-${{ hashFiles('**/package-temp-dir/pnpm-lock.yaml') }}
6366

6467
- name: Prettier check
65-
run: yarn prettier
68+
run: pnpm prettier
6669

6770
eslint:
6871
needs: [setup]
6972
runs-on: ubuntu-latest
7073
steps:
7174
- uses: actions/checkout@v2
7275

73-
- name: Restore cache from yarn.lock
76+
- name: Restore cache from pnpm-lock.yaml
7477
uses: actions/cache@v4
7578
with:
7679
path: package-temp-dir
@@ -80,18 +83,18 @@ jobs:
8083
uses: actions/cache@v4
8184
with:
8285
path: node_modules
83-
key: node_modules-${{ hashFiles('**/package-temp-dir/yarn.lock') }}
86+
key: node_modules-${{ hashFiles('**/package-temp-dir/pnpm-lock.yaml') }}
8487

8588
- name: Eslint check
86-
run: yarn eslint
89+
run: pnpm eslint
8790

8891
test:
8992
needs: [setup]
9093
runs-on: ubuntu-latest
9194
steps:
9295
- uses: actions/checkout@v2
9396

94-
- name: Restore cache from yarn.lock
97+
- name: Restore cache from pnpm-lock.yaml
9598
uses: actions/cache@v4
9699
with:
97100
path: package-temp-dir
@@ -101,23 +104,23 @@ jobs:
101104
uses: actions/cache@v4
102105
with:
103106
path: node_modules
104-
key: node_modules-${{ hashFiles('**/package-temp-dir/yarn.lock') }}
107+
key: node_modules-${{ hashFiles('**/package-temp-dir/pnpm-lock.yaml') }}
105108

106109
- name: Setup timezone
107110
uses: zcong1993/setup-timezone@master
108111
with:
109112
timezone: Asia/Shanghai
110113

111114
- name: Unit Test
112-
run: yarn test
115+
run: pnpm test
113116

114117
build:
115118
runs-on: ubuntu-latest
116119
needs: [setup, prettier, eslint, test]
117120
steps:
118121
- uses: actions/checkout@v2
119122

120-
- name: Restore cache from yarn.lock
123+
- name: Restore cache from pnpm-lock.yaml
121124
uses: actions/cache@v4
122125
with:
123126
path: package-temp-dir
@@ -127,7 +130,7 @@ jobs:
127130
uses: actions/cache@v4
128131
with:
129132
path: node_modules
130-
key: node_modules-${{ hashFiles('**/package-temp-dir/yarn.lock') }}
133+
key: node_modules-${{ hashFiles('**/package-temp-dir/pnpm-lock.yaml') }}
131134

132135
- name: Build test
133-
run: yarn build
136+
run: pnpm build

docs/contribution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
1、请 `fork` 本项目,`clone` 自己的仓库,按照上述分支定义从 `master` 分支新建 `feat` 分支进行开发,分支命名用下划线加上版本号、功能名,如:`feat_1.x_xxx`
2424

25-
2、`feat` 分支开发完毕后,本地执行 `yarn lint` 命令,再执行 `yarn test` 命令,均通过后向相应人员提 PR,期望合入 `release` 分支,待相应人员 review 代码后合入
25+
2、`feat` 分支开发完毕后,本地执行 `pnpm lint` 命令,再执行 `pnpm test` 命令,均通过后向相应人员提 PR,期望合入 `release` 分支,待相应人员 review 代码后合入
2626

2727

2828
## Bugs

docs/quickstart.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
```bash
55
npm install @dtinsight/dt-utils
66
yarn add @dtinsight/dt-utils
7+
pnpm install @dtinsight/dt-utils
78
```
89
## 使用
910

@@ -12,7 +13,7 @@ yarn add @dtinsight/dt-utils
1213
````
1314

1415
## Package Managers
15-
JavaScript @dtinsight/dt-utils supports npm and yarn under the name @dtinsight/dt-utils. Module Loaders
16+
JavaScript @dtinsight/dt-utils supports npm, yarn and pnpm under the name @dtinsight/dt-utils. Module Loaders
1617

1718
## Module Loaders
1819
JavaScript @dtinsight/dt-utils can also be loaded as an ES6 module.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"homepage": "https://dtstack.github.io/dt-utils/",
2525
"scripts": {
2626
"build": "tsc",
27+
"lint": "npm run eslint && npm run prettier",
2728
"prettier": "npx prettier --check 'src/**/*.{js,jsx,json,ts}'",
2829
"prettier:fix": "npx prettier --write 'src/**/*.{js,jsx,json,ts}'",
2930
"eslint": "npx eslint --ext .js,.ts ./src",

scripts/release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ git pull origin $branch
2626
echo "Current pull origin $branch."
2727

2828

29-
echo "yarn prepublishOnly"
30-
yarn prepublishOnly
29+
echo "pnpm prepublishOnly"
30+
pnpm prepublishOnly
3131

3232

3333
# Auto generate version number and tag

0 commit comments

Comments
 (0)