Skip to content

Commit

Permalink
fix(ci): groom the build scripts and dependencies (uport-project#97)
Browse files Browse the repository at this point in the history
* fix(ci): simplify caching and use codecov action

* fix(build): update build outputs

* fix(deps): bump did-resolver & ethr-did-resolver & did-jwt

upgrade tests and docs to match new document formats

* chore(deps): use ganache instead of ganache-cli

* chore(deps): bump devDependencies to latest
  • Loading branch information
mirceanis authored Jun 6, 2022
1 parent 448fd36 commit 0a29790
Show file tree
Hide file tree
Showing 14 changed files with 2,739 additions and 4,956 deletions.
18 changes: 0 additions & 18 deletions .eslintrc.js

This file was deleted.

18 changes: 18 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"env": {
"node": true,
"jest/globals": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "jest"],
"rules": {}
}
17 changes: 5 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,17 @@ jobs:
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '14.x'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
id: yarn-cache
- name: "Setup node with cache"
uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
node-version: 14
cache: 'yarn'

- run: yarn install --frozen-lockfile
- run: yarn build

- name: setup git coordinates
- name: "Setup git coordinates"
run: |
git config user.name uport-automation-bot
git config user.email [email protected]
Expand Down
22 changes: 10 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
name: Build and Test NODE
on: [pull_request, workflow_dispatch]
on: [pull_request, workflow_dispatch, push]
jobs:
build-test:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '14.x'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
id: yarn-cache
- name: "Setup node with cache"
uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
node-version: 14
cache: 'yarn'

- run: yarn install --frozen-lockfile
- run: yarn run build
- run: yarn run lint
- run: yarn run test:ci

