Skip to content

Commit

Permalink
update template
Browse files Browse the repository at this point in the history
  • Loading branch information
HillLiu committed Jan 4, 2022
1 parent 8d5fadf commit 1117edb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
27 changes: 7 additions & 20 deletions packages/generator-reshow/generators/library/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@ const getYo = require("yo-reshow");
const { YoGenerator, YoHelper, commonPrompt } = getYo();

/**
* Library Generator
* Library Generator
*/

module.exports = class extends YoGenerator {
constructor(args, opts) {
super(args, opts);
this.argument("mainName", { type: String, required: false });
}

/**
* Run loop (Life cycle)
* https://yeoman.io/authoring/running-context.html#the-run-loop
Expand All @@ -32,9 +27,8 @@ module.exports = class extends YoGenerator {
* https://github.com/SBoudrias/Inquirer.js
*/
async prompting() {
this.env.options.nodePackageManager = "yarn";

const {
handleAnswers,
mergePromptOrOption,
promptChainLocator,
promptChain,
Expand All @@ -46,21 +40,14 @@ module.exports = class extends YoGenerator {
...commonPrompt.author(this),
];

const answers = await mergePromptOrOption(
prompts,
(nextPrompts) => promptChain(promptChainLocator(nextPrompts))
const answers = await mergePromptOrOption(prompts, (nextPrompts) =>
promptChain(promptChainLocator(nextPrompts))
);

this.mainName = answers.mainName;
this.payload = {
...answers,
mainName: this.mainName,
description: answers.description || 'TODO: description',
keyword: answers.keyword || this.mainName,
};
handleAnswers(answers);
}

writing() {
this.env.options.nodePackageManager = "yarn";
const { cp, chMainName } = YoHelper(this);

// handle change to new folder
Expand All @@ -78,7 +65,7 @@ module.exports = class extends YoGenerator {
end() {
if (!this.options?.skipInstall) {
const { say, onExit } = YoHelper(this);
onExit(()=>say('Next you could try "npm run build" or "npm run test"'));
onExit(() => say('Next you could try "npm run build" or "npm run test"'));
}
}
};
2 changes: 1 addition & 1 deletion packages/generator-reshow/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generator-reshow",
"version": "0.15.1",
"version": "0.15.2",
"description": "Yeoman generator for reshow. (app, generator, ...etc)",
"author": "Hill <[email protected]>",
"repository": {
Expand Down

0 comments on commit 1117edb

Please sign in to comment.