Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/development' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Nov 27, 2024
2 parents fd05248 + 7f63909 commit 0422224
Show file tree
Hide file tree
Showing 24 changed files with 130 additions and 7,664 deletions.
2 changes: 1 addition & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"ignorePaths": ["**/*.json", "**/*.css", "node_modules", "**/*.log", "**/*.http", "**/*.toml", "src/types/database.ts"],
"ignorePaths": ["**/*.json", "**/*.css", "node_modules", "**/*.log", "**/*.http", "**/*.toml", "src/types/database.ts", "dist/**"],
"useGitignore": true,
"language": "en",
"words": ["Nektos", "dataurl", "devpool", "outdir", "servedir", "Supabase", "SUPABASE", "typebox", "ubiquibot", "Smee", "Rpcs", "hono"],
Expand Down
2 changes: 1 addition & 1 deletion .github/knip.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { KnipConfig } from "knip";

const config: KnipConfig = {
entry: ["build/index.ts"],
entry: ["src/main.ts", "src/worker.ts"],
project: ["src/**/*.ts"],
ignore: ["**/__mocks__/**", "**/__fixtures__/**", "src/types/database.ts"],
ignoreExportsUsedInFile: true,
Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/compute.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "command-wallet"
name: "Plugin Compute"

on:
workflow_dispatch:
Expand All @@ -15,17 +15,17 @@ on:
description: "Auth Token"
ref:
description: "Ref"
signature:
description: "Signature tp identify the Kernel"
command:
required: true
description: "Command"

jobs:
compute:
name: "command-wallet"
runs-on: ubuntu-latest
permissions: write-all
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
environment: ${{ github.ref == 'refs/heads/main' && 'main' || 'development' }}

steps:
- uses: actions/checkout@v4
Expand All @@ -35,12 +35,10 @@ jobs:
with:
node-version: "20.10.0"

- name: install dependencies
run: yarn

- name: execute directive
run: npx tsx ./src/main.ts
id: command-wallet
run: node dist/index.js
env:
PLUGIN_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KERNEL_PUBLIC_KEY: ${{ secrets.KERNEL_PUBLIC_KEY }}
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
24 changes: 0 additions & 24 deletions .github/workflows/cspell.yml

This file was deleted.

7 changes: 5 additions & 2 deletions .github/workflows/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ jobs:
with:
node-version: "20.10.0"

- name: Setup Bun
uses: oven-sh/setup-bun@v2

- name: Generate Supabase Types
run: |
yarn install
yarn run "supabase:generate:remote"
bun install --frozen-lockfile
bun run "supabase:generate:remote"
- name: Commit and Push generated types
run: |
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/formatting-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Formatting Check

on:
push:

jobs:
format-check:
name: Check for formatting errors
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2

- name: Install toolchain
run: bun install --frozen-lockfile

- name: Eslint
run: bun run eslint --fix-dry-run

- name: Cspell
run: bun run format:cspell

- name: Prettier
run: bun run prettier --check .
8 changes: 7 additions & 1 deletion .github/workflows/jest-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@ jobs:
with:
fetch-depth: 0

- name: Setup Bun
uses: oven-sh/setup-bun@v2

- name: Install toolchain
run: bun install --frozen-lockfile

- name: Jest With Coverage
run: yarn install --immutable --immutable-cache --check-cache && yarn test
run: bun run test

- name: Add Jest Report to Summary
if: always()
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/knip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ jobs:
with:
node-version: 20.10.0

- name: Setup Bun
uses: oven-sh/setup-bun@v2

- name: Install toolchain
run: yarn install
run: bun install --frozen-lockfile

- name: Store PR number
run: echo ${{ github.event.number }} > pr-number.txt

- name: Run Knip
run: yarn knip || yarn knip --reporter json > knip-results.json
run: bun run knip || bun run knip --reporter json > knip-results.json

- name: Upload knip result
if: failure()
Expand Down
53 changes: 8 additions & 45 deletions .github/workflows/update-configuration.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,21 @@
name: "Update Configuration"
name: Update Manifest and Commit Changes

on:
workflow_dispatch:
push:

jobs:
update:
name: "Update Configuration in manifest.json"
update-manifest:
name: "Update Manifest and Commit Changes"
runs-on: ubuntu-latest
permissions: write-all

steps:
- uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
- name: Update Manifest and Commit Changes
uses: ubiquity-os/action-deploy-plugin@main
with:
node-version: "20.10.0"

- name: Install deps and run configuration update
run: |
yarn install --immutable --immutable-cache --check-cache
yarn tsc --noCheck --project tsconfig.json
- name: Update manifest configuration using GitHub Script
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = require('path');
const { pluginSettingsSchema } = require('./src/types');
const manifestPath = path.resolve("${{ github.workspace }}", './manifest.json');
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
const configuration = JSON.stringify(pluginSettingsSchema);
manifest["configuration"] = JSON.parse(configuration);
const updatedManifest = JSON.stringify(manifest, null, 2)
console.log('Updated manifest:', updatedManifest);
fs.writeFileSync(manifestPath, updatedManifest);
- name: Commit and Push generated types
run: |
git config --global user.name 'ubiquity-os[bot]'
git config --global user.email 'ubiquity-os[bot]@users.noreply.github.com'
git add ./manifest.json
if [ -n "$(git diff-index --cached --name-only HEAD)" ]; then
git commit -m "chore: updated generated configuration" || echo "Lint-staged check failed"
git push origin HEAD:${{ github.ref_name }}
else
echo "No changes to commit"
fi
treatAsEsm: false
sourcemap: false
pluginEntry: ${{ github.workspace }}/src/main.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 9 additions & 1 deletion .github/workflows/worker-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:
deploy-to-cloudflare:
runs-on: ubuntu-latest
name: Automatic Cloudflare Deploy
environment: ${{ github.ref == 'refs/heads/main' && 'main' || 'development' }}

steps:
- name: Setup Node
uses: actions/setup-node@v4
Expand All @@ -19,6 +21,9 @@ jobs:

- uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2

- name: Update wrangler.toml Name Field
run: |
branch_name=$(echo '${{ github.event.ref }}' | sed 's#refs/heads/##' | sed 's#[^a-zA-Z0-9]#-#g')
Expand All @@ -31,23 +36,26 @@ jobs:
# Update the wrangler.toml file
sed -i "s/^name = .*/name = \"$new_name\"/" wrangler.toml
echo "Updated wrangler.toml name to: $new_name"
- name: Deploy with Wrangler
id: wrangler_deploy
uses: cloudflare/wrangler-action@v3
with:
wranglerVersion: "3.79.0"
wranglerVersion: "3.87.0"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
secrets: |
SUPABASE_URL
SUPABASE_KEY
CLOUDFLARE_ACCOUNT_ID
CLOUDFLARE_API_TOKEN
${{ secrets.KERNEL_PUBLIC_KEY && secrets.KERNEL_PUBLIC_KEY != '' && 'KERNEL_PUBLIC_KEY' || '' }}
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
KERNEL_PUBLIC_KEY: ${{ secrets.KERNEL_PUBLIC_KEY }}

- name: Write Deployment URL to Summary
run: |
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
coverage/
16 changes: 6 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,22 @@

## [1.1.0](https://github.com/Meniole/command-wallet/compare/v1.0.0...v1.1.0) (2024-07-16)


### Features

* added test for wallet link ([e059e13](https://github.com/Meniole/command-wallet/commit/e059e1329da781194a4f7a928be17015d2b28962))
* parsing arguments and executing run ([70fb75e](https://github.com/Meniole/command-wallet/commit/70fb75e6e970d6439f5d9ba64ee51caa5edaf269))

- added test for wallet link ([e059e13](https://github.com/Meniole/command-wallet/commit/e059e1329da781194a4f7a928be17015d2b28962))
- parsing arguments and executing run ([70fb75e](https://github.com/Meniole/command-wallet/commit/70fb75e6e970d6439f5d9ba64ee51caa5edaf269))

### Bug Fixes

* fixed crash when user does not exist ([433a6a7](https://github.com/Meniole/command-wallet/commit/433a6a7c3f19b2722df75e7b826bc6b8e0244a1e))
- fixed crash when user does not exist ([433a6a7](https://github.com/Meniole/command-wallet/commit/433a6a7c3f19b2722df75e7b826bc6b8e0244a1e))

## 1.0.0 (2024-07-08)


### Features

* added test for wallet link ([e059e13](https://github.com/ubiquibot/command-wallet/commit/e059e1329da781194a4f7a928be17015d2b28962))
* parsing arguments and executing run ([70fb75e](https://github.com/ubiquibot/command-wallet/commit/70fb75e6e970d6439f5d9ba64ee51caa5edaf269))

- added test for wallet link ([e059e13](https://github.com/ubiquibot/command-wallet/commit/e059e1329da781194a4f7a928be17015d2b28962))
- parsing arguments and executing run ([70fb75e](https://github.com/ubiquibot/command-wallet/commit/70fb75e6e970d6439f5d9ba64ee51caa5edaf269))

### Bug Fixes

* fixed crash when user does not exist ([433a6a7](https://github.com/ubiquibot/command-wallet/commit/433a6a7c3f19b2722df75e7b826bc6b8e0244a1e))
- fixed crash when user does not exist ([433a6a7](https://github.com/ubiquibot/command-wallet/commit/433a6a7c3f19b2722df75e7b826bc6b8e0244a1e))
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Allows users to register their wallets to collect rewards.
1. Install the dependencies preferably using `yarn` or `bun`.
2. Copy `.dev.vars.example` to `.dev.vars` and fill the variables
3. Generate Supabase types by running
```shell
yarn prebuild
```
```shell
yarn prebuild
```
4. Run the project with `yarn wrangler`

## Example configuration
Expand Down
Binary file added bun.lockb
Binary file not shown.
39 changes: 39 additions & 0 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default tsEslint.config({
"@typescript-eslint": tsEslint.plugin,
"check-file": checkFile,
},
ignores: [".github/knip.ts", "src/types/database.ts"],
ignores: [".github/knip.ts", "src/types/database.ts", ".wrangler/**", "dist/**", "coverage/**", "eslint.config.mjs"],
extends: [eslint.configs.recommended, ...tsEslint.configs.recommended, sonarjs.configs.recommended],
languageOptions: {
parser: tsEslint.parser,
Expand Down
11 changes: 3 additions & 8 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"name": "Wallet",
"description": "Allows users to register their wallets to collect rewards.",
"ubiquity:listeners": [
"issue_comment.created"
],
"ubiquity:listeners": ["issue_comment.created"],
"skipBotEvents": true,
"commands": {
"wallet": {
Expand All @@ -27,9 +25,6 @@
"default": false,
"type": "boolean"
}
},
"required": [
"registerWalletWithVerification"
]
}
}
}
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
"supabase": "1.178.2",
"ts-jest": "29.1.5",
"ts-node": "10.9.2",
"tsx": "4.15.6",
"typescript": "5.6.2",
"typescript-eslint": "8.14.0",
"wrangler": "^3.87.0"
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createActionsPlugin } from "@ubiquity-os/plugin-sdk";
import { createAdapters } from "./adapters";
import { SupportedEvents } from "./types/context";
import { Env, envSchema } from "./types/env";
import { PluginSettings, pluginSettingsSchema } from "./types/plugin-inputs";
import { PluginSettings, pluginSettingsSchema } from "./types/plugin-input";
import { Command } from "./types/command";
import { plugin } from "./plugin";
import { LogLevel } from "@ubiquity-os/ubiquity-os-logger";
Expand Down
2 changes: 1 addition & 1 deletion src/types/context.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createAdapters } from "../adapters";
import { Env } from "./env";
import { PluginSettings } from "./plugin-inputs";
import { PluginSettings } from "./plugin-input";
import { Context as PluginContext } from "@ubiquity-os/plugin-sdk";
import { Command } from "./command";

Expand Down
2 changes: 1 addition & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "./context";
export * from "./env";
export * from "./plugin-inputs";
export * from "./plugin-input";
File renamed without changes.
Loading

0 comments on commit 0422224

Please sign in to comment.