Skip to content

Commit a6773e1

Browse files
feat: write title of app/lab in readme
closes #26
1 parent 5d8197d commit a6773e1

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"fs-extra": "7.0.1",
6363
"hosted-git-info": "2.7.1",
6464
"inquirer": "6.2.2",
65+
"lodash": "4.17.11",
6566
"yargs": "12.0.5"
6667
}
6768
}

src/initStarter.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import _ from 'lodash';
12
import path from 'path';
23
import { execSync } from 'child_process';
34
import execa from 'execa';
@@ -137,6 +138,15 @@ const clone = async (hostInfo, rootPath) => {
137138
await fs.remove(path.join(rootPath, '.git'));
138139
};
139140

141+
const writeReadme = async (rootPath, name, type) => {
142+
const string = `# Graasp ${_.capitalize(type)}: ${name}`;
143+
try {
144+
await fs.writeFile(path.join(rootPath, 'README.md'), string, 'utf8');
145+
} catch (e) {
146+
console.error(e);
147+
}
148+
};
149+
140150
const initStarter = async (options = {}) => {
141151
const {
142152
starter = DEFAULT_STARTER,
@@ -187,6 +197,9 @@ const initStarter = async (options = {}) => {
187197
awsSecretAccessKey,
188198
});
189199

200+
// write readme
201+
await writeReadme(projectDirectory, name, type);
202+
190203
return commit(projectDirectory);
191204
};
192205

0 commit comments

Comments
 (0)