Skip to content

Commit

Permalink
Merge pull request #30 from TBD54566975/pnpm
Browse files Browse the repository at this point in the history
`pnpm` and `changesets`
  • Loading branch information
KendallWeihe authored Sep 27, 2023
2 parents 8cf87c7 + 2773c2f commit ea864fc
Show file tree
Hide file tree
Showing 16 changed files with 6,152 additions and 8,554 deletions.
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [["@tbdex/protocol", "@tbdex/http-client", "@tbdex/http-server"]],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
39 changes: 26 additions & 13 deletions .github/workflows/integrity-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,58 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
CI: true
PNPM_CACHE_FOLDER: .pnpm-store

jobs:
security-audit:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- name: install pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Set up Node.js
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: 20

- name: Report known vulnerabilities
run: npm audit
run: pnpm audit

test-with-node:
runs-on: macos-latest
steps:
- name: Checkout source
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- name: install pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Set up Node.js
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: 20
registry-url: https://registry.npmjs.org/

- name: Install latest npm
run: npm install -g npm@latest

- name: Install dependencies
run: npm ci
run: pnpm install

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

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

- name: Run tests for all packages
run: npm 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
Expand All @@ -60,20 +71,22 @@ jobs:
- name: Checkout source
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- name: install pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Set up Node.js
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: 20
registry-url: https://registry.npmjs.org/

- name: Install latest npm
run: npm install -g npm@latest

- name: Install dependencies
run: npm ci
run: pnpm install

- name: Install Playwright Browsers
run: npx playwright install --with-deps

- name: Run tests for all packages
run: npm run test:browser
run: pnpm test:browser
58 changes: 34 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
# 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 multimodule repository uses `npm` workspaces. All commands are intended to be run from the root folder.
This multi-package repository uses [`pnpm` workspaces](https://pnpm.io/workspaces).

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

### `node`

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

```
$ node --version
v20.3.0
$ npm --version
9.6.7
```

If you don't have `node` installed. Feel free to choose whichever approach you feel the most comfortable with. If you don't have a preferred installation method, we recommend using `nvm` (aka [node version manager](https://github.com/nvm-sh/nvm)). `nvm` allows you to install and use different versions of node. It can be installed by running `brew install nvm` (assuming that you have homebrew)
If you don't have `node` installed, Feel free to choose whichever approach you feel the most comfortable with. If you don't have a preferred installation method, we recommend using `nvm` (aka [node version manager](https://github.com/nvm-sh/nvm)). `nvm` allows you to install and use different versions of node. It can be installed by running `brew install nvm` (assuming that you have homebrew)

Once you have installed `nvm`, install the desired node version with `nvm install vX.Y.Z`. After installation, you may run `nvm use` to automatically tell `nvm` which `node` version to use (this will be picked up from the target version noted in `.nvmrc`):

Expand All @@ -30,24 +31,33 @@ Found '/Users/.../TBD54566975/tbdex-js/packages/protocol/.nvmrc' with version <v
Now using node v20.3.0 (npm v9.6.7)
```

### [`pnpm`](https://pnpm.io/)

If you don't have `pnpm` installed, choose whichever approach you feel most comfortable with [here](https://pnpm.io/installation)

> [!NOTE]
>
> 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 `npm 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 `npm run test:node` to run tests within a nodejs runtime
4. run tests using `npm run test:browser` to run tests within a browser runtime. Before doing so, run `npx playwright install --with-deps`, only required once.

## `npm` scripts

| Script | Description |
| ---------------------- | --------------------------------------------------------- |
| `npm run clean` | deletes `dist` dir and compiled tests |
| `npm run test:node` | runs tests in node runtime |
| `npm run test:browser` | runs tests in headless browsers (chrome, safari, firefox) |
| `npm run lint` | runs linter without auto-fixing |
| `npm run lint:fix` | runs linter and applies automatic fixes wherever possible |
| `npm run build` | builds all distributions and dumps them into `dist` |
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 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` |
Loading

0 comments on commit ea864fc

Please sign in to comment.