Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to pnpm #2276

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 14 additions & 25 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,34 @@ Thanks for your interest in contributing to Inertia.js!

## Packages

To make local Inertia.js development easier, this project has been setup as a monorepo using [NPM Workspaces](https://docs.npmjs.com/using-npm/workspaces). To set it up, start by cloning the repository on your system.
To make local Inertia.js development easier, this project has been setup as a monorepo using [pnpm](https://pnpm.io/workspaces). To set it up, start by cloning the repository on your system.

```sh
git clone https://github.com/inertiajs/inertia.git inertia
cd inertia
```

Next, install the JavaScript dependencies:
Next, install the JavaScript dependencies and build the packages:

```sh
npm install
pnpm install && pnpm build
```

Next, build the packages:
If you're making changes to one of the packages, you can setup a watcher to automatically run the build step whenever files are changed.

```sh
npm run build --workspace=packages --if-present
pnpm watch
```

If you're making changes to one of the packages that requires a build step (`core`, `react`, `vue2`, `vue3`), you can setup a watcher to automatically run the build step whenever files are changed.

```sh
cd packages/core
npm run dev
```

When proposing changes to one of the adapters (`react`, `vue2`, `vue3`, `svelte`), please try to apply the same changes to the other adapters where possible.
When proposing changes to one of the adapters, please try to apply the same changes to the other adapters where possible.

## Playgrounds

It's often helpful to develop Inertia.js using a real application. The playground folder contains an example Laravel project for each of the adapters. Here's how to get a playground running:

```sh
cd playgrounds/react
npm run build
pnpm build
composer install
cp .env.example .env
php artisan key:generate
Expand All @@ -49,30 +42,26 @@ php artisan serve
To automatically see changes to the JavaScript files in the browser, start the development server:

```sh
npm run dev
pnpm dev
```

To test the SSR mode, first run the build, and then start the SSR server:

```sh
npm run build
pnpm build
php artisan inertia:start-ssr
```

## Testing

Inertia.js uses [Playwright](https://playwright.dev/) for testing. To run the tests, use the following command:

```sh
cd tests && npx playwright test
```
Inertia.js uses [Playwright](https://playwright.dev/) for testing. To run the tests, use the `pnpm test` command.

## Publishing

This section is really for the benefit of the core maintainers.

1. Increment the version numbers in the `package.json` file for each package, making sure to also update the adapter dependencies on `@inertiajs/core`.
2. Run `npm install` to update the top-level `package-lock.json` file.
3. Update `CHANGELOG.md`.
4. Run `npm publish` for each package. This will automatically run the necessary build step. When publishing beta releases, make sure to run `npm publish --tag=beta` or `npm publish --tag=next` if it's `next`.
1. Increment the version numbers in the `package.json` file for each package,
2. Run `pnpm install`,
3. Update `CHANGELOG.md`,
4. Run `pnpm publish -r` in the root directory. This will automatically run the necessary build steps and publish all packages. When publishing beta releases, make sure to run `pnpm publish -r --tag=beta` or `npm publish -r --tag=next` if it's `next`,
5. Add release notes to [GitHub](https://github.com/inertiajs/inertia/releases).
25 changes: 9 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,23 @@ jobs:
timeout-minutes: 15
runs-on: ubuntu-20.04

strategy:
matrix:
adapter: ['react', 'vue3', 'svelte']

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

- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 10

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.15
cache: pnpm

- name: Cache node modules
uses: actions/cache@v4
with:
key: ${{ runner.OS }}-npm-cache-${{ hashFiles('package-lock.json') }}
path: |
~/.cache
node_modules
packages/${{ matrix.adapter }}/tests/node_modules
- name: Install dependencies
run: pnpm install

- name: Build Inertia
run: |
npm install
cd packages/core && npm run build
cd ../${{ matrix.adapter }} && npm run build
run: pnpm build
60 changes: 20 additions & 40 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,30 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
adapter: ['vue3', 'react', 'svelte']
env:
PACKAGE: ${{ matrix.adapter }}
adapter: ['vue', 'react', 'svelte']
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 21.7.3
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 10

- name: Build Inertia
run: |
npm install
cd packages/core
npm run build
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 21.7.3
cache: pnpm

- name: Build Adapter
run: |
cd packages/${{ matrix.adapter }}
npm run build
- name: Install dependencies
run: pnpm install

- name: Install Test Dependencies
run: |
cd packages/${{ matrix.adapter }}/test-app
npm install
- name: Build Inertia
run: pnpm -r --filter ./packages/core --filter ./packages/${{ matrix.adapter }}* build

- name: Local-link @inertiajs/core
run: cd packages/core && npm link
- name: Install Playwright Browsers
run: pnpm playwright install chromium

- name: Local-link @inertiajs/${{ matrix.adapter }}
run: cd packages/${{ matrix.adapter }} && npm link

- name: Install Playwright Browsers
run: cd packages/${{ matrix.adapter }} && npx playwright install --with-deps

- name: Install Playwright Test Dependencies
run: cd tests/app && npm install

- name: Run Playwright Tests
run: cd tests && npx playwright test

- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: packages/${{ matrix.adapter }}/playwright-report/
retention-days: 30
- name: Run Playwright Tests
run: pnpm test:${{ matrix.adapter }}
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.github/
pnpm-lock.yaml
**/.svelte-kit
**/bootstrap/ssr
**/composer.json
Expand Down
Loading