Skip to content

Commit

Permalink
fix: use pnpm for plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanClementsHax committed Nov 19, 2024
1 parent 3e2d036 commit 0f834b1
Show file tree
Hide file tree
Showing 8 changed files with 5,402 additions and 13,365 deletions.
69 changes: 36 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,22 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 22
- name: restore dependencies
uses: bahmutov/npm-install@v1
- name: restore dependencies
uses: bahmutov/npm-install@v1
with:
working-directory: e2e
cache: 'pnpm'
- name: install plugin
run: pnpm install
- name: install e2e
run: pnpm install
working-directory: e2e
- name: lint plugin and e2e
run: pnpm run lint:all
# lint the e2e repos
# e2e repos need the plugin to be built
- run: npm run build
- name: restore dependencies
uses: bahmutov/npm-install@v1
with:
working-directory: e2e/test_repos/repos/tailwindv3/repo
- run: npm run lint:all
- run: npm run lint
- run: pnpm run build
- name: install tailwindv3
run: pnpm install
working-directory: e2e/test_repos/repos/tailwindv3/repo
- name: lint tailwindv3
run: pnpm run lint
working-directory: e2e/test_repos/repos/tailwindv3/repo
type_check:
name: type check
Expand All @@ -37,16 +39,19 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 22
- name: restore dependencies
uses: bahmutov/npm-install@v1
cache: 'pnpm'
- name: install plugin
run: pnpm install
- name: type-check plugin
run: pnpm run type-check
# type check the e2e repos
# e2e repos need the plugin to be built
- run: npm run build
- name: restore dependencies
uses: bahmutov/npm-install@v1
with:
working-directory: e2e/test_repos/repos/tailwindv3/repo
- run: npm run type-check
- run: npm run type-check
- run: pnpm run build
- name: install tailwindv3
run: pnpm install
working-directory: e2e/test_repos/repos/tailwindv3/repo
- name: type-check tailwindv3
run: pnpm run type-check
working-directory: e2e/test_repos/repos/tailwindv3/repo
test:
runs-on: ubuntu-latest
Expand All @@ -56,9 +61,9 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 22
- name: restore dependencies
uses: bahmutov/npm-install@v1
- run: npm run test
cache: 'pnpm'
- run: pnpm install
- run: pnpm run test
- name: report coverage
if: always()
uses: davelosert/vitest-coverage-report-action@v2
Expand All @@ -70,14 +75,12 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 22
- name: restore dependencies
uses: bahmutov/npm-install@v1
- run: npm run build
- name: restore e2e dependencies
uses: bahmutov/npm-install@v1
with:
working-directory: e2e
- run: npm run e2e
cache: 'pnpm'
- run: pnpm install
- run: pnpm run build
- run: pnpm install
working-directory: e2e
- run: pnpm run e2e
working-directory: e2e
- name: upload playwright report
uses: actions/upload-artifact@v4
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ jobs:
with:
node-version: 22
registry-url: https://registry.npmjs.org/
- name: restore dependencies
uses: bahmutov/npm-install@v1
- name: release
run: npm run release
cache: 'pnpm'
- run: pnpm install
- run: pnpm run release
env:
HUSKY: 0 # semantic-release does a push which would trigger the pre-push git hook
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npm run test:all
pnpm run test:all
8 changes: 4 additions & 4 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"*.@(ts|tsx|js|jsx)": ["npm run lint:js", "npm run format"],
"*.json": ["npm run format"],
"*.*rc": ["npm run format -- --parser json"],
"*.@(css|scss)": ["npm run lint:styles", "npm run format"]
"*.@(ts|tsx|js|jsx)": ["pnpm run lint:js", "pnpm run format"],
"*.json": ["pnpm run format"],
"*.*rc": ["pnpm run format -- --parser json"],
"*.@(css|scss)": ["pnpm run lint:styles", "pnpm run format"]
}
33 changes: 17 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If you are here to suggest a feature, feel free to [start a discussion](https://
The fastest way to work on the repository is by using [Stackblitz's Codeflow](https://stackblitz.com/codeflow)

1. Click the `Open in Codeflow` button on this repo's README (or go directly to [this link](https:///pr.new/RyanClementsHax/tailwindcss-themer))
2. Run the build using `npm run watch`
2. Run the build using `pnpm run watch`
3. Implement your changes and tests to files in the `src/` directory and corresponding test files
4. Use the example repos to integration test changes
5. Document your changes in the appropriate doc page
Expand All @@ -31,35 +31,36 @@ The fastest way to work on the repository is by using [Stackblitz's Codeflow](ht
If you prefer to not use Stackblitz for faster development, you can still do this the old fashioned way.

1. Fork this repository
2. Install dependencies by running `npm install`
3. Run the build using `npm run watch`
4. Implement your changes and tests to files in the `src/` directory and corresponding test files
5. Use the example repos to integration test changes
6. Document your changes in the appropriate doc page
7. Git stage your required changes and commit (see below commit guidelines)
8. Submit PR for review
2. [Install pnpm](https://pnpm.io/installation)
3. Install dependencies by running `pnpm install`
4. Run the build using `pnpm run watch`
5. Implement your changes and tests to files in the `src/` directory and corresponding test files
6. Use the example repos to integration test changes
7. Document your changes in the appropriate doc page
8. Git stage your required changes and commit (see below commit guidelines)
9. Submit PR for review

### Running examples

All examples are located in the `examples` directory of this repo.

1. Run `npm run watch` in the root of `tailwindcss-themer` to build the plugin and watch for any changes
1. Run `pnpm run watch` in the root of `tailwindcss-themer` to build the plugin and watch for any changes
2. Replace the `"tailwindcss-themer": "latest"` line in the example project's `package.json` with `"tailwindcss-themer": "file:../../"`
3. Run`npm install` in the repo's root directory
4. Run `npm run start` in the selected example's directory
5. After making a change to the plugin, restart the example's server (i.e. rerun `npm run start`) so that it picks up the changes
3. Run`pnpm install` in the repo's root directory
4. Run `pnpm run start` in the selected example's directory
5. After making a change to the plugin, restart the example's server (i.e. rerun `pnpm run start`) so that it picks up the changes

### Running e2e tests

For e2e testing we use [Playwright](https://playwright.dev/).

1. Run `npm install` to install dependencies
2. Run `npm run build` to build the plugin
1. Run `pnpm install` to install dependencies
2. Run `pnpm run build` to build the plugin
3. Change directories to the `e2e` directory
4. Run `npm install` to install the playwright dependencies and browsers
4. Run `pnpm install` to install the playwright dependencies and browsers
- This step should handle setting up playwright but if this isn't working, their [documentation](https://playwright.dev/python/docs/intro) for more help on setting up your environment
- If you use WSL, you might find [this comment](https://github.com/microsoft/playwright/issues/13533#issuecomment-1098391029) to be helpful
5. Run `npm run e2e` to run the playwright tests
5. Run `pnpm run e2e` to run the playwright tests

## Commit message conventions

Expand Down
Loading

0 comments on commit 0f834b1

Please sign in to comment.