generator-reshow 0.0.3 → 0.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,10 +60,10 @@ module.exports = class extends YoGenerator {
60
60
  }
61
61
 
62
62
  async end() {
63
- if (!this.options?.skipInstall) {
64
- const { say } = YoHelper(this);
63
+ if (!this.options.skipInstall) {
64
+ const { say, onExit } = YoHelper(this);
65
65
  await this.spawnCommand("./compile.sh", ["s", "open"]);
66
- say("Check the web browser, it should autoload now.");
66
+ sonExit(() => ay("Check the web browser, it should autoload now."));
67
67
  }
68
68
  }
69
69
  };
@@ -4,7 +4,7 @@ import Menu from "../molecules/Menu";
4
4
 
5
5
  const DocTemplate = getDocTemplate({
6
6
  sideWidth: 160,
7
- active: true
7
+ active: true,
8
8
  });
9
9
 
10
10
  const Doc = ({ children, ...props }) => (
@@ -2,15 +2,10 @@ const getYo = require("yo-reshow");
2
2
  const { YoGenerator, YoHelper, commonPrompt } = getYo();
3
3
 
4
4
  /**
5
- * Library Generator
5
+ * Library Generator
6
6
  */
7
7
 
8
8
  module.exports = class extends YoGenerator {
9
- constructor(args, opts) {
10
- super(args, opts);
11
- this.argument("mainName", { type: String, required: false });
12
- }
13
-
14
9
  /**
15
10
  * Run loop (Life cycle)
16
11
  * https://yeoman.io/authoring/running-context.html#the-run-loop
@@ -32,9 +27,8 @@ module.exports = class extends YoGenerator {
32
27
  * https://github.com/SBoudrias/Inquirer.js
33
28
  */
34
29
  async prompting() {
35
- this.env.options.nodePackageManager = "yarn";
36
-
37
30
  const {
31
+ handleAnswers,
38
32
  mergePromptOrOption,
39
33
  promptChainLocator,
40
34
  promptChain,
@@ -46,21 +40,14 @@ module.exports = class extends YoGenerator {
46
40
  ...commonPrompt.author(this),
47
41
  ];
48
42
 
49
- const answers = await mergePromptOrOption(
50
- prompts,
51
- (nextPrompts) => promptChain(promptChainLocator(nextPrompts))
43
+ const answers = await mergePromptOrOption(prompts, (nextPrompts) =>
44
+ promptChain(promptChainLocator(nextPrompts))
52
45
  );
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);
61
47
  }
62
48
 
63
49
  writing() {
50
+ this.env.options.nodePackageManager = "yarn";
64
51
  const { cp, chMainName } = YoHelper(this);
65
52
 
66
53
  // handle change to new folder
@@ -72,12 +59,13 @@ module.exports = class extends YoGenerator {
72
59
  cp("package.json", null, this.payload);
73
60
  cp("src", null, this.payload);
74
61
  cp("Test.js", "src/__tests__/Test.js", this.payload);
62
+ cp("yarn.lock");
75
63
  }
76
64
 
77
65
  end() {
78
- if (!this.options?.skipInstall) {
79
- const { say } = YoHelper(this);
80
- say('Next you could try "npm run build" or "npm run test"');
66
+ if (!this.options.skipInstall) {
67
+ const { say, onExit } = YoHelper(this);
68
+ onExit(() => say('Next you could try "npm run build" or "npm run test"'));
81
69
  }
82
70
  }
83
71
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-reshow",
3
- "version": "0.0.3",
3
+ "version": "0.15.3",
4
4
  "description": "Yeoman generator for reshow. (app, generator, ...etc)",
5
5
  "author": "Hill <hill@kimo.com>",
6
6
  "repository": {
@@ -14,10 +14,10 @@
14
14
  "license": "ISC",
15
15
  "main": "",
16
16
  "dependencies": {
17
- "yo-reshow": "*"
17
+ "yo-reshow": "^0.15.0"
18
18
  },
19
19
  "devDependencies": {
20
- "yo-unit": "*"
20
+ "yo-unit": "^0.15.0"
21
21
  },
22
22
  "files": [
23
23
  "generators"