Skip to content

Commit 32cff9a

Browse files
committed
chore: replace yarn with pnpm
1 parent 77ce923 commit 32cff9a

File tree

6 files changed

+49
-32
lines changed

6 files changed

+49
-32
lines changed

.github/workflows/CI.yml

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,46 @@ jobs:
1414
setup:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- name: Checkout code
18-
uses: actions/checkout@v4
17+
- uses: actions/checkout@v4
1918

20-
- name: Cache yarn.lock
19+
- uses: pnpm/action-setup@v2
20+
with:
21+
version: 6.32.12
22+
23+
- name: Cache pnpm-lock.yaml
2124
uses: actions/cache@v4
2225
with:
2326
path: package-temp-dir
2427
key: lock-${{ github.sha }}
2528

26-
- name: Create yarn.lock
27-
run: yarn generate-lock-entry
28-
2929
- name: Hack for single file
3030
run: |
3131
if [ ! -d "package-temp-dir" ]; then
3232
mkdir package-temp-dir
3333
fi
34-
cp yarn.lock package-temp-dir
34+
cp pnpm-lock.yaml package-temp-dir
3535
- name: Cache node_modules
3636
id: node_modules_cache_id
3737
uses: actions/cache@v4
3838
with:
3939
path: node_modules
40-
key: node_modules-${{ hashFiles('**/package-temp-dir/yarn.lock') }}
40+
key: node_modules-${{ hashFiles('**/package-temp-dir/pnpm-lock.yaml') }}
4141

4242
- name: Install dependencies
4343
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
44-
run: yarn
44+
run: pnpm install
4545

4646
prettier:
4747
needs: [setup]
4848
runs-on: ubuntu-latest
4949
steps:
50-
- uses: actions/checkout@v2
50+
- uses: actions/checkout@v4
5151

52-
- name: Restore cache from yarn.lock
52+
- uses: pnpm/action-setup@v2
53+
with:
54+
version: 6.32.12
55+
56+
- name: Restore cache from pnpm-lock.yaml
5357
uses: actions/cache@v4
5458
with:
5559
path: package-temp-dir
@@ -59,18 +63,18 @@ jobs:
5963
uses: actions/cache@v4
6064
with:
6165
path: node_modules
62-
key: node_modules-${{ hashFiles('**/package-temp-dir/yarn.lock') }}
66+
key: node_modules-${{ hashFiles('**/package-temp-dir/pnpm-lock.yaml') }}
6367

6468
- name: Prettier check
65-
run: yarn prettier
69+
run: pnpm prettier
6670

6771
eslint:
6872
needs: [setup]
6973
runs-on: ubuntu-latest
7074
steps:
7175
- uses: actions/checkout@v2
7276

73-
- name: Restore cache from yarn.lock
77+
- name: Restore cache from pnpm-lock.yaml
7478
uses: actions/cache@v4
7579
with:
7680
path: package-temp-dir
@@ -80,18 +84,22 @@ jobs:
8084
uses: actions/cache@v4
8185
with:
8286
path: node_modules
83-
key: node_modules-${{ hashFiles('**/package-temp-dir/yarn.lock') }}
87+
key: node_modules-${{ hashFiles('**/package-temp-dir/pnpm-lock.yaml') }}
8488

8589
- name: Eslint check
86-
run: yarn eslint
90+
run: pnpm eslint
8791

8892
test:
8993
needs: [setup]
9094
runs-on: ubuntu-latest
9195
steps:
92-
- uses: actions/checkout@v2
96+
- uses: actions/checkout@v4
9397

94-
- name: Restore cache from yarn.lock
98+
- uses: pnpm/action-setup@v2
99+
with:
100+
version: 6.32.12
101+
102+
- name: Restore cache from pnpm-lock.yaml
95103
uses: actions/cache@v4
96104
with:
97105
path: package-temp-dir
@@ -101,33 +109,31 @@ jobs:
101109
uses: actions/cache@v4
102110
with:
103111
path: node_modules
104-
key: node_modules-${{ hashFiles('**/package-temp-dir/yarn.lock') }}
112+
key: node_modules-${{ hashFiles('**/package-temp-dir/pnpm-lock.yaml') }}
105113

106114
- name: Setup timezone
107115
uses: zcong1993/setup-timezone@master
108116
with:
109-
timezone: Asia/Shanghai
117+
timezone: Asia/Shanghai
110118

111119
- name: Unit Test
112-
run: yarn test
120+
run: pnpm test
113121

114122
build:
115123
runs-on: ubuntu-latest
116124
needs: [setup, prettier, eslint, test]
117125
steps:
118-
- uses: actions/checkout@v2
126+
- uses: actions/checkout@v4
119127

120-
- name: Restore cache from yarn.lock
121-
uses: actions/cache@v4
128+
- uses: pnpm/action-setup@v2
122129
with:
123-
path: package-temp-dir
124-
key: lock-${{ github.sha }}
130+
version: 6.32.12
125131

126132
- name: Restore cache from node_modules
127133
uses: actions/cache@v4
128134
with:
129135
path: node_modules
130-
key: node_modules-${{ hashFiles('**/package-temp-dir/yarn.lock') }}
136+
key: node_modules-${{ hashFiles('**/package-temp-dir/pnpm-lock.yaml') }}
131137

132138
- name: Build test
133-
run: yarn build
139+
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: 2 additions & 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",
@@ -55,6 +56,7 @@
5556
"jest-environment-jsdom": "^29.7.0",
5657
"ko-lint-config": "^2.2.18",
5758
"lint-staged": "^9.5.0",
59+
"prettier": "^3.6.2",
5860
"standard-version": "^9.5.0",
5961
"ts-jest": "^29.2.5",
6062
"ts-node": "^10.9.2",

pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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)