Skip to content

Commit b9bc9db

Browse files
feat: add post-install instructions
1 parent a7a56e8 commit b9bc9db

7 files changed

Lines changed: 171 additions & 8 deletions

File tree

biome.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
"enabled": true,
99
"useIgnoreFile": true
1010
},
11-
"files": {
12-
"ignore": ["source/**/*.js"]
13-
},
1411
"formatter": {
1512
"attributePosition": "multiline",
1613
"indentStyle": "space",

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@
1313
"lint": "pnpm biome check",
1414
"lint:fix": "pnpm biome check --write"
1515
},
16-
"files": ["dist"],
16+
"files": [
17+
"dist"
18+
],
1719
"dependencies": {
1820
"figures": "^6.1.0",
1921
"ink": "^5.2.1",
2022
"ink-big-text": "^2.0.0",
2123
"ink-divider": "^4.1.1",
2224
"ink-gradient": "^3.0.0",
25+
"ink-link": "^4.1.0",
2326
"ink-select-input": "^6.2.0",
2427
"ink-spawn": "^0.1.4",
2528
"ink-text-input": "^6.0.0",
@@ -34,6 +37,8 @@
3437
"typescript": "^5.8.3"
3538
},
3639
"pnpm": {
37-
"onlyBuiltDependencies": ["@biomejs/biome"]
40+
"onlyBuiltDependencies": [
41+
"@biomejs/biome"
42+
]
3843
}
3944
}

pnpm-lock.yaml

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/app.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import FileCleanup from './import/components/steps/FileCleanup.js'
66
import Install from './import/components/steps/Install/Install.js'
77
import InstallationMode from './import/components/steps/InstallationMode.js'
88
import OptionalPackages from './import/components/steps/OptionalPackages.js'
9+
import PostInstall from './import/components/steps/PostInstall.js'
910
import ProjectName from './import/components/steps/ProjectName.js'
1011
import type { InstallationSelectItem, MultiSelectItem } from './import/types/types.js'
1112
import { canShowStep } from './import/utils/utils.js'
@@ -65,7 +66,14 @@ const App = () => {
6566
projectName={projectName}
6667
key={6}
6768
/>,
68-
<Text key={7}>Done!</Text>,
69+
<PostInstall
70+
projectName={projectName}
71+
installationConfig={{
72+
installationType: setupType?.value,
73+
selectedFeatures: selectedFeatures,
74+
}}
75+
key={7}
76+
/>,
6977
],
7078
[
7179
finishStep,
@@ -81,6 +89,7 @@ const App = () => {
8189
<Box
8290
flexDirection={'column'}
8391
rowGap={1}
92+
width={80}
8493
>
8594
<MainTitle />
8695
{steps.map((item, index) => canShowStep(currentStep, index + 1) && item)}

source/import/components/Divider.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const Divider: FC<{ title: string }> = ({ title }) => (
66
titlePadding={2}
77
titleColor={'whiteBright'}
88
title={title}
9-
width={80}
109
/>
1110
)
1211

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import { Box, Text } from 'ink'
2+
import Link from 'ink-link'
3+
import React, { type FC } from 'react'
4+
import type { InstallationType, MultiSelectItem } from '../../types/types.js'
5+
import { featureSelected } from '../../utils/utils.js'
6+
import Divider from '../Divider.js'
7+
8+
const SubgraphWarningMessage: FC = () => (
9+
<Box
10+
flexDirection={'column'}
11+
rowGap={1}
12+
>
13+
<Box
14+
alignItems={'center'}
15+
borderColor={'yellow'}
16+
borderStyle={'bold'}
17+
flexDirection={'column'}
18+
justifyContent={'center'}
19+
padding={1}
20+
>
21+
<Text color={'yellow'}>
22+
<Text bold>WARNING:</Text> You <Text bold>MUST</Text> finish subgraph configuration manually
23+
</Text>
24+
</Box>
25+
<Text bold>Follow these steps:</Text>
26+
<Box flexDirection={'column'}>
27+
<Text>
28+
1- Provide your own API key for <Text bold>PUBLIC_SUBGRAPHS_API_KEY</Text> in{' '}
29+
<Text bold>.env.local</Text> You can get one at{' '}
30+
<Link url="https://thegraph.com/studio/apikeys">https://thegraph.com/studio/apikeys</Link>
31+
</Text>
32+
<Text>
33+
2- After the API key is correctly configured, run <Text bold>pnpm subgraph-codegen</Text> in
34+
your console from the project's folder
35+
</Text>
36+
</Box>
37+
<Text
38+
color={'yellow'}
39+
bold
40+
>
41+
Only after you have followed the previous steps you may proceed.
42+
</Text>
43+
</Box>
44+
)
45+
46+
const PostInstallMessage: FC<{ projectName: string }> = ({ projectName }) => (
47+
<Box
48+
flexDirection={'column'}
49+
rowGap={1}
50+
paddingBottom={2}
51+
>
52+
<Text bold>To start development on your project:</Text>
53+
<Box flexDirection={'column'}>
54+
<Text>
55+
1- Move into the project's folder with <Text bold>cd {projectName}</Text>
56+
</Text>
57+
<Text>
58+
2- Start the development server with <Text bold>pnpm dev</Text>
59+
</Text>
60+
</Box>
61+
<Text bold>More info:</Text>
62+
<Box flexDirection={'column'}>
63+
<Text>
64+
- Check out <Text bold>.env.local</Text> for more configurations.
65+
</Text>
66+
<Text>
67+
- Read the docs at{' '}
68+
<Link url="https://docs.dappbooster.dev">https://docs.dappbooster.dev</Link> to know more
69+
about <Text bold>dAppBooster</Text>
70+
</Text>
71+
</Box>
72+
</Box>
73+
)
74+
75+
interface Props {
76+
installationConfig: {
77+
installationType: InstallationType | undefined
78+
selectedFeatures?: Array<MultiSelectItem>
79+
}
80+
projectName: string
81+
}
82+
83+
/**
84+
* Component to ask for the project name.
85+
* @param selectedFeatures
86+
* @param projectName
87+
*/
88+
const PostInstall: FC<Props> = ({ installationConfig, projectName }) => {
89+
const { selectedFeatures, installationType } = installationConfig
90+
const subgraphSupport = featureSelected('subgraph', selectedFeatures)
91+
92+
return (
93+
<>
94+
<Divider title={'Post-install instructions'} />
95+
<Box
96+
flexDirection={'column'}
97+
rowGap={2}
98+
>
99+
{(subgraphSupport || installationType === 'full') && <SubgraphWarningMessage />}
100+
<PostInstallMessage projectName={projectName} />
101+
</Box>
102+
</>
103+
)
104+
}
105+
106+
export default PostInstall

source/import/components/steps/ProjectName.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const ProjectName: FC<Props> = ({ projectName, onSubmit, onCompletion }) => {
3939
answer={projectName}
4040
errorMessage={errorMessage}
4141
onSubmit={handleSubmit}
42-
question={'Project name?'}
42+
question={'Project name'}
4343
tip={'Letters (a–z, A–Z), numbers (0–9), and underscores (_) are allowed.'}
4444
/>
4545
)

0 commit comments

Comments
 (0)