- name: "Upload coverage reports"
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,25 @@ aggregate to form a DID's DID document using
the [Ethr-Did-Resolver](https://github.com/decentralized-identity/ethr-did-resolver)
.

An example of a DID document resolved using the Ethr-Did-Resolver:
An example of a DID document resolved using the [ethr-did-resolver](https://github.com/decentralized-identity/ethr-did-resolver):

```javascript
```json5
{
'@context': [
'https://www.w3.org/ns/did/v1',
'https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld'
'https://w3id.org/security/suites/secp256k1recovery-2020/v2'
],
id: 'did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a',
verificationMethod: [
{
id: `did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a#controller`,
id: 'did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a#controller',
type: 'EcdsaSecp256k1RecoveryMethod2020',
controller: did,
blockchainAccountId: `did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a@eip155:1`
controller: 'did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a',
blockchainAccountId: 'eip155:1:0xb9c5714089478a327f09197987f16f9e5d936e8a'
}
],
assertionMethod: [`did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a#controller`],
authentication: [`did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a#controller`]
assertionMethod: ['did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a#controller'],
authentication: ['did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a#controller']
}
```

Expand Down Expand Up @@ -85,7 +85,7 @@ For example:
import { EthrDID } from 'ethr-did'

const chainNameOrId = 1 // mainnet
const provider = InfuraProvider(<infura project ID>, chainNameOrId)
const provider = InfuraProvider("<infura project ID>", chainNameOrId)
const ethrDid = new EthrDID({identifier: '0x...', privateKey: '...', provider, chainNameOrId})
```

Expand Down Expand Up @@ -128,8 +128,8 @@ EthrDid can be configured to control a DID on any ethereum network. To do this,
during construction. Example:

```ts
console.log( new EthrDid({ '0xb9c5714089478a327f09197987f16f9e5d936e8a', 'rinkeby' }).did )
// did:ethr:rinkeby:0xb9c5714089478a327f09197987f16f9e5d936e8a
console.log( new EthrDID({ identifier: '0xb9c5714089478a327f09197987f16f9e5d936e8a', chainNameOrId: 'rinkeby' }).did )
// did:ethr:rinkeby:0xB9C5714089478a327F09197987f16f9E5d936E8a
```

If this property is not specified, then the library will attempt to infer it from the `provider` configuration or from
Expand Down
3 changes: 0 additions & 3 deletions babel.config.js

This file was deleted.

3 changes: 3 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": [["@babel/preset-env", { "targets": { "node": "current" } }], "@babel/preset-typescript"]
}
6 changes: 3 additions & 3 deletions docs/guides/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const ethrDidOnGoerli = new EthrDID({...keypair, chainNameOrId})

If you use a built-in web3 provider like metamask you can use one of your metamask addresses as your identifier.

```js
```typescript
const provider = new Web3Provider((window as any).ethereum);
const chainNameOrId = (await provider.getNetwork()).chainId
const accounts = await provider.listAccounts()
Expand Down Expand Up @@ -90,15 +90,15 @@ const didDocument = (await didResolver.resolve(ethrDidOnRinkeby.did)).didDocumen
{
"@context": [
"https://www.w3.org/ns/did/v1",
"https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld"
"https://w3id.org/security/suites/secp256k1recovery-2020/v2"
],
"id": "did:ethr:rinkeby:0x02ac49094591d32a4e2f93f3368da2d7d827e987ce6cdb3bd3b8a3390fde8fc33b",
"verificationMethod": [
{
"id": "did:ethr:rinkeby:0x02ac49094591d32a4e2f93f3368da2d7d827e987ce6cdb3bd3b8a3390fde8fc33b#controller",
"type": "EcdsaSecp256k1RecoveryMethod2020",
"controller": "did:ethr:rinkeby:0x02ac49094591d32a4e2f93f3368da2d7d827e987ce6cdb3bd3b8a3390fde8fc33b",
"blockchainAccountId": "0x80155C25E363Ee9e1BbBCC08cD5Df7CD249A98C4@eip155:4"
"blockchainAccountId": "eip155:4:0x80155C25E363Ee9e1BbBCC08cD5Df7CD249A98C4"
},
{
"id": "did:ethr:rinkeby:0x02ac49094591d32a4e2f93f3368da2d7d827e987ce6cdb3bd3b8a3390fde8fc33b#controllerKey",
Expand Down
78 changes: 42 additions & 36 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,36 @@
"name": "ethr-did",
"version": "2.2.2",
"description": "Create, manage and use did:ethr identifiers",
"type": "module",
"source": "src/index.ts",
"main": "lib/index.js",
"module": "lib/index.module.js",
"unpkg": "lib/index.umd.js",
"types": "lib/index.d.ts",
"umd:main": "lib/index.umd.js",
"repository": {
"type": "git",
"url": "[email protected]:uport-project/ethr-did.git"
},
"main": "./lib/index.cjs",
"module": "./lib/index.module.js",
"unpkg": "./lib/index.umd.js",
"types": "./lib/index.d.ts",
"umd:main": "./lib/index.umd.js",
"files": [
"lib",
"src",
"LICENSE"
],
"exports": {
".": {
"require": "./lib/index.cjs",
"import": "./lib/index.module.js"
}
},
"repository": {
"type": "git",
"url": "[email protected]:uport-project/ethr-did.git"
},
"author": "Pelle Braendgaard",
"contributors": [
"Mircea Nistor <[email protected]>"
],
"license": "Apache-2.0",
"scripts": {
"test": "jest",
"test:ci": "jest --coverage && codecov",
"test:ci": "jest --coverage",
"build": "microbundle --compress=false",
"format": "prettier --write \"src/**/*.[jt]s\"",
"lint": "eslint --ignore-pattern \"src/**/*.test.[jt]s\" \"src/**/*.[jt]s\"",
Expand All @@ -45,40 +52,39 @@
]
},
"devDependencies": {
"@babel/core": "7.16.7",
"@babel/preset-env": "7.16.7",
"@babel/preset-typescript": "7.16.7",
"@ethersproject/contracts": "5.6.0",
"@babel/core": "7.18.2",
"@babel/preset-env": "7.17.12",
"@babel/preset-typescript": "7.17.12",
"@ethersproject/contracts": "5.6.2",
"@semantic-release/changelog": "6.0.1",
"@semantic-release/git": "10.0.1",
"@types/jest": "27.4.0",
"@typescript-eslint/eslint-plugin": "5.9.0",
"@typescript-eslint/parser": "5.9.0",
"codecov": "3.8.2",
"eslint": "8.6.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-jest": "26.1.0",
"@types/jest": "28.1.1",
"@typescript-eslint/eslint-plugin": "5.27.0",
"@typescript-eslint/parser": "5.27.0",
"eslint": "8.17.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-jest": "26.5.3",
"eslint-plugin-prettier": "4.0.0",
"ethr-did-registry": "0.0.3",
"ganache-cli": "6.12.2",
"ganache": "7.2.0",
"jest": "28.1.0",
"microbundle": "0.14.2",
"prettier": "2.5.1",
"microbundle": "0.15.0",
"prettier": "2.6.2",
"semantic-release": "19.0.2",
"typescript": "4.5.4"
"typescript": "4.7.3"
},
"dependencies": {
"@ethersproject/abstract-signer": "^5.6.0",
"@ethersproject/base64": "^5.6.0",
"@ethersproject/basex": "^5.6.0",
"@ethersproject/abstract-signer": "^5.6.2",
"@ethersproject/base64": "^5.6.1",
"@ethersproject/basex": "^5.6.1",
"@ethersproject/bytes": "^5.6.1",
"@ethersproject/providers": "^5.6.2",
"@ethersproject/signing-key": "^5.6.0",
"@ethersproject/strings": "^5.6.0",
"@ethersproject/transactions": "^5.6.0",
"@ethersproject/wallet": "^5.5.0",
"did-jwt": "^6.0.0",
"did-resolver": "^3.2.0",
"ethr-did-resolver": "^5.0.4"
"@ethersproject/providers": "^5.6.8",
"@ethersproject/signing-key": "^5.6.2",
"@ethersproject/strings": "^5.6.1",
"@ethersproject/transactions": "^5.6.2",
"@ethersproject/wallet": "^5.6.2",
"did-jwt": "^6.1.2",
"did-resolver": "^3.2.2",
"ethr-did-resolver": "^6.0.1"
}
}
4 changes: 2 additions & 2 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"devDependencies"
],
"groupName": "devDeps",
"schedule": [
"before 5am on Monday"
"extends": [
"schedule:earlyMondays"
]
}
]
Expand Down
Loading

0 comments on commit 0a29790

Please sign in to comment.