Skip to content
Merged
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
4 changes: 1 addition & 3 deletions .editorconfig-checker.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"Exclude": [
"^(node_modules|dist|output|build)/"
]
"Exclude": ["^(node_modules|dist|output|build)/", "\\.(mjs|js|mts|ts|tsx)$"]
}
40 changes: 20 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,34 @@ jobs:
name: Build package
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v5
- name: Check out code
uses: actions/checkout@v5

- name: Pin node.js version
uses: actions/setup-node@v5
with:
node-version: 24
- name: Pin node.js version
uses: actions/setup-node@v5
with:
node-version: 24

- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build package
run: yarn build
- name: Build package
run: yarn build

test:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v5
- name: Check out code
uses: actions/checkout@v5

- name: Pin node.js version
uses: actions/setup-node@v5
with:
node-version: 24
- name: Pin node.js version
uses: actions/setup-node@v5
with:
node-version: 24

- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run tests
run: yarn test
- name: Run tests
run: yarn test
23 changes: 23 additions & 0 deletions .github/workflows/code-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,26 @@ jobs:

- name: Check code formatting
run: editorconfig-checker -no-color

prettier-eslint:
name: Check Prettier and ESLint
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v7

- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: 24
cache: yarn

- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-scripts

- name: Check Prettier formatting
run: yarn format:check

- name: Check ESLint rules
run: yarn lint
38 changes: 19 additions & 19 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ jobs:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- name: Check PR title follows Conventional Commits
uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
feat
fix
perf
refactor
docs
test
build
ci
chore
requireScope: false
subjectPattern: ^(?![A-Z]).+$
subjectPatternError: |
The subject "{subject}" of PR title "{title}" must start with a lower-case letter.
- name: Check PR title follows Conventional Commits
uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
feat
fix
perf
refactor
docs
test
build
ci
chore
requireScope: false
subjectPattern: ^(?![A-Z]).+$
subjectPatternError: |
The subject "{subject}" of PR title "{title}" must start with a lower-case letter.
80 changes: 40 additions & 40 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,43 @@ jobs:
# Holds the release App's key; deployment branches: master only
environment: release
steps:
- name: Create release App token
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ vars.RELEASE_APP_CLIENT_ID }}
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}

- name: Check out code
uses: actions/checkout@v5
with:
# semantic-release needs the full history and tags
fetch-depth: 0
# semantic-release pushes with the App token below
persist-credentials: false

- name: Pin node.js version
uses: actions/setup-node@v5
with:
node-version: 24
check-latest: true

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run tests
run: yarn test

- name: Release
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
GIT_AUTHOR_NAME: wwwallet-release[bot]
GIT_AUTHOR_EMAIL: 339619412+wwwallet-release[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: wwwallet-release[bot]
GIT_COMMITTER_EMAIL: 339619412+wwwallet-release[bot]@users.noreply.github.com
run: >
npx --yes
-p semantic-release@25.0.9
-p @semantic-release/git@11.0.1
-p conventional-changelog-conventionalcommits@9.3.1
semantic-release
- name: Create release App token
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ vars.RELEASE_APP_CLIENT_ID }}
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}

- name: Check out code
uses: actions/checkout@v5
with:
# semantic-release needs the full history and tags
fetch-depth: 0
# semantic-release pushes with the App token below
persist-credentials: false

- name: Pin node.js version
uses: actions/setup-node@v5
with:
node-version: 24
check-latest: true

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run tests
run: yarn test

- name: Release
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
GIT_AUTHOR_NAME: wwwallet-release[bot]
GIT_AUTHOR_EMAIL: 339619412+wwwallet-release[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: wwwallet-release[bot]
GIT_COMMITTER_EMAIL: 339619412+wwwallet-release[bot]@users.noreply.github.com
run: >
npx --yes
-p semantic-release@25.0.9
-p @semantic-release/git@11.0.1
-p conventional-changelog-conventionalcommits@9.3.1
semantic-release
22 changes: 21 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,25 @@ repos:
hooks:
- id: editorconfig-checker
name: Check .editorconfig rules
args: ["-no-color"]
args: ['-no-color']
types_or: [text]

- repo: local
hooks:
- id: prettier
name: Check Prettier formatting
entry: yarn format:check
language: system
pass_filenames: false

- id: eslint
name: Check ESLint rules
entry: yarn lint
language: system
pass_filenames: false

- id: typecheck
name: Check TypeScript types
entry: yarn typecheck
language: system
pass_filenames: false
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
output/
assets/
3 changes: 3 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
singleQuote: true
trailingComma: 'all'
printWidth: 100
24 changes: 15 additions & 9 deletions .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@
["@semantic-release/commit-analyzer", { "preset": "conventionalcommits" }],
["@semantic-release/release-notes-generator", { "preset": "conventionalcommits" }],
["@semantic-release/npm", { "npmPublish": false }],
["@semantic-release/git", {
"assets": ["package.json"],
"message": "chore(release): ${nextRelease.version} [skip ci]"
}],
["@semantic-release/github", {
"successCommentCondition": "<% return issue.pull_request; %>",
"failCommentCondition": false,
"releasedLabels": false
}]
[
"@semantic-release/git",
{
"assets": ["package.json"],
"message": "chore(release): ${nextRelease.version} [skip ci]"
}
],
[
"@semantic-release/github",
{
"successCommentCondition": "<% return issue.pull_request; %>",
"failCommentCondition": false,
"releasedLabels": false
}
]
]
}
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<img src="https://demo.wwwallet.org/wallet_192.png" width="80" style="max-width: 100%; float:left; margin-right: 20px;"/>


