Skip to content

Commit 4802dfb

Browse files
authored
Cleanup and switch to pnpm (#709)
1 parent 050313d commit 4802dfb

39 files changed

+9800
-15325
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ end_of_line = lf
55
insert_final_newline = true
66
charset = utf-8
77

8-
[*.{js,cjs,mjs,ts,tsx,mts,cts}]
8+
[*.{js,cjs,mjs,ts,tsx,mts,cts,mdx}]
99
indent_style = space
1010
indent_size = 2
1111
#indent_style = tab

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
benchmark/suites/
12
**/__fixtures__/
23
**/dist/
34
**/node_modules

.eslintrc.cjs

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
root: true,
55
extends: ['eslint:recommended', 'plugin:prettier/recommended'],
66
parserOptions: {
7-
ecmaVersion: 2020,
7+
ecmaVersion: 2022,
88
sourceType: 'module',
99
},
1010
rules: {
@@ -35,7 +35,7 @@ module.exports = {
3535
},
3636
overrides: [
3737
{
38-
files: ['*.cjs'],
38+
files: ['**/*.cjs'],
3939
parserOptions: {
4040
ecmaVersion: 2020,
4141
sourceType: 'script',
@@ -45,7 +45,7 @@ module.exports = {
4545
},
4646
},
4747
{
48-
files: '**/*.ts',
48+
files: ['**/*.ts', '**/*.tsx'],
4949
parser: '@typescript-eslint/parser',
5050
plugins: ['@typescript-eslint'],
5151
extends: ['plugin:@typescript-eslint/recommended'],

.github/workflows/build.yml

+27-15
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,25 @@ jobs:
3131
- name: Checkout
3232
uses: actions/checkout@v3
3333

34+
- name: Install pnpm
35+
uses: pnpm/action-setup@v2
36+
3437
- name: Setup Node.js
3538
uses: actions/setup-node@v3
3639
with:
3740
node-version: ${{ matrix.node }}
38-
cache: 'yarn'
41+
cache: 'pnpm'
3942

4043
- name: Install dependencies
41-
run: yarn install --immutable
44+
run: pnpm install --frozen-lockfile
4245

4346
- name: Unit tests with coverage
4447
if: '${{ matrix.node == env.NODE_VERSION }}'
45-
run: yarn test --coverage
48+
run: pnpm test -- --coverage
4649

4750
- name: Unit tests
4851
if: '${{ matrix.node != env.NODE_VERSION }}'
49-
run: yarn test
52+
run: pnpm test
5053

5154
- name: Upload coverage to Codecov
5255
if: '${{ matrix.node == env.NODE_VERSION }}'
@@ -60,17 +63,20 @@ jobs:
6063
- name: Checkout
6164
uses: actions/checkout@v3
6265

66+
- name: Install pnpm
67+
uses: pnpm/action-setup@v2
68+
6369
- name: Setup Node.js
6470
uses: actions/setup-node@v3
6571
with:
6672
node-version: ${{ env.NODE_VERSION }}
67-
cache: 'yarn'
73+
cache: 'pnpm'
6874

6975
- name: Install dependencies
70-
run: yarn install --immutable
76+
run: pnpm install --frozen-lockfile
7177

7278
- name: Lint
73-
run: yarn lint
79+
run: pnpm lint
7480

7581
playground:
7682
name: Test build playground
@@ -81,20 +87,23 @@ jobs:
8187
- name: Checkout
8288
uses: actions/checkout@v3
8389

90+
- name: Install pnpm
91+
uses: pnpm/action-setup@v2
92+
8493
- name: Setup Node.js
8594
uses: actions/setup-node@v3
8695
with:
8796
node-version: ${{ env.NODE_VERSION }}
88-
cache: 'yarn'
97+
cache: 'pnpm'
8998

9099
- name: Install dependencies
91-
run: yarn install --immutable
100+
run: pnpm install --frozen-lockfile
92101

93102
- name: Build
94-
run: yarn build
103+
run: pnpm build
95104

96105
- name: Build playground
97-
run: yarn playground:build
106+
run: pnpm playground:build
98107

99108
deploy:
100109
name: Deploy playground
@@ -107,20 +116,23 @@ jobs:
107116
- name: Checkout
108117
uses: actions/checkout@v3
109118

119+
- name: Install pnpm
120+
uses: pnpm/action-setup@v2
121+
110122
- name: Setup Node.js
111123
uses: actions/setup-node@v3
112124
with:
113125
node-version: ${{ env.NODE_VERSION }}
114-
cache: 'yarn'
126+
cache: 'pnpm'
115127

116128
- name: Install dependencies
117-
run: yarn install --immutable
129+
run: pnpm install --frozen-lockfile
118130

119131
- name: Build
120-
run: yarn build
132+
run: pnpm build
121133

122134
- name: Build playground
123-
run: yarn playground:build
135+
run: pnpm playground:build
124136

125137
- name: Deploy
126138
uses: JamesIves/github-pages-deploy-action@v4

.github/workflows/changesets.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,24 @@ jobs:
2222
with:
2323
persist-credentials: false
2424

25+
- name: Install pnpm
26+
uses: pnpm/action-setup@v2
27+
2528
- name: Setup Node.js
2629
uses: actions/setup-node@v3
2730
with:
2831
node-version: ${{ env.NODE_VERSION }}
29-
cache: 'yarn'
32+
cache: 'pnpm'
3033

3134
- name: Install dependencies
32-
run: yarn install --immutable
35+
run: pnpm install --frozen-lockfile
3336

3437
- name: Run Changesets
3538
id: changesets
3639
uses: changesets/action@v1
3740
with:
38-
publish: yarn release
39-
version: yarn changesets-version
41+
publish: pnpm changesets-release
42+
version: pnpm changesets-version
4043
title: Packages ready to publish
4144
commit: Publish new versions
4245
env:

.gitignore

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1+
benchmark/suites/
12
dist/
23
**/node_modules/*
34
!**/__fixtures__/**/node_modules/*
45
.idea/
56
coverage/
6-
yarn-error.log
7-
.pnp.*
8-
.yarn/*
9-
!.yarn/patches
10-
!.yarn/plugins
11-
!.yarn/releases
12-
!.yarn/sdks
13-
!.yarn/versions

.gitpod.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
tasks:
2-
- init: yarn install
2+
- init: pnpm install
33
vscode:
44
extensions:
55
- dbaeumer.vscode-eslint

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
link-workspace-packages=false

.prettierignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
benchmark/suites/
12
**/__fixtures__/
2-
benchmark/fixtures/
33
**/dist/
4+
**/node_modules

.release-please-manifest.json

-4
This file was deleted.

.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

-28
This file was deleted.

.yarn/releases/yarn-3.3.0.cjs

-807
This file was deleted.

.yarnrc.yml

-9
This file was deleted.

benchmark/.gitignore

-9
This file was deleted.

benchmark/index.mjs

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import fs from 'fs';
2-
import path, { dirname, join } from 'path';
2+
import path, { dirname } from 'path';
33
import { fileURLToPath } from 'url';
44
import Table from 'cli-table';
55
import glob from 'fast-glob';
66
import Benchmark from 'benchmark';
77
import { parse } from '../packages/react-docgen/dist/main.js';
88
import { parse as parse5 } from 'react-docgen5';
9-
import { parse as parse6old } from 'react-docgen6pre';
9+
import { parse as parse6 } from 'react-docgen6latest';
1010

1111
console.log(`Node: ${process.version}`);
1212

1313
const __dirname = dirname(fileURLToPath(import.meta.url));
1414

15-
const head = ['fixture', 'v5.4.3', 'v6.0.0-alpha.3', 'current'];
15+
const head = ['fixture', 'v5.4.3', 'v6.0.0-alpha.4', 'current'];
1616

1717
process.stdout.write(`Preparing suites ... `);
1818

@@ -42,10 +42,10 @@ if (!global.gc) {
4242
}
4343

4444
const preparedSuites = [];
45-
const suite = new Benchmark.Suite('bootstrap');
4645

4746
suites.forEach(({ name, files }) => {
4847
const suite = new Benchmark.Suite(name);
48+
4949
files.forEach(file => {
5050
const code = fs.readFileSync(path.join(__dirname, file), 'utf-8');
5151
const options = { filename: file, babelrc: false, configFile: false };
@@ -54,7 +54,7 @@ suites.forEach(({ name, files }) => {
5454
try {
5555
// warmup
5656
parse(code, newOptions);
57-
parse6old(code, undefined, undefined, options);
57+
parse6(code, newOptions);
5858
parse5(code, undefined, undefined, options);
5959
global.gc();
6060

@@ -63,17 +63,19 @@ suites.forEach(({ name, files }) => {
6363
options,
6464
newOptions,
6565
});
66-
} catch {}
66+
} catch {
67+
// ignore errors
68+
}
6769
});
6870

6971
suite.add('v5.4.3', () => {
7072
for (const { code, options } of preparedSuites) {
7173
parse5(code, undefined, undefined, options);
7274
}
7375
});
74-
suite.add('v6.0.0-alpha.3', () => {
75-
for (const { code, options } of preparedSuites) {
76-
parse6old(code, undefined, undefined, options);
76+
suite.add('v6.0.0-alpha.4', () => {
77+
for (const { code, newOptions } of preparedSuites) {
78+
parse6(code, newOptions);
7779
}
7880
});
7981
suite.add('current', () => {

benchmark/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
"dependencies": {
1313
"benchmark": "2.1.4",
1414
"cli-table": "0.3.11",
15-
"fast-glob": "^3.2.12",
15+
"fast-glob": "3.2.12",
1616
"microtime": "3.1.1",
1717
"react-docgen5": "npm:[email protected]",
18-
"react-docgen6pre": "npm:react-docgen@^6.0.0-alpha"
18+
"react-docgen6latest": "npm:react-docgen@^6.0.0-alpha.4",
19+
"react-docgen": "workspace:react-docgen@^6.0.0-alpha.4"
1920
}
2021
}

0 commit comments

Comments
 (0)