Skip to content

Commit a3d956b

Browse files
authored
Templatise readme quickstart section (#790)
1 parent 8984d74 commit a3d956b

File tree

3 files changed

+87
-108
lines changed

3 files changed

+87
-108
lines changed
Lines changed: 77 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,68 @@
11
import { withDefaults } from "../utils.js";
22

3-
const contents = ({ solidityFrameWork, quickStart }) =>
3+
const getQuickStart = ({
4+
solidityFramework,
5+
networkConfigPath,
6+
contractsPath,
7+
scriptsPath,
8+
testCommand,
9+
}) => `## Quickstart
10+
11+
To get started with Scaffold-ETH 2, follow the steps below:
12+
13+
1. Install dependencies if it was skipped in CLI:
14+
15+
\`\`\`
16+
cd my-dapp-example
17+
yarn install
18+
\`\`\`
19+
20+
${
21+
Boolean(solidityFramework[0])
22+
? `2. Run a local network in the first terminal:
23+
24+
\`\`\`
25+
yarn chain
26+
\`\`\`
27+
28+
This command starts a local Ethereum network using ${solidityFramework[0]}. The network runs on your local machine and can be used for testing and development. You can customize the network configuration in ${networkConfigPath[0]}.
29+
30+
3. On a second terminal, deploy the test contract:
31+
32+
\`\`\`
33+
yarn deploy
34+
\`\`\`
35+
36+
This command deploys a test smart contract to the local network. The contract is located in ${contractsPath[0]} and can be modified to suit your needs. The \`yarn deploy\` command uses the deploy script located in ${scriptsPath[0]} to deploy the contract to the network. You can also customize the deploy script.
37+
38+
4. On a third terminal, start your NextJS app:`
39+
: "2. Start your NextJS app:"
40+
}
41+
42+
\`\`\`
43+
yarn start
44+
\`\`\`
45+
46+
Visit your app on: \`http://localhost:3000\`. You can interact with your smart contract using the \`Debug Contracts\` page. You can tweak the app config in \`packages/nextjs/scaffold.config.ts\`.
47+
${
48+
Boolean(solidityFramework[0])
49+
? `
50+
Run smart contract test with ${testCommand[0]}
51+
52+
- Edit your smart contract \`YourContract.sol\` in ${contractsPath[0]}
53+
- Edit your frontend homepage at \`packages/nextjs/app/page.tsx\`. For guidance on [routing](https://nextjs.org/docs/app/building-your-application/routing/defining-routes) and configuring [pages/layouts](https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts) checkout the Next.js documentation.
54+
- Edit your deployment scripts in ${scriptsPath[0]}
55+
`
56+
: ""
57+
}`;
58+
59+
const contents = ({
60+
solidityFramework,
61+
networkConfigPath,
62+
contractsPath,
63+
scriptsPath,
64+
testCommand,
65+
}) =>
466
`# 🏗 Scaffold-ETH 2
567
668
<h4 align="center">
@@ -11,10 +73,10 @@ const contents = ({ solidityFrameWork, quickStart }) =>
1173
🧪 An open-source, up-to-date toolkit for building decentralized applications (dapps) on the Ethereum blockchain. It's designed to make it easier for developers to create and deploy smart contracts and build user interfaces that interact with those contracts.
1274
1375
⚙️ Built using NextJS, RainbowKit, ${
14-
Boolean(solidityFrameWork[0]) ? solidityFrameWork[0] + ", " : ""
76+
Boolean(solidityFramework[0]) ? solidityFramework[0] + ", " : ""
1577
}Wagmi, Viem, and Typescript.
1678
${
17-
Boolean(solidityFrameWork[0])
79+
Boolean(solidityFramework[0])
1880
? "\n- ✅ **Contract Hot Reload**: Your frontend auto-adapts to your smart contract as you edit it."
1981
: ""
2082
}
@@ -33,8 +95,13 @@ Before you begin, you need to install the following tools:
3395
- Yarn ([v1](https://classic.yarnpkg.com/en/docs/install/) or [v2+](https://yarnpkg.com/getting-started/install))
3496
- [Git](https://git-scm.com/downloads)
3597
36-
${quickStart[0]}
37-
98+
${getQuickStart({
99+
solidityFramework,
100+
networkConfigPath,
101+
contractsPath,
102+
scriptsPath,
103+
testCommand,
104+
})}
38105
## Documentation
39106
40107
Visit our [docs](https://docs.scaffoldeth.io) to learn how to start building with Scaffold-ETH 2.
@@ -48,23 +115,9 @@ We welcome contributions to Scaffold-ETH 2!
48115
Please see [CONTRIBUTING.MD](https://github.com/scaffold-eth/scaffold-eth-2/blob/main/CONTRIBUTING.md) for more information and guidelines for contributing to Scaffold-ETH 2.`;
49116

50117
export default withDefaults(contents, {
51-
solidityFrameWork: "",
52-
quickStart: `## Quickstart
53-
54-
To get started with Scaffold-ETH 2, follow the steps below:
55-
56-
1. Install dependencies if it was skipped in CLI:
57-
58-
\`\`\`
59-
cd my-dapp-example
60-
yarn install
61-
\`\`\`
62-
63-
2. Start your NextJS app:
64-
65-
\`\`\`
66-
yarn start
67-
\`\`\`
68-
69-
Visit your app on: \`http://localhost:3000\`. You can interact with your smart contract using the \`Debug Contracts\` page. You can tweak the app config in \`packages/nextjs/scaffold.config.ts\`.`,
118+
solidityFramework: "",
119+
networkConfigPath: "",
120+
contractsPath: "",
121+
scriptsPath: "",
122+
testCommand: "",
70123
});
Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,5 @@
1-
export const quickStart = `## Quickstart
2-
3-
To get started with Scaffold-ETH 2, follow the steps below:
4-
5-
1. Install dependencies if it was skipped in CLI:
6-
7-
\`\`\`
8-
cd my-dapp-example
9-
yarn install
10-
\`\`\`
11-
12-
2. Run a local network in the first terminal:
13-
14-
\`\`\`
15-
yarn chain
16-
\`\`\`
17-
18-
This command starts a local Ethereum network using Foundry. The network runs on your local machine and can be used for testing and development. You can customize the network configuration in \`packages/foundry/foundry.toml\`.
19-
20-
3. On a second terminal, deploy the test contract:
21-
22-
\`\`\`
23-
yarn deploy
24-
\`\`\`
25-
26-
This command deploys a test smart contract to the local network. The contract is located in \`packages/foundry/contracts\` and can be modified to suit your needs. The \`yarn deploy\` command uses the deploy script located in \`packages/foundry/script\` to deploy the contract to the network. You can also customize the deploy script.
27-
28-
4. On a third terminal, start your NextJS app:
29-
30-
\`\`\`
31-
yarn start
32-
\`\`\`
33-
34-
Visit your app on: \`http://localhost:3000\`. You can interact with your smart contract using the \`Debug Contracts\` page. You can tweak the app config in \`packages/nextjs/scaffold.config.ts\`.
35-
36-
Run smart contract test with \`yarn foundry:test\`
37-
38-
- Edit your smart contract \`YourContract.sol\` in \`packages/foundry/contracts\`
39-
- Edit your frontend homepage at \`packages/nextjs/app/page.tsx\`. For guidance on [routing](https://nextjs.org/docs/app/building-your-application/routing/defining-routes) and configuring [pages/layouts](https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts) checkout the Next.js documentation.
40-
- Edit your deployment scripts in \`packages/foundry/script\``;
41-
42-
export const solidityFrameWork = "Foundry";
1+
export const solidityFramework = "Foundry";
2+
export const networkConfigPath = `\`packages/foundry/foundry.toml\``;
3+
export const contractsPath = `\`packages/foundry/contracts\``;
4+
export const scriptsPath = `\`packages/foundry/script\``;
5+
export const testCommand = `\`yarn foundry:test\``;
Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,5 @@
1-
export const quickStart = `## Quickstart
2-
3-
To get started with Scaffold-ETH 2, follow the steps below:
4-
5-
1. Install dependencies if it was skipped in CLI:
6-
7-
\`\`\`
8-
cd my-dapp-example
9-
yarn install
10-
\`\`\`
11-
12-
2. Run a local network in the first terminal:
13-
14-
\`\`\`
15-
yarn chain
16-
\`\`\`
17-
18-
This command starts a local Ethereum network using Hardhat. The network runs on your local machine and can be used for testing and development. You can customize the network configuration in \`packages/hardhat/hardhat.config.ts\`.
19-
20-
3. On a second terminal, deploy the test contract:
21-
22-
\`\`\`
23-
yarn deploy
24-
\`\`\`
25-
26-
This command deploys a test smart contract to the local network. The contract is located in \`packages/hardhat/contracts\` and can be modified to suit your needs. The \`yarn deploy\` command uses the deploy script located in \`packages/hardhat/deploy\` to deploy the contract to the network. You can also customize the deploy script.
27-
28-
4. On a third terminal, start your NextJS app:
29-
30-
\`\`\`
31-
yarn start
32-
\`\`\`
33-
34-
Visit your app on: \`http://localhost:3000\`. You can interact with your smart contract using the \`Debug Contracts\` page. You can tweak the app config in \`packages/nextjs/scaffold.config.ts\`.
35-
36-
Run smart contract test with \`yarn hardhat:test\`
37-
38-
- Edit your smart contract \`YourContract.sol\` in \`packages/hardhat/contracts\`
39-
- Edit your frontend homepage at \`packages/nextjs/app/page.tsx\`. For guidance on [routing](https://nextjs.org/docs/app/building-your-application/routing/defining-routes) and configuring [pages/layouts](https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts) checkout the Next.js documentation.
40-
- Edit your deployment scripts in \`packages/hardhat/deploy\``;
41-
42-
export const solidityFrameWork = "Hardhat";
1+
export const solidityFramework = "Hardhat";
2+
export const networkConfigPath = `\`packages/hardhat/hardhat.config.ts\``;
3+
export const contractsPath = `\`packages/hardhat/contracts\``;
4+
export const scriptsPath = `\`packages/hardhat/deploy\``;
5+
export const testCommand = `\`yarn hardhat:test\``;

0 commit comments

Comments
 (0)