Skip to content

Commit

Permalink
Merge pull request #81 from gadget-inc/pnpm
Browse files Browse the repository at this point in the history
Switch to using pnpm for development
  • Loading branch information
airhorns authored Jun 8, 2023
2 parents 1686a5e + 7f99460 commit fc0bf04
Show file tree
Hide file tree
Showing 8 changed files with 4,788 additions and 4,859 deletions.
14 changes: 7 additions & 7 deletions .github/actions/setup-test-env/action.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: 'Setup test environment'
description: ''
name: "Setup test environment"
description: ""
inputs: {}
outputs: {}
runs:
using: "composite"
steps:
using: "composite"
steps:
- uses: cachix/install-nix-action@v20
- run: nix flake check
shell: bash
- name: Add Gadget yarn registry
- name: Add Gadget npm registry
shell: nix develop -c bash -eo pipefail -l {0}
run: npm config set @gadget-client:registry https://registry.gadget.dev/npm
- name: Install dependencies with yarn install
- name: Install dependencies with pnpm
shell: nix develop -c bash -eo pipefail -l {0}
run: yarn install
run: pnpm install
10 changes: 7 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/setup-test-env
- run: yarn build
- run: pnpm build
shell: nix develop -c bash -eo pipefail -l {0}
- run: test/test.sh
- run: yarn jest
shell: nix develop -c bash -eo pipefail -l {0}
- run: pnpm jest
shell: nix develop -c bash -eo pipefail -l {0}

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/setup-test-env
- run: yarn lint
- run: pnpm lint
shell: nix develop -c bash -eo pipefail -l {0}
8 changes: 4 additions & 4 deletions Contributing.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Testing

Gotta build the package, which you can do once with `yarn build`, or watch your local development directory and rebuild when things change with `yarn watch`.
Gotta build the package, which you can do once with `pnpm build`, or watch your local development directory and rebuild when things change with `pnpm watch`.

Then gotta use it somewhere, which tends to be easiest in a project. I use `yarn link` for this.
Then gotta use it somewhere, which tends to be easiest in a project. I use `pnpm link` for this.

# Releasing

Releases are managed automatically by Github Actions. To create a new release, follow these setps:
Releases are managed automatically by Github Actions. To create a new release, follow these steps:

1. Run `npm version minor|major|patch`. This will change the version in the package.json and create a new git commit changing it.
1. Run `npm version minor|major|patch`. This will change the version in the package.json and create a new git commit changing it.
2. Push this commit to the `main` branch. CI will run the tests, then run the release workflow, which publishes to NPM, create a Github release, and creates a git tag for the version.
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
rec {
bash = pkgs.bash;
nodejs = pkgs.nodejs-18_x;
yarn = pkgs.yarn.override {
inherit nodejs;
};
pnpm = pkgs.nodePackages.pnpm;
};

devShell = pkgs.mkShell {
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@
"LICENSE.txt"
],
"scripts": {
"preinstall": "npx only-allow pnpm",
"build": "rm -rf pkg && tsc && chmod +x pkg/wds.bin.js pkg/wds-bench.bin.js",
"prepublishOnly": "yarn run build",
"prepublishOnly": "pnpm run build",
"watch": "tsc -w",
"typecheck": "tsc --noEmit",
"lint": "yarn run lint:prettier && yarn run lint:eslint",
"lint:prettier": "node --max-old-space-size=4096 node_modules/.bin/prettier --check \"src/**/*.{js,ts,tsx}\"",
"lint:eslint": "node --max-old-space-size=4096 node_modules/.bin/eslint --quiet --ext ts,tsx src",
"lint:fix": "node --max-old-space-size=4096 node_modules/.bin/prettier --write --check \"src/**/*.{js,ts,tsx}\" && eslint --ext ts,tsx --fix src",
"lint": "pnpm run lint:prettier && pnpm run lint:eslint",
"lint:prettier": "NODE_OPTIONS=\"--max-old-space-size=4096\" prettier --check \"src/**/*.{js,ts,tsx}\"",
"lint:eslint": "NODE_OPTIONS=\"--max-old-space-size=4096\" eslint --quiet --ext ts,tsx src",
"lint:fix": "NODE_OPTIONS=\"--max-old-space-size=4096\" prettier --write --check \"src/**/*.{js,ts,tsx}\" && eslint --ext ts,tsx --fix src",
"prerelease": "gitpkg publish",
"test": "jest"
},
Expand Down
Loading

0 comments on commit fc0bf04

Please sign in to comment.