Skip to content

Commit

Permalink
Weekly cli backmerge
Browse files Browse the repository at this point in the history
  • Loading branch information
technophile-04 authored Jul 17, 2024
2 parents 697fda9 + ef59bf0 commit 831b7bf
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 20 deletions.
7 changes: 7 additions & 0 deletions .changeset/light-sloths-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"create-eth": patch
---

- fix: BigInt parsing losing precision in IntegerInput (https://github.com/scaffold-eth/scaffold-eth-2/pull/893)
- feat: bundler module resolution (https://github.com/scaffold-eth/scaffold-eth-2/pull/885)
- fix: ignore strings starting with 0 (https://github.com/scaffold-eth/scaffold-eth-2/pull/894)
5 changes: 5 additions & 0 deletions .changeset/tender-foxes-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-eth": patch
---

cli: don't prompt for install + remove prettier plugins (#80)
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,31 @@ const isJsonString = (str: string) => {
}
};

const isBigInt = (str: string) => {
if (str.trim().length === 0 || str.startsWith("0")) return false;
try {
BigInt(str);
return true;
} catch (e) {
return false;
}
};

// Recursive function to deeply parse JSON strings, correctly handling nested arrays and encoded JSON strings
const deepParseValues = (value: any): any => {
if (typeof value === "string") {
// first try with bigInt because we losse precision with JSON.parse
if (isBigInt(value)) {
return BigInt(value);
}

if (isJsonString(value)) {
const parsed = JSON.parse(value);
return deepParseValues(parsed);
} else {
// It's a string but not a JSON string, return as is
return value;
}

// It's a string but not a JSON string, return as is
return value;
} else if (Array.isArray(value)) {
// If it's an array, recursively parse each element
return value.map(element => deepParseValues(element));
Expand Down
8 changes: 4 additions & 4 deletions templates/base/packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"react-hot-toast": "~2.4.0",
"use-debounce": "~8.0.4",
"usehooks-ts": "2.13.0",
"viem": "2.13.6",
"wagmi": "2.9.8",
"viem": "2.17.4",
"wagmi": "2.10.10",
"zustand": "~4.1.2"
},
"devDependencies": {
Expand All @@ -43,7 +43,7 @@
"@types/react": "^18.0.21",
"@types/react-copy-to-clipboard": "^5.0.4",
"@typescript-eslint/eslint-plugin": "~5.40.0",
"abitype": "1.0.2",
"abitype": "1.0.5",
"autoprefixer": "~10.4.12",
"eslint": "~8.24.0",
"eslint-config-next": "~14.0.4",
Expand All @@ -53,7 +53,7 @@
"prettier": "~3.3.2",
"tailwindcss": "~3.4.3",
"type-fest": "~4.6.0",
"typescript": "5.1.6",
"typescript": "5.5.3",
"vercel": "~32.4.1"
}
}
2 changes: 1 addition & 1 deletion templates/base/packages/nextjs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
Expand Down
12 changes: 0 additions & 12 deletions templates/base/packages/nextjs/types/abitype/abi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,3 @@ declare module "abitype" {
AddressType: AddressType;
}
}

declare module "viem/node_modules/abitype" {
export interface Register {
AddressType: AddressType;
}
}

declare module "wagmi/node_moudles/abitype" {
export interface Register {
AddressType: AddressType;
}
}

0 comments on commit 831b7bf

Please sign in to comment.