Skip to content

Commit

Permalink
fix: resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
rndquu committed Oct 14, 2024
2 parents c8f4209 + dbe772f commit 86e54cd
Show file tree
Hide file tree
Showing 22 changed files with 12,128 additions and 7,376 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"mswjs",
"Numberish",
"outdir",
"outfile",
"pageable",
"Reloadly",
"Rpcs",
Expand Down
149 changes: 149 additions & 0 deletions .github/.ubiquibot-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
plugins:
- uses:
- plugin: https://ubiquibot-command-wallet-development.ubiquity.workers.dev
- uses:
- plugin: https://ubiquibot-command-query-user-development.ubiquity.workers.dev
with:
allowPublicQuery: true
- uses:
- plugin: https://ubiquibot-assistive-pricing-development.ubiquity.workers.dev
with:
labels:
time:
- "Time: <1 Hour"
- "Time: <2 Hours"
- "Time: <4 Hours"
- "Time: <1 Day"
- "Time: <1 Week"
- "Time: <1 Month"
priority:
- "Priority: 1 (Normal)"
- "Priority: 2 (Medium)"
- "Priority: 3 (High)"
- "Priority: 4 (Urgent)"
- "Priority: 5 (Emergency)"
basePriceMultiplier: 2
publicAccessControl:
setLabel: true
fundExternalClosedIssue: false
- skipBotEvents: false
uses:
- plugin: ubiquibot/conversation-rewards@development
# we don't skip bot events so conversation rewards triggered by the bot also run
with:
evmNetworkId: 100
evmPrivateEncrypted: "bd5AFnSCO6c5jJyPifpOfr5Zys29RE7SyXkEU3akT13RtGmYDrqGIGuvJQyH53HA5dIba7PL5bXfll0JebmwXYe5gHIXSGX80WuGMDHh0cFfeGjHhmUXe8kkZ1OT2De9qRpqejJcEzdfi-8XNAvP7cQu2Vt-7RNnPw" # https://github.com/ubiquibot/conversation-rewards/pull/111#issuecomment-2348639931
erc20RewardToken: "0xC6ed4f520f6A4e4DC27273509239b7F8A68d2068"
incentives:
contentEvaluator:
enabled: true
userExtractor:
enabled: true
redeemTask: true
dataPurge:
enabled: true
formattingEvaluator:
multipliers:
- role: [ISSUE_SPECIFICATION]
multiplier: 3
rewards:
regex:
"\\b\\w+\\b": 0.1
html:
br: 0
code: 5
p: 1
em: 0
img: 5
strong: 0
blockquote: 0
h1: 1
h2: 1
h3: 1
h4: 1
h5: 1
h6: 1
a: 5
li: 1
td: 1
hr: 0
- role: [ISSUE_AUTHOR]
multiplier: 1
rewards:
regex:
"\\b\\w+\\b": 0.2
- role: [ISSUE_ASSIGNEE]
multiplier: 1
rewards:
regex:
"\\b\\w+\\b": 0.1
- role: [ISSUE_COLLABORATOR]
multiplier: 1
rewards:
regex:
"\\b\\w+\\b": 0.1
- role: [ISSUE_CONTRIBUTOR]
multiplier: 0.25
rewards:
regex:
"\\b\\w+\\b": 0.1
- role: [PULL_SPECIFICATION]
multiplier: 0
rewards:
regex:
"\\b\\w+\\b": 0
- role: [PULL_AUTHOR]
multiplier: 0
rewards:
regex:
"\\b\\w+\\b": 0.2
- role: [PULL_ASSIGNEE]
multiplier: 1
rewards:
regex:
"\\b\\w+\\b": 0.1
- role: [PULL_COLLABORATOR]
multiplier: 1
rewards:
regex:
"\\b\\w+\\b": 0.1
- role: [PULL_CONTRIBUTOR]
multiplier: 0.25
rewards:
regex:
"\\b\\w+\\b": 0.1
permitGeneration:
enabled: true
githubComment:
post: true
debug: false
- uses:
- plugin: ubiquibot/user-activity-watcher@development
with:
watch:
optOut:
- ubiquibot
- launch-party
- staging
- production
- uses:
- plugin: ubiquibot/automated-merging@development
with:
approvalsRequired:
collaborator: 1
mergeTimeout:
collaborator: "3.5 days"
repos:
ignore:
- ubiquibot
- launch-party
- staging
- production
- uses:
- plugin: https://ubiquibot-command-start-stop-development.ubiquity.workers.dev
with:
reviewDelayTolerance: "3 Days"
taskStaleTimeoutDuration: "30 Days"
startRequiresWallet: true # default is true
- uses:
- plugin: ubiquibot/issue-comment-embeddings@development
70 changes: 70 additions & 0 deletions .github/workflows/sync-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Sync branch to template

on:
workflow_dispatch:
schedule:
- cron: "14 0 1 * *"

