Skip to content

Commit

Permalink
Merge branch 'main' into add-sepolia
Browse files Browse the repository at this point in the history
  • Loading branch information
bhargavaparoksham authored Feb 13, 2024
2 parents 10dee7c + 0bd1dea commit 99c7eaa
Show file tree
Hide file tree
Showing 401 changed files with 23,497 additions and 9,697 deletions.
41 changes: 13 additions & 28 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,19 @@
<!--
Thank you for your pull request! Please review the requirements below
and ensure your pull request has fulfilled all requirements outlined in the target package.
Before submitting a PR for review, please make sure that all the CI checks are passing.
-->
<!-- Thank you for your pull request! Before marking it as "Ready for review",
please ensure that all items of checklist are satisfied and that CI checks are
passing. -->

## PR checklist
Fixes: #issue

For every PR, make sure that these statements are true:
- [ ] Includes only changes relevant to the original ticket. Significant refactoring needs to be separated.
- [ ] Doesn't contain type casts and non-null assertions.
- [ ] Doesn't add `@ts-ignore`.
- [ ] Doesn't disable lints.
- [ ] Doesn't use `useState` just for computation - use plain variables instead.
- [ ] Splits components into pure components that don't depend on external state or hooks.
- [ ] Avoid embedding components within other components
- [ ] Doesn't propagate optional values without good reason, doesn't mark property values as optional if that doesn't represent reality.
- [ ] Doesn't duplicate existing code.
- [ ] Parses out-of-domain data - this includes user input, API respones, on-chain data etc.
- [ ] Doesn't contain commented out code.
- [ ] Doesn't contain skipped or empty tests.
- [ ] If this PR adds/updates any feature, it adds/updates its test script

Subjective - at the discretion of the reviewers
- Does things as simply as possible, but not simpler.
- Doesn't reinvent the wheel or create premature abstractions.

##### Description
## Description

<!-- Describe your changes here. -->

##### Refers/Fixes
## Checklist

fixes #issuenumber
This PR:

- [ ] Includes only changes relevant to the original ticket. Significant refactoring needs to be separated.
- [ ] Doesn't disable eslint rules.
- [ ] Doesn't work around the type checker (including but not limited to: type casts, non-null assertions, `@ts-ignore`, unjustified optional values).
- [ ] Doesn't contain commented out code.
- [ ] If adding/updating a feature, it adds/updates its test script on Notion.
6 changes: 3 additions & 3 deletions .github/workflows/builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ jobs:
- name: Lint Builder
run: |
pnpm b-lint
pnpm lint:builder
- name: Test Builder
run: |
pnpm b-test
pnpm test:builder
- name: Typecheck Builder
run: |
pnpm b-typecheck
pnpm typecheck:builder
6 changes: 5 additions & 1 deletion .github/workflows/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ jobs:
run: |
pnpm install
- name: Typecheck
run: |
pnpm typecheck:common
- name: Test Common
run: |
pnpm c-test
pnpm test:common
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Data client - Lint & Test & Typecheck
name: Data Layer - Lint & Test & Typecheck
on:
push:
branches:
Expand All @@ -9,7 +9,7 @@ on:
- "**"
jobs:
lint-test-typecheck:
concurrency: ci-data-client-${{ github.head_ref || github.run_id }}
concurrency: ci-data-layer-${{ github.head_ref || github.run_id }}
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -31,15 +31,15 @@ jobs:
pnpm install
# TODO
# - name: Lint Data Client
# - name: Lint Data Layer
# run: |
# pnpm dc-lint
# pnpm lint:data-layer

