Skip to content

Commit 1117edb

Browse files
committed
update template
1 parent 8d5fadf commit 1117edb

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

packages/generator-reshow/generators/library/index.js

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,10 @@ const getYo = require("yo-reshow");
22
const { YoGenerator, YoHelper, commonPrompt } = getYo();
33

44
/**
5-
* Library Generator
5+
* Library Generator
66
*/
77

88
module.exports = class extends YoGenerator {
9-
constructor(args, opts) {
10-
super(args, opts);
11-
this.argument("mainName", { type: String, required: false });
12-
}
13-
149
/**
1510
* Run loop (Life cycle)
1611
* https://yeoman.io/authoring/running-context.html#the-run-loop
@@ -32,9 +27,8 @@ module.exports = class extends YoGenerator {
3227
* https://github.com/SBoudrias/Inquirer.js
3328
*/
3429
async prompting() {
35-
this.env.options.nodePackageManager = "yarn";
36-
3730
const {
31+
handleAnswers,
3832
mergePromptOrOption,
3933
promptChainLocator,
4034
promptChain,
@@ -46,21 +40,14 @@ module.exports = class extends YoGenerator {
4640
...commonPrompt.author(this),
4741
];
4842

49-
const answers = await mergePromptOrOption(
50-
prompts,
51-
(nextPrompts) => promptChain(promptChainLocator(nextPrompts))
43+
const answers = await mergePromptOrOption(prompts, (nextPrompts) =>
44+
promptChain(promptChainLocator(nextPrompts))
5245
);
53-
54-
this.mainName = answers.mainName;
55-
this.payload = {
56-
...answers,
57-
mainName: this.mainName,
58-
description: answers.description || 'TODO: description',
59-
keyword: answers.keyword || this.mainName,
60-
};
46+
handleAnswers(answers);
6147
}
6248

6349
writing() {
50+
this.env.options.nodePackageManager = "yarn";
6451
const { cp, chMainName } = YoHelper(this);
6552

6653
// handle change to new folder
@@ -78,7 +65,7 @@ module.exports = class extends YoGenerator {
7865
end() {
7966
if (!this.options?.skipInstall) {
8067
const { say, onExit } = YoHelper(this);
81-
onExit(()=>say('Next you could try "npm run build" or "npm run test"'));
68+
onExit(() => say('Next you could try "npm run build" or "npm run test"'));
8269
}
8370
}
8471
};

packages/generator-reshow/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "generator-reshow",
3-
"version": "0.15.1",
3+
"version": "0.15.2",
44
"description": "Yeoman generator for reshow. (app, generator, ...etc)",
55
"author": "Hill <hill@kimo.com>",
66
"repository": {

0 commit comments

Comments
 (0)