Skip to content

Commit 7e2dfb7

Browse files
feat: add more file cleanup scripts
1 parent 68e61ca commit 7e2dfb7

3 files changed

Lines changed: 65 additions & 10 deletions

File tree

source/import/components/steps/CloneRepo/CloneRepo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface Props {
1515
*/
1616
const CloneRepo: FC<Props> = ({ projectName, onCompletion }) => (
1717
<>
18-
<Divider title={`Cloning "${projectName}"`} />
18+
<Divider title={'Git tasks'} />
1919
<Commands
2020
projectName={projectName}
2121
onCompletion={onCompletion}

source/import/components/steps/FileCleanup.tsx

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ interface Props {
2424
const FileCleanup: FC<Props> = ({ onCompletion, installationConfig, projectName }) => {
2525
const { installationType, selectedFeatures } = installationConfig
2626
const projectFolder = useMemo(() => getProjectFolder(projectName), [projectName])
27-
const currentHomeFolder = `${projectFolder}${homeFolder}`
28-
const cleanHomeFile = './.install-files/home/index.tsx'
27+
const currentHomeFolder = `${projectFolder}/src/components/pageComponents/home`
2928

3029
return (
3130
<>
@@ -35,9 +34,10 @@ const FileCleanup: FC<Props> = ({ onCompletion, installationConfig, projectName
3534
gap={0}
3635
>
3736
<Script>
37+
{/* Component demos files and folders */}
3838
{!featureSelected('demo', selectedFeatures) && (
3939
<Script>
40-
<Text color={'whiteBright'}>Demo files</Text>
40+
<Text color={'whiteBright'}>Component demos</Text>
4141
<Spawn
4242
shell
4343
cwd={projectFolder}
@@ -63,16 +63,61 @@ const FileCleanup: FC<Props> = ({ onCompletion, installationConfig, projectName
6363
cwd={projectFolder}
6464
silent
6565
command="cp"
66-
args={[cleanHomeFile, currentHomeFolder]}
66+
args={['.install-files/home/index.tsx', currentHomeFolder]}
6767
runningText={'Creating new home page file...'}
6868
successText={'Done!'}
6969
failureText={'Error...'}
7070
/>
7171
</Script>
7272
)}
73+
{/* Subgraph files and folders */}
74+
{!featureSelected('subgraph', selectedFeatures) && (
75+
<Script>
76+
<Text color={'whiteBright'}>Subgraph</Text>
77+
<Spawn
78+
shell
79+
cwd={projectFolder}
80+
silent
81+
command="rm"
82+
args={['-rf', 'src/subgraphs']}
83+
runningText={'Removing subgraphs folder...'}
84+
successText={'Done!'}
85+
failureText={'Error...'}
86+
/>
87+
{/* The user chose to keep the component demos but opted out of subgraph support */}
88+
{featureSelected('demo', selectedFeatures) && (
89+
<Script>
90+
<Spawn
91+
shell
92+
cwd={projectFolder}
93+
silent
94+
command="rm"
95+
args={['-rf', `${currentHomeFolder}/Examples/demos/subgraphs`]}
96+
runningText={'Removing subgraphs demos folder...'}
97+
successText={'Done!'}
98+
failureText={'Error...'}
99+
/>
100+
<Spawn
101+
shell
102+
cwd={projectFolder}
103+
silent
104+
command="cp"
105+
args={[
106+
'.install-files/home/Examples/index.tsx',
107+
`${currentHomeFolder}/index.tsx`,
108+
]}
109+
runningText={'Creating new home page file...'}
110+
successText={'Done!'}
111+
failureText={'Error...'}
112+
/>
113+
</Script>
114+
)}
115+
</Script>
116+
)}
117+
{/* Typedoc files and folders */}
73118
{!featureSelected('typedoc', selectedFeatures) && (
74119
<Script>
75-
<Text color={'whiteBright'}>Typedoc files</Text>
120+
<Text color={'whiteBright'}>Typedoc</Text>
76121
<Spawn
77122
shell
78123
cwd={projectFolder}
@@ -85,9 +130,10 @@ const FileCleanup: FC<Props> = ({ onCompletion, installationConfig, projectName
85130
/>
86131
</Script>
87132
)}
133+
{/* Vocs files and folders */}
88134
{!featureSelected('vocs', selectedFeatures) && (
89135
<Script>
90-
<Text color={'whiteBright'}>Vocs files</Text>
136+
<Text color={'whiteBright'}>Vocs</Text>
91137
<Spawn
92138
shell
93139
cwd={projectFolder}
@@ -110,9 +156,14 @@ const FileCleanup: FC<Props> = ({ onCompletion, installationConfig, projectName
110156
/>
111157
</Script>
112158
)}
159+
{/* Husky files and folders */}
160+
{/* Also removes files from tasks executed by Husky:
161+
- lint-staged
162+
- commitlint
163+
*/}
113164
{!featureSelected('husky', selectedFeatures) && (
114165
<Script>
115-
<Text color={'whiteBright'}>Husky files</Text>
166+
<Text color={'whiteBright'}>Husky</Text>
116167
<Spawn
117168
shell
118169
cwd={projectFolder}
@@ -145,7 +196,8 @@ const FileCleanup: FC<Props> = ({ onCompletion, installationConfig, projectName
145196
/>
146197
</Script>
147198
)}
148-
<Text color={'whiteBright'}>Install files</Text>
199+
{/* Install script files and folders */}
200+
<Text color={'whiteBright'}>Install script</Text>
149201
<Spawn
150202
shell
151203
cwd={projectFolder}

source/import/components/steps/Install/Install.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ interface Props {
1919
const Install: FC<Props> = ({ projectName, onCompletion, installationConfig }) => {
2020
const { installationType, selectedFeatures } = installationConfig
2121
const projectFolder = useMemo(() => getProjectFolder(projectName), [projectName])
22+
const title = installationType
23+
? installationType[0]?.toUpperCase() + installationType.slice(1)
24+
: ''
2225

2326
return (
2427
<>
25-
<Divider title={`Executing ${installationType ?? 'full'} installation`} />
28+
<Divider title={`${title ?? 'Full'} installation`} />
2629
<Box
2730
flexDirection={'column'}
2831
gap={0}

0 commit comments

Comments
 (0)