- name: Test Data Client
- name: Test Data Layer
run: |
pnpm dc-test
pnpm test:data-layer
# TODO
# - name: Typecheck Explorer
# - name: Typecheck Data Layer
# run: |
# pnpm ge-typecheck
# pnpm typecheck:data-layer
6 changes: 3 additions & 3 deletions .github/workflows/grant-explorer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ jobs:
- name: Lint Explorer
run: |
pnpm ge-lint
pnpm lint:explorer
- name: Test Explorer
run: |
pnpm ge-test
pnpm test:explorer
- name: Typecheck Explorer
run: |
pnpm ge-typecheck
pnpm typecheck:explorer
14 changes: 7 additions & 7 deletions .github/workflows/round-manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
branches:
- main
- release
- mrelease
pull_request:
branches:
- "**"
Expand All @@ -30,14 +30,14 @@ jobs:
run: |
pnpm install
- name: Lint Explorer
- name: Lint Round Manager
run: |
pnpm rm-lint
pnpm lint:manager
- name: Test Explorer
- name: Test Round Manager
run: |
pnpm rm-test
pnpm test:manager
- name: Typecheck Explorer
- name: Typecheck Round Manager
run: |
pnpm rm-typecheck
pnpm typecheck:manager
2 changes: 1 addition & 1 deletion .github/workflows/verify-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
- name: Test Verify-Env
run: |
pnpm ve-test
pnpm test:verify-env
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ node_modules
dist/
coverage/
.eslintcache

bun.lockb
tmp
17 changes: 15 additions & 2 deletions docs/DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
Welcome to the Grants Stack development repository!
This repository houses the main three dApps that make up the Grants Stack ecosystem:


