generator-reshow 0.16.0 → 0.16.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.
- package/generators/app/templates/README.md +8 -2
- package/generators/app/templates/package.json +1 -2
- package/generators/app/templates/src/usePage.js +1 -1
- package/generators/compile-sh/templates/compile.sh +48 -38
- package/generators/docker/README.md +9 -0
- package/generators/docker/__tests__/Test.js +45 -0
- package/generators/docker/index.js +100 -0
- package/generators/docker/templates/.env.build +4 -0
- package/generators/docker/templates/Dockerfile +9 -0
- package/generators/docker/templates/README.md +12 -0
- package/generators/docker/templates/_circleci/config.yml +52 -0
- package/generators/docker/templates/_gitignore +3 -0
- package/generators/docker/templates/build.sh +22 -0
- package/generators/docker/templates/compile.sh +123 -0
- package/generators/docker/templates/enter +24 -0
- package/generators/docker/templates/install-packages.sh +24 -0
- package/generators/docker/templates/support/FOLDER_PREFIX.sh +8 -0
- package/generators/docker/templates/support/VERSION.sh +8 -0
- package/generators/docker/templates/support/sourceImage.sh +8 -0
- package/generators/docker/templates/support/targetImage.sh +8 -0
- package/generators/generator/templates/index.js +4 -7
- package/generators/library/index.js +1 -1
- package/generators/library/templates/README.md +3 -3
- package/generators/npm/index.js +1 -1
- package/generators/npm/templates/README.md +1 -1
- package/generators/update-esm-export/README.md +9 -0
- package/generators/update-esm-export/__tests__/Test.js +45 -0
- package/generators/update-esm-export/index.js +91 -0
- package/package.json +2 -3
- package/generators/library/templates/yarn.lock +0 -4075
- package/generators/npm/templates/yarn.lock +0 -4026
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
> <%= description %>
|
|
4
4
|
|
|
5
5
|
## Repositories
|
|
6
|
-
* GIT
|
|
7
|
-
*
|
|
8
|
-
* NPM
|
|
6
|
+
* `GIT`
|
|
7
|
+
* <%= repositoryHomepage %>
|
|
8
|
+
* `NPM`
|
|
9
9
|
* https://www.npmjs.com/package/<%= mainName %>
|
|
10
10
|
|
|
11
11
|
## Usage
|
package/generators/npm/index.js
CHANGED
|
@@ -63,7 +63,7 @@ module.exports = class extends YoGenerator {
|
|
|
63
63
|
cp("src", null, this.payload);
|
|
64
64
|
cp("README.md", null, this.payload);
|
|
65
65
|
cp("Test.js", "src/__tests__/Test.js", this.payload);
|
|
66
|
-
cp("yarn.lock");
|
|
66
|
+
// cp("yarn.lock");
|
|
67
67
|
|
|
68
68
|
updateJSON("package.json", null, this.payload, (data) => {
|
|
69
69
|
data.repository = this.payload.repository;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://yeoman.io/authoring/testing.html
|
|
3
|
+
* https://gilsondev.gitbooks.io/yeoman-authoring/content/authoring/unit_testing.html
|
|
4
|
+
*
|
|
5
|
+
* https://github.com/yeoman/yeoman-assert/blob/main/index.js
|
|
6
|
+
* https://github.com/yeoman/yeoman-test/blob/main/lib/run-context.js
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const getYoUnit = require("yo-unit");
|
|
10
|
+
const { YoTest, assert } = getYoUnit();
|
|
11
|
+
|
|
12
|
+
describe("!! update-esm-export !!", () => {
|
|
13
|
+
let runResult;
|
|
14
|
+
|
|
15
|
+
before(async () => {
|
|
16
|
+
runResult = await YoTest({
|
|
17
|
+
source: __dirname + "/../.",
|
|
18
|
+
params: {
|
|
19
|
+
isReady: true,
|
|
20
|
+
appNamee: "foo",
|
|
21
|
+
description: "foo-desc",
|
|
22
|
+
keyword: "foo-keyword",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
after(() => {
|
|
28
|
+
if (runResult) {
|
|
29
|
+
runResult.restore();
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("should have folder", () => {
|
|
34
|
+
// assert.file(["src", "ui"]);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("should have file", () => {
|
|
38
|
+
// assert.file(["compile.sh", "index.html"]);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("should have content", () => {
|
|
42
|
+
// assert.fileContent('composer.json', 'foo-desc');
|
|
43
|
+
// assert.fileContent('.circleci/config.yml', 'foo');
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
const getYo = require("yo-reshow");
|
|
2
|
+
const { KEYS } = require("reshow-constant");
|
|
3
|
+
const { YoGenerator, YoHelper, commonPrompt } = getYo();
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* update-esm-export Generator
|
|
7
|
+
*/
|
|
8
|
+
module.exports = class extends YoGenerator {
|
|
9
|
+
/**
|
|
10
|
+
* Run loop (Life cycle)
|
|
11
|
+
* https://yeoman.io/authoring/running-context.html#the-run-loop
|
|
12
|
+
*
|
|
13
|
+
* 1. initializing
|
|
14
|
+
* 2. prompting
|
|
15
|
+
* 3. configuring
|
|
16
|
+
* 4. default
|
|
17
|
+
* 5. writing
|
|
18
|
+
* 6. conflicts
|
|
19
|
+
* 7. install
|
|
20
|
+
* 8. end
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Questions.
|
|
25
|
+
*
|
|
26
|
+
* https://www.alwaystwisted.com/post.php?s=using-lists-in-a-yeoman-generator
|
|
27
|
+
* https://github.com/SBoudrias/Inquirer.js
|
|
28
|
+
*/
|
|
29
|
+
async prompting() {
|
|
30
|
+
const {
|
|
31
|
+
say,
|
|
32
|
+
exit,
|
|
33
|
+
isFile,
|
|
34
|
+
getDotYo,
|
|
35
|
+
glob,
|
|
36
|
+
updateJSON,
|
|
37
|
+
} = YoHelper(this);
|
|
38
|
+
const pkg = isFile("package.json");
|
|
39
|
+
|
|
40
|
+
const opts = getDotYo();
|
|
41
|
+
if (!opts.exports) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const { srcArr, appendArr, prependArr, moreKeyArr, moreValArr, pkgjson } =
|
|
45
|
+
opts.exports;
|
|
46
|
+
const nextExports = {};
|
|
47
|
+
srcArr.forEach((v, index) => {
|
|
48
|
+
const prepend = prependArr[index];
|
|
49
|
+
const append = appendArr[index];
|
|
50
|
+
glob(
|
|
51
|
+
v,
|
|
52
|
+
({ filename }) => {
|
|
53
|
+
nextExports[
|
|
54
|
+
`${prepend}${filename}`
|
|
55
|
+
] = `${prepend}${filename}${append}`;
|
|
56
|
+
},
|
|
57
|
+
true
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
moreKeyArr?.forEach((v, index) => {
|
|
61
|
+
nextExports[v] = moreValArr[index];
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const pkgFile = isFile(pkgjson);
|
|
65
|
+
if (pkgFile) {
|
|
66
|
+
updateJSON(null, pkgFile, null, ({ exports, ...json }) => {
|
|
67
|
+
if (this.options.n) {
|
|
68
|
+
const diff = {};
|
|
69
|
+
KEYS(exports).forEach((key) => {
|
|
70
|
+
if (exports[key] !== nextExports[key]) {
|
|
71
|
+
diff[key] = {
|
|
72
|
+
prev: exports[key],
|
|
73
|
+
next: nextExports[key]
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
delete exports[key];
|
|
77
|
+
});
|
|
78
|
+
const allDiff = {...diff, ...exports};
|
|
79
|
+
this.log({allDiff});
|
|
80
|
+
return null;
|
|
81
|
+
} else {
|
|
82
|
+
json.exports = nextExports;
|
|
83
|
+
return json;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
writing() {}
|
|
91
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "generator-reshow",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.3",
|
|
4
4
|
"description": "Yeoman generator for reshow. (app, generator, ...etc)",
|
|
5
5
|
"author": "Hill <hill@kimo.com>",
|
|
6
6
|
"repository": {
|
|
@@ -33,6 +33,5 @@
|
|
|
33
33
|
},
|
|
34
34
|
"bugs": {
|
|
35
35
|
"url": "https://github.com/react-atomic/reshow/issues"
|
|
36
|
-
}
|
|
37
|
-
"gitHead": "be1806f6f2d188920e2c36ff2c150e584ef7d7fc"
|
|
36
|
+
}
|
|
38
37
|
}
|