Skip to content

Commit ecaa79d

Browse files
authored
Merge pull request #87 from storybookjs/switch-to-pnpm
Switch to pnpm and add ESLint
2 parents d7e22f0 + c5f3840 commit ecaa79d

File tree

14 files changed

+6218
-5170
lines changed

14 files changed

+6218
-5170
lines changed

.github/workflows/build.yml

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,59 @@ name: Build
33
on: [push]
44

55
jobs:
6-
release:
6+
lint:
77
runs-on: ubuntu-latest
88
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
9+
strategy:
10+
matrix:
11+
node-version: [20.19, 22.12]
912
steps:
10-
- uses: actions/checkout@v4
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
1117

12-
- name: Prepare repository
13-
run: git fetch --unshallow --tags
18+
- name: Install pnpm
19+
uses: pnpm/action-setup@v4
1420

15-
- name: Use Node.js 20.x
21+
- name: Use Node.js ${{ matrix.node-version }}
1622
uses: actions/setup-node@v4
1723
with:
18-
node-version: 20.x
24+
node-version: ${{ matrix.node-version }}
25+
cache: 'pnpm'
26+
27+
- name: Install dependencies
28+
run: pnpm install
29+
30+
- name: Check for linter errors
31+
run: pnpm lint
32+
33+
build:
34+
runs-on: ubuntu-latest
35+
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
36+
strategy:
37+
matrix:
38+
node-version: [20.19, 22.12]
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 0
1944

20-
- name: Enable corepack
21-
run: corepack enable
45+
- name: Install pnpm
46+
uses: pnpm/action-setup@v4
47+
48+
- name: Use Node.js ${{ matrix.node-version }}
49+
uses: actions/setup-node@v4
50+
with:
51+
node-version: ${{ matrix.node-version }}
52+
cache: 'pnpm'
2253

2354
- name: Install dependencies
24-
run: yarn install
55+
run: pnpm install
2556

26-
- name: Build
27-
run: |
28-
yarn run build
57+
- name: Build addon
58+
run: pnpm build
2959

3060
- name: Build Storybook
31-
run: |
32-
yarn run build-storybook
61+
run: pnpm build-storybook

.github/workflows/release.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,29 @@ on: [push]
55
jobs:
66
release:
77
runs-on: ubuntu-latest
8-
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
8+
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci') && github.repository != 'storybookjs/addon-kit'"
99
steps:
10-
- uses: actions/checkout@v4
10+
- name: Checkout
11+
uses: actions/checkout@v4
1112

1213
- name: Prepare repository
1314
run: git fetch --unshallow --tags
1415

16+
- name: Install pnpm
17+
uses: pnpm/action-setup@v4
18+
1519
- name: Use Node.js 20.x
1620
uses: actions/setup-node@v4
1721
with:
1822
node-version: 20.x
19-
20-
- name: Enable corepack
21-
run: corepack enable
23+
cache: 'pnpm'
2224

2325
- name: Install dependencies
24-
run: yarn install
26+
run: pnpm install
2527

2628
- name: Create Release
2729
env:
2830
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2931
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3032
run: |
31-
yarn run release
33+
pnpm run release

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ storybook-static/
44
build-storybook.log
55
.DS_Store
66
.env
7-
!yarn.lock
8-
.yarn/install-state.gz
7+
.eslintcache

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
dist
2+
pnpm-lock.yaml
3+
node_modules
4+
storybook-static

.yarnrc.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

eslint.config.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import storybook from 'eslint-plugin-storybook';
2+
import js from '@eslint/js';
3+
import prettierRecommended from 'eslint-plugin-prettier/recommended';
4+
import reactPlugin from 'eslint-plugin-react';
5+
import tseslint from 'typescript-eslint';
6+
7+
export default [
8+
{
9+
ignores: [
10+
'.github/dependabot.yml',
11+
'!.*',
12+
'*.tgz',
13+
'dist/',
14+
'scripts/',
15+
'coverage/',
16+
'node_modules/',
17+
'storybook-static/',
18+
'build-storybook.log',
19+
'.DS_Store',
20+
'.env',
21+
'.idea',
22+
'.vscode',
23+
],
24+
},
25+
js.configs.recommended,
26+
reactPlugin.configs.flat.recommended,
27+
{
28+
settings: {
29+
react: {
30+
version: 'detect',
31+
},
32+
},
33+
},
34+
...tseslint.configs.recommended,
35+
...storybook.configs['flat/recommended'],
36+
prettierRecommended,
37+
];

package.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,16 @@
4040
"eject-ts": "zx scripts/eject-typescript.js",
4141
"postinstall": "node scripts/welcome.js",
4242
"format": "prettier --write .",
43+
"lint": "eslint --cache .",
44+
"lint:fix": "pnpm lint --fix",
4345
"prerelease": "zx scripts/prepublish-checks.js",
4446
"release": "npm run build && auto shipit",
4547
"start": "run-p build:watch \"storybook --quiet\"",
4648
"storybook": "storybook dev -p 6006",
4749
"test": "echo \"Error: no test specified\" && exit 1"
4850
},
4951
"devDependencies": {
52+
"@eslint/js": "^9.36.0",
5053
"@storybook/addon-docs": "next",
5154
"@storybook/icons": "^1.4.0",
5255
"@storybook/react-vite": "next",
@@ -56,6 +59,11 @@
5659
"@vitejs/plugin-react": "^4.7.0",
5760
"auto": "^11.3.0",
5861
"boxen": "^8.0.1",
62+
"eslint": "^9.36.0",
63+
"eslint-config-prettier": "^10.1.8",
64+
"eslint-plugin-prettier": "^5.5.4",
65+
"eslint-plugin-react": "^7.37.5",
66+
"eslint-plugin-storybook": "next",
5967
"npm-run-all2": "^8.0.4",
6068
"prettier": "^3.6.2",
6169
"prompts": "^2.4.2",
@@ -65,6 +73,7 @@
6573
"ts-dedent": "^2.2.0",
6674
"tsup": "^8.5.0",
6775
"typescript": "^5.8.3",
76+
"typescript-eslint": "^8.44.1",
6877
"vite": "^7.0.5",
6978
"zx": "^8.7.1"
7079
},
@@ -94,5 +103,10 @@
94103
],
95104
"icon": "https://user-images.githubusercontent.com/321738/63501763-88dbf600-c4cc-11e9-96cd-94adadc2fd72.png"
96105
},
97-
"packageManager": "yarn@4.10.3"
106+
"packageManager": "pnpm@10.0.0",
107+
"pnpm": {
108+
"onlyBuiltDependencies": [
109+
"esbuild"
110+
]
111+
}
98112
}

0 commit comments

Comments
 (0)