generator-reshow 0.17.32 → 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.
- package/generators/compile-sh/templates/compile.sh +2 -5
- package/generators/docker/README.md +16 -2
- package/generators/npm/index.js +44 -2
- package/generators/npm/templates/IndexTest.js +11 -0
- package/generators/npm/templates/babel.config.js +1 -0
- package/generators/npm/templates/package.json +7 -0
- package/generators/npm/templates/ui/pages/Index.jsx +2 -0
- package/generators/npm/templates/ui-src/index.js +2 -0
- package/package.json +2 -2
|
@@ -88,16 +88,13 @@ develop() {
|
|
|
88
88
|
|
|
89
89
|
watch() {
|
|
90
90
|
echo "Watch Mode"
|
|
91
|
-
npm run build:es
|
|
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
|
|
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
|
|
|
@@ -2,9 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
> Docker generator
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Setup circleci
|
|
6
|
+
|
|
7
|
+
### setup multi version
|
|
8
|
+
* https://github.com/HillLiu/docker-twemproxy-alpine/blob/main/.circleci/config.yml#L62
|
|
9
|
+
|
|
10
|
+
### Environment Variables
|
|
6
11
|
* DOCKER_LOGIN
|
|
7
12
|
* DOCKER_PASSWORD
|
|
8
13
|
|
|
9
14
|
### circleci sample url
|
|
10
|
-
|
|
15
|
+
|
|
16
|
+
* Syntax
|
|
17
|
+
```
|
|
18
|
+
* /settings/project/github/[git-org]/[git-repository-name]/environment-variables
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
* Sample
|
|
22
|
+
* git-org: HillLiu
|
|
23
|
+
* git-repository-name: docker-twemproxy-alpine
|
|
24
|
+
* url: https://app.circleci.com/settings/project/github/HillLiu/docker-twemproxy-alpine/environment-variables
|
package/generators/npm/index.js
CHANGED
|
@@ -59,10 +59,8 @@ module.exports = class extends YoGenerator {
|
|
|
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(",");
|
|
@@ -77,6 +75,7 @@ module.exports = class extends YoGenerator {
|
|
|
77
75
|
};
|
|
78
76
|
if (!this.payload.isUseBabel) {
|
|
79
77
|
delete data.devDependencies["@babel/cli"];
|
|
78
|
+
delete data.exports;
|
|
80
79
|
delete data.module;
|
|
81
80
|
delete data.scripts.clean;
|
|
82
81
|
delete data.scripts.build;
|
|
@@ -89,6 +88,49 @@ module.exports = class extends YoGenerator {
|
|
|
89
88
|
data.files = data.files.filter((f) => f !== "build");
|
|
90
89
|
data.files.push("src");
|
|
91
90
|
}
|
|
91
|
+
if (this.payload.babelUI) {
|
|
92
|
+
data.scripts["build:cjs"] = data.scripts["build:ui:cjs"];
|
|
93
|
+
data.scripts["build:es"] = data.scripts["build:ui:es"];
|
|
94
|
+
data.scripts["mocha"] = data.scripts["mocha:ui"];
|
|
95
|
+
if (this.payload.babelRootMode) {
|
|
96
|
+
[
|
|
97
|
+
"build:cjs:src",
|
|
98
|
+
"build:cjs:ui",
|
|
99
|
+
"build:es:src",
|
|
100
|
+
"build:es:ui",
|
|
101
|
+
].forEach((key) => {
|
|
102
|
+
data.scripts[key] += " --root-mode upward";
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
delete data.bin;
|
|
106
|
+
["build:ui:cjs", "build:ui:es", "mocha:ui"].forEach((key) => {
|
|
107
|
+
delete data.scripts[key];
|
|
108
|
+
});
|
|
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);
|
|
118
|
+
} else {
|
|
119
|
+
cp("src", null, this.payload);
|
|
120
|
+
cp("Test.js", "src/__tests__/Test.js", this.payload);
|
|
121
|
+
// clean babelUI script
|
|
122
|
+
[
|
|
123
|
+
"build:cjs:src",
|
|
124
|
+
"build:cjs:ui",
|
|
125
|
+
"build:ui:cjs",
|
|
126
|
+
"build:es:src",
|
|
127
|
+
"build:es:ui",
|
|
128
|
+
"build:ui:es",
|
|
129
|
+
"mocha:ui",
|
|
130
|
+
].forEach((key) => {
|
|
131
|
+
delete data.scripts[key];
|
|
132
|
+
});
|
|
133
|
+
}
|
|
92
134
|
if (!this.payload.isUseWebpack) {
|
|
93
135
|
delete data.scripts["webpack"];
|
|
94
136
|
delete data.scripts["clean:webpack"];
|
|
@@ -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");
|
|
@@ -31,10 +31,17 @@
|
|
|
31
31
|
"format": "prettier-eslint --write 'src/**/*.js' 'ui/**/*.js*'",
|
|
32
32
|
"clean:webpack": "find ./assets -name '*.*' | xargs rm -rf && rm -rf workbox-*.js",
|
|
33
33
|
"clean": "find ./build -name '*.*' | xargs rm -rf",
|
|
34
|
+
"build:cjs:src": "BABEL_ENV=cjs babel src -d build/cjs/src --ignore /**/__tests__",
|
|
35
|
+
"build:cjs:ui": "BABEL_ENV=cjs babel ui -d build/cjs/ui --ignore /**/__tests__",
|
|
36
|
+
"build:ui:cjs": "npm run build:cjs:src && npm run build:cjs:ui",
|
|
34
37
|
"build:cjs": "BABEL_ENV=cjs babel src -d build/cjs/src<%= babelRootMode %>",
|
|
38
|
+
"build:es:src": "BABEL_ENV=es babel src -d build/es/src --out-file-extension .mjs",
|
|
39
|
+
"build:es:ui": "BABEL_ENV=es babel ui -d build/es/ui --out-file-extension .mjs",
|
|
40
|
+
"build:ui:es": "npm run build:es:src && npm run build:es:ui",
|
|
35
41
|
"build:es": "BABEL_ENV=es babel src -d build/es/src<%= babelRootMode %>",
|
|
36
42
|
"build": "npm run clean && npm run build:cjs && npm run build:es",
|
|
37
43
|
"mochaFor": "mocha -r global-jsdom/register",
|
|
44
|
+
"mocha:ui": "npm run mochaFor -- 'build/es/**/__tests__/*.mjs'",
|
|
38
45
|
"mocha": "npm run mochaFor -- 'build/cjs/**/__tests__/*.js'",
|
|
39
46
|
"test": "npm run build && npm run mocha",
|
|
40
47
|
"prepublishOnly": "npm run test"
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.17.
|
|
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"
|