# Wallet Common


This library serves as a centralized collection of reusable component-functions that are shared across multiple software stacks. Its main goal is to promote consistency, reduce duplication and streamline development by providing well-tested, commonly used utilities and components in one place.

## Components
Expand All @@ -16,12 +14,10 @@ This library serves as a centralized collection of reusable component-functions
- Common type definitions
- Common JSON schema definition for response validations


### Interfaces

The `interface.ts` file defines all the interfaces that are exported from this library.


## Development

### Pre-commit Hook
Expand Down Expand Up @@ -80,12 +76,12 @@ type(optional-scope): lower-case summary

wallet-common follows [semantic versioning](https://semver.org/). Every merge to `master` runs the `release` workflow, which uses [semantic-release](https://github.com/semantic-release/semantic-release) to work out the next version from the commits merged since the last `v*` tag (PR title and description). If there are several, the largest bump wins:

| PR title | Release (e.g. from `1.0.1`) |
|---|---|
| any type with `!`, e.g. `feat!: …` | major (`2.0.0`) |
| `feat: …` | minor (`1.1.0`) |
| `fix: …`, `perf: …` | patch (`1.0.2`) |
| `docs`, `test`, `ci`, `build`, `refactor`, `chore` | no release |
| PR title | Release (e.g. from `1.0.1`) |
| -------------------------------------------------- | --------------------------- |
| any type with `!`, e.g. `feat!: …` | major (`2.0.0`) |
| `feat: …` | minor (`1.1.0`) |
| `fix: …`, `perf: …` | patch (`1.0.2`) |
| `docs`, `test`, `ci`, `build`, `refactor`, `chore` | no release |

A line starting with `BREAKING CHANGE:` (or `BREAKING-CHANGE:`) in the PR description also makes a major release, whatever the title.

Expand Down
50 changes: 50 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import eslint from '@eslint/js';
import { defineConfig } from 'eslint/config';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import prettierConfig from 'eslint-config-prettier/flat';

export default defineConfig(
{
ignores: [
'dist/**',
'build/**',
'output/**',
'coverage/**',
'.nyc_output/**',
'node_modules/**',
],
},
{
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
},
eslint.configs.recommended,
...tseslint.configs.recommended,
{
files: ['**/*.{ts,mts}'],
rules: {
'no-undef': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'prefer-const': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'no-useless-escape': 'off',
'no-case-declarations': 'off',
},
},
{
files: ['src/**/*.test.ts', 'eslint.config.mjs', 'vitest.config.mts', 'setup-vitest.ts'],
languageOptions: {
globals: globals.node,
},
},
prettierConfig,
{
rules: {
'no-unexpected-multiline': 'error',
},
},
);
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
"test": "tsc && vitest run",
"test-start": "vitest",
"build": "rm -rf dist/ && tsc",
"typecheck": "tsc --noEmit",
"lint": "eslint . --max-warnings=0",
"format": "prettier . --write",
"format:check": "prettier . --check",
"prepare": "npm run build"
},
"dependencies": {
Expand All @@ -36,10 +40,16 @@
"zod": "^3.24.1"
},
"devDependencies": {
"@eslint/js": "^9.39.5",
"@sd-jwt/types": "^0.10.0",
"@types/node": "^24.10.2",
"@xmldom/xmldom": "^0.9.12",
"eslint": "^9.39.5",
"eslint-config-prettier": "^10.1.8",
"globals": "^16.0.0",
"prettier": "^3.8.0",
"typescript": "~5.9.3",
"typescript-eslint": "^8.53.0",
"vitest": "^4.1.11"
}
}
Loading
Loading