refactor: rename packages and change monorepo structure (#322)

* rename and move packages to `pkgs` folder

* pin typescript version to 5.1.6

see typescript eslint warning

WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.

You may find that it works just fine, or you may not.
SUPPORTED TYPESCRIPT VERSIONS: >=3.3.1 <5.2.0
YOUR TYPESCRIPT VERSION: 5.2.2

* fix tsconfig extends relative paths

* update readme

* fix jest preset
This commit is contained in:
sripwoud
2024-01-31 22:42:01 +01:00
committed by GitHub
parent 8fe07628e3
commit 2de1427d70
118 changed files with 443 additions and 397 deletions

View File

@@ -1,8 +1,8 @@
{
"directory": [
"@anonklub/query/src/requests",
"discord-bot/src/lib",
"discord-bot/src/lib/decorators",
"pkgs/query/src/requests",
"query-api/src/api/controllers/requests",
"query-api/src/api/services",
"query-api/src/api/repositories",

View File

@@ -20,3 +20,9 @@ next-env.d.ts
next.config.js
public
.turbo
cache
queries
target

View File

@@ -2,17 +2,17 @@ extends: ['@sripwoud/eslint-config-with-jest']
parserOptions:
project:
[
'@anonklub/proof/tsconfig.json',
'@anonklub/cli/tsconfig.json',
'@anonklub/query/tsconfig.json',
'circuits/circom/tsconfig.json',
'circom/tsconfig.json',
'discord-bot/tsconfig.json',
'test/tsconfig.json',
'pkgs/cli/tsconfig.json',
'pkgs/merkle-tree-worker/tsconfig.json',
'pkgs/proof/tsconfig.json',
'pkgs/query/tsconfig.json',
'pkgs/spartan-ecdsa-worker/tsconfig.json',
'query-api/tsconfig.json',
'test/tsconfig.json',
'ui/tsconfig.json',
'tsconfig.json',
'workers/merkle-tree-worker/tsconfig.json',
'workers/spartan-ecdsa-worker/tsconfig.json',
]
rules:
@@ -31,14 +31,14 @@ overrides:
- files: ['test/jest-preset.js']
rules:
'@typescript-eslint/no-var-requires': off
- files: ['@anonklub/proof/test/ProofRequest.test.ts']
- files: ['pkgs/proof/test/ProofRequest.test.ts']
rules:
'@typescript-eslint/dot-notation': off
- files:
[
'@anonklub/cli/src/cli/index.ts',
'@anonklub/proof/src/ProofRequest/index.ts',
'@anonklub/proof/test/ProofRequest.test.ts',
'pkgs/cli/src/cli/index.ts',
'pkgs/proof/src/ProofRequest/index.ts',
'pkgs/proof/test/ProofRequest.test.ts',
]
rules:
'@typescript-eslint/restrict-template-expressions': off
@@ -55,9 +55,9 @@ overrides:
[error, { checksVoidReturn: { attributes: false } }]
- files:
[
'circuits/circom/scripts/*.ts',
'@anonklub/cli/src/index.ts',
'@anonklub/cli/src/Cli/index.ts',
'pkgs/cli/src/index.ts',
'pkgs/cli/src/Cli/index.ts',
'circom/scripts/*.ts',
'query- api/src/index.ts',
'ui/src/lib/config.ts',
]
@@ -74,15 +74,9 @@ overrides:
rules:
'@typescript-eslint/ban-ts-comment': 'off'
- files:
[
'query-api/test/unit/*Controller.test.ts',
'circuits/circom/test/circuit.test.ts',
]
['circom/test/circuit.test.ts', 'query-api/test/unit/*Controller.test.ts']
rules:
jest/expect-expect: 'off'
- files: ['shared/src/index.ts']
rules:
'sort/exports': 'off'
- files: ['@anonklub/cli/src/Prompt/index.ts']
- files: ['pkgs/cli/src/Prompt/index.ts']
rules:
'@typescript-eslint/naming-convention': off

View File

@@ -5,7 +5,7 @@ on:
branches: ['main']
paths:
[
'@anonklub/**',
'pkgs/**',
'circuits/spartan/**',
'merkle-tree-wasm/**',
'!**/*.md',

View File

@@ -7,7 +7,7 @@ on:
branches: [main, staging]
paths:
[
'@anonklub/**/*.{json,ts}',
'pkgs/**/*.{json,ts}',
'contracts/**/*.sol',
'query-api/**/*.{js,json,ts,graphql}',
'test/**/*.{js,ts}',
@@ -18,7 +18,7 @@ on:
branches: [main, staging]
paths:
[
'@anonklub/**/*.{json,ts}',
'pkgs/**/*.{json,ts}',
'contracts/**/*.sol',
'test/**/*.{js,ts}',
'query-api/**/*.{js,json,ts,graphql}',
@@ -70,7 +70,7 @@ jobs:
run: pnpm compile.wasm
- name: Install node deps
run: pnpm --filter=!@anonklub/infra i --ignore-scripts
run: pnpm i --ignore-scripts
- name: Run tests
env:

View File

@@ -2,7 +2,7 @@ import type { KnipConfig } from 'knip'
const config: KnipConfig = {
ignore: [
'circuits/circom/generated/**',
'circom/generated/**',
'contracts/lib/openzeppelin-contracts/**',
'discord-bot/src/lib/logger.ts',
'query-api/src/api/controllers/AnonymitySet.ts',

View File

@@ -27,4 +27,3 @@ contracts/out
package.json
target
wasm-pkg

6
Cargo.lock generated
View File

@@ -1904,7 +1904,7 @@ dependencies = [
[[package]]
name = "merkle-tree-wasm"
version = "0.1.0"
version = "1.0.0"
dependencies = [
"ark-ff",
"ark-secp256k1",
@@ -3028,8 +3028,8 @@ dependencies = [
]
[[package]]
name = "spartan"
version = "0.1.0"
name = "spartan-ecdsa-wasm"
version = "1.0.0"
dependencies = [
"ark-ec",
"ark-ff",

View File

@@ -3,8 +3,8 @@
resolver = "2"
members = [
"merkle-tree-wasm",
"circuits/spartan"
"pkgs/merkle-tree-wasm",
"pkgs/spartan-ecdsa-wasm"
]
[profile.release]

View File

@@ -57,21 +57,21 @@
</a>
</p>
| Content | Description | Status | Live Version |
| ------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [circuits/circom](circuits/circom) | Circom circuits | :heavy_check_mark: | |
| [circuits/spartan](circuits/spartan) | Spartan/Sapir circuits & corresponding wasm TS package. | :heavy_check_mark: | |
| [contracts](contracts) | Solidity contracts | :heavy_check_mark: | [Groth16Verifier](https://sepolia.etherscan.io/address/0x893f293e3918a179bf87fb772206e9927db61b0c#code) [AnonMinter](https://sepolia.etherscan.io/address/0xcc639e338f9fb382d76f30928559cf14943600e0#code) |
| [discord-bot](discord-bot) | Discord Verification Bot | :hourglass_flowing_sand: IN PROGRESS | [anonklub-discord-bot.fly.dev](https://anonklub-discord-bot.fly.dev) |
| [merkle-tree-wasm](merkle-tree-wasm) | Merkle tree Rust crate & corresponding wasm TS package | :heavy_check_mark: | |
|nullifier| | :calendar: TO DO
| [queries/crypto_ethereum](queries/crypto_ethereum) | Google [`bigquery-public-data.crypto_ethereum`](https://console.cloud.google.com/marketplace/product/ethereum/crypto-ethereum-blockchain) queries examples | :heavy_check_mark: | |
| [queries/dune_analytics](queries/dune_analytics) | [Dune Analytics](https://dune.com/) queries examples | :heavy_check_mark: | |
| [queries/the_graph](queries/the_graph) | [The Graph](https://thegraph.com/en/) queries examples | :heavy_check_mark: | |
| [query-api](query-api) | Query API server | :heavy_check_mark: | [anonset.fly.dev](https://anonset.fly.dev) |
| [ui](ui) | User Interface (fetch anonymity sets, generate or verify membership proofs) | :heavy_check_mark: | [anonklub.fly.dev](https://anonklub.fly.dev) |
| [workers/merkle-tree-worker](workers/merkle-tree-worker) | Web worker wrapper of the [@anonklub/merkle-tree-wasm](merkle-tree-wasm/Cargo.toml) wasm package | :heavy_check_mark: | |
| [workers/spartan-ecdsa-worker](workers/spartan-ecdsa-worker) | Web worker wrapper of the [@anonklub/spartan](circuits/spartan/Cargo.toml) wasm package | :heavy_check_mark: | |
| Content | Description | Status | Live Version |
| ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [circom](circom) | Circom circuits | :heavy_check_mark: | |
| [discord-bot](discord-bot) | Discord Verification Bot | :hourglass_flowing_sand: IN PROGRESS | [anonklub-discord-bot.fly.dev](https://anonklub-discord-bot.fly.dev) |
| [contracts](contracts) | Solidity contracts | :heavy_check_mark: | [Groth16Verifier](https://sepolia.etherscan.io/address/0x893f293e3918a179bf87fb772206e9927db61b0c#code) [AnonMinter](https://sepolia.etherscan.io/address/0xcc639e338f9fb382d76f30928559cf14943600e0#code) |
| nullifier | | :calendar: TO DO |
| [pkgs/merkle-tree-wasm](pkgs/merkle-tree-wasm) | Merkle tree Rust crate & corresponding wasm TS package | :heavy_check_mark: | |
| [pkgs/merkle-tree-worker](pkgs/merkle-tree-worker) | Web worker wrapper of the [@anonklub/merkle-tree-wasm](merkle-tree-wasm/Cargo.toml) wasm package | :heavy_check_mark: | |
| [pkgs/spartan-ecdsa-wasm](pkgs/spartan-ecdsa-wasm) | Spartan/Sapir circuits & corresponding wasm TS package. | :heavy_check_mark: | |
| [pkgs/spartan-ecdsa-worker](pkgs/spartan-ecdsa-worker) | Web worker wrapper of the [@anonklub/spartan](circuits/spartan/Cargo.toml) wasm package | :heavy_check_mark: | |
| [queries/crypto_ethereum](queries/crypto_ethereum) | Google [`bigquery-public-data.crypto_ethereum`](https://console.cloud.google.com/marketplace/product/ethereum/crypto-ethereum-blockchain) queries examples | :heavy_check_mark: | |
| [queries/dune_analytics](queries/dune_analytics) | [Dune Analytics](https://dune.com/) queries examples | :heavy_check_mark: | |
| [queries/the_graph](queries/the_graph) | [The Graph](https://thegraph.com/en/) queries examples | :heavy_check_mark: | |
| [query-api](query-api) | Query API server | :heavy_check_mark: | [anonset.fly.dev](https://anonset.fly.dev) |
| [ui](ui) | User Interface (fetch anonymity sets, generate or verify membership proofs) | :heavy_check_mark: | [anonklub.fly.dev](https://anonklub.fly.dev) |
## Environment

View File

@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../tsconfig.json",
"compilerOptions": {
"lib": ["es2020"],

View File

@@ -31,24 +31,22 @@
"tsconfig-paths": "^4.2.0",
"ttab": "^0.8.0",
"turbo": "^1.10.16",
"typescript": "^5.0.4"
"typescript": "5.1.6"
},
"scripts": {
"pnpm:devPreinstall": "bash -c '[[ ! -f merkle-tree-wasm/wasm-pkg/package.json && ! -f circuits/spartan/wasm-pkg/package.json ]]' && pnpm compile.wasm || return 0",
"compile.wasm": "pnpm --filter @anonklub/merkle-tree compile && pnpm --filter @anonklub/spartan-ecdsa compile",
"pnpm:devPreinstall": "bash -c '[[ ! -f pkgs/merkle-tree-wasm/dist/package.json && ! -f pkgs/spartan-ecdsa-wasm/dist/package.json ]]' && pnpm compile.wasm || return 0",
"compile.wasm": "pnpm --filter merkle-tree-wasm compile && pnpm --filter spartan-ecdsa-wasm compile",
"compile": "turbo run compile",
"build": "pnpm run compile && turbo run build",
"build.docker.discord": "docker build -f discord-bot/Dockerfile . -t discord-bot",
"build.docker.query": "docker build -f query-api/Dockerfile . -t query-api",
"build.docker.ui": "docker build -f ui/Dockerfile . -t anonklub-ui",
"compile-wasm": "pnpm run compile-merkle-wasm && pnpm run compile-spartan-wasm",
"compile-merkle-wasm": "pnpm --filter @anonklub/merkle-tree compile",
"compile-spartan-wasm": "pnpm --filter @anonklub/spartan-ecdsa compile",
"compile-merkle-wasm": "pnpm --filter pkgs/merkle-tree compile",
"compile-spartan-wasm": "pnpm --filter pkgs/spartan-ecdsa compile",
"barrels": "barrelsby --config .barrelsby.json",
"clean": "find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +",
"clean": "find . \\( -name 'node_modules' -o -name 'dist' -o -name 'next' \\) -type d -prune -exec rm -rf '{}' +",
"start.query-api": "pnpm --filter query-api start.dev",
"pre.demo": "ttab -w 'pnpm run start.prove-api'",
"demo": "pnpm run pre.demo && sleep 5 && pnpm run --filter @anonklub/demo start",
"fix": "turbo _format.fix _lint.fix",
"_format": "prettier -c .",
"format": "turbo run _format",
@@ -59,7 +57,7 @@
"lint": "turbo run _lint",
"_lint.fix": "eslint . --ext .js,.ts,.tsx --fix",
"lint.fix": "turbo run _lint.fix",
"publish-packages": "turbo --filter='./@anonklub/*' build && changeset version && changeset publish",
"publish-packages": "turbo --filter='./pkgs/*' build && changeset version && changeset publish",
"test.watch": "jest --watch",
"_test": "jest",
"test": "turbo run _test",
@@ -67,15 +65,12 @@
"validate": "turbo run _format _lint build --cache-dir=.turbo"
},
"workspaces": [
"@anonklub/*",
"contracts",
"circuits/**",
"circom",
"discord-bot",
"merkle-tree-wasm",
"merkle-tree-wasm/wasm-pkg",
"pkgs/*",
"query-api",
"test",
"ui",
"workers/*"
"ui"
]
}

View File

@@ -1,9 +1,9 @@
{
"name": "@anonklub/merkle-tree",
"name": "merkle-tree-wasm",
"main": "index.js",
"scripts": {
"check-wasm-pack": "command -v wasm-pack >/dev/null 2>&1 || echo \"wasm-pack is not installed\"\n",
"compile": "pnpm run check-wasm-pack && wasm-pack build . --target bundler --out-dir wasm-pkg --out-name index --scope anonklub"
"compile": "pnpm run check-wasm-pack && wasm-pack build . --target bundler --out-dir dist --out-name index --scope anonklub"
},
"private": true
}

View File

@@ -7,7 +7,7 @@
"strictPropertyInitialization": false,
"lib": ["webWorker", "DOM"],
"paths": {
"@anonklub/merkle-tree-wasm": ["../../merkle_tree_wasm/wasm-pkg"]
"@anonklub/merkle-tree-wasm": ["../merkle_tree_wasm/dist"]
}
},
"include": ["src"]

Some files were not shown because too many files have changed in this diff Show More