Skip to content

Commit 8a10d09

Browse files
committed
refactor: update per code review comments
1 parent cc6677c commit 8a10d09

3 files changed

Lines changed: 44 additions & 16 deletions

File tree

packages/create-app/src/index.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const commandHandler = {
5858
},
5959
}
6060

61-
const getTemplateFile = (templateName) => {
61+
const getTemplateDirectory = (templateName) => {
6262
return templateName === 'react-router'
6363
? templates.templateWithReactRouter
6464
: templates.templateWithList
@@ -156,7 +156,7 @@ const command = {
156156
}
157157

158158
reporter.info('Copying template files')
159-
const templateFiles = getTemplateFile(selectedOptions.templateName)
159+
const templateFiles = getTemplateDirectory(selectedOptions.templateName)
160160
fs.copySync(templateFiles, cwd)
161161

162162
const paths = {
@@ -166,6 +166,7 @@ const command = {
166166
pnpmLock: path.join(cwd, 'pnpm-lock.yaml'),
167167
pnpmWorkspace: path.join(cwd, 'pnpm-workspace.yaml'),
168168
appRootFile: path.join(cwd, 'src/App.tsx'),
169+
appRootWrapperFile: path.join(cwd, 'src/AppWrapper.tsx'),
169170
initYarnLock: path.join(__dirname, '../templates/yarn.lock'),
170171
initNpmLock: path.join(__dirname, '../templates/package-lock.json'),
171172
}
@@ -179,6 +180,12 @@ const command = {
179180
// Default template is with PNPM with TypeScript - some modifications here for yarn/npm/JS
180181
const templateModifications = [
181182
[paths.package, true, (f) => f.replace('{{template-name}}', name)],
183+
[
184+
paths.appRootWrapperFile,
185+
true,
186+
(f) => f.replace('{{template-name}}', name),
187+
],
188+
182189
// [
183190
// path.join(paths.base, '.husky/pre-commit'),
184191
// !pnpm,
@@ -249,14 +256,14 @@ const command = {
249256
// convert to JS
250257
if (!typeScript) {
251258
reporter.info('Preparing JavaScript template')
252-
reporter.info(` running '${pkgManager} install'`)
259+
reporter.info(` Running '${pkgManager} install'`)
253260

254261
await exec({
255262
cmd: pkgManager,
256263
args: ['install'],
257264
cwd: paths.base,
258265
})
259-
reporter.info(' convert template to JS with tsc')
266+
reporter.info(' Converting template to JS with tsc')
260267
await exec({
261268
cmd: 'npx',
262269
args: [
@@ -274,7 +281,7 @@ const command = {
274281
pipe: argv.debug,
275282
})
276283

277-
reporter.info(' Deleting TS files')
284+
reporter.debug(' Deleting TS files')
278285
const filePathsToRemove = path.join(paths.base, '/src/**/*.ts[x]')
279286
const filesToRemove = await fg.glob(filePathsToRemove)
280287

packages/create-app/templates/template-ts-dataelements-react-router/src/App.module.css

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
font-size: 14px;
55
grid-template-columns: auto;
66
grid-template-rows: auto 1fr auto;
7-
overflow: auto;
87
}
98

109
.sidebar {
@@ -20,17 +19,9 @@
2019
grid-area: main;
2120
width: 100%;
2221
padding-inline-start: 10px;
23-
/*height: 100%;
24-
display: flex;
25-
flex-direction: column;
26-
font-size: 1rem;
27-
max-width: 1020px;
28-
margin: 0px auto;
29-
padding-top: 8px; */
3022
}
3123

3224
.noticeContainer {
33-
/* width: 768px; */
3425
max-width: 340px;
3526

3627
margin: 16px 0;
@@ -45,7 +36,6 @@
4536
height: 100%;
4637
grid-template-columns: 250px 1fr;
4738
grid-template-rows: 1fr auto;
48-
overflow: auto;
4939
min-height: 1000px;
5040
}
5141

@@ -59,3 +49,22 @@
5949
margin: 8px;
6050
margin-inline-start: 0;
6151
}
52+
53+
.footer {
54+
display: flex;
55+
flex-direction: column;
56+
margin-top: 16px;
57+
align-items: center;
58+
gap: 6px;
59+
background-color: rgb(44, 102, 147);
60+
padding: 16px;
61+
color: white;
62+
}
63+
64+
.footer a,
65+
.footer a:visited,
66+
.footer a:active,
67+
.footer a:link,
68+
.footer a:focus {
69+
color: white;
70+
}

packages/create-app/templates/template-ts-dataelements-react-router/src/AppWrapper.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,19 @@ const AppWrapper = () => {
2222
<Route path="/about" element={<AboutPage />} />
2323
</Routes>
2424
</div>
25-
<div className={classes.footer}>Our App</div>
25+
<div className={classes.footer}>
26+
<div>{'{{template-name}}'}</div>
27+
<div>
28+
This web application was created using{' '}
29+
<a
30+
target="_blank"
31+
rel="noreferrer"
32+
href="https://developers.dhis2.org/docs/quickstart/quickstart-web"
33+
>
34+
@dhis2/create-app
35+
</a>
36+
</div>
37+
</div>
2638
</HashRouter>
2739
</div>
2840
)

0 commit comments

Comments
 (0)