Skip to content

Commit

Permalink
Add Pnpm support (follow-up of #162) (#165)
Browse files Browse the repository at this point in the history
* Ensure all extension types use top-level type dependencies

* Ensure pnpm is properly handled

* Completely replace Yarn with pnpm

* Update link to extension types
  • Loading branch information
cezaraugusto authored Sep 5, 2024
1 parent 2a006d2 commit 3d10394
Show file tree
Hide file tree
Showing 36 changed files with 13,293 additions and 8,933 deletions.
30 changes: 21 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
name: command:build
on: push
name: extension build

on:
push:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v2
- name: Install modules
run: yarn
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4 # No version specified here
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Run compiler
run: yarn compile
- name: Run `extenion build` command
run: yarn test:build

run: pnpm compile
- name: Run `extension build` command
run: pnpm test:build
35 changes: 23 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
name: 🛠

on: push
on:
push:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v2
- name: Install modules
run: yarn
- name: Run compiler
run: yarn compile
- name: Run tests
run: yarn test:coverage
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Run compiler
run: pnpm compile
- name: Run tests
run: pnpm test:coverage
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
26 changes: 19 additions & 7 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
name: cli
on: push
name: extension

on:
push:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v2
- name: Install modules
run: yarn
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Run compiler
run: yarn compile
run: pnpm compile
- name: Run `extenion` cli without arguments
run: yarn test:cli
run: pnpm test:cli
25 changes: 18 additions & 7 deletions .github/workflows/create.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
name: command:create
on: push
name: extension create

on:
push:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [20]
steps:
- uses: actions/checkout@v2
- name: Install modules
run: yarn
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Run compiler
run: yarn compile
run: pnpm compile
- name: Run `extension create` command
run: yarn test:create
run: pnpm test:create
27 changes: 20 additions & 7 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
name: command:dev
on: push
name: extension dev

on:
push:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v2
- name: Install modules
run: yarn
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Run compiler
run: yarn compile
run: pnpm compile
- name: Run `extension dev` command
run: yarn test:dev
run: pnpm test:dev
2 changes: 1 addition & 1 deletion .github/workflows/discord-notify-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Github Releases To Discord
uses: SethCohen/github-releases-to-discord@v1.13.1
with:
Expand Down
27 changes: 20 additions & 7 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
name: command:preview
on: push
name: extension preview

on:
push:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v2
- name: Install modules
run: yarn
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Run compiler
run: yarn compile
run: pnpm compile
# - name: Run `extension preview` command (TODO)
# run: yarn test:preview
# run: pnpm test:preview
22 changes: 11 additions & 11 deletions .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- run: corepack enable
- uses: actions/setup-node@v4
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
- name: Install modules
run: yarn install
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Run compiler
run: yarn compile
run: pnpm compile
- name: Deploy release preview
run: pnpx pkg-pr-new publish './programs/*'
run: pnpx pkg-pr-new publish './programs/*'
25 changes: 19 additions & 6 deletions .github/workflows/start.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
name: command:start
on: push

on:
push:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v2
- name: Install modules
run: yarn
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Run compiler
run: yarn compile
run: pnpm compile
# - name: Run start tests (TODO)
# run: yarn test:start
# run: pnpm test:start
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,14 @@ yarn-error.log*
# swc
.swc

# pnpm
pnpm-lock.yaml

# Extension.js (beta)
__TEST__

# Examples
/examples/**/package-lock.json
/examples/**/yarn.lock
/examples/**/pnpm-lock.yaml
/examples/**/extension-env.d.ts
24 changes: 12 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Extension.js runs on top of webpack using custom plugins. The whole Extension.js
## Installation

1. Clone the project `git@github.com:cezaraugusto/extension.git` && `cd extension`.
2. Install dependencies (will symlink files where appropriate) `yarn install`
2. Install dependencies (will symlink files where appropriate) `pnpm install`
3. Create an `.env` file at the project root and add `EXTENSION_ENV=development`

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

### Terminal 1: Watch mode

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

```sh
yarn watch
pnpm watch
```

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

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.
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.

```sh
yarn extension <command> [argument]
pnpm extension <command> [argument]
```

That's all!

## Templates

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.
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.

## Useful Commands

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

```sh
yarn extension <command> [args] [flags]
pnpm extension <command> [args] [flags]
```

### `compile`

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

```sh
yarn compile
pnpm compile
```

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

### `lint`

Iterates over all projects and lint them using ESLint.

```sh
yarn lint
pnpm lint
```

### `test`

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

```sh
yarn test
pnpm test
```

### `clean`

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

```sh
yarn clean
pnpm clean
```
Loading

0 comments on commit 3d10394

Please sign in to comment.