generator-reshow 0.17.42 → 0.17.44

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.
@@ -1,9 +1,14 @@
1
+ //@ts-check
2
+
1
3
  import { VerticalMenu } from "pmvc_react_admin";
2
4
  import { SideMenu } from "organism-react-navigation";
3
5
  import { pageStore, ReLink } from "reshow";
4
6
  import { KEYS } from "reshow-constant";
5
7
 
6
- const Menu = (props) => {
8
+ /**
9
+ * @returns {React.ReactElement}
10
+ */
11
+ const Menu = () => {
7
12
  const thisMenus = {};
8
13
  const themes = pageStore.getMap("themes");
9
14
  KEYS(themes).forEach((item) => {
@@ -1,30 +1,29 @@
1
+ import { lazy } from "react";
1
2
  import { ReshowMessage, Return } from "reshow";
2
3
  import { ClientRoute } from "reshow-url";
3
4
  import { PopupPool } from "organism-react-popup";
4
5
  import { PageLoadProgressHandler } from "organism-react-progress";
5
6
 
6
7
  import Doc from "../templates/Doc";
7
- import Page1 from "../pages/Page1";
8
- import Page2 from "../pages/Page2";
9
8
 
10
9
  const themes = {
11
- Page1,
12
- Page2,
10
+ Page1: lazy(() => import("../pages/Page1")),
11
+ Page2: lazy(() => import("../pages/Page2")),
13
12
  };
14
13
 
15
14
  const Index = (props) => (
16
- <Return initStates={["tplProps", "pageName"]}>
17
- {({ tplProps, pageName }) => {
18
- return (
15
+ <>
16
+ <Return initStates={["tplProps", "pageName"]}>
17
+ {({ tplProps, pageName }) => (
19
18
  <Doc {...tplProps} className={pageName}>
20
19
  <ClientRoute {...props} themes={themes} defaultThemePath="Page1" />
21
- <PageLoadProgressHandler ajax={true} />
22
- <ReshowMessage />
23
- <PopupPool />
24
20
  </Doc>
25
- );
26
- }}
27
- </Return>
21
+ )}
22
+ </Return>
23
+ <PageLoadProgressHandler ajax={true} />
24
+ <ReshowMessage />
25
+ <PopupPool />
26
+ </>
28
27
  );
29
28
 
30
29
  export default Index;
@@ -1,4 +1,5 @@
1
- import React, { Component } from "react";
1
+ //@ts-check
2
+
2
3
  import { getDocTemplate } from "organism-react-navigation";
3
4
  import Menu from "../molecules/Menu";
4
5
 
@@ -1,4 +1,7 @@
1
- const { YoGenerator, YoHelper, commonPrompt } = require("yo-reshow");
1
+ const { YoGenerator, YoHelper } = require("yo-reshow");
2
+
3
+ const getUIBuildTypeScript = (filePattern) =>
4
+ `npx -p typescript tsc src/*.js ${filePattern} --jsx react-jsx --declaration --allowJs --emitDeclarationOnly --skipLibCheck --declarationDir types`;
2
5
 
3
6
  /**
4
7
  * package-json Generator
@@ -46,8 +49,9 @@ module.exports = class extends YoGenerator {
46
49
  };
47
50
  delete data.devDependencies;
48
51
  delete data.version;
49
- data.scripts["prepublishOnly"] = "exit 1;";
52
+ data.scripts.prepublishOnly = "exit 1;";
50
53
  data.scripts.build = "npm run clean && npm run build:es";
54
+ data.scripts["build:type"] = getUIBuildTypeScript("src/ui/**/*.jsx");
51
55
  } else {
52
56
  delete data.private;
53
57
  data.dependencies = {
@@ -74,8 +78,9 @@ module.exports = class extends YoGenerator {
74
78
  data.devDependencies["react"] = "^18.x";
75
79
  data.devDependencies["react-dom"] = "^18.x";
76
80
  data.devDependencies["reshow-unit"] = "*";
77
- data.scripts["build:type"] =
78
- "npx -p typescript tsc src/index.js src/**/*.js src/ui/**/*.jsx --jsx react-jsx --declaration --allowJs --emitDeclarationOnly --skipLibCheck --declarationDir types";
81
+ data.scripts["build:type"] = getUIBuildTypeScript(
82
+ "src/**/*.js src/ui/**/*.jsx"
83
+ );
79
84
  delete data.devDependencies["reshow-unit-dom"];
80
85
  }
81
86
  if (!isUseWebpack) {
@@ -34,7 +34,7 @@
34
34
  "clean": "find ./build ./types -name '*.*' | xargs rm -rf",
35
35
  "build:cjs": "BABEL_ENV=cjs babel src -d build/cjs/src --ignore /**/__tests__<%= babelRootMode %>",
36
36
  "build:es": "BABEL_ENV=es babel src -d build/es/src --out-file-extension .mjs<%= babelRootMode %>",
37
- "build:type": "npx -p typescript tsc src/index.js src/**/*.js --declaration --allowJs --emitDeclarationOnly --skipLibCheck --declarationDir types",
37
+ "build:type": "npx -p typescript tsc src/*.js src/**/*.js --declaration --allowJs --emitDeclarationOnly --skipLibCheck --declarationDir types",
38
38
  "build": "npm run clean && npm run build:cjs && npm run build:es && npm run build:type",
39
39
  "mochaFor": "mocha -r global-jsdom/register",
40
40
  "mocha": "npm run mochaFor -- 'build/{cjs,es}/**/__tests__/*.{js,mjs}'",
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.17.42",
2
+ "version": "0.17.44",
3
3
  "name": "generator-reshow",
4
4
  "repository": {
5
5
  "type": "git",