jobs:
sync:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get GitHub App token
uses: tibdex/[email protected]
id: get_installation_token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Sync branch to template
env:
GH_TOKEN: ${{ steps.get_installation_token.outputs.token }}
run: |
branch_name=$(git rev-parse --abbrev-ref HEAD)
original_remote=$(git remote get-url origin)
pr_branch="sync-template/${branch_name}"
git config --global user.email "ubiquity-os[bot]@users.noreply.github.com"
git config --global user.name "ubiquity-os[bot]"
git remote add template https://github.com/ubiquity/ts-template.git
git fetch template
git checkout -b "$pr_branch"
last_sync=$(git log --grep="Sync template" --format="%H" -n 1)
if [ -n "$last_sync" ]; then
# If there's a previous sync, try to cherry-pick new changes
if ! git cherry-pick $last_sync..template/main; then
# If cherry-pick fails, abort and try a merge instead
git cherry-pick --abort
git merge template/main --no-commit
fi
else
# If it's the first sync, merge the template
git merge template/main --allow-unrelated-histories --no-commit
fi
# Check if there are any changes
if git diff --staged --quiet && git diff --quiet; then
echo "No changes to sync from template."
exit 0
fi
# Commit changes, even if there are conflicts
git commit -am "chore: sync template (with potential conflicts)" || true
# Push changes and create PR
git push -f "$original_remote" "$pr_branch"
gh pr create --title "Sync branch to template (manual resolution required)" \
--body "This pull request merges changes from the template repository. There may be conflicts that require manual resolution." \
--head "$pr_branch" \
--base "$branch_name" || true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ commit.txt
.pnp.loader.mjs
.env
static/dist
static/bundles

cypress/screenshots
cypress/videos
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,18 @@ A vanilla Typescript dApp for claiming Ubiquity Rewards. It also includes tools
RPC_PROVIDER_URL="http://127.0.0.1:8545"
PAYMENT_TOKEN_ADDRESS="0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d"
# Storing tx data is not required to test locally although you do need to fill these with valid values
# unless working on this feature specifically you won't need to build a supabase instance
SUPABASE_URL=https://<yourSupabaseInstance>.supabase.co # used for storing permit tx data
SUPABASE_ANON_KEY="...." # used for storing permit tx data
# Variables depending on spender (bounty hunter)
AMOUNT_IN_ETH="50"
BENEFICIARY_ADDRESS="0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
# Legacy env vars (only used when invalidating **REAL** permits via /scripts/solidity/getInvalidateNonceParams.ts)
NONCE="0"
NONCE_SIGNER_ADDRESS="0x"
```

3. Update values for wrangler variables to use Reloadly sandbox or production API in the `wrangler.toml` file.
Expand Down
38 changes: 37 additions & 1 deletion build/esbuild-build.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
import { execSync } from "child_process";
import { config } from "dotenv";
import esbuild from "esbuild";
import { appendFileSync, readFileSync, writeFileSync } from "fs";

// CSS files in order
const cssFiles: string[] = [
"static/styles/rewards/background.css",
"static/styles/rewards/claim-table.css",
"static/styles/rewards/gift-cards.css",
"static/styles/rewards/light-mode.css",
"static/styles/rewards/media-queries.css",
"static/styles/rewards/pay.css",
"static/styles/rewards/ubiquity-dollar.css",
"static/styles/proxima.css",
"static/styles/toast.css",
];

// Output bundles file
const outputFilePath = "static/bundles/bundles.css";

const typescriptEntries = ["static/scripts/rewards/init.ts", "static/scripts/ubiquity-dollar/init.ts"];
export const entries = [...typescriptEntries];

Expand All @@ -17,10 +35,28 @@ export const esBuildContext: esbuild.BuildOptions = {
".ttf": "dataurl",
".svg": "dataurl",
},
outdir: "static/out",
outfile: "static/bundles/bundles.js",
entryNames: "bundles", // Ensure the CSS is named bundles.css
define: createEnvDefines(["SUPABASE_URL", "SUPABASE_ANON_KEY"], {
commitHash: execSync(`git rev-parse --short HEAD`).toString().trim(),
}),
plugins: [
{
name: "css-bundle",
setup(build) {
build.onEnd((result) => {
// Clear the file first
writeFileSync(outputFilePath, "", "utf8");

// Concatenate each file into the bundles file
cssFiles.forEach((file) => {
const data = readFileSync(file, "utf8");
appendFileSync(outputFilePath, data, "utf8");
});
});
},
},
],
};

esbuild
Expand Down
14 changes: 6 additions & 8 deletions build/esbuild-server.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import esbuild from "esbuild";
import { esBuildContext } from "./esbuild-build";

(async () => {
await server();
})().catch((error) => {
console.error("Unhandled error:", error);
startServer().catch((error) => {
console.error("Server startup error:", error);
process.exit(1);
});

export async function server() {
const _context = await esbuild.context(esBuildContext);
const { port } = await _context.serve({
async function startServer() {
const context = await esbuild.context(esBuildContext);
const { port } = await context.serve({
servedir: "static",
port: 8080,
});
console.log(`http://localhost:${port}`);
console.log(`Server running at http://localhost:${port}`);
}
7 changes: 3 additions & 4 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { defineConfig } from "cypress";
import { config } from "dotenv";

config();

export default defineConfig({
e2e: {
setupNodeEvents() {},
setupNodeEvents() {
// implement node event listeners here
},
baseUrl: "http://localhost:8080",
experimentalStudio: true,
env: {
Expand Down
10 changes: 10 additions & 0 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"preset": "ts-jest",
"testEnvironment": "node",
"roots": ["./tests"],
"coveragePathIgnorePatterns": ["node_modules", "mocks"],
"collectCoverage": true,
"coverageReporters": ["json", "lcov", "text", "clover", "json-summary"],
"reporters": ["default", "jest-junit", "jest-md-dashboard"],
"coverageDirectory": "coverage"
}
Loading

0 comments on commit 86e54cd

Please sign in to comment.