generator-reshow 0.17.34 → 0.17.35

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.
@@ -88,16 +88,13 @@ develop() {
88
88
 
89
89
  watch() {
90
90
  echo "Watch Mode"
91
- npm run build:es:ui -- --watch &
92
- npm run build:es:src -- --watch &
91
+ npm run build:es -- --watch &
93
92
  }
94
93
 
95
94
  hot() {
96
95
  stop
97
- [ -e "$SWJS" ] && rm $SWJS
98
96
  echo "Hot Mode"
99
- npm run build:es:ui -- --watch &
100
- npm run build:es:src -- --watch &
97
+ npm run build:es -- --watch &
101
98
  [ ! -z "$webpack" ] && sleep 10 && HOT_UPDATE=1 CONFIG=$conf $webpack serve &
102
99
  }
103
100
 
@@ -53,16 +53,14 @@ module.exports = class extends YoGenerator {
53
53
 
54
54
  writing() {
55
55
  this.env.options.nodePackageManager = "yarn";
56
- const { cp, mkdir, chMainName, syncJSON } = YoHelper(this);
56
+ const { cp, chMainName, syncJSON } = YoHelper(this);
57
57
 
58
58
  // handle change to new folder
59
59
  chMainName(this.mainName);
60
60
 
61
61
  // handle copy file
62
- cp("src", null, this.payload);
63
62
  cp("README.md", null, this.payload);
64
63
  cp(".gitignore", null, this.payload);
65
- cp("Test.js", "src/__tests__/Test.js", this.payload);
66
64
 
67
65
  syncJSON("package.json", null, this.payload, (data) => {
68
66
  const keywords = this.payload.keyword?.split(",");
@@ -91,7 +89,6 @@ module.exports = class extends YoGenerator {
91
89
  data.files.push("src");
92
90
  }
93
91
  if (this.payload.babelUI) {
94
- delete data.bin;
95
92
  data.scripts["build:cjs"] = data.scripts["build:ui:cjs"];
96
93
  data.scripts["build:es"] = data.scripts["build:ui:es"];
97
94
  data.scripts["mocha"] = data.scripts["mocha:ui"];
@@ -105,11 +102,22 @@ module.exports = class extends YoGenerator {
105
102
  data.scripts[key] += " --root-mode upward";
106
103
  });
107
104
  }
105
+ delete data.bin;
108
106
  ["build:ui:cjs", "build:ui:es", "mocha:ui"].forEach((key) => {
109
107
  delete data.scripts[key];
110
108
  });
111
- mkdir("ui");
109
+ data.devDependencies["react"] = "^18.x";
110
+ data.devDependencies["react-dom"] = "^18.x";
111
+ data.devDependencies["reshow-unit"] = "*";
112
+ data.devDependencies["react-atomic-atom"] = "*";
113
+ delete data.devDependencies["reshow-unit-dom"];
114
+ cp("ui");
115
+ cp("babel.config.js");
116
+ cp("ui-src", "src");
117
+ cp("IndexTest.js", "ui/pages/__tests__/IndexTest.js", this.payload);
112
118
  } else {
119
+ cp("src", null, this.payload);
120
+ cp("Test.js", "src/__tests__/Test.js", this.payload);
113
121
  // clean babelUI script
114
122
  [
115
123
  "build:cjs:src",
@@ -0,0 +1,11 @@
1
+ import { expect } from "chai";
2
+ import { render } from "reshow-unit";
3
+
4
+ import Index from "../Index";
5
+
6
+ describe("AjaxForm Test", () => {
7
+ it("basic test", () => {
8
+ const wrap = render(<Index />);
9
+ expect(wrap.html()).to.have.string("Hello, there.");
10
+ });
11
+ });
@@ -0,0 +1 @@
1
+ module.exports = require("react-atomic-atom/babel.config");
@@ -0,0 +1,2 @@
1
+ const Index = props => <div>Hello, there.</div>
2
+ export default Index;
@@ -0,0 +1,2 @@
1
+
2
+ export { default as Index } from "../ui/pages/Index";
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.17.34",
2
+ "version": "0.17.35",
3
3
  "name": "generator-reshow",
4
4
  "repository": {
5
5
  "type": "git",
@@ -20,7 +20,7 @@
20
20
  "yo-unit": "*"
21
21
  },
22
22
  "scripts": {
23
- "mochaFor": "mocha",
23
+ "mochaFor": "mocha --timeout 2500",
24
24
  "mocha": "npm run mochaFor -- 'generators/**/__tests__/*.js'",
25
25
  "test": "npm run mocha",
26
26
  "prepublishOnly": "npm run test"