Skip to content

Commit

Permalink
feat: write title of app/lab in readme
Browse files Browse the repository at this point in the history
closes #26
  • Loading branch information
juancarlosfarah committed May 16, 2019
1 parent 5d8197d commit a6773e1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"fs-extra": "7.0.1",
"hosted-git-info": "2.7.1",
"inquirer": "6.2.2",
"lodash": "4.17.11",
"yargs": "12.0.5"
}
}
13 changes: 13 additions & 0 deletions src/initStarter.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import path from 'path';
import { execSync } from 'child_process';
import execa from 'execa';
Expand Down Expand Up @@ -137,6 +138,15 @@ const clone = async (hostInfo, rootPath) => {
await fs.remove(path.join(rootPath, '.git'));
};

const writeReadme = async (rootPath, name, type) => {
const string = `# Graasp ${_.capitalize(type)}: ${name}`;
try {
await fs.writeFile(path.join(rootPath, 'README.md'), string, 'utf8');
} catch (e) {
console.error(e);
}
};

const initStarter = async (options = {}) => {
const {
starter = DEFAULT_STARTER,
Expand Down Expand Up @@ -187,6 +197,9 @@ const initStarter = async (options = {}) => {
awsSecretAccessKey,
});

// write readme
await writeReadme(projectDirectory, name, type);

return commit(projectDirectory);
};

Expand Down

0 comments on commit a6773e1

Please sign in to comment.