Skip to content

Commit

Permalink
WIP: Feat/versioning (openwallet-foundation#71)
Browse files Browse the repository at this point in the history
Signed-off-by: Mirko Mollik <mirko.mollik@fit.fraunhofer.de>
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
Signed-off-by: Lukas <Lukas@hopae.io>
Co-authored-by: Mirko Mollik <mirko.mollik@fit.fraunhofer.de>
Co-authored-by: Lukas.J.Han <lukas.j.han@gmail.com>
  • Loading branch information
3 people authored Feb 21, 2024
1 parent 3c4571b commit b259b86
Show file tree
Hide file tree
Showing 34 changed files with 1,827 additions and 714 deletions.
14 changes: 14 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": "standard-with-typescript",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
}
}
172 changes: 172 additions & 0 deletions .github/workflows/build-test-publish-on-push-cached.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
name: build-test-publish-on-push-cached
on:
workflow_dispatch:
pull_request:
branches:
- 'main'
- 'next'
- 'unstable'
push:
branches:
- 'main'
- 'next'
- 'unstable'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: pnpm/action-setup@v3
with:
version: 8
- run: pnpm add -g pnpm
- name: 'Setup Node.js with pnpm cache'
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- run: pnpm install
- run: pnpm build
- name: 'Save build output'
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}
key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}

test:
needs: build
runs-on: ubuntu-latest
steps:
- uses: pnpm/action-setup@v3
with:
version: 8
- run: pnpm add -g pnpm
- name: 'Restore build output'
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}
key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}
restore-keys: ${{ runner.os }}-build-${{ github.sha }}
fail-on-cache-miss: true
- name: 'Setup Node.js with pnpm cache'
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: 'Run node'
run: pnpm test
- uses: actions/upload-artifact@v3
with:
name: coverage-artifacts
path: coverage/

report-coverage:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/download-artifact@v3
with:
name: coverage-artifacts
path: coverage
# - name: Merge Code Coverage
# run: npx nyc merge coverage/ coverage/coverage-final.json
# TODO: include once we have codecov token setup
# - uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# fail_ci_if_error: false

# lint:
# needs: build
# runs-on: ubuntu-latest
# steps:
# - uses: pnpm/action-setup@v3
# with:
# version: 8
# - run: pnpm add -g pnpm
# - name: 'Restore build output'
# uses: actions/cache/restore@v4
# with:
# path: ${{ github.workspace }}
# key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}
# restore-keys: ${{ runner.os }}-build-${{ github.sha }}
# fail-on-cache-miss: true
# - name: 'Setup Node.js with pnpm cache'
# uses: actions/setup-node@v4
# with:
# node-version: 20
# cache: 'pnpm'
# - name: 'Run lint'
# run: pnpm run lint

# Only run this job when the push is on main, next or unstable
publish:
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next' || github.ref == 'refs/heads/unstable')
needs:
- build
- test
# - lint
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
GH_TOKEN: ${{secrets.GH_TOKEN}}
GITHUB_TOKEN: ${{secrets.GH_TOKEN}}
GH_USER: ${{secrets.GH_USER}}
GH_EMAIL: ${{secrets.GH_EMAIL}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{secrets.GH_TOKEN}}
- uses: pnpm/action-setup@v3
with:
version: 8
- run: pnpm add -g pnpm
- name: 'Setup Node.js with pnpm cache'
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: 'Restore build output'
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}
key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }}
restore-keys: ${{ runner.os }}-build-${{ github.sha }}
fail-on-cache-miss: true

- name: 'Setup git coordinates'
run: |
git remote set-url origin https://${{secrets.GH_USER}}:${{secrets.GH_TOKEN}}@github.com/${{ github.repository }}.git
git config user.name $GH_USER
git config user.email $GH_EMAIL
- name: 'Setup npm registry'
run: |
echo "@veramo:registry=https://registry.npmjs.org/" > .npmrc
echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
npm whoami
- name: 'Publish @latest when on main'
if: github.ref == 'refs/heads/main'
run: pnpm publish:latest

- name: 'Publish @next when on next'
if: github.ref == 'refs/heads/next'
run: pnpm publish:next

- name: 'Publish @unstable when on unstable branch'
if: github.ref == 'refs/heads/unstable'
run: pnpm publish:unstable
26 changes: 0 additions & 26 deletions .github/workflows/test-pr.yaml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules
dist