* [Builder](https://builder.gitcoin.co/)
* [Explorer](https://explorer.gitcoin.co/#/round/424/0x4473725beb9a9d503547d2fe677f4b5aa39b68f6)
* [Manager](https://manager.gitcoin.co/)

Each of these dapps is a single-page React application, and you can find their respective source code under the `/packages` folder.

If you are importing external libraries, please use the ones already added in the projects, or consider using one of the preferred options from this document: [LIBRARIES.md](./LIBRARIES.md)

While there is no central backend application, all three dApps rely on various external services for data reading and writing. These dependencies include:

Expand All @@ -24,7 +24,6 @@ While there is no central backend application, all three dApps rely on various e
5. **[Pinata](https://www.pinata.cloud/)**: Pinata is used to upload and pin files to IPFS, ensuring the availability of data.



Depending on the configuration in your local `.env` file, you can choose to use these services directly or opt for a local version of them.

For faster development and a more responsive feedback loop, we recommend setting up a local development environment instead of relying on testnets
Expand Down Expand Up @@ -149,6 +148,20 @@ component route

Find more information about routing [here](https://reactrouter.com/docs/en/v6).

## Running E2E tests using Synpress

Synpress is an E2E testing framework for testing dApps. It works by setting up metamask before every run.

### Running Synpress

1. Put `TEST_PRIVATE_KEY` in `.env.local` in the respective directory (e.g. `packages/round-manager`)
2. Start the dev server `pnpm start`
3. Download playwright with `pnpm exec playwright install`
4. Run tests with `pnpm synpress:test`

NOTE: some tests require you to be part of a testing program and have some gas in your wallet. Please use a private key that has some gas on Fantom Testnet and Optimism Mainnet, and is part of the "GS Optimism Program 10 Round" Program on Optimism Mainnet.


## Submitting a PR

Please always submit draft PRs at first, and make sure they pass the following conditions before you mark them as Ready for review.
Expand Down
22 changes: 22 additions & 0 deletions docs/LIBRARIES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Recommended libraries for use within Grants Stack

- data validation: https://github.com/colinhacks/zod
- unit testing: https://vitest.dev/
- client-side data fetching: https://swr.vercel.app/
- server-side fetch: https://github.com/npm/make-fetch-happen
- server-side sqlite3: https://github.com/WiseLibs/better-sqlite3
- sql querying: https://kysely.dev/
- server-side logging: https://github.com/pinojs/pino
- git hook management: https://github.com/evilmartians/lefthook/
- nodejs execution in dev: https://github.com/esbuild-kit/tsx
- nextjs - https://github.com/vercel/next.js
- tailwind-variants - https://github.com/nextui-org/tailwind-variants
- made a utility function Component utility for polymorphic components nextui-org/tailwind-variants#112
- merge classNames and easy to apply conditional classes
- msw - https://github.com/mswjs/msw
- react-use - https://github.com/streamich/react-use
- Lot's of great utility hooks
- My favorite starter:
- create t3 app https://github.com/t3-oss/create-t3-app includes next, tailwind, trpc, zod
- Linting and formatting: BiomeJS (formerly Rome.tools)
- UI library for stuff like loading skeletons, dropdowns etc.: Chakra UI
19 changes: 9 additions & 10 deletions lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,37 @@ pre-commit:
run: pnpm format {staged_files}
stage_fixed: true

lint-ge:
lint-builder:
root: "packages/builder"
glob: "**/*.{js,ts,jsx,tsx}"
run: pnpm --filter "builder" lint:local {staged_files}
stage_fixed: true

lint-rm:
lint-manager:
root: "packages/round-manager"
glob: "**/*.{js,ts,jsx,tsx}"
run: pnpm --filter "round-manager" lint:local {staged_files}
stage_fixed: true

lint-builder:
lint-explorer:
root: "packages/grant-explorer"
glob: "**/*.{js,ts,jsx,tsx}"
run: pnpm --filter "grant-explorer" lint:local {staged_files}
stage_fixed: true

lint-data-client:
root: "packages/grants-stack-data-client"
lint-data-layer:
root: "packages/data-layer"
glob: "**/*.{js,ts,jsx,tsx}"
# TODO: harmonize command name with others
run: pnpm --filter "grants-stack-data-client" lint {staged_files}
run: pnpm --filter "data-layer" lint {staged_files}
stage_fixed: true


pre-push:
parallel: true
commands:
typecheck:
run: turbo run typecheck
run: pnpm turbo run typecheck
build:
run: turbo run build
run: pnpm turbo run build
test:
run: turbo run test --concurrency=50%
run: pnpm turbo run test --concurrency=50%
48 changes: 23 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,37 @@
"test": "pnpm turbo run test --no-cache --concurrency=50%",
"typecheck": "turbo run typecheck",
"format": "prettier --write",
"// round manager script": "====== packages/round-manager specific ======",
"rm-build": "pnpm --filter round-manager run build",
"rm-test": "turbo run test --filter=round-manager",
"rm-start": "pnpm --filter round-manager run start",
"rm-lint": "turbo run lint:ci --filter=round-manager",
"rm-typecheck": "turbo run typecheck --filter=round-manager",
"// grant explorer script": "====== packages/grant-explorer specific ======",
"ge-build": "turbo run build --filter=grant-explorer",
"ge-test": "turbo run test --filter=grant-explorer",
"ge-start": "pnpm --filter grant-explorer run start",
"ge-typecheck": "turbo run typecheck --filter=grant-explorer",
"ge-lint": "turbo run lint:ci --filter=grant-explorer",
"// builder script": "====== packages/builder specific ======",
"b-start": "pnpm --filter builder run start",
"b-lint": "turbo run lint:ci --filter=builder",
"b-test": "pnpm test --filter=builder",
"b-typecheck": "turbo run typecheck --filter=builder",
"c-test": "turbo run test --filter=common",
"ve-test": "turbo run test --filter=verify-env",
"// data client script": "====== packages/builder specific ======",
"dc-test": "turbo run test --filter=grants-stack-data-client"
"build:manager": "pnpm --filter round-manager run build",
"test:manager": "turbo run test --filter=round-manager",
"start:manager": "pnpm --filter round-manager run start",
"lint:manager": "turbo run lint:ci --filter=round-manager",
"typecheck:manager": "turbo run typecheck --filter=round-manager",
"build:explorer": "turbo run build --filter=grant-explorer",
"test:explorer": "turbo run test --filter=grant-explorer",
"start:explorer": "pnpm --filter grant-explorer run start",
"typecheck:explorer": "turbo run typecheck --filter=grant-explorer",
"lint:explorer": "turbo run lint:ci --filter=grant-explorer",
"start:builder": "pnpm --filter builder run start",
"lint:builder": "turbo run lint:ci --filter=builder",
"test:builder": "pnpm test --filter=builder",
"typecheck:builder": "turbo run typecheck --filter=builder",
"test:common": "turbo run test --filter=common",
"typecheck:common": "turbo run typecheck --filter=common",
"test:verify-env": "turbo run test --filter=verify-env",
"test:data-layer": "turbo run test --filter=data-layer"
},
"devDependencies": {
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0"
"@commitlint/config-conventional": "^17.7.0",
"turbo": "^1.12.2"
},
"dependencies": {
"prettier": "^3.0.3",
"turbo": "^1.10.15"
"prettier": "^3.0.3"
},
"pnpm": {
"overrides": {
"webpack": "^5"
}
}
},
"workspaces": ["packages/*"]
}
Loading

0 comments on commit 99c7eaa

Please sign in to comment.