Skip to content

Commit

Permalink
Remove unnecessary 'run' in pnpm script commands
Browse files Browse the repository at this point in the history
  • Loading branch information
KendallWeihe committed Sep 27, 2023
1 parent a5b548e commit 02e0e35
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 32 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/integrity-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,21 @@ jobs:
run: pnpm install

- name: Build all workspace packages
run: pnpm run build
run: pnpm build

- name: Run linter for all packages
run: pnpm run lint
run: pnpm lint

- name: Run tests for all packages
run: pnpm run test:node
run: pnpm test:node

test-with-browsers:
# Run browser tests using macOS so that WebKit tests don't fail under a Linux environment
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- name: install pnpm
uses: pnpm/action-setup@v2
with:
Expand All @@ -89,4 +89,4 @@ jobs:
run: npx playwright install --with-deps

- name: Run tests for all packages
run: pnpm run test:browser
run: pnpm test:browser
34 changes: 19 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# tbdex-js

This repo contains 3 npm packages:
* [`@tbdex/protocol`](./packages/protocol/) - create, parse, verify, and validate the tbdex messages and resources defined in the [protocol draft specification](https://github.com/TBD54566975/tbdex-protocol/blob/main/README.md)
* [`@tbdex/http-client`](./packages/http-client) - An HTTP client that can be used to send tbdex messages to PFIs
* [`@tbdex/http-server`](./packages/http-server) - A configurable implementation of the [tbdex http api draft specification](https://github.com/TBD54566975/tbdex-protocol/blob/main/rest-api/README.md)

- [`@tbdex/protocol`](./packages/protocol/) - create, parse, verify, and validate the tbdex messages and resources defined in the [protocol draft specification](https://github.com/TBD54566975/tbdex-protocol/blob/main/README.md)
- [`@tbdex/http-client`](./packages/http-client) - An HTTP client that can be used to send tbdex messages to PFIs
- [`@tbdex/http-server`](./packages/http-server) - A configurable implementation of the [tbdex http api draft specification](https://github.com/TBD54566975/tbdex-protocol/blob/main/rest-api/README.md)

# Development

This multi-package repository uses [`pnpm` workspaces](https://pnpm.io/workspaces).

## Prerequisites

### `node`

This project is using `node v20.3.0`. You can verify your `node` and `npm` installation via the terminal:

```
Expand All @@ -37,23 +40,24 @@ If you don't have `pnpm` installed, choose whichever approach you feel most comf
> it's possible that this project may work with `npm` as well but it's not guaranteed.
## Running Tests

> [!NOTE]
>
>
> Make sure you have all the [prerequisites](#prerequisites)
0. clone the repo and `cd` into the project directory
1. Install all project dependencies by `pnpm install`
1. Install all project dependencies by `pnpm install`
2. Build all workspace projects in this repo by running `npm run build`
3. run tests using `pnpm run test:node` to run tests within a nodejs runtime
4. run tests using `pnpm run test:browser` to run tests within a browser runtime. Before doing so, run `npx playwright install --with-deps`, only required once.
3. run tests using `pnpm test:node` to run tests within a nodejs runtime
4. run tests using `pnpm test:browser` to run tests within a browser runtime. Before doing so, run `npx playwright install --with-deps`, only required once.

## `pnpm` scripts

| Script | Description |
| ----------------------- | --------------------------------------------------------- |
| `pnpm run clean` | deletes `dist` dir and compiled tests |
| `pnpm run test:node` | runs tests in node runtime |
| `pnpm run test:browser` | runs tests in headless browsers (chrome, safari, firefox) |
| `pnpm run lint` | runs linter without auto-fixing |
| `pnpm run lint:fix` | runs linter and applies automatic fixes wherever possible |
| `pnpm run build` | builds all distributions and dumps them into `dist` |
| Script | Description |
| ------------------- | --------------------------------------------------------- |
| `pnpm clean` | deletes `dist` dir and compiled tests |
| `pnpm test:node` | runs tests in node runtime |
| `pnpm test:browser` | runs tests in headless browsers (chrome, safari, firefox) |
| `pnpm lint` | runs linter without auto-fixing |
| `pnpm lint:fix` | runs linter and applies automatic fixes wherever possible |
| `pnpm build` | builds all distributions and dumps them into `dist` |
6 changes: 3 additions & 3 deletions packages/http-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@
"build:browser": "rimraf dist/browser.mjs dist/browser.js && node build/bundles.js",
"test:node": "rimraf tests/compiled && tsc -p tests/tsconfig.json && mocha",
"test:browser": "karma start karma.conf.cjs",
"build": "pnpm run clean && pnpm run build:esm && pnpm run build:cjs && pnpm run build:browser",
"build": "pnpm clean && pnpm build:esm && pnpm build:cjs && pnpm build:browser",
"lint": "eslint . --ext .ts --max-warnings 0",
"lint:fix": "eslint . --ext .ts --fix",
"docs": "pnpm run build:esm && typedoc --plugin typedoc-plugin-markdown --out docs src/main.ts",
"try": "pnpm run build:esm && node dist/esm/src/try.js"
"docs": "pnpm build:esm && typedoc --plugin typedoc-plugin-markdown --out docs src/main.ts",
"try": "pnpm build:esm && node dist/esm/src/try.js"
}
}
13 changes: 9 additions & 4 deletions packages/http-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
"version": "0.0.12",
"module": "./dist/main.js",
"types": "./dist/types/main.d.ts",
"files": ["./dist", "./src"],
"files": [
"./dist",
"./src"
],
"exports": {
"types": "./dist/types/main.d.ts",
"import": "./dist/main.js"
Expand All @@ -37,12 +40,14 @@
"undici": "^5.23.0"
},
"scripts": {
"build": "pnpm run clean && tsc",
"build": "pnpm clean && tsc",
"clean": "rimraf dist tests/compiled",
"lint": "eslint . --ext .ts --max-warnings 0",
"lint:fix": "eslint . --ext .ts --fix",
"test:node": "rimraf tests/compiled && tsc -p tests/tsconfig.json && mocha",
"try": "pnpm run build && node dist/try.js"
"try": "pnpm build && node dist/try.js"
},
"keywords": ["tbdex"]
"keywords": [
"tbdex"
]
}
10 changes: 5 additions & 5 deletions packages/protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@
"build:esm": "rimraf dist/esm dist/types && tsc",
"build:cjs": "rimraf dist/cjs && tsc -p tsconfig.cjs.json && echo '{\"type\": \"commonjs\"}' > ./dist/cjs/package.json",
"build:browser": "rimraf dist/browser.mjs dist/browser.js && node build/bundles.js",
"test:node": "rimraf tests/compiled && pnpm run compile-validators && tsc -p tests/tsconfig.json && mocha",
"test:browser": "pnpm run compile-validators && karma start karma.conf.cjs",
"build": "pnpm run clean && pnpm run compile-validators && pnpm run build:esm && pnpm run build:cjs && pnpm run build:browser",
"test:node": "rimraf tests/compiled && pnpm compile-validators && tsc -p tests/tsconfig.json && mocha",
"test:browser": "pnpm compile-validators && karma start karma.conf.cjs",
"build": "pnpm clean && pnpm compile-validators && pnpm build:esm && pnpm build:cjs && pnpm build:browser",
"lint": "eslint . --ext .ts --max-warnings 0",
"lint:fix": "eslint . --ext .ts --fix",
"docs": "pnpm run build:esm && typedoc --plugin typedoc-plugin-markdown --out docs src/main.ts",
"try": "pnpm run compile-validators && pnpm run build:esm && node dist/esm/src/try.js"
"docs": "pnpm build:esm && typedoc --plugin typedoc-plugin-markdown --out docs src/main.ts",
"try": "pnpm compile-validators && pnpm build:esm && node dist/esm/src/try.js"
}
}

0 comments on commit 02e0e35

Please sign in to comment.