Skip to content

Commit

Permalink
Merge pull request #410 from Tonomy-Foundation/testnet
Browse files Browse the repository at this point in the history
Master release: veramo library support, yarn 4.3, Pure ES-package compiles
  • Loading branch information
theblockstalk authored Sep 23, 2024
2 parents 411e07c + ba0ce6d commit ab1738f
Show file tree
Hide file tree
Showing 92 changed files with 17,328 additions and 10,615 deletions.
46 changes: 0 additions & 46 deletions .eslintrc.json

This file was deleted.

16 changes: 12 additions & 4 deletions .github/workflows/publish-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,41 @@ jobs:
publish-npm:
runs-on: ubuntu-20.04
steps:
- name: Install jq
run: sudo apt install jq -y

- name: 🏗 Setup repo
uses: actions/checkout@v4
with:
token: ${{secrets.MY_GITHUB_PERSONAL_ACCESS_TOKEN}}

- name: Enable Corepack before setting up Node
run: corepack enable

- name: 📦 Install
uses: actions/setup-node@v4
with:
node-version: 18.12.1
node-version: 22.3.0
registry-url: https://registry.npmjs.org/

- name: 🚀 Build and publish SDK
uses: actions/setup-node@v4
with:
node-version: 18.12.1
node-version: 22.3.0
- name: Check branch name
run: echo ${GITHUB_REF#refs/*/}
- run: |
if [[ ${GITHUB_REF#refs/*/} == "development" ]]; then
echo "Variable BRANCH_NAME is set to 'development'"
yarn config set tag development
jq --arg tag "development" '.publishConfig.tag = $tag' package.json > package.tmp.json && mv package.tmp.json package.json
fi
if [[ ${GITHUB_REF#refs/*/} == "testnet" ]]; then
echo "Variable BRANCH_NAME is set to 'testnet'"
yarn config set tag rc
jq --arg tag "rc" '.publishConfig.tag = $tag' package.json > package.tmp.json && mv package.tmp.json package.json
fi
- run: yarn install --immutable
- run: yarn run build
- run: yarn run release
env:
GITHUB_TOKEN: ${{secrets.MY_GITHUB_PERSONAL_ACCESS_TOKEN}}
Expand Down
20 changes: 13 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
name: Run Tonomy-ID-SDK Tests

on:
pull_request:
branches:
- development
push

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Enable Corepack before setting up Node
run: corepack enable

- name: Run lint and test
uses: actions/setup-node@v4
with:
node-version: 18.12.1
node-version: 22.3.0
cache: yarn
- run: yarn install --immutable
- run: yarn run build
- run: yarn run lint
- run: yarn run test:unit

compile-contracts:
name: Compiles contracts needed for bootstrap script
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -89,19 +91,23 @@ jobs:
with:
name: Tonomy-Contracts
path: ./Tonomy-Contracts

- name: Enable Corepack before setting up Node
run: corepack enable

- name: Install SDK and Bootstrap blockchain
uses: actions/setup-node@v4
with:
node-version: 18.12.1
node-version: 22.3.0
cache: yarn
- run: yarn install --immutable
- run: yarn run build
- run: yarn run cli bootstrap

- name: Run integration and governance tests
uses: actions/setup-node@v4
with:
node-version: 18.12.1
node-version: 22.3.0
cache: yarn
- run: yarn run test:integration
- run: yarn run test:governance
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ node_modules
build
site
.yarn
.pnp.*
.pnp.*
database.sqlite
8 changes: 7 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,11 @@
"markdownlint.config": {
"default": true,
"MD033": false
}
},
"git.branchPrefix": "feature/",
"git.branchProtection": [
"master",
"main",
"development"
],
}
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
25 changes: 4 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@ The SDK is written in typescript with jest to run tests.
## Dependencies

- Linux debian distribution (Ubuntu 20.0.4 LTS used)
- [Nodejs](https://nodejs.org) v18.12.1+ suggested installed with [nvm](https://github.com/nvm-sh/nvm)
- [Nodejs](https://nodejs.org) v20+ suggested installed with [nvm](https://github.com/nvm-sh/nvm)

Integration tests:

- [Docker](http://docs.docker.com) v20.10+

Documentation:

- [mkdocs](https://www.mkdocs.org) with [material](https://squidfunk.github.io/mkdocs-material) theme

## Sub-Repositories

- [Contracts](https://github.com/Tonomy-Foundation/Tonomy-Contracts) (inside SDK repo) - Smart contracts to run the governance, identity, DAO, token and other ecosystem tools. This is used to run the integration tests
Expand All @@ -32,7 +28,7 @@ Build notes:

- Build just the sdk `yarn run build:sdk`
- Build just the cli `yarn run build:cli`
- Cli has dependency of `argon2` package, which is not needed by SDK and should be moved to a devDependency if these softwares are ever separated.
- TODO: cli has dependency of `argon2` package, which is not needed by SDK and should be moved to a devDependency if these softwares are ever separated.

## Run

Expand All @@ -44,10 +40,6 @@ This builds to `/build` and runs the project in watch mode so any edits you save

To do a one-off build, use `yarn run build`.

## Tests

To show logs during tests `export LOG=true`

### Unit tests

Tests individual class and function logic within the SDK.
Expand Down Expand Up @@ -112,15 +104,6 @@ yarn run lint

See [errors.ts](./src/services/errors.ts). All errors have a registered unique enumeration code.

## Documentation

Documentation is in the `./docs` folder and runs with [mkdocs](https://www.mkdocs.org) with [material](https://squidfunk.github.io/mkdocs-material) theme.

Install with

```bash
sudo apt-get -y install mkdocs
pip install mkdocs-material
```
## Debugging

Then `yarn run docs:serve`
Uses [debug](https://www.npmjs.com/package/debug) package. Use `export DEBUG="tonomy*"` to see all debug logs.
2 changes: 1 addition & 1 deletion Tonomy-Contracts
6 changes: 0 additions & 6 deletions babel.config.json

This file was deleted.

31 changes: 0 additions & 31 deletions custom-test-env.js

This file was deleted.

2 changes: 1 addition & 1 deletion docs/guides/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Please <a href="https://tonomy.io/contact" target="_blank">contact us</a> for as
## Prerequisites

- Tonomy ID services run exclusively in `Linux`, we recommend Ubuntu 20.04 or 22.04.
- `npm` with `corepack enabled`, we recommend v18.12.1. Suggested to install with nvm v0.35+
- `npm` with `corepack enabled`, we recommend v22.3.0. Suggested to install with nvm v0.35+

## Services to run Tonomy ID

Expand Down
12 changes: 1 addition & 11 deletions docs/start/single-sign-on.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,7 @@ Currently, only the `username` is able to be requested. We are working on suppor

### Styling the Tonomy login button

To use the Tonomy login button styles, import the stylesheet and use the class `tonomy-login-button` on your button.

```typescript
import "@tonomy/tonomy-id-sdk/build/api/tonomy.css";
```

or

```html
<link href="https://unpkg.com/@tonomy/tonomy-id-sdk/build/api/tonomy.css" />
```
TODO: need to provide this in the gitbook docs

## 3. Callback page

Expand Down
51 changes: 51 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import prettier from 'eslint-plugin-prettier/recommended';
import globals from 'globals';

export default [
eslint.configs.recommended,
...tseslint.configs.recommended,
prettier,
{
rules: {
eqeqeq: 'error',
'no-console': 'warn',
indent: ['error', 4, { SwitchCase: 1 }],
camelcase: 'error',
'prettier/prettier': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': 'warn',
'padding-line-between-statements': [
'warn',
{ blankLine: 'always', prev: 'block-like', next: '*' },
{ blankLine: 'always', prev: 'block', next: '*' },
{ blankLine: 'always', prev: '*', next: ['block', 'block-like'] },
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
{ blankLine: 'any', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] },
{ blankLine: 'always', prev: ['export', 'import'], next: '*' },
{ blankLine: 'any', prev: 'import', next: 'import' },
{ blankLine: 'any', prev: 'export', next: 'export' },
],
},
languageOptions: {
ecmaVersion: 6,
sourceType: 'module',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals.browser,
...globals.node,
...globals.es6,
...globals.jest,
},
},
files: ['**/*.js', '**/*.ts'],
ignores: ['build/**'],
},
];
Loading

0 comments on commit ab1738f

Please sign in to comment.