From 9b8a22ead98c44a89d40e63f9af6f27dae6eddca Mon Sep 17 00:00:00 2001 From: "Shiv Bhonde | shivbhonde.eth" Date: Mon, 4 Nov 2024 20:46:32 +0700 Subject: [PATCH] fix: processing solidity-example template (#148) --- .changeset/friendly-boats-fix.md | 5 +++++ src/tasks/copy-template-files.ts | 12 ++++++++++-- .../packages/foundry/test/YourContract.t.sol | 14 +++----------- 3 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 .changeset/friendly-boats-fix.md diff --git a/.changeset/friendly-boats-fix.md b/.changeset/friendly-boats-fix.md new file mode 100644 index 000000000..dc5deedaf --- /dev/null +++ b/.changeset/friendly-boats-fix.md @@ -0,0 +1,5 @@ +--- +"create-eth": patch +--- + +fix: processing solidity-example template diff --git a/src/tasks/copy-template-files.ts b/src/tasks/copy-template-files.ts index 8575ed670..a6a868b7e 100644 --- a/src/tasks/copy-template-files.ts +++ b/src/tasks/copy-template-files.ts @@ -360,11 +360,19 @@ export async function copyTemplateFiles(options: Options, templateDir: string, t await copyExtensionFiles(options, externalExtensionPath, targetDir); } - if (!options.externalExtension && options.solidityFramework && exampleContractsPath) { + const shouldCopyExampleContracts = !options.externalExtension && options.solidityFramework && exampleContractsPath; + if (shouldCopyExampleContracts) { await copyExtensionFiles(options, exampleContractsPath, targetDir); } + // 4. Process templated files and generate output - await processTemplatedFiles(options, basePath, solidityFrameworkPath, exampleContractsPath, targetDir); + await processTemplatedFiles( + options, + basePath, + solidityFrameworkPath, + shouldCopyExampleContracts ? exampleContractsPath : null, + targetDir, + ); // 5. Delete tmp directory if (options.externalExtension && !options.dev) { diff --git a/templates/solidity-frameworks/foundry/packages/foundry/test/YourContract.t.sol b/templates/solidity-frameworks/foundry/packages/foundry/test/YourContract.t.sol index a6a2c10d0..5104250f4 100644 --- a/templates/solidity-frameworks/foundry/packages/foundry/test/YourContract.t.sol +++ b/templates/solidity-frameworks/foundry/packages/foundry/test/YourContract.t.sol @@ -2,10 +2,10 @@ pragma solidity ^0.8.13; import "forge-std/Test.sol"; -import "../contracts/YourContract.sol"; +// import "../contracts/YourContract.sol"; contract YourContractTest is Test { - YourContract public yourContract; +/* YourContract public yourContract; function setUp() public { yourContract = new YourContract(vm.addr(1)); @@ -16,13 +16,5 @@ contract YourContractTest is Test { keccak256(bytes(yourContract.greeting())) == keccak256("Building Unstoppable Apps!!!") ); - } - - function testSetNewMessage() public { - yourContract.setGreeting("Learn Scaffold-ETH 2! :)"); - require( - keccak256(bytes(yourContract.greeting())) - == keccak256("Learn Scaffold-ETH 2! :)") - ); - } + } */ }