.vscode
coverage
coverage
.npmrc
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.0.3](https://github.com/openwallet-foundation-labs/sd-jwt-js/compare/v2.0.2...v2.0.3) (2024-02-20)


### Bug Fixes

* update versioning ([058a562](https://github.com/openwallet-foundation-labs/sd-jwt-js/commit/058a5623e9fad3ef37fd3b1a0627a98fa7b3d59e))
12 changes: 10 additions & 2 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "2.0.1",
"version": "2.0.3",
"npmClient": "pnpm",
"exact": true,
"message": "chore(release): %s"
"message": "chore(release): %s",
"packages": [
"packages/*"
],
"command": {
"publish": {
"conventionalCommits": true
}
}
}
39 changes: 25 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,18 @@
"version": "2.0.1",
"description": "sd-jwt draft 7 implementation in typescript",
"scripts": {
"build": "pnpm -r build",
"test": "pnpm -r test",
"test:browser": "pnpm -r test:browser",
"test:e2e": "pnpm -r test:e2e",
"test:cov": "pnpm -r test:cov"
"build": "lerna run build --stream",
"lint": "lerna run lint --stream",
"test": "vitest run --coverage",
"clean": "lerna clean -y",
"publish:latest": "lerna publish --conventional-commits --include-merged-tags --create-release github --yes --dist-tag latest",
"publish:next": "lerna publish --conventional-prerelease --force-publish --canary --no-git-tag-version --include-merged-tags --preid next --pre-dist-tag next --yes",
"publish:unstable": "lerna publish --conventional-prerelease --force-publish --canary --no-git-tag-version --include-merged-tags --preid unstable --pre-dist-tag unstable --yes"
},
"keywords": [
"verifiable-credentials",
"digital-wallet",
"sd-jwt",
"sdjwt",
"sd-jwt-vc",
"decentralized-identity",
"ssi",
"oauth",
"oauth2",
"openid-connect"
"sd-jwt-vc"
],
"repository": {
"type": "git",
Expand All @@ -32,6 +27,22 @@
},
"license": "Apache-2.0",
"devDependencies": {
"lerna": "^8.1.2"
"@types/node": "^20.10.2",
"@vitest/coverage-v8": "^1.2.2",
"jsdom": "^24.0.0",
"lerna": "^8.1.2",
"ts-node": "^10.9.1",
"tsup": "^8.0.2",
"typescript": "^5.3.2",
"vite": "^5.1.1",
"vitest": "^1.2.2"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^6.4.0",
"eslint": "^8.0.1",
"eslint-config-standard-with-typescript": "^43.0.1",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-n": "^16.0.0",
"eslint-plugin-promise": "^6.0.0"
}
}
8 changes: 8 additions & 0 deletions packages/broswer-crypto/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.0.3](https://github.com/openwallet-foundation-labs/sd-jwt-js/compare/v2.0.2...v2.0.3) (2024-02-20)

**Note:** Version bump only for package @hopae/sd-jwt-browser-crypto
30 changes: 7 additions & 23 deletions packages/broswer-crypto/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hopae/sd-jwt-browser-crypto",
"version": "2.0.1",
"version": "2.0.3",
"description": "sd-jwt draft 7 implementation in typescript",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand All @@ -13,21 +13,15 @@
},
"scripts": {
"build": "rm -rf **/dist && tsup",
"test": "vitest run ./src/test/*.spec.ts",
"test:browser": "vitest run ./src/test/*.spec.ts --environment jsdom",
"lint": "eslint src/**/*.ts",
"test": "pnpm run test:browser && pnpm run test:cov",
"test:browser": "vitest run ./src/test/*.spec.ts",
"test:cov": "vitest run --coverage"
},
"keywords": [
"verifiable-credentials",
"digital-wallet",
"sd-jwt",
"sdjwt",
"sd-jwt-vc",
"decentralized-identity",
"ssi",
"oauth",
"oauth2",
"openid-connect"
"sd-jwt-vc"
],
"repository": {
"type": "git",
Expand All @@ -39,17 +33,6 @@
"url": "https://github.com/openwallet-foundation-labs/sd-jwt-js/issues"
},
"license": "Apache-2.0",
"devDependencies": {
"@types/node": "^20.10.2",
"@vitest/coverage-v8": "^1.2.2",
"jsdom": "^24.0.0",
"lerna": "^8.1.2",
"ts-node": "^10.9.1",
"tsup": "^8.0.2",
"typescript": "^5.3.2",
"vite": "^5.1.1",
"vitest": "^1.2.2"
},
"tsup": {
"entry": [
"./src/index.ts"
Expand All @@ -62,5 +45,6 @@
"cjs",
"esm"
]
}
},
"gitHead": "ded40e4551bde7ae93083181bf26bd1b38bbfcfb"
}
14 changes: 2 additions & 12 deletions packages/broswer-crypto/vitest.config.mts
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
// vite.config.ts
import { defineConfig } from 'vite';
import { browserConfig } from '../../vitest.shared';

export default defineConfig({
test: {
// Common test configuration
globals: true,
coverage: {
reporter: ['text', 'json', 'html'],
},
environment: 'node', // Default environment
// Override per environment as needed
},
});
export default browserConfig;
Loading

0 comments on commit b259b86

Please sign in to comment.