Skip to content

Commit

Permalink
weekly cli backmerge (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
technophile-04 authored Aug 12, 2024
1 parent e173f8b commit 2b5937f
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 39 deletions.
5 changes: 5 additions & 0 deletions .changeset/nine-queens-explode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-eth": patch
---

revert https://github.com/scaffold-eth/scaffold-eth-2/pull/875 (https://github.com/scaffold-eth/scaffold-eth-2/pull/905)
4 changes: 1 addition & 3 deletions templates/base/packages/nextjs/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"plugins": ["@trivago/prettier-plugin-sort-imports"],
"arrowParens": "avoid",
"printWidth": 120,
"tabWidth": 2,
"trailingComma": "all",
"importOrder": ["^react$", "^next/(.*)$", "<THIRD_PARTY_MODULES>", "^@heroicons/(.*)$", "^~~/(.*)$"],
"importOrderSortSpecifiers": true,
"plugins": ["@trivago/prettier-plugin-sort-imports"]
"importOrderSortSpecifiers": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,15 @@ export const TupleArray = ({ abiTupleParameter, setParentForm, parentStateObject

useEffect(() => {
// Extract and group fields based on index prefix
const groupedFields = Object.keys(form).reduce(
(acc, key) => {
const [indexPrefix, ...restArray] = key.split("_");
const componentName = restArray.join("_");
if (!acc[indexPrefix]) {
acc[indexPrefix] = {};
}
acc[indexPrefix][componentName] = form[key];
return acc;
},
{} as Record<string, Record<string, any>>,
);
const groupedFields = Object.keys(form).reduce((acc, key) => {
const [indexPrefix, ...restArray] = key.split("_");
const componentName = restArray.join("_");
if (!acc[indexPrefix]) {
acc[indexPrefix] = {};
}
acc[indexPrefix][componentName] = form[key];
return acc;
}, {} as Record<string, Record<string, any>>);

let argsArray: Array<Record<string, any>> = [];

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 @@ -37,7 +37,7 @@
"zustand": "~4.1.2"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "~4.3.0",
"@trivago/prettier-plugin-sort-imports": "~4.1.1",
"@types/node": "^17.0.45",
"@types/nprogress": "^0",
"@types/react": "^18.0.21",
Expand All @@ -47,10 +47,10 @@
"autoprefixer": "~10.4.12",
"eslint": "~8.24.0",
"eslint-config-next": "~14.0.4",
"eslint-config-prettier": "~9.1.0",
"eslint-plugin-prettier": "~5.1.3",
"eslint-config-prettier": "~8.5.0",
"eslint-plugin-prettier": "~4.2.1",
"postcss": "~8.4.16",
"prettier": "~3.3.2",
"prettier": "~2.8.4",
"tailwindcss": "~3.4.3",
"type-fest": "~4.6.0",
"typescript": "5.5.3",
Expand Down
21 changes: 10 additions & 11 deletions templates/base/packages/nextjs/utils/scaffold-eth/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,16 @@ type OptionalTupple<T> = T extends readonly [infer H, ...infer R] ? readonly [H
type UseScaffoldArgsParam<
TContractName extends ContractName,
TFunctionName extends ExtractAbiFunctionNames<ContractAbi<TContractName>>,
> =
TFunctionName extends FunctionNamesWithInputs<TContractName>
? {
args: OptionalTupple<UnionToIntersection<AbiFunctionArguments<ContractAbi<TContractName>, TFunctionName>>>;
value?: ExtractAbiFunction<ContractAbi<TContractName>, TFunctionName>["stateMutability"] extends "payable"
? bigint | undefined
: undefined;
}
: {
args?: never;
};
> = TFunctionName extends FunctionNamesWithInputs<TContractName>
? {
args: OptionalTupple<UnionToIntersection<AbiFunctionArguments<ContractAbi<TContractName>, TFunctionName>>>;
value?: ExtractAbiFunction<ContractAbi<TContractName>, TFunctionName>["stateMutability"] extends "payable"
? bigint | undefined
: undefined;
}
: {
args?: never;
};

export type UseScaffoldReadConfig<
TContractName extends ContractName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,16 @@ const generateTsAbis: DeployFunction = async function () {
if (!fs.existsSync(TARGET_DIR)) {
fs.mkdirSync(TARGET_DIR);
}
const formattedContent = await prettier.format(
`${generatedContractComment} import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract"; \n\n
fs.writeFileSync(
`${TARGET_DIR}deployedContracts.ts`,
prettier.format(
`${generatedContractComment} import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract"; \n\n
const deployedContracts = {${fileContent}} as const; \n\n export default deployedContracts satisfies GenericContractsDeclaration`,
{
parser: "typescript",
},
{
parser: "typescript",
},
),
);
fs.writeFileSync(`${TARGET_DIR}deployedContracts.ts`, formattedContent);

console.log(`📝 Updated TypeScript contract definition file on ${TARGET_DIR}deployedContracts.ts`);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@
"@typescript-eslint/parser": "~6.7.3",
"chai": "~4.3.6",
"eslint": "~8.26.0",
"eslint-config-prettier": "~9.1.0",
"eslint-plugin-prettier": "~5.1.3",
"eslint-config-prettier": "~8.5.0",
"eslint-plugin-prettier": "~4.2.1",
"ethers": "~6.10.0",
"hardhat": "~2.19.4",
"hardhat-deploy": "~0.11.45",
"hardhat-deploy-ethers": "~0.4.1",
"hardhat-gas-reporter": "~1.0.9",
"prettier": "~3.3.2",
"prettier": "~2.8.4",
"solidity-coverage": "~0.8.5",
"ts-node": "~10.9.1",
"typechain": "~8.1.0",
Expand Down

0 comments on commit 2b5937f

Please sign in to comment.