From da12484f2df865f3457c6871b9e8e03f80f91625 Mon Sep 17 00:00:00 2001 From: Thang Do Date: Wed, 9 Oct 2024 10:10:59 +0700 Subject: [PATCH] chore: setup the github action, add release action, update package name --- .github/workflows/lint.yaml | 28 ++++++++++++++ .github/workflows/release.yaml | 37 +++++++++++++++++++ .github/workflows/test.yaml | 28 ++++++++++++++ .releaserc | 3 +- README.md | 8 ++-- examples/nodejs/index.ts | 2 +- examples/nodejs/package-lock.json | 6 +-- examples/nodejs/package.json | 2 +- examples/nodejs/yarn.lock | 2 +- examples/react/package.json | 2 +- .../Modal/CredentialDetailModal.tsx | 2 +- examples/react/src/pages/EnsDetail/index.tsx | 2 +- examples/react/vite.config.ts | 2 +- examples/react/yarn.lock | 2 +- package.json | 10 ++++- 15 files changed, 119 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/lint.yaml create mode 100644 .github/workflows/release.yaml create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..0a2e25b --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,28 @@ +name: ESLint check + +on: + pull_request: + types: [opened, synchronize] + branches: ['main'] + +jobs: + run-eslint: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - run: yarn install + - run: yarn lint diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..db32e8b --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,37 @@ +name: Deployment CI + +on: + push: + branches: ['release'] + +permissions: + contents: write + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + - run: yarn install + - run: yarn build && touch dist/.nojekyll + + - name: Semantic Release + uses: cycjimmy/semantic-release-action@v4 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish + run: npm publish --//registry.npmjs.org/:_authToken="${{ secrets.NPM_TOKEN }}" diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..ca32291 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,28 @@ +name: Run Test case + +on: + pull_request: + types: [opened, synchronize] + branches: ['main'] + +jobs: + run-test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - run: yarn install + - run: yarn test diff --git a/.releaserc b/.releaserc index f075d04..1469af8 100644 --- a/.releaserc +++ b/.releaserc @@ -1,7 +1,8 @@ { "branches": [ "main", - "master" + "master", + "release" ], "plugins": [ "@semantic-release/commit-analyzer", diff --git a/README.md b/README.md index 5659c88..765faed 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# dentity-ens-client +# @dentity/ens-client A combination of [Denitty](https://dentity.com) and [ENS domains](https://ens.domains) to verify basic information for ENS domain owners. @@ -7,7 +7,7 @@ A combination of [Denitty](https://dentity.com) and [ENS domains](https://ens.d ## Install ``` sh -npm i dentity-ens-client +npm i @dentity/ens-client ``` ## Getting started @@ -15,7 +15,7 @@ npm i dentity-ens-client The simplest example is to get all verifcations shared by Dentity users with their ENS domain. You can easily get all those verifications by initially add to their ENS domain. ``` ts import { EnsPublicClient, createEnsPublicClient } from '@ensdomains/ensjs'; -import { CredentialTemplate, EnsDentityClient } from 'dentity-ens-client'; +import { CredentialTemplate, EnsDentityClient } from '@dentity/ens-client'; import { http } from 'viem'; import { mainnet } from 'viem/chains'; @@ -40,7 +40,7 @@ EnsDentityClient.initialize(client as any, 'moisesj.eth').then((ensClient) => { Currently Dentity is supporting sharing a number of verification types for ENS domain. You can specifically get any verification by passing in a specific credential template. You can then verify the correctness of that verification. ``` ts import { EnsPublicClient, createEnsPublicClient } from '@ensdomains/ensjs'; -import { CredentialTemplate, DentityEnsClient } from 'dentity-ens-client'; +import { CredentialTemplate, DentityEnsClient } from '@dentity/ens-client'; import { http } from 'viem'; import { mainnet } from 'viem/chains'; diff --git a/examples/nodejs/index.ts b/examples/nodejs/index.ts index dd2511a..2be5fe0 100644 --- a/examples/nodejs/index.ts +++ b/examples/nodejs/index.ts @@ -1,5 +1,5 @@ import { EnsPublicClient, createEnsPublicClient } from '@ensdomains/ensjs'; -import { CredentialTemplate, DentityEnsClient } from 'dentity-ens-client'; +import { CredentialTemplate, DentityEnsClient } from '@dentity/ens-client'; import { http } from 'viem'; import { mainnet } from 'viem/chains'; diff --git a/examples/nodejs/package-lock.json b/examples/nodejs/package-lock.json index e9ffa2e..67d3659 100644 --- a/examples/nodejs/package-lock.json +++ b/examples/nodejs/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "dentity-ens-client": "file:../src" + "@dentity/ens-client": "file:../src" }, "devDependencies": { "ts-node": "^10.9.2", @@ -186,7 +186,7 @@ "node": ">=0.3.1" } }, - "node_modules/dentity-ens-client": { + "node_modules/@dentity/ens-client": { "resolved": "../src", "link": true }, @@ -374,7 +374,7 @@ "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true }, - "dentity-ens-client": { + "@dentity/ens-client": { "version": "file:../src" }, "make-error": { diff --git a/examples/nodejs/package.json b/examples/nodejs/package.json index ca7d7b1..cfc758a 100644 --- a/examples/nodejs/package.json +++ b/examples/nodejs/package.json @@ -11,7 +11,7 @@ "license": "ISC", "dependencies": { "@ensdomains/ensjs": "^4.0.1", - "dentity-ens-client": "link:../../" + "@dentity/ens-client": "link:../../" }, "devDependencies": { "ts-node": "^10.9.2", diff --git a/examples/nodejs/yarn.lock b/examples/nodejs/yarn.lock index c0d8bfd..a000eb7 100644 --- a/examples/nodejs/yarn.lock +++ b/examples/nodejs/yarn.lock @@ -236,7 +236,7 @@ delayed-stream@~1.0.0: resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== -"dentity-ens-client@link:../..": +"@dentity/ens-client@link:../..": version "0.0.0" uid "" diff --git a/examples/react/package.json b/examples/react/package.json index cb3012f..071d512 100644 --- a/examples/react/package.json +++ b/examples/react/package.json @@ -22,7 +22,7 @@ "dependencies": { "@ensdomains/ensjs": "^4.0.1", "copy-to-clipboard": "^3.3.3", - "dentity-ens-client": "link:../../", + "@dentity/ens-client": "link:../../", "react": "^18.3.1", "react-dom": "^18.3.1", "react-json-view": "^1.21.3", diff --git a/examples/react/src/components/Modal/CredentialDetailModal.tsx b/examples/react/src/components/Modal/CredentialDetailModal.tsx index 41d2935..0845c4a 100644 --- a/examples/react/src/components/Modal/CredentialDetailModal.tsx +++ b/examples/react/src/components/Modal/CredentialDetailModal.tsx @@ -7,7 +7,7 @@ import MiniLoading from '../Icon/MiniLoading'; import { DentityEnsClient, VerifiableCredentialPresentationResponse, -} from 'dentity-ens-client'; +} from '@dentity/ens-client'; import { toast } from 'react-toastify'; import Tick from '../Icon/Tick'; diff --git a/examples/react/src/pages/EnsDetail/index.tsx b/examples/react/src/pages/EnsDetail/index.tsx index 0419ee1..c576ae8 100644 --- a/examples/react/src/pages/EnsDetail/index.tsx +++ b/examples/react/src/pages/EnsDetail/index.tsx @@ -6,7 +6,7 @@ import { DentityEnsClient, VerifiableCredentialPresentation, CredentialTemplate, -} from 'dentity-ens-client'; +} from '@dentity/ens-client'; import { useLayoutEffect, useMemo, useState } from 'react'; import Discord from '../../components/Icon/Discord'; import Email from '../../components/Icon/Email'; diff --git a/examples/react/vite.config.ts b/examples/react/vite.config.ts index d872ede..c6ac523 100644 --- a/examples/react/vite.config.ts +++ b/examples/react/vite.config.ts @@ -21,6 +21,6 @@ export default defineConfig({ port: 3000, }, optimizeDeps: { - include: ['dentity-ens-client'], + include: ['@dentity/ens-client'], }, }); diff --git a/examples/react/yarn.lock b/examples/react/yarn.lock index 7e25071..94692f4 100644 --- a/examples/react/yarn.lock +++ b/examples/react/yarn.lock @@ -901,7 +901,7 @@ delayed-stream@~1.0.0: resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== -"dentity-ens-client@link:../..": +"@dentity/ens-client@link:../..": version "0.0.0" uid "" diff --git a/package.json b/package.json index 45b0f18..663d0c0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@dentity/ens-client", "repository": { - "url": "https://github.com/Dentity-Development/ens-client.git" + "url": "git+https://github.com/Dentity-Development/ens-client.git" }, "version": "1.0.0", "author": "Dentity", @@ -66,5 +66,13 @@ "resolutions": { "wrap-ansi": "7.0.0", "string-width": "4.2.3" + }, + "bugs": { + "url": "https://github.com/Dentity-Development/ens-client/issues" + }, + "homepage": "https://github.com/Dentity-Development/ens-client#readme", + "directories": { + "example": "examples", + "test": "tests" } }