Skip to content

Commit 3d10394

Browse files
authored
Add Pnpm support (follow-up of #162) (#165)
* Ensure all extension types use top-level type dependencies * Ensure pnpm is properly handled * Completely replace Yarn with pnpm * Update link to extension types
1 parent 2a006d2 commit 3d10394

File tree

36 files changed

+13293
-8933
lines changed

36 files changed

+13293
-8933
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
1-
name: command:build
2-
on: push
1+
name: extension build
2+
3+
on:
4+
push:
5+
36
jobs:
47
build:
58
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
node-version: [20]
612
steps:
7-
- uses: actions/checkout@v2
8-
- name: Install modules
9-
run: yarn
13+
- uses: actions/checkout@v4
14+
- name: Install pnpm
15+
uses: pnpm/action-setup@v4 # No version specified here
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
cache: 'pnpm'
21+
- name: Install dependencies
22+
run: pnpm install
1023
- name: Run compiler
11-
run: yarn compile
12-
- name: Run `extenion build` command
13-
run: yarn test:build
14-
24+
run: pnpm compile
25+
- name: Run `extension build` command
26+
run: pnpm test:build

.github/workflows/ci.yml

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
11
name: 🛠
22

3-
on: push
3+
on:
4+
push:
45

56
jobs:
67
build:
78
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
node-version: [20]
812
steps:
9-
- uses: actions/checkout@v2
10-
- name: Install modules
11-
run: yarn
12-
- name: Run compiler
13-
run: yarn compile
14-
- name: Run tests
15-
run: yarn test:coverage
16-
- name: Upload results to Codecov
17-
uses: codecov/codecov-action@v4
18-
with:
19-
token: ${{ secrets.CODECOV_TOKEN }}
13+
- uses: actions/checkout@v4
14+
- name: Install pnpm
15+
uses: pnpm/action-setup@v4
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
cache: 'pnpm'
21+
- name: Install dependencies
22+
run: pnpm install
23+
- name: Run compiler
24+
run: pnpm compile
25+
- name: Run tests
26+
run: pnpm test:coverage
27+
- name: Upload results to Codecov
28+
uses: codecov/codecov-action@v4
29+
with:
30+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/cli.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
1-
name: cli
2-
on: push
1+
name: extension
2+
3+
on:
4+
push:
35

46
jobs:
57
build:
68
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
node-version: [20]
712
steps:
8-
- uses: actions/checkout@v2
9-
- name: Install modules
10-
run: yarn
13+
- uses: actions/checkout@v4
14+
- name: Install pnpm
15+
uses: pnpm/action-setup@v4
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
cache: 'pnpm'
21+
- name: Install dependencies
22+
run: pnpm install
1123
- name: Run compiler
12-
run: yarn compile
24+
run: pnpm compile
1325
- name: Run `extenion` cli without arguments
14-
run: yarn test:cli
26+
run: pnpm test:cli

.github/workflows/create.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
1-
name: command:create
2-
on: push
1+
name: extension create
2+
3+
on:
4+
push:
5+
36
jobs:
47
build:
58
runs-on: ${{ matrix.os }}
69
strategy:
710
matrix:
811
os: [ubuntu-latest, windows-latest]
12+
node-version: [20]
913
steps:
10-
- uses: actions/checkout@v2
11-
- name: Install modules
12-
run: yarn
14+
- uses: actions/checkout@v4
15+
- name: Install pnpm
16+
uses: pnpm/action-setup@v4
17+
- name: Use Node.js ${{ matrix.node-version }}
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: ${{ matrix.node-version }}
21+
cache: 'pnpm'
22+
- name: Install dependencies
23+
run: pnpm install
1324
- name: Run compiler
14-
run: yarn compile
25+
run: pnpm compile
1526
- name: Run `extension create` command
16-
run: yarn test:create
27+
run: pnpm test:create

.github/workflows/dev.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
1-
name: command:dev
2-
on: push
1+
name: extension dev
2+
3+
on:
4+
push:
5+
36
jobs:
47
build:
58
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
node-version: [20]
612
steps:
7-
- uses: actions/checkout@v2
8-
- name: Install modules
9-
run: yarn
13+
- uses: actions/checkout@v4
14+
- name: Install pnpm
15+
uses: pnpm/action-setup@v4
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
cache: 'pnpm'
21+
- name: Install dependencies
22+
run: pnpm install
1023
- name: Run compiler
11-
run: yarn compile
24+
run: pnpm compile
1225
- name: Run `extension dev` command
13-
run: yarn test:dev
26+
run: pnpm test:dev

.github/workflows/discord-notify-releases.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- name: Checkout
10-
uses: actions/checkout@v3
10+
uses: actions/checkout@v4
1111
- name: Github Releases To Discord
1212
uses: SethCohen/[email protected]
1313
with:

.github/workflows/preview.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
1-
name: command:preview
2-
on: push
1+
name: extension preview
2+
3+
on:
4+
push:
5+
36
jobs:
47
build:
58
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
node-version: [20]
612
steps:
7-
- uses: actions/checkout@v2
8-
- name: Install modules
9-
run: yarn
13+
- uses: actions/checkout@v4
14+
- name: Install pnpm
15+
uses: pnpm/action-setup@v4
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
cache: 'pnpm'
21+
- name: Install dependencies
22+
run: pnpm install
1023
- name: Run compiler
11-
run: yarn compile
24+
run: pnpm compile
1225
# - name: Run `extension preview` command (TODO)
13-
# run: yarn test:preview
26+
# run: pnpm test:preview

.github/workflows/release-preview.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ jobs:
66
runs-on: ubuntu-latest
77

88
steps:
9-
- name: Checkout code
10-
uses: actions/checkout@v4
11-
12-
- run: corepack enable
13-
- uses: actions/setup-node@v4
9+
- uses: actions/checkout@v4
10+
- name: Install pnpm
11+
uses: pnpm/action-setup@v4
12+
- name: Use Node.js ${{ matrix.node-version }}
13+
uses: actions/setup-node@v4
1414
with:
15-
node-version: 20
16-
cache: 'yarn'
17-
- name: Install modules
18-
run: yarn install
15+
node-version: ${{ matrix.node-version }}
16+
cache: 'pnpm'
17+
- name: Install dependencies
18+
run: pnpm install
1919
- name: Run compiler
20-
run: yarn compile
20+
run: pnpm compile
2121
- name: Deploy release preview
22-
run: pnpx pkg-pr-new publish './programs/*'
22+
run: pnpx pkg-pr-new publish './programs/*'

.github/workflows/start.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
name: command:start
2-
on: push
2+
3+
on:
4+
push:
5+
36
jobs:
47
build:
58
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
node-version: [20]
612
steps:
7-
- uses: actions/checkout@v2
8-
- name: Install modules
9-
run: yarn
13+
- uses: actions/checkout@v4
14+
- name: Install pnpm
15+
uses: pnpm/action-setup@v4
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
cache: 'pnpm'
21+
- name: Install dependencies
22+
run: pnpm install
1023
- name: Run compiler
11-
run: yarn compile
24+
run: pnpm compile
1225
# - name: Run start tests (TODO)
13-
# run: yarn test:start
26+
# run: pnpm test:start

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,14 @@ yarn-error.log*
5050
# swc
5151
.swc
5252

53+
# pnpm
54+
pnpm-lock.yaml
55+
5356
# Extension.js (beta)
5457
__TEST__
5558

5659
# Examples
5760
/examples/**/package-lock.json
5861
/examples/**/yarn.lock
62+
/examples/**/pnpm-lock.yaml
5963
/examples/**/extension-env.d.ts

CONTRIBUTING.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Extension.js runs on top of webpack using custom plugins. The whole Extension.js
1313
## Installation
1414

1515
1. Clone the project `[email protected]:cezaraugusto/extension.git` && `cd extension`.
16-
2. Install dependencies (will symlink files where appropriate) `yarn install`
16+
2. Install dependencies (will symlink files where appropriate) `pnpm install`
1717
3. Create an `.env` file at the project root and add `EXTENSION_ENV=development`
1818

1919
## Usage
@@ -22,25 +22,25 @@ To watch and apply changes to the project, you will need two or more terminals o
2222

2323
### Terminal 1: Watch mode
2424

25-
Use it to watch file changes. Under the hood this runs the compiler (`yarn compile`) infinitely.
25+
Use it to watch file changes. Under the hood this runs the compiler (`pnpm compile`) infinitely.
2626

2727
```sh
28-
yarn watch
28+
pnpm watch
2929
```
3030

3131
### Terminal 2: Mimick `extension` command behavior.
3232

33-
Now that you have the watcher running, running `yarn extension <command> [argument]` will emulate the production `extension <command> [argument]`. Use it to experiment with the multiple Extension.js CLI commands.
33+
Now that you have the watcher running, running `pnpm extension <command> [argument]` will emulate the production `extension <command> [argument]`. Use it to experiment with the multiple Extension.js CLI commands.
3434

3535
```sh
36-
yarn extension <command> [argument]
36+
pnpm extension <command> [argument]
3737
```
3838

3939
That's all!
4040

4141
## Templates
4242

43-
Extension.js uses its own templates for testing. If you need to test a React extension behavior for example, running `yarn extension dev ./examples/new-react` will open the `new-react` template and use the defaults applied for a React configuration.
43+
Extension.js uses its own templates for testing. If you need to test a React extension behavior for example, running `pnpm extension dev ./examples/new-react` will open the `new-react` template and use the defaults applied for a React configuration.
4444

4545
## Useful Commands
4646

@@ -52,15 +52,15 @@ and are needed for the project development.
5252
This is the same command users run when they do `npx extension <command>
5353

5454
```sh
55-
yarn extension <command> [args] [flags]
55+
pnpm extension <command> [args] [flags]
5656
```
5757

5858
### `compile`
5959

6060
Compiles (builds) packages and programns. This npm script generates the `/dist` folder that other packages may consume.
6161

6262
```sh
63-
yarn compile
63+
pnpm compile
6464
```
6565

6666
### `watch`
@@ -70,29 +70,29 @@ Like compile, but listens for code changes, where it compiles again.
7070
> Note: You want a terminal always running this command during development.
7171
7272
```sh
73-
yarn watch
73+
pnpm watch
7474
```
7575

7676
### `lint`
7777

7878
Iterates over all projects and lint them using ESLint.
7979

8080
```sh
81-
yarn lint
81+
pnpm lint
8282
```
8383

8484
### `test`
8585

8686
Run the test suite of each package and program (where available).
8787

8888
```sh
89-
yarn test
89+
pnpm test
9090
```
9191

9292
### `clean`
9393

9494
Deletes cache, `dist/` and `node_modules/` across packages and programs.
9595

9696
```sh
97-
yarn clean
97+
pnpm clean
9898
```

0 commit comments

Comments
 (0)