Skip to content
Open
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
6 changes: 0 additions & 6 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,4 @@ npm-debug.log
.git
.env
**/dist
# Rush temporary files
common/deploy/
common/temp/
common/autoinstallers/*/.npmrc
**/.rush/temp/

**/*.log
8 changes: 8 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
# Called by "git commit" with no arguments. The hook exits with non-zero
# status if it wants to stop the commit.

# Regenerate the OpenAPI document so it stays in sync with the code, then
# reformat staged changes with Prettier.
pnpm --filter @energyweb/ssi-vc-api run update-openapi || exit $?
pnpm exec pretty-quick --staged || exit $?
2 changes: 1 addition & 1 deletion .github/workflows/container-image-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

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

- name: Get latest release version
id: get_version
Expand Down
34 changes: 11 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,22 @@ jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v5
with:
fetch-depth: 0

- uses: actions/setup-node@v2
with:
node-version: '18.12'

- name: Cache Rush
uses: actions/cache@v2
with:
path: |
common/temp/install-run
~/.rush
key: ${{ runner.os }}-${{ hashFiles('rush.json') }}
- uses: pnpm/action-setup@v4

- name: Cache pnpm
uses: actions/cache@v2
- uses: actions/setup-node@v5
with:
path: |
common/temp/pnpm-store
key: ${{ runner.os }}-${{ hashFiles('common/config/rush/pnpm-lock.yaml') }}
node-version-file: .nvmrc
cache: pnpm

- name: Rush install
run: node common/scripts/install-run-rush.js install
- name: Install
run: pnpm install --frozen-lockfile

- name: Rush build
run: node common/scripts/install-run-rush.js build --verbose
- name: Build
run: pnpm run build

- name: Run test
run: node common/scripts/install-run-rush.js test --verbose
- name: Test
run: pnpm run test
13 changes: 3 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,10 @@ jspm_packages/
# OS X temporary files
.DS_Store

# Rush temporary files
common/deploy/
common/temp/
common/autoinstallers/*/.npmrc
**/.rush/temp/

# Heft
.heft

# Custom from default rush file
dist
.vscode/
docker-compose.yml
.aider*

