Skip to content

Commit

Permalink
chore: migrate to turbo repo to avoid nx issues
Browse files Browse the repository at this point in the history
  • Loading branch information
moldy530 committed Nov 11, 2024
1 parent 16c51ae commit bc6ef43
Show file tree
Hide file tree
Showing 17 changed files with 753 additions and 362 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ site/.vitepress/cache/**/*

/examples/*
!/examples/ui-demo
/examples/ui-demo/.next/*
/examples/ui-demo/.next/*

**/.turbo/*
13 changes: 1 addition & 12 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,4 @@ runs:

- name: Install dependencies
run: yarn install --frozen-lockfile
shell: bash

- name: Cache Nx and Node modules
id: cache-nx
uses: actions/cache@v3
with:
path: |
.nx
node_modules/.cache/nx
key: ${{ runner.os }}-nx-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-nx-
shell: bash
4 changes: 4 additions & 0 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.ALCHEMY_BOT_PAT }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -55,6 +57,8 @@ jobs:
runs-on: ubuntu-latest
env:
API_KEY: ${{ secrets.API_KEY }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
steps:
- uses: actions/checkout@v3
with:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ site/**/*.js
vocs.config.tsx.timestamp-*.mjs

bin
**/.turbo

# Turborepo
.turbo
2 changes: 1 addition & 1 deletion examples/embedded-accounts-quickstart
3 changes: 3 additions & 0 deletions examples/ui-demo/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const nextConfig = {
},
],
},
eslint: {
ignoreDuringBuilds: true,
},
webpack: (config) => {
config.externals.push("pino-pretty", "lokijs", "encoding");
return config;
Expand Down
19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,19 @@
"viem": "2.20.0"
},
"scripts": {
"generate": "lerna run generate",
"generate": "turbo run generate",
"postgenerate": "yarn lint:write",
"preinstall": "yarn config set ignore-engines true",
"postinstall": "git submodule update --init --recursive && patch-package",
"build": "is-ci && yarn build:ci || yarn build:dev",
"build:base": "lerna run build --verbose --ignore=alchemy-daapp --ignore=embedded-accounts-quickstart --ignore=aa-simple-dapp --ignore=ui-demo",
"build:dev": "yarn build:base --ignore=docs",
"build:base": "turbo run build --filter=!embedded-accounts-quickstart --filter=!ui-demo",
"build:dev": "yarn build:base --filter=!docs",
"build:ci": "yarn build:base && yarn lint:write",
"build:examples": "lerna run build",
"clean": "yarn clean:nx && yarn clean:lerna && yarn clean:node_modules",
"clean:nx": "nx reset",
"clean:lerna": "lerna run clean",
"clean:node_modules": "lerna clean && rm -rf node_modules",
"docs:gen": "lerna run docs:gen",
"build:examples": "turbo run build",
"clean": "yarn clean:turbo && yarn clean:node_modules",
"clean:turbo": "turbo run clean",
"clean:node_modules": "lerna clean -y && rm -rf node_modules",
"docs:gen": "turbo run docs:gen",
"test": "vitest dev",
"test:ci": "vitest run",
"lint:write": "eslint . --fix && yarn docs:gen && prettier --write --ignore-unknown .",
Expand Down Expand Up @@ -64,11 +63,11 @@
"lerna": "^8.0.2",
"lint-staged": "^13.2.2",
"node-fetch": "^3.3.1",
"nx": "^17.3.0",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"prettier": "^2.8.8",
"prool": "^0.0.15",
"turbo": "^2.2.3",
"viem": "2.20.0",
"vitest": "^2.0.4",
"wagmi": "2.12.7",
Expand Down
54 changes: 0 additions & 54 deletions patches/vocs+1.0.0-alpha.55.patch

This file was deleted.

22 changes: 22 additions & 0 deletions patches/vocs+1.0.0-alpha.62.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/node_modules/vocs/_lib/app/components/Sidebar.js b/node_modules/vocs/_lib/app/components/Sidebar.js
index 203ded0..cc1acc0 100644
--- a/node_modules/vocs/_lib/app/components/Sidebar.js
+++ b/node_modules/vocs/_lib/app/components/Sidebar.js
@@ -48,7 +48,7 @@ function getSidebarGroups(sidebar) {
}
function getActiveChildItem(items, pathname) {
return items.find((item) => {
- if (matchPath(pathname, item.link ?? ''))
+ if (matchPath(pathname, item.link ?? '') && pathname !== '/')
return true;
if (item.link === pathname)
return true;
@@ -64,7 +64,7 @@ function SidebarItem(props) {
const match = useMatch(item.link || '');
const hasActiveChildItem = useMemo(() => (item.items ? Boolean(getActiveChildItem(item.items, pathname)) : false), [item.items, pathname]);
const [collapsed, setCollapsed] = useState(() => {
- if (item.link && match)
+ if (item.link && match && pathname !== '/')
return false;
if (!item.items)
return false;
4 changes: 2 additions & 2 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"predev": "npx tsx ./scripts/prebuild.ts",
"dev": "vocs dev",
"prebuild": "npx tsx ./scripts/prebuild.ts",
"build": "./retry-build.sh",
"build": "vocs build",
"preview": "vocs preview"
},
"devDependencies": {
Expand All @@ -31,7 +31,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"viem": "2.20.0",
"vocs": "^1.0.0-alpha.55",
"vocs": "^1.0.0-alpha.62",
"wagmi": "2.12.7"
}
}
5 changes: 2 additions & 3 deletions site/pages/infra/sponsor-gas.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ import {
sepolia,
alchemyFeeEstimator,
createAlchemyPublicRpcClient,
alchemy,
} from "@account-kit/infra";
import { createLightAccount } from "@account-kit/smart-contracts";
// You can replace this with any signer you'd like
Expand All @@ -157,9 +158,7 @@ const alchemyTransport = alchemy({

const alchemyRpcClient = createAlchemyPublicRpcClient({
chain: sepolia,
connectionConfig: {
apiKey: "API_KEY",
},
transport: alchemyTransport,
});

// 2. create a split transport to route traffic between the paymaster and the bundler
Expand Down
8 changes: 4 additions & 4 deletions site/pages/react/customization/authentication-modal.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ In this example, we hide the default header text and replace it with our own.
```tsx twoslash
// @jsx: react-jsx
import { createConfig } from "@account-kit/react";
import { sepolia } from "@account-kit/infra";
import { sepolia, alchemy } from "@account-kit/infra";

export const confg = createConfig(
{
apiKey: "YOUR_API_KEY",
transport: alchemy({ apiKey: "YOUR_API_KEY" }),
chain: sepolia,
},
{
Expand All @@ -38,11 +38,11 @@ In this example, we leave the `Sign in` text in the modal and add an icon above
```tsx twoslash
// @jsx: react-jsx
import { createConfig } from "@account-kit/react";
import { sepolia } from "@account-kit/infra";
import { sepolia, alchemy } from "@account-kit/infra";

export const confg = createConfig(
{
apiKey: "YOUR_API_KEY",
transport: alchemy({ apiKey: "YOUR_API_KEY" }),
chain: sepolia,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ const upgradedAccount = await createMAAccount();

```ts [lightAccountClient.ts] twoslash filename="lightAccountClient.ts"
import { createLightAccountAlchemyClient } from "@account-kit/smart-contracts";
import { sepolia } from "@account-kit/infra";
import { sepolia, alchemy } from "@account-kit/infra";
import { LocalAccountSigner } from "@aa-sdk/core";
import { generatePrivateKey } from "viem/accounts";

export const lightAccountClient = await createLightAccountAlchemyClient({
apiKey: "YOUR_API_KEY",
transport: alchemy({ apiKey: "YOUR_API_KEY" }),
chain: sepolia,
signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),
});
Expand All @@ -48,12 +48,12 @@ That is all! Now, you can create a smart account client to connect with the upgr
:::code-group

```ts twoslash [example.ts]
import { createAlchemySmartAccountClient } from "@account-kit/infra";
import { createAlchemySmartAccountClient, alchemy } from "@account-kit/infra";
import { multiOwnerPluginActions } from "@account-kit/smart-contracts";
import { upgradedAccount } from "./upgradedAccount";

const upgradedAccountClient = await createAlchemySmartAccountClient({
apiKey: "YOUR_API_KEY",
transport: alchemy({ apiKey: "YOUR_API_KEY" }),
chain: lightAccountClient.chain,
account: upgradedAccount,
}).extend(multiOwnerPluginActions);
Expand All @@ -80,12 +80,12 @@ export const upgradedAccount = await createMAAccount();

```ts [lightAccountClient.ts] twoslash filename="lightAccountClient.ts"
import { createLightAccountAlchemyClient } from "@account-kit/smart-contracts";
import { sepolia } from "@account-kit/infra";
import { sepolia, alchemy } from "@account-kit/infra";
import { LocalAccountSigner } from "@aa-sdk/core";
import { generatePrivateKey } from "viem/accounts";

export const lightAccountClient = await createLightAccountAlchemyClient({
apiKey: "YOUR_API_KEY",
transport: alchemy({ apiKey: "YOUR_API_KEY" }),
chain: sepolia,
signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),
});
Expand Down
7 changes: 6 additions & 1 deletion site/tailwind.config.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
module.exports = {
content: ["./**/*.{js,ts,jsx,tsx,md,mdx}"],
content: [
"./components/**/*.{js,ts,jsx,tsx,md,mdx}",
"./pages/**/*.{js,ts,jsx,tsx,md,mdx}",
"./shared/**/*.{js,ts,jsx,tsx,md,mdx}",
"./sidebar/**/*.{js,ts,jsx,tsx,md,mdx}",
],
darkMode: "class",
important: true,
theme: {
Expand Down
9 changes: 9 additions & 0 deletions site/turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": ["//"],
"tasks": {
"build": {
"outputs": ["dist/**", "sidebar/**"],
"dependsOn": ["^build"]
}
}
}
26 changes: 26 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "https://turbo.build/schema.json",
"tasks": {
"build": {
"dependsOn": ["^build", "generate"],
"outputs": [".next/**", "!.next/cache/**", "dist/**"],
"cache": true
},
"test": {
"dependsOn": ["^build"],
"cache": false,
"persistent": true
},
"test:ci": {
"dependsOn": ["^build"]
},
"docs:gen": {
"outputs": ["../../site/pages/reference/**"]
},
"generate": {
"dependsOn": ["^build"],
"outputs": ["src/**/plugins/**"],
"cache": true
}
}
}
Loading

0 comments on commit bc6ef43

Please sign in to comment.