generator-reshow 0.16.3 → 0.17.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.
@@ -6,8 +6,7 @@
6
6
  * https://github.com/yeoman/yeoman-test/blob/main/lib/run-context.js
7
7
  */
8
8
 
9
- const getYoUnit = require("yo-unit");
10
- const { YoTest, assert } = getYoUnit();
9
+ const { YoTest, assert } = require("yo-unit");
11
10
 
12
11
  describe("generator-reshow:app", () => {
13
12
  let runResult;
@@ -1,5 +1,4 @@
1
- const getYo = require("yo-reshow");
2
- const { YoGenerator, YoHelper, commonPrompt } = getYo();
1
+ const { YoGenerator, YoHelper, commonPrompt } = require("yo-reshow");
3
2
 
4
3
  /**
5
4
  * App Generator
@@ -10,18 +10,10 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "get-object-value": "*",
14
- "organism-react-ajax": "*",
15
- "organism-react-navigation": "*",
16
- "organism-react-popup": "*",
17
- "organism-react-progress": "*",
18
13
  "pmvc_react_admin": "*",
19
- "react": "^16.x",
20
- "react-dom": "^16.x",
21
- "reshow": "*",
14
+ "react": "^18.x",
15
+ "react-dom": "^18.x",
22
16
  "reshow-app": "*",
23
- "reshow-constant": "*",
24
- "reshow-url": "*",
25
17
  "ricon": "*"
26
18
  },
27
19
  "scripts": {
@@ -6,8 +6,7 @@
6
6
  * https://github.com/yeoman/yeoman-test/blob/main/lib/run-context.js
7
7
  */
8
8
 
9
- const getYoUnit = require("yo-unit");
10
- const { YoTest, assert } = getYoUnit();
9
+ const { YoTest, assert } = require("yo-unit");
11
10
 
12
11
  describe("!! compile-sh !!", () => {
13
12
  let runResult;
@@ -1,12 +1,12 @@
1
- const getYo = require("yo-reshow");
2
- const { YoGenerator, YoHelper, commonPrompt } = getYo();
1
+ const { YoGenerator, YoHelper, commonPrompt } = require("yo-reshow");
3
2
 
4
3
  /**
5
4
  * compile-sh Generator
6
5
  */
7
6
  module.exports = class extends YoGenerator {
8
7
  writing() {
9
- const { cp } = YoHelper(this);
10
- cp("compile.sh", null, { webpackEnabled: this.options.webpackEnabled });
8
+ const { cp, getDotYo } = YoHelper(this);
9
+ const { webpackEnabled } = { ...this.options, ...getDotYo(this.options) };
10
+ cp("compile.sh", null, { webpackEnabled }, true);
11
11
  }
12
12
  };
@@ -6,8 +6,7 @@
6
6
  * https://github.com/yeoman/yeoman-test/blob/main/lib/run-context.js
7
7
  */
8
8
 
9
- const getYoUnit = require("yo-unit");
10
- const { YoTest, assert } = getYoUnit();
9
+ const { YoTest, assert } = require("yo-unit");
11
10
 
12
11
  describe("!! docker !!", () => {
13
12
  let runResult;
@@ -1,5 +1,4 @@
1
- const getYo = require("yo-reshow");
2
- const { YoGenerator, YoHelper, commonPrompt } = getYo();
1
+ const { YoGenerator, YoHelper, commonPrompt } = require("yo-reshow");
3
2
 
4
3
  /**
5
4
  * docker Generator
@@ -3,7 +3,8 @@ version: 2.1
3
3
  executors:
4
4
  docker-publisher:
5
5
  docker:
6
- - image: circleci/buildpack-deps:18.04
6
+ # https://github.com/CircleCI-Public/cimg-base
7
+ - image: cimg/base:current
7
8
 
8
9
  jobs:
9
10
  build-and-publish:
@@ -6,8 +6,7 @@
6
6
  * https://github.com/yeoman/yeoman-test/blob/main/lib/run-context.js
7
7
  */
8
8
 
9
- const getYoUnit = require("yo-unit");
10
- const { YoTest, assert } = getYoUnit();
9
+ const { YoTest, assert } = require("yo-unit");
11
10
 
12
11
  describe("!! generator !!", () => {
13
12
  let runResult;
@@ -1,5 +1,4 @@
1
- const getYo = require("yo-reshow");
2
- const { YoGenerator, YoHelper, commonPrompt } = getYo();
1
+ const { YoGenerator, YoHelper, commonPrompt } = require("yo-reshow");
3
2
 
4
3
  /**
5
4
  * The Generator
@@ -6,8 +6,7 @@
6
6
  * https://github.com/yeoman/yeoman-test/blob/main/lib/run-context.js
7
7
  */
8
8
 
9
- const getYoUnit = require("yo-unit");
10
- const { YoTest, assert } = getYoUnit();
9
+ const { YoTest, assert } = require("yo-unit");
11
10
 
12
11
  describe("!! <%= mainName %> !!", () => {
13
12
  let runResult;
@@ -1,5 +1,4 @@
1
- const getYo = require("yo-reshow");
2
- const { YoGenerator, YoHelper, commonPrompt } = getYo();
1
+ const { YoGenerator, YoHelper, commonPrompt } = require("yo-reshow");
3
2
 
4
3
  /**
5
4
  * <%= mainName %> Generator
@@ -6,8 +6,7 @@
6
6
  * https://github.com/yeoman/yeoman-test/blob/main/lib/run-context.js
7
7
  */
8
8
 
9
- const getYoUnit = require("yo-unit");
10
- const { YoTest, assert } = getYoUnit();
9
+ const { YoTest, assert } = require("yo-unit");
11
10
 
12
11
  describe("!! library !!", () => {
13
12
  let runResult;
@@ -1,5 +1,4 @@
1
- const getYo = require("yo-reshow");
2
- const { YoGenerator, YoHelper, commonPrompt } = getYo();
1
+ const { YoGenerator, YoHelper, commonPrompt } = require("yo-reshow");
3
2
 
4
3
  /**
5
4
  * Library Generator
@@ -6,8 +6,7 @@
6
6
  * https://github.com/yeoman/yeoman-test/blob/main/lib/run-context.js
7
7
  */
8
8
 
9
- const getYoUnit = require("yo-unit");
10
- const { YoTest, assert } = getYoUnit();
9
+ const { YoTest, assert } = require("yo-unit");
11
10
 
12
11
  describe("!! npm !!", () => {
13
12
  let runResult;
@@ -1,5 +1,4 @@
1
- const getYo = require("yo-reshow");
2
- const { YoGenerator, YoHelper, commonPrompt } = getYo();
1
+ const { YoGenerator, YoHelper, commonPrompt } = require("yo-reshow");
3
2
 
4
3
  /**
5
4
  * NPM Generator
@@ -6,8 +6,7 @@
6
6
  * https://github.com/yeoman/yeoman-test/blob/main/lib/run-context.js
7
7
  */
8
8
 
9
- const getYoUnit = require("yo-unit");
10
- const { YoTest, assert } = getYoUnit();
9
+ const { YoTest, assert } = require("yo-unit");
11
10
 
12
11
  describe("!! update-esm-export !!", () => {
13
12
  let runResult;
@@ -1,6 +1,4 @@
1
- const getYo = require("yo-reshow");
2
- const { KEYS } = require("reshow-constant");
3
- const { YoGenerator, YoHelper, commonPrompt } = getYo();
1
+ const { YoGenerator, YoHelper, commonPrompt } = require("yo-reshow");
4
2
 
5
3
  /**
6
4
  * update-esm-export Generator
@@ -27,32 +25,46 @@ module.exports = class extends YoGenerator {
27
25
  * https://github.com/SBoudrias/Inquirer.js
28
26
  */
29
27
  async prompting() {
30
- const {
31
- say,
32
- exit,
33
- isFile,
34
- getDotYo,
35
- glob,
36
- updateJSON,
37
- } = YoHelper(this);
28
+ const { say, exit, isFile, getDotYo, glob, updateJSON } = YoHelper(this);
38
29
  const pkg = isFile("package.json");
39
30
 
40
31
  const opts = getDotYo();
41
32
  if (!opts.exports) {
42
33
  return;
43
34
  }
44
- const { srcArr, appendArr, prependArr, moreKeyArr, moreValArr, pkgjson } =
45
- opts.exports;
35
+ const {
36
+ srcArr,
37
+ prependArr,
38
+ moreKeyArr,
39
+ moreValArr,
40
+ pkgjson,
41
+ appendArr,
42
+ requirePrependArr,
43
+ requireAppendArr,
44
+ importPrependArr,
45
+ importAppendArr,
46
+ } = opts.exports;
46
47
  const nextExports = {};
47
48
  srcArr.forEach((v, index) => {
48
49
  const prepend = prependArr[index];
49
- const append = appendArr[index];
50
50
  glob(
51
51
  v,
52
52
  ({ filename }) => {
53
- nextExports[
54
- `${prepend}${filename}`
55
- ] = `${prepend}${filename}${append}`;
53
+ let content;
54
+ if (appendArr) {
55
+ const append = appendArr[index];
56
+ content = `${prepend}${filename}${append}`;
57
+ } else {
58
+ content = {
59
+ require: `${requirePrependArr[index]}${filename}${requireAppendArr[index]}`,
60
+ import: `${importPrependArr[index]}${filename}${importAppendArr[index]}`,
61
+ };
62
+ }
63
+ let nextKey = `${prepend}${filename}`;
64
+ if (nextKey === "./index") {
65
+ nextKey = ".";
66
+ }
67
+ nextExports[nextKey] = content;
56
68
  },
57
69
  true
58
70
  );
@@ -63,20 +75,27 @@ module.exports = class extends YoGenerator {
63
75
 
64
76
  const pkgFile = isFile(pkgjson);
65
77
  if (pkgFile) {
66
- updateJSON(null, pkgFile, null, ({ exports, ...json }) => {
78
+ updateJSON(null, pkgFile, null, ({ exports = {}, ...json }) => {
67
79
  if (this.options.n) {
68
80
  const diff = {};
69
81
  KEYS(exports).forEach((key) => {
70
82
  if (exports[key] !== nextExports[key]) {
71
83
  diff[key] = {
72
84
  prev: exports[key],
73
- next: nextExports[key]
85
+ next: nextExports[key],
74
86
  };
75
87
  }
76
- delete exports[key];
88
+ if (exports[key] && nextExports[key]) {
89
+ delete exports[key];
90
+ delete nextExports[key];
91
+ }
77
92
  });
78
- const allDiff = {...diff, ...exports};
79
- this.log({allDiff});
93
+ const allDiff = {
94
+ new: nextExports,
95
+ willClean: exports,
96
+ modify: diff,
97
+ };
98
+ this.log({ allDiff });
80
99
  return null;
81
100
  } else {
82
101
  json.exports = nextExports;
@@ -84,7 +103,6 @@ module.exports = class extends YoGenerator {
84
103
  }
85
104
  });
86
105
  }
87
-
88
106
  }
89
107
 
90
108
  writing() {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-reshow",
3
- "version": "0.16.3",
3
+ "version": "0.17.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.16.0"
17
+ "yo-reshow": "*"
18
18
  },
19
19
  "devDependencies": {
20
- "yo-unit": "^0.16.0"
20
+ "yo-unit": "*"
21
21
  },
22
22
  "files": [
23
23
  "generators"