# pnpm
.pnpm-store/
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
22
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Documentation for this file: https://prettier.io/docs/en/configuration.html
module.exports = {
...require('./common/temp/node_modules/@energyweb/prettier-config'),
...require('@energyweb/prettier-config'),
// We use a larger print width because Prettier's word-wrapping seems to be tuned
// for plain JavaScript without type annotations
printWidth: 110,
Expand Down
25 changes: 10 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,39 +31,34 @@ The Architecture Decisions Records can be found [here](apps/vc-api/docs/architec
The [ADR Tools command line tool](https://github.com/npryce/adr-tools) can be used to add new ADRs.

## App Development
This repository is a monorepo that uses [Rush](https://rushjs.io/) with the PNPM package manager.
This repository is a monorepo that uses [pnpm workspaces](https://pnpm.io/workspaces).

PNPM is used for its speed and solution to NPM doppelgangers (as well as being the default option for rush).
See comparison of [NPM vs PNPM vs Yarn for Rush](https://rushjs.io/pages/maintainer/package_managers/).
PNPM is used for its speed and solution to NPM doppelgangers.

### Requirements

PNPM is required. See installation instructions here: https://pnpm.js.org/installation/
Node.js >= 22 is required (see `.nvmrc`).

Rush is required. See installation instructions here: https://rushjs.io/pages/intro/get_started/
pnpm is required. With Node.js installed, the easiest way to get it is `corepack enable`
(the version is pinned by the `packageManager` field in `package.json`).
See other installation options here: https://pnpm.io/installation

### Install

Use rush to install dependencies (not the package manager directly).
In other words, do not run `npm install` or `pnpm install`.
This is because [Rush optimizes](https://rushjs.io/pages/developer/new_developer/) by installing all of the dependency packages in a central folder, and then uses symlinks to create the “node_modules” folder for each of the projects.

```sh
$ rush install
$ pnpm install
```

### Build

Use rush to build.

```sh
$ rush build
$ pnpm run build
```

## Testing
To run tests across all apps and libraries in one command, a rush script has been added to `./common/config/rush/command-line.json`
To run tests across all apps and libraries in one command:
``` sh
$ rush test
$ pnpm run test
```

## Release Process
Expand Down
22 changes: 11 additions & 11 deletions apps/vc-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
FROM node:18.19 as base
FROM node:22 AS base

WORKDIR /app

FROM base as builder
RUN corepack enable

COPY common common
COPY rush.json .
FROM base AS builder

COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
COPY patches patches
COPY apps/vc-api/package.json apps/vc-api/package.json
COPY tests/e2e/package.json tests/e2e/package.json
COPY libraries/did/package.json libraries/did/package.json
COPY libraries/webkms/package.json libraries/webkms/package.json

RUN node common/scripts/install-run-rush.js install
RUN pnpm install --frozen-lockfile

COPY tsconfig.json .
COPY libraries libraries
COPY apps apps
COPY tests tests

RUN node common/scripts/install-run-rush.js build
RUN node common/scripts/install-run-rush.js deploy -s ssi-vc-api

RUN cp -R ./apps/vc-api/dist ./common/deploy/apps/vc-api
RUN pnpm --filter @energyweb/ssi-vc-api... run build
RUN pnpm deploy --legacy --filter @energyweb/ssi-vc-api --prod /app/deploy/apps/vc-api

FROM base as final
FROM base AS final
ENV NODE_ENV=production
EXPOSE 3000

COPY --from=builder /app/common/deploy /app
COPY --from=builder /app/deploy /app
COPY license-header.txt /app

CMD ["node", "apps/vc-api/dist/src/main.js"]
2 changes: 1 addition & 1 deletion apps/vc-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ For more information about this, see the [context documentation](./docs/contexts

## Installation

Install using the [rush commands](../../README.md#installation) described in the root README.
Install using the [pnpm commands](../../README.md#install) described in the root README.

## Running the app

Expand Down
66 changes: 33 additions & 33 deletions apps/vc-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@
"dependencies": {
"@energyweb/ssi-did": "workspace:*",
"@energyweb/w3c-ccg-webkms": "workspace:*",
"@nestjs/common": "^10.0.4",
"@nestjs/config": "^3.0.0",
"@nestjs/core": "^10.0.4",
"@nestjs/platform-express": "^10.0.4",
"@nestjs/common": "catalog:",
"@nestjs/config": "~3.2.3",
"@nestjs/core": "catalog:",
"@nestjs/platform-express": "catalog:",
"@nestjs/typeorm": "^10.0.0",
"jose": "^4.14.4",
"reflect-metadata": "^0.1.13",
"rimraf": "^4.0.0",
"jose": "catalog:",
"reflect-metadata": "catalog:",
"rimraf": "catalog:",
"rxjs": "^7.8.1",
"typeorm": "^0.3.17",
"did-resolver": "~4.1.0",
"class-validator": "~0.14.0",
"did-resolver": "catalog:",
"class-validator": "0.14.1",
"class-transformer": "~0.5.1",
"@nestjs/swagger": "^7.0.12",
"swagger-ui-express": "~4.6.3",
Expand All @@ -47,40 +47,40 @@
"@nestjs/axios": "^3.0.0",
"@nestjs/serve-static": "^4.0.0",
"joi": "^17.9.2",
"axios": "~1.4.0",
"@credo-ts/askar": "^0.5.3",
"@credo-ts/core": "^0.5.3",
"@credo-ts/node": "^0.5.3",
"@hyperledger/aries-askar-nodejs": "^0.2.1",
"axios": "~1.18.1",
"@credo-ts/askar": "catalog:",
"@credo-ts/core": "catalog:",
"@credo-ts/node": "catalog:",
"@hyperledger/aries-askar-nodejs": "catalog:",
"@hyperledger/aries-askar-shared": "^0.2.3",
"sqlite3": "~5.1.7"
},
"devDependencies": {
"@nestjs/cli": "^10.1.0",
"@nestjs/schematics": "^10.0.1",
"@nestjs/testing": "^10.0.4",
"@nestjs/testing": "catalog:",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.2",
"@types/jest": "catalog:",
"@types/node": "^20.3.2",
"@types/supertest": "^2.0.12",
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"eslint": "^8.22.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.5.0",
"prettier": "^2.8.8",
"supertest": "^6.3.3",
"ts-jest": "^29.1.1",
"ts-loader": "^9.4.4",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "^4.8.0",
"@types/supertest": "catalog:",
"@typescript-eslint/eslint-plugin": "catalog:",
"@typescript-eslint/parser": "catalog:",
"eslint": "catalog:",
"eslint-config-prettier": "catalog:",
"eslint-plugin-prettier": "catalog:",
"jest": "catalog:",
"prettier": "catalog:",
"supertest": "catalog:",
"ts-jest": "catalog:",
"ts-loader": "catalog:",
"ts-node": "catalog:",
"tsconfig-paths": "catalog:",
"typescript": "catalog:",
"nock": "^14.0.0",
"@sphereon/pex-models": "~2.0.2",
"@energyweb/eslint-config": "~0.1.0",
"@energyweb/prettier-config": "~0.0.1",
"eslint-plugin-no-only-tests": "~3.1.0"
"@energyweb/eslint-config": "catalog:",
"@energyweb/prettier-config": "catalog:",
"eslint-plugin-no-only-tests": "catalog:"
},
"jest": {
"moduleFileExtensions": [
Expand Down
9 changes: 0 additions & 9 deletions common/autoinstallers/rush-prettier/package.json

This file was deleted.

Loading
Loading