Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
36 changes: 30 additions & 6 deletions .rev-dep.config.jsonc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://github.com/jayu/rev-dep/blob/master/config-schema/1.7.schema.json?raw=true",
"configVersion": "1.7",
"configVersion": "1.10",
"$schema": "https://raw.githubusercontent.com/jayu/rev-dep/master/config-schema/1.10.schema.json",
"rules": [
{
"path": "packages/widget",
Expand All @@ -18,13 +18,36 @@
],
"devEntryPoints": [
"scripts/generate-effect-openapi.ts",
"tests/utils/setup.ts",
"tests/utils/setup.browser.ts",
"tests/utils/setup.dom.ts",
"tests/**/*.test.ts",
"tests/**/*.test.tsx"
],
"orphanFilesDetection": {
"enabled": true
},
"orphanFilesDetection": [
{
"enabled": true
},
{
// check for runtime files that are only reachable from tests
"enabled": true,
"validEntryPoints": [
"src/index.package.ts",
"src/index.bundle.ts",
"src/main.tsx",
"src/translation/i18next.d.ts",
"src/types/purify-extend.d.ts",
"src/types/window.d.ts",
"src/vite-env.d.ts",
"postcss.config.js",
"public/mockServiceWorker.js",
"vite/*.ts",
"scripts/generate-effect-openapi.ts",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"graphExclude": ["tests/**/*.ts", "tests/**/*.tsx"]
}
],
"unusedExportsDetection": {
"enabled": true,
"ignoreFiles": ["src/types/yield-api-schema.d.ts"]
Expand All @@ -35,6 +58,7 @@
"@effect/openapi-generator",
"@effect/platform-node",
"babel-plugin-react-compiler",
"jsdom",
"playwright",
"postcss",
"swagger2openapi",
Expand Down
9 changes: 7 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
- `packages/widget/src/hooks/*` — feature and API hooks.
- `packages/widget/src/domain/*` — shared domain types/helpers.
- `packages/widget/src/translation/*` — i18n resources (`English`, `French`).
- `packages/widget/tests/*` — Vitest browser tests (MSW-backed).
- `packages/widget/tests/*` — Vitest Node and browser tests; browser tests use the `.browser.test.*` suffix and MSW.
- `packages/examples/*` — integration examples (`with-vite`, `with-vite-bundled`, `with-nextjs`, `with-cdn-script`).

## Commands Agents Should Use
Expand All @@ -30,6 +30,11 @@

### Focused widget commands (recommended for most tasks)
- `pnpm --filter @stakekit/widget {command}`
- `pnpm --filter @stakekit/widget test:unit` — run the fast Node test project.
- `pnpm --filter @stakekit/widget test:dom` — run React/DOM tests in jsdom.
- `pnpm --filter @stakekit/widget test:browser` — run the Chromium test project.
- `pnpm --filter @stakekit/widget test:changed` — run affected Node + jsdom tests.
- `pnpm --filter @stakekit/widget test:changed:all` — run all affected projects, including Chromium.

## Agent Working Guidelines (short)
- Keep public API compatibility in `src/index.package.ts` and `src/index.bundle.ts`.
Expand All @@ -44,7 +49,7 @@
- React Query defaults are in `packages/widget/src/providers/query-client/index.tsx`.
- App-level config/env mapping is in `packages/widget/src/config/index.ts`.
- Test bootstrapping + MSW worker setup:
- `packages/widget/tests/utils/setup.ts`
- `packages/widget/tests/utils/setup.browser.ts`
- `packages/widget/tests/mocks/worker.ts`

## Vendored Repositories
Expand Down
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- fix ast linting
1 change: 1 addition & 0 deletions amplify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ frontend:
- echo "VITE_YIELDS_API_URL=$VITE_YIELDS_API_URL" >> packages/widget/.env
- echo "VITE_API_URL=$VITE_API_URL" >> packages/widget/.env
- echo "VITE_API_KEY=$VITE_API_KEY" >> packages/widget/.env
- echo "VITE_FORCE_BORROW=$VITE_FORCE_BORROW" >> packages/widget/.env

build:
commands:
Expand Down
61 changes: 59 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"!**/region-iso-3166-codes.ts",
"!**/mockServiceWorker.js",
"!**/package.json",
"!**/repos"
"!**/@repos"
]
},
"formatter": {
Expand All @@ -35,8 +35,19 @@
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"preset": "recommended",
"style": {
"noRestrictedImports": {
"level": "error",
"options": {
"patterns": [
{
"group": ["**/generated/api/**"],
"message": "Generated API modules are internal. Import the Effect API service or an application-owned domain schema/model instead."
}
]
}
},
"noNonNullAssertion": "off",
"noParameterAssign": "error",
"useAsConstAssertion": "error",
Expand Down Expand Up @@ -78,6 +89,52 @@
"trailingCommas": "es5"
}
},
"overrides": [
{
"includes": [
"packages/widget/src/providers/api/api-service.ts",
"packages/widget/src/providers/api/borrow-api-service.ts",
"packages/widget/src/providers/api/legacy-api-service.ts",
"packages/widget/src/providers/api/yield-api-service.ts",
"packages/widget/tests/generated/**/*.ts",
"packages/widget/scripts/**/*.ts"
],
"linter": {
"rules": {
"style": {
"noRestrictedImports": "off"
}
}
}
},
{
"includes": [
"packages/widget/src/domain/schema/**/*.ts",
"packages/widget/src/borrow/domain/**/*.ts"
],
"linter": {
"rules": {
"style": {
"noRestrictedImports": {
"level": "error",
"options": {
"patterns": [
{
"group": [
"**/generated/api/legacy",
"**/generated/api/yield",
"**/generated/api/borrow-client"
],
"message": "Generated runtime API clients are private to the application API transport implementation. Domain modules may import generated schema artifacts only."
}
]
}
}
}
}
}
}
],
"html": {
"formatter": {
"enabled": true,
Expand Down
2 changes: 1 addition & 1 deletion mise.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mise.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[tools]
node = "24.15.0"
"npm:npm" = "11.14.1"
"npm:pnpm" = "10.33.2"
"npm:pnpm" = "11.10.0"
21 changes: 14 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,35 @@
],
"author": "Petar Todorovic <petar@omni.app> (https://github.com)",
"license": "MIT",
"devEngines": {
"packageManager": {
"name": "pnpm",
"version": "11.10.0"
}
},
"scripts": {
"build": "turbo run build",
"lint": "turbo run lint",
"lint:ast": "ast-grep scan --off=no-react-memoization --error=no-suppress-all --error=unused-suppression packages/widget",
"test:ast": "ast-grep test --skip-snapshot-tests",
"test": "turbo run test",
"format": "turbo run format",
"clean": "turbo run clean",
"prepare": "husky",
"check-hygiene": "rev-dep config run --list-all-issues",
"check-hygiene": "pnpm run check-hygiene:rev-dep && pnpm run check-hygiene:test-only-exports",
"check-hygiene:rev-dep": "rev-dep config run --list-all-issues",
"check-hygiene:test-only-exports": "tsx scripts/check-test-only-exports.ts",
"check": "turbo run lint && pnpm run check-hygiene && turbo run test && turbo run build"
},
"devDependencies": {
"@ast-grep/cli": "catalog:",
"@biomejs/biome": "catalog:",
"@commitlint/cli": "catalog:",
"@commitlint/config-conventional": "catalog:",
"husky": "catalog:",
"knip": "catalog:",
"rev-dep": "catalog:",
"tsx": "catalog:",
"turbo": "catalog:"
},
"pnpm": {
"patchedDependencies": {
"purify-ts": "patches/purify-ts.patch",
"@stakekit/rainbowkit@2.2.11": "patches/@stakekit__rainbowkit@2.2.11.patch"
}
}
}
1 change: 1 addition & 0 deletions packages/examples/with-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@types/node": "catalog:",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"@typescript/native": "catalog:",
"typescript": "catalog:"
}
}
2 changes: 1 addition & 1 deletion packages/examples/with-vite-bundled/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@stakekit/widget": "workspace:*"
},
"devDependencies": {
"typescript": "catalog:",
"@typescript/native": "catalog:",
"vite": "catalog:"
}
}
2 changes: 1 addition & 1 deletion packages/examples/with-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"devDependencies": {
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"typescript": "catalog:",
"@typescript/native": "catalog:",
"vite": "catalog:",
"@vitejs/plugin-react": "catalog:"
}
Expand Down
3 changes: 2 additions & 1 deletion packages/widget/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ VITE_FORCE_WALLET_CONNECT_ONLY=false
VITE_ENABLE_MSW_MOCK=true
VITE_SHOW_QUERY_DEVTOOLS=true
VITE_FORCE_ADDRESS=
VITE_FORCE_BORROW=
VITE_FORCE_DASHBOARD=
VITE_APP_VARIANT=
VITE_APP_VARIANT=
23 changes: 14 additions & 9 deletions packages/widget/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@
"start": "pnpm dev",
"build": "pnpm lint && pnpm clean && pnpm build:package && pnpm build:bundle && pnpm build:website && pnpm build:types",
"lint": "biome check . && tsc",
"test": "vitest -c vite/vite.config.dev.ts --retry 2 run",
"test": "vitest -c vite/vitest.config.ts run",
"test:unit": "vitest -c vite/vitest.config.ts --project unit run",
"test:unit:watch": "vitest -c vite/vitest.config.ts --project unit",
"test:dom": "vitest -c vite/vitest.config.ts --project dom run",
"test:dom:watch": "vitest -c vite/vitest.config.ts --project dom",
"test:browser": "vitest -c vite/vitest.config.ts --project browser run",
"test:changed": "vitest -c vite/vitest.config.ts run --project unit --project dom --changed",
"test:changed:all": "vitest -c vite/vitest.config.ts run --changed",
"test:changed:unit": "vitest -c vite/vitest.config.ts run --project unit --changed",
"format": "biome check --write . --unsafe",
"build:website": "vite -c vite/vite.config.website build",
"build:package": "vite -c vite/vite.config.package.ts build",
Expand All @@ -54,7 +62,7 @@
"build:types": "tsc --project tsconfig.build.json",
"clean": "rm -rf dist",
"preview": "vite -c vite/vite.config.dev.ts preview --outDir dist/website",
"gen:api": "tsx scripts/generate-effect-openapi.ts"
"gen:api": "node --import tsx scripts/generate-effect-openapi.ts"
},
"peerDependencies": {
"react": ">=18",
Expand All @@ -75,7 +83,9 @@
"@cosmos-kit/keplr": "catalog:",
"@cosmos-kit/leap": "catalog:",
"@cosmos-kit/walletconnect": "catalog:",
"@effect/atom-react": "catalog:",
"@effect/openapi-generator": "catalog:",
"@effect/platform-browser": "catalog:",
"@effect/platform-node": "catalog:",
"@faker-js/faker": "catalog:",
"@ledgerhq/wallet-api-client": "catalog:",
Expand Down Expand Up @@ -109,15 +119,14 @@
"@types/lodash.uniqwith": "catalog:",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"@typescript/native": "catalog:",
"@vanilla-extract/css": "catalog:",
"@vanilla-extract/dynamic": "catalog:",
"@vanilla-extract/recipes": "catalog:",
"@vanilla-extract/sprinkles": "catalog:",
"@vanilla-extract/vite-plugin": "catalog:",
"@vitejs/plugin-react": "catalog:",
"@vitest/browser-playwright": "catalog:",
"@xstate/react": "catalog:",
"@xstate/store": "catalog:",
"autoprefixer": "catalog:",
"babel-plugin-react-compiler": "catalog:",
"bignumber.js": "catalog:",
Expand All @@ -129,6 +138,7 @@
"eventemitter3": "catalog:",
"i18next": "catalog:",
"i18next-browser-languagedetector": "catalog:",
"jsdom": "catalog:",
"lodash.merge": "catalog:",
"lodash.uniqwith": "catalog:",
"mipd": "catalog:",
Expand All @@ -137,25 +147,20 @@
"msw": "catalog:",
"playwright": "catalog:",
"postcss": "catalog:",
"purify-ts": "catalog:",
"react": "catalog:",
"react-dom": "catalog:",
"react-i18next": "catalog:",
"react-loading-skeleton": "catalog:",
"react-router": "catalog:",
"reselect": "catalog:",
"rxjs": "catalog:",
"swagger2openapi": "catalog:",
"tsx": "catalog:",
"typescript": "catalog:",
"unplugin-macros": "catalog:",
"viem": "catalog:",
"vite": "catalog:",
"vite-plugin-node-polyfills": "catalog:",
"vitest": "catalog:",
"vitest-browser-react": "catalog:",
"wagmi": "catalog:",
"xstate": "catalog:",
"yaml": "catalog:",
"recharts": "catalog:"
},
Expand Down
Loading
Loading