diff --git a/package.json b/package.json index 173d617..d45880a 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/src/initStarter.js b/src/initStarter.js index a28304c..1e9eab8 100644 --- a/src/initStarter.js +++ b/src/initStarter.js @@ -1,3 +1,4 @@ +import _ from 'lodash'; import path from 'path'; import { execSync } from 'child_process'; import execa from 'execa'; @@ -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, @@ -187,6 +197,9 @@ const initStarter = async (options = {}) => { awsSecretAccessKey, }); + // write readme + await writeReadme(projectDirectory, name, type); + return commit(projectDirectory); };