Skip to content

Commit

Permalink
add readme template, consolidate answers obj
Browse files Browse the repository at this point in the history
  • Loading branch information
elyseholladay committed Mar 1, 2019
1 parent bbc4923 commit 275e311
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
29 changes: 14 additions & 15 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,33 @@ module.exports = class extends Generator {
}

async prompting() {
this.answers = await this.prompt([
this.userAnswers = await this.prompt([
{
type: "input",
name: "name",
message: "Your project name",
default: this.appname // Default to current folder name
name: "repoName",
message: "What is your project's name?",
default: this.appname // Defaults to current folder name
// TODO: can we check to see if this matches the repo name, and fail if it doesn't? Do we _want_ to do that?
},
{
type: "confirm",
name: "cool",
message: "Would you like to enable the Cool feature?"
type: "input",
name: "shortDescription",
message: "What is a short, one-sentence description of this package?",
validate: x => x.length > 0 ? true : "Providing a short description is required. Don't worry, you can always edit it later."
}
]);
}

// configuring - save configs and create files like .editorconfig //#endregion
// writing
writing() {
this.log("Creating documentation in the project...", this.contextRoot);
this.log("Writing documentation from templates ", this.sourceRoot());

// copy a template file
writing() {
this.fs.copyTpl(
this.templatePath('dummyfile.txt'),
this.destinationPath('foo/test.txt'),
{ title: this.answers.name }
this.templatePath('README.md'),
this.destinationPath('README.md'),
this.userAnswers
);
}

// install, if anything
// end
};
3 changes: 3 additions & 0 deletions generators/app/templates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# <%= repoName %>

> <%= shortDescription %>
1 change: 0 additions & 1 deletion generators/app/templates/dummyfile.txt

This file was deleted.

0 comments on commit 275e311

Please sign in to comment.