generator-reshow 0.15.1 → 0.16.1

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,7 +60,7 @@ module.exports = class extends YoGenerator {
60
60
  }
61
61
 
62
62
  async end() {
63
- if (!this.options?.skipInstall) {
63
+ if (!this.options.skipInstall) {
64
64
  const { say, onExit } = YoHelper(this);
65
65
  await this.spawnCommand("./compile.sh", ["s", "open"]);
66
66
  sonExit(() => ay("Check the web browser, it should autoload now."));
@@ -0,0 +1,8 @@
1
+ node_modules
2
+ npm-debug.log
3
+ coverage*
4
+ .tern-port
5
+ v8.log
6
+ build
7
+ .*.sw?
8
+ webpack.pid
@@ -1,6 +1,12 @@
1
- # `APP`
1
+ # `<%= mainName %>`
2
2
 
3
- > TODO: description
3
+ > <%= description %>
4
+
5
+ ## Repository
6
+ * `GIT`
7
+ * <%= repositoryHomepage %>
8
+ * `NPM`
9
+ * https://www.npmjs.com/package/<%= mainName %>
4
10
 
5
11
  ## Usage
6
12
 
@@ -13,9 +13,7 @@ const usePage = (props) => {
13
13
  activeMenu: pageName,
14
14
  },
15
15
  });
16
- if (tplProps) {
17
- dispatch({ tplProps });
18
- }
16
+ dispatch({ tplProps, pageName });
19
17
  });
20
18
  ajaxDispatch("ajaxGet", {
21
19
  url: "/data/env",
@@ -30,7 +28,7 @@ const usePage = (props) => {
30
28
  });
31
29
  });
32
30
  };
33
- });
31
+ }, []);
34
32
  };
35
33
 
36
34
  export default usePage;
@@ -13,10 +13,10 @@ const themes = {
13
13
  };
14
14
 
15
15
  const Index = (props) => (
16
- <Return initStates={["tplProps"]}>
17
- {({ tplProps }) => {
16
+ <Return initStates={["tplProps", "pageName"]}>
17
+ {({ tplProps, pageName }) => {
18
18
  return (
19
- <Doc {...tplProps}>
19
+ <Doc {...tplProps} className={pageName}>
20
20
  <ClientRoute {...props} themes={themes} defaultThemePath="Page1" />
21
21
  <PageLoadProgressHandler ajax={true} />
22
22
  <ReshowMessage />
@@ -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
@@ -76,9 +63,9 @@ module.exports = class extends YoGenerator {
76
63
  }
77
64
 
78
65
  end() {
79
- if (!this.options?.skipInstall) {
66
+ if (!this.options.skipInstall) {
80
67
  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"'));
82
69
  }
83
70
  }
84
71
  };
@@ -3,9 +3,9 @@
3
3
  > <%= description %>
4
4
 
5
5
  ## Repositories
6
- * GIT
7
- * https://github.com/react-atomic/react-atomic-organism/tree/main/packages/lib/<%= mainName %>
8
- * NPM
6
+ * `GIT`
7
+ * <%= repositoryHomepage %>
8
+ * `NPM`
9
9
  * https://www.npmjs.com/package/<%= mainName %>
10
10
 
11
11
  ## Usage
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## Repository
6
6
  * `GIT`
7
- * <% repositoryHomepage %>
7
+ * <%= repositoryHomepage %>
8
8
  * `NPM`
9
9
  * https://www.npmjs.com/package/<%= mainName %>
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-reshow",
3
- "version": "0.15.1",
3
+ "version": "0.16.1",
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": "^0.15.0"
17
+ "yo-reshow": "^0.16.0"
18
18
  },
19
19
  "devDependencies": {
20
- "yo-unit": "^0.15.0"
20
+ "yo-unit": "^0.16.0"
21
21
  },
22
22
  "files": [
23
23
  "generators"
@@ -1,10 +0,0 @@
1
- import { expect } from "chai";
2
-
3
- import YourFunc from "../index";
4
-
5
- describe("Test <%= mainName %>", () => {
6
- it("basic testt", () => {
7
- /*your test code*/
8
- YourFunc();
9
- });
10
- });
@@ -1,3 +0,0 @@
1
- #!/bin/sh
2
-
3
- npm run build
@@ -1,3 +0,0 @@
1
- const YourFunc = (props) => {};
2
-
3
- export default YourFunc;