From 7b8fec1f8d0c2cf9c080d5eb8b171bd0f1020167 Mon Sep 17 00:00:00 2001 From: yellowCrimsonGator Date: Tue, 14 May 2024 18:07:29 +0400 Subject: [PATCH] feat: publish ethereum wallets package --- .../ISSUE_TEMPLATE/bug---defect---problem.md | 45 ---------- .github/ISSUE_TEMPLATE/change_request.md | 13 --- .github/ISSUE_TEMPLATE/epic-template.md | 26 ------ .github/ISSUE_TEMPLATE/feature_request.md | 23 ----- .github/ISSUE_TEMPLATE/issue-template.md | 16 ---- .github/PULL_REQUEST_TEMPLATE.md | 8 -- .github/PULL_REQUEST_TEMPLATE/general.md | 25 ------ .../wallet_integration.md | 11 --- .github/actions/checklist.js | 37 -------- .github/actions/pr-title.js | 56 ------------ .github/dependabot.yml | 35 -------- .github/release-drafter.yml | 28 ------ .github/workflows/bump-version.yml | 90 +++++-------------- .github/workflows/deploy-angular-example.yml | 36 -------- .github/workflows/dev-pr.yml | 73 --------------- .github/workflows/pr-actions.yaml | 32 ------- nx.json | 2 +- 17 files changed, 24 insertions(+), 532 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug---defect---problem.md delete mode 100644 .github/ISSUE_TEMPLATE/change_request.md delete mode 100644 .github/ISSUE_TEMPLATE/epic-template.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 .github/ISSUE_TEMPLATE/issue-template.md delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/PULL_REQUEST_TEMPLATE/general.md delete mode 100644 .github/PULL_REQUEST_TEMPLATE/wallet_integration.md delete mode 100644 .github/actions/checklist.js delete mode 100644 .github/actions/pr-title.js delete mode 100644 .github/dependabot.yml delete mode 100644 .github/release-drafter.yml delete mode 100644 .github/workflows/deploy-angular-example.yml delete mode 100644 .github/workflows/dev-pr.yml delete mode 100644 .github/workflows/pr-actions.yaml diff --git a/.github/ISSUE_TEMPLATE/bug---defect---problem.md b/.github/ISSUE_TEMPLATE/bug---defect---problem.md deleted file mode 100644 index 17aad1d2b..000000000 --- a/.github/ISSUE_TEMPLATE/bug---defect---problem.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -name: Bug / Defect / Problem -about: Find a problem? Something not working? Please fill out as much info as possible. -title: "[Defect] " -labels: bug, Emerging Tech, Near BOS -assignees: '' - ---- - -**Describe the bug** - - - -**Steps To Reproduce**å - -_Steps to reproduce the behavior:_ - -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' - -_Error description_ - -**Expected behavior** - - - -**Screenshots** - - - -**Desktop**: -* OS : -* Browser : -* Browser Version : - -**Smartphone**: -* Device : -* OS <1-- e.g. iOS8.1 -->: -* Browser : -* Browser Version : - -**Additional Context** - - diff --git a/.github/ISSUE_TEMPLATE/change_request.md b/.github/ISSUE_TEMPLATE/change_request.md deleted file mode 100644 index 659f4ebc3..000000000 --- a/.github/ISSUE_TEMPLATE/change_request.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -name: Change request -about: Template for change requests -title: '' -labels: change-request -assignees: '' - ---- - -**Description** -If applicable add: Relates to # -**Acceptance Criteria** -Set of predefined requirements that must be met for it to be completed. diff --git a/.github/ISSUE_TEMPLATE/epic-template.md b/.github/ISSUE_TEMPLATE/epic-template.md deleted file mode 100644 index b10f0f622..000000000 --- a/.github/ISSUE_TEMPLATE/epic-template.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -name: Epic Template -about: Epics are milestones or groups of alike issues -title: "\U0001F537 [Epic] " -labels: Emerging Tech, Epic, Near BOS -assignees: '' - ---- - -### Description - -(Overview of milestone or function governed by this epic) - -### Resources - -(Relevant documentation, Figma links, and other reference material) - -Item 1 - -Item 2 - -Item 3 - -```[tasklist] -### Related Issues -``` diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 2bf09e5cd..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: enhancement -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Acceptance criteria** -The minimum requirements in order for this issue to be resolved. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/issue-template.md b/.github/ISSUE_TEMPLATE/issue-template.md deleted file mode 100644 index cd812980d..000000000 --- a/.github/ISSUE_TEMPLATE/issue-template.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -name: Issue Template -about: Issues are general tasks to be compeleted -title: '' -labels: Emerging Tech, Near BOS -assignees: '' - ---- - -### Description - -(Summary of task, purpose, impact) - -### Optional: User Story - -(As a [user], I need [function, outcome, enhancement] that [provides value].) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 4c4d4f2f4..000000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,8 +0,0 @@ -Thanks for taking the time to submit a pull request! - -If you haven't already, be sure to take a look at the [CONTRIBUTING](https://github.com/near/wallet-selector/blob/main/CONTRIBUTING.md) documentation to get up to speed with the practices in this repository. - -When you're ready, switch to the "Preview" tab to select an applicable template: - -- [General template (most common)](?expand=1&template=general.md) -- [Wallet integration template](?expand=1&template=wallet_integration.md) diff --git a/.github/PULL_REQUEST_TEMPLATE/general.md b/.github/PULL_REQUEST_TEMPLATE/general.md deleted file mode 100644 index 648aecd09..000000000 --- a/.github/PULL_REQUEST_TEMPLATE/general.md +++ /dev/null @@ -1,25 +0,0 @@ -# Description - -Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. - -# Checklist: - -- [ ] I have performed a self-review of my own code -- [ ] I have commented my code, particularly in hard-to-understand areas -- [ ] I have made corresponding changes to the documentation -- [ ] My changes generate no new warnings - - -# Type of change. - -- [ ] FIX - a PR of this type patches a bug. -- [ ] FEATURE - a PR of this type introduces a new feature. -- [ ] BUILD - a PR of this type introduces build changes. -- [ ] CI - a PR of this type introduces CI changes. -- [ ] DOCS - a PR of this type introduces DOCS improvement. -- [ ] STYLE - a PR of this type introduces style changes. -- [ ] REFACTOR - a PR of this type introduces refactoring. -- [ ] PERFORMANCE - a PR of this type introduces performance changes. -- [ ] TEST - a PR of this type adds more tests. -- [ ] CHORE - a PR introduces other changes than the specified above. - diff --git a/.github/PULL_REQUEST_TEMPLATE/wallet_integration.md b/.github/PULL_REQUEST_TEMPLATE/wallet_integration.md deleted file mode 100644 index f5e1ebb41..000000000 --- a/.github/PULL_REQUEST_TEMPLATE/wallet_integration.md +++ /dev/null @@ -1,11 +0,0 @@ -# Description - -Please include a summary of the wallet and how users can install it. Be sure to take a look at our guide on [Custom Wallets](https://github.com/near/wallet-selector/blob/main/packages/core/docs/guides/custom-wallets.md) to understand core concepts when integrating with Wallet Selector. - -# Checklist: - -- [ ] I have performed a self-review of my own code -- [ ] I have commented my code, particularly in hard-to-understand areas -- [ ] I have made corresponding changes to the documentation -- [ ] My changes generate no new warnings - diff --git a/.github/actions/checklist.js b/.github/actions/checklist.js deleted file mode 100644 index aa5e2365e..000000000 --- a/.github/actions/checklist.js +++ /dev/null @@ -1,37 +0,0 @@ -const CHECKLIST_TYPES = { - ALL: (completed, numberOfTasks) => completed === numberOfTasks, - ONE: (completed) => completed === 1, -}; - -const REGEX_CHECKLIST_START = new RegExp(`^`, 'gm'); -const REGEX_CHECKLIST_END = new RegExp('^', 'gm'); - -const REGEX_COMPLETED_TASK = /(- \[[x]\].+)/g; -const REGEX_UNCOMPLETED_TASK = /(- \[[ ]\].+)/g; - -module.exports.check = function({ - context -}) { - if(!context.payload.pull_request) throw new Error(`Unsupported payload: ${JSON.stringify(context.payload)}`); - // Making sure the body is a string - const body = '' + context.payload.pull_request.body.split('\n').map(line => line.trim()).join('\n'); - // Finding all the checklist start points - const matchIterator = body.matchAll(REGEX_CHECKLIST_START); - - for (const { 0 : matched, 1: type, index } of matchIterator) { - const part = body.substring(index); - // Finding the end of the checklist - const endIndex = part.search(REGEX_CHECKLIST_END); - if(endIndex === -1) throw new Error(`Syntax error: Could not find end of checklist`); - - // Getting the content of the checklist - const list = part.substring(0, endIndex); - - // Separating completed and uncompleted tasks - const completed = list.match(REGEX_COMPLETED_TASK) || []; - const uncompleted = list.match(REGEX_UNCOMPLETED_TASK) || []; - - // Ensuring conditions for each type of the checklist are met - if(!CHECKLIST_TYPES[type](completed.length, [...completed, ...uncompleted ].length)) throw new Error(`Invalid checklist: ${matched}`); - } -}; diff --git a/.github/actions/pr-title.js b/.github/actions/pr-title.js deleted file mode 100644 index 61a669430..000000000 --- a/.github/actions/pr-title.js +++ /dev/null @@ -1,56 +0,0 @@ -const CONVENTIONAL_COMMIT_CHANGES = { - FIX: 'fix', - FEATURE: 'feat', - BUILD: 'build', - CHORE: 'chore', - CI: 'ci', - DOCS: 'docs', - STYLE: 'style', - REFACTOR: 'refactor', - PERFORMANCE: 'perf', - TEST: 'test', - CHORE: 'chore' -}; - -const REGEX_CHANGE_TYPE = new RegExp(`(- \\[[x]\\] (${Object.keys(CONVENTIONAL_COMMIT_CHANGES).join('|')}).+)`, 'g'); - -module.exports.update = async function ({ - context, - github -}) { - if (!context.payload.pull_request) throw new Error(`Unsupported payload: ${JSON.stringify(context.payload)}`); - - - let { title, body, labels = [] } = context.payload.pull_request; - - const scopes = labels.map(label => label.name).filter(label => label.startsWith('scope:')).map(label => label.substring(6)); - - if (scopes.length > 1) throw new Error(`Too many scopes: ${scopes.join(', ')}`); - - const [ scope ] = scopes; - - for (const { 2: type } of body.matchAll(REGEX_CHANGE_TYPE)) { - title = `${CONVENTIONAL_COMMIT_CHANGES[type]}${scope ? '(' + scope + ')' : ''}: ${title.replace(/^.*:(\s)?/g, '').trim()}`; - } - - - const [ match ] = body.match(/(- \[[x]\] (BREAKING CHANGE).+)/g) || []; - - title = title.replace(/(\n)?(BREAKING CHANGE).+/g, ''); - - if(match) { - const [, reason] = match.split(':'); - title = `${title} - BREAKING CHANGE: ${reason}`; - } - - - const updateParams = { - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - title - }; - - await github.issues.update(updateParams); -} diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index d1178cf8f..000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,35 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "npm" - directory: "/" - schedule: - interval: "monthly" - target-branch: "dev" - allow: - - dependency-name: "lodash" - - dependency-name: "@jscutlery/semver" - - dependency-name: "@ledgerhq/hw*" - - dependency-name: "@meteorwallet/sdk" - - dependency-name: "@walletconnect/qrcode-modal" - - dependency-name: "@walletconnect/sign-client" - - dependency-name: "better-sqlite3" - - dependency-name: "big.js" - - dependency-name: "bn.js" - - dependency-name: "buffer" - - dependency-name: "copy-to-clipboard" - - dependency-name: "is-mobile" - - dependency-name: "near-api-js" - - dependency-name: "ngx-deploy-npm" - - dependency-name: "qrcode" - - dependency-name: "react-qr-code" - - dependency-name: "regenerator-runtime" - - dependency-name: "rxjs" - - dependency-name: "tslib" - - dependency-name: "@types/big.js" - - dependency-name: "@types/bn.js" - - dependency-name: "@types/gh-pages" - - dependency-name: "@types/qrcode" - - dependency-name: "@types/w3c-web-hid" - - dependency-name: "@types/w3c-web-usb" - - dependency-name: "@walletconnect/types" - - dependency-name: "gh-pages" diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml deleted file mode 100644 index fb56b5976..000000000 --- a/.github/release-drafter.yml +++ /dev/null @@ -1,28 +0,0 @@ -categories: - - title: '🚀 Features' - labels: - - 'feat' - - title: '🐛 Bug Fixes' - labels: - - 'fix' - - title: '🧰 Maintenance' - labels: - - 'chore' - - 'ci' - - title: '📝 Documentation & Styling' - labels: - - 'docs' - - 'style' - - title: '📚 Workflow & Infrastructure' - labels: - - 'refactor' - - 'perf' - - 'test' - - 'build' - -exclude-labels: - - 'skip-changelog' - -template: | - ## Changelog - $CHANGES diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index 00472fb59..45c73d53d 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -1,84 +1,40 @@ -on: - push: - branches: - - main - workflow_dispatch: +name: on release -permissions: - actions: write - issues: write - pull-requests: write - contents: write +on: pull_request jobs: - release: - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + publish-github-registry: runs-on: ubuntu-latest + permissions: + contents: read + packages: write steps: - name: Checkout uses: actions/checkout@v2 with: + ref: ik/worflow-package-publish fetch-depth: 0 - - name: Setup Git - run: | - git config user.name "GitHub Bot" - git config user.email "gituser@example.com" - - run: echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > ./.npmrc - - name: Setup Node.js uses: actions/setup-node@v3 with: node-version: "18.x" cache: 'yarn' - - name: Check example apps - run: echo "EXAMPLE_APPS=$(ls ./examples | tr '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV - - name: Install dependencies run: yarn install --frozen-lockfile --prefer-offline - - - name: Bump version - if: github.ref == 'refs/heads/main' - run: yarn nx run core:version --dryRun - - - name: Bump version - if: github.ref != 'refs/heads/main' - run: yarn nx run core:version:dev --dryRun - - - name: Tag version - if: github.ref == 'refs/heads/main' - run: echo "GIT_TAG=$(git describe --exact-match --tags $(git log -n1 --pretty='%h') 2> /dev/null)" >> $GITHUB_ENV - - - name: Run Build All - run: yarn build:all - - # Use npx instead of yarn because yarn automatically sets NPM_* environment variables - # like NPM_CONFIG_REGISTRY so npm publish ends up ignoring the .npmrc file - # which is set up by `setup-node` action. - - name: Deploy - run: npx nx run-many --target=deploy --all --noBuild --exclude=$EXAMPLE_APPS --dry-run - env: - EXAMPLE_APPS: ${{ env.EXAMPLE_APPS }} - - # Drafts your next Release notes as Pull Requests are merged into "main" - - name: Draft Release notes - id: draft-release-notes - uses: release-drafter/release-drafter@v5 - if: github.ref == 'refs/heads/main' - with: - config-name: release-drafter.yml - publish: true - tag: ${{ env.GIT_TAG }} + - name: Build + run: yarn nx run-many --target=build --projects=core,ethereum-wallets,modal-ui,my-near-wallet --configuration=production + - name: Creating .npmrc + run: | + cat << EOF > "$HOME/.npmrc" + //registry.npmjs.org/:_authToken=$NPM_TOKEN + EOF env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Push changes - uses: ad-m/github-push-action@master - if: github.ref == 'refs/heads/main' - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }} - force: true - tags: true - + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Publish Core + run: cd ./dist/packages/core && npm pkg set name=aurora-is-near/wallet-selector/core && npm pkg set repository.url=https://github.com/aurora-is-near/wallet-selector.git && npm pkg set bugs.url=https://github.com/aurora-is-near/issues && npm pkg set homepage=https://github.com/aurora-is-near/wallet-selector/tree/main/packages/core && npm publish --access public + - name: Publish Modal ui + run: cd .. && cd ./modal-ui && npm pkg set name=aurora-is-near/wallet-selector/modal-ui && npm pkg set repository.url=https://github.com/aurora-is-near/wallet-selector.git && npm pkg set bugs.url=https://github.com/aurora-is-near/issues && npm pkg set homepage=https://github.com/aurora-is-near/wallet-selector/tree/main/packages/modal-ui && npm publish --access public + - name: Publish My Near Wallet + run: cd .. && cd ./my-near-wallet && npm pkg set name=aurora-is-near/wallet-selector/my-near-wallet && npm pkg set repository.url=https://github.com/aurora-is-near/wallet-selector.git && npm pkg set bugs.url=https://github.com/aurora-is-near/issues && npm pkg set homepage=https://github.com/aurora-is-near/wallet-selector/tree/main/packages/my-near-wallet && npm publish --access public + - name: Publish Ethereum Wallets + run: cd .. && cd ./dist/packages/ethereum-wallets && npm pkg set name=aurora-is-near/wallet-selector/ethereum-wallets && npm pkg set repository.url=https://github.com/aurora-is-near/wallet-selector.git && npm pkg set bugs.url=https://github.com/aurora-is-near/issues && npm pkg set homepage=https://github.com/aurora-is-near/wallet-selector/tree/main/packages/ethereum-wallets && npm publish --access public diff --git a/.github/workflows/deploy-angular-example.yml b/.github/workflows/deploy-angular-example.yml deleted file mode 100644 index 86537abca..000000000 --- a/.github/workflows/deploy-angular-example.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Deploy Angular Example - -on: - push: - branches: - - main - workflow_dispatch: - -jobs: - deploy: - runs-on: ubuntu-latest - permissions: - actions: write - issues: write - pull-requests: write - contents: write - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: "18.x" - - - name: Install dependencies - run: yarn install - - - name: Build - run: yarn nx build angular - - - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./dist/examples/angular diff --git a/.github/workflows/dev-pr.yml b/.github/workflows/dev-pr.yml deleted file mode 100644 index add395c74..000000000 --- a/.github/workflows/dev-pr.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: Dev PR -on: - pull_request_review: - types: - - submitted - pull_request_target: - types: - - opened - - reopened - - edited - - labeled - - unlabeled - - synchronize - - ready_for_review - - unlocked - branches: - - dev - - main - -permissions: - actions: write - issues: write - pull-requests: write - -jobs: - # printer: - # runs-on: ubuntu-latest - # steps: - # - name: Checkout - # uses: actions/checkout@v2 - # - name: Print - # run: echo '${{ github.event.pull_request.base.ref }}' - - dev-pr: - if: github.base_ref == 'dev' && github.event.pull_request.draft == false - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Ensure checklists are filled - uses: actions/github-script@v4 - with: - script: | - const script = require('.github/actions/checklist.js').check; - await script({context}); - - name: Ensure title update with changes type - uses: actions/github-script@v4 - with: - script: | - const script = require('.github/actions/pr-title.js').update; - await script({ context, github }); - - name: automerge - uses: pascalgn/automerge-action@v0.14.3 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MERGE_LABELS: automerge - MERGE_METHOD: squash - MERGE_COMMIT_MESSAGE: pull-request-title - MERGE_REQUIRED_APPROVALS: 1 - - prod-pr: - if: github.base_ref == 'main' && github.event.pull_request.draft == false - runs-on: ubuntu-latest - steps: - - name: automerge - uses: pascalgn/automerge-action@v0.14.3 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MERGE_LABELS: automerge - MERGE_METHOD: rebase - MERGE_COMMIT_MESSAGE: automatic - MERGE_REQUIRED_APPROVALS: 1 - - diff --git a/.github/workflows/pr-actions.yaml b/.github/workflows/pr-actions.yaml deleted file mode 100644 index a076c3254..000000000 --- a/.github/workflows/pr-actions.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: PR Actions - -on: - pull_request: - branches: - - main - - dev - -env: - CI: true - -jobs: - test: - name: Test Suite - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: "18.x" - cache: 'yarn' - - name: Install NPM Dependencies - run: yarn install - - name: Run Build All - run: yarn build:all - - name: Run Linting - run: yarn lint - - name: Run Unit & Integration Tests - run: yarn test diff --git a/nx.json b/nx.json index be060ad73..a7480d6bf 100644 --- a/nx.json +++ b/nx.json @@ -1,6 +1,6 @@ { "$schema": "./node_modules/nx/schemas/nx-schema.json", - "npmScope": "near-wallet-selector", + "npmScope": "aurora-is-near", "workspaceLayout": { "appsDir": "examples", "libsDir": "packages"