@zohodesk/react-cli 0.0.1-test.148.2 → 1.0.0

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.
Files changed (174) hide show
  1. package/.eslintignore +7 -7
  2. package/.eslintrc.js +180 -183
  3. package/.prettierrc +6 -0
  4. package/{CHANGELOG.md → CHANGELOG-fz.md} +0 -0
  5. package/Changelog.md +1019 -0
  6. package/README.md +1152 -678
  7. package/bin/cli.js +483 -392
  8. package/docs/CustomChunks.md +26 -0
  9. package/docs/DevServerPort.md +39 -0
  10. package/docs/DevStart.md +18 -0
  11. package/docs/HoverActive.md +12 -0
  12. package/docs/InstallNode.md +28 -0
  13. package/docs/SelectorWeight.md +6 -0
  14. package/docs/TODOS.md +10 -0
  15. package/docs/ValueReplacer.md +60 -0
  16. package/docs/VariableConversion.md +724 -0
  17. package/docs/warnings_while_install.txt +35 -0
  18. package/files/eslintrc.js +62 -62
  19. package/files/prettierrc.js +3 -3
  20. package/lib/common/index.js +6 -6
  21. package/lib/common/splitChunks.js +60 -12
  22. package/lib/common/sslcertUpdater.js +59 -0
  23. package/lib/common/testPattern.js +69 -0
  24. package/lib/common/valueReplacer.js +55 -0
  25. package/lib/configs/jest.config.js +18 -8
  26. package/lib/configs/libAlias.js +38 -0
  27. package/lib/configs/resolvers.js +40 -0
  28. package/lib/configs/webpack.css.umd.config.js +4 -4
  29. package/lib/configs/webpack.dev.config.js +59 -54
  30. package/lib/configs/webpack.docs.config.js +56 -53
  31. package/lib/configs/webpack.impact.config.js +54 -50
  32. package/lib/configs/webpack.prod.config.js +72 -47
  33. package/lib/constants.js +31 -0
  34. package/lib/jest/preProcessors/cssPreprocessor.js +16 -7
  35. package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
  36. package/lib/loaderUtils/getCSSLoaders.js +89 -21
  37. package/lib/loaderUtils/index.js +4 -4
  38. package/lib/loaderUtils/windowsModification.js +11 -0
  39. package/lib/loaders/fileBountryLoader.js +17 -0
  40. package/lib/loaders/scriptInstrumentLoader.js +2 -2
  41. package/lib/loaders/selectorMappingLoader.js +75 -0
  42. package/lib/loaders/workerLoader.js +9 -9
  43. package/lib/pluginUtils/configHtmlWebpackPlugins.js +59 -0
  44. package/lib/pluginUtils/getDevPlugins.js +69 -45
  45. package/lib/pluginUtils/getDocsPlugins.js +6 -8
  46. package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
  47. package/lib/pluginUtils/getProdPlugins.js +73 -58
  48. package/lib/pluginUtils/index.js +12 -12
  49. package/lib/plugins/CdnChangePlugin.js +16 -2
  50. package/lib/plugins/EFCPlugin.js +52 -20
  51. package/lib/plugins/EFCPlugin.md +6 -0
  52. package/lib/plugins/EFCTemplatePlugin.js +151 -0
  53. package/lib/plugins/I18NInjectIntoIndexPlugin.js +4 -4
  54. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
  55. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
  56. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +8 -8
  57. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -86
  58. package/lib/plugins/I18nSplitPlugin/README.md +25 -25
  59. package/lib/plugins/I18nSplitPlugin/index.js +57 -57
  60. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +2 -2
  61. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +1 -1
  62. package/lib/plugins/ManifestPlugin.js +8 -0
  63. package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
  64. package/lib/plugins/ResourceHintsPlugin.js +17 -17
  65. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +11 -7
  66. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
  67. package/lib/plugins/SelectorPlugin.js +97 -0
  68. package/lib/plugins/ServiceWorkerPlugin.js +13 -9
  69. package/lib/plugins/SourceMapHookPlugin.js +9 -3
  70. package/lib/plugins/TPHashMappingPlugin.js +4 -4
  71. package/lib/plugins/VariableConversionCollector.js +352 -0
  72. package/lib/plugins/composeCommonPlugin.js +30 -0
  73. package/lib/plugins/index.js +36 -36
  74. package/lib/plugins/libraryImpactPlugin.js +14 -2
  75. package/lib/postcss-plugins/{ExcludeRTLPlugin.js → ExcludePlugin.js} +1 -1
  76. package/lib/postcss-plugins/RTLSplitPlugin.js +36 -32
  77. package/lib/postcss-plugins/ValueReplacer.js +46 -0
  78. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
  79. package/lib/postcss-plugins/__test__/test1Input.css +39 -0
  80. package/lib/postcss-plugins/__test__/test1Output.css +39 -0
  81. package/lib/postcss-plugins/hoverActivePlugin.js +389 -0
  82. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +60 -0
  83. package/lib/postcss-plugins/variableModificationPlugin/index.js +307 -0
  84. package/lib/postcss-plugins/variableModifier.js +244 -0
  85. package/lib/schemas/index.js +166 -11
  86. package/lib/servers/devBuild.js +102 -0
  87. package/lib/servers/docsServerCore.js +16 -18
  88. package/lib/servers/getCliPath.js +28 -0
  89. package/lib/servers/httpsOptions.js +49 -0
  90. package/lib/servers/nowatchserver.js +206 -0
  91. package/lib/servers/server.js +114 -82
  92. package/lib/sh/pre-commit.sh +34 -34
  93. package/lib/sh/reportPublish.sh +45 -45
  94. package/lib/templates/linterConstant.js +1 -1
  95. package/lib/utils/buildstats.html +148 -148
  96. package/lib/utils/cssClassNameGenerate.js +9 -2
  97. package/lib/utils/cssURLReplacer.js +30 -43
  98. package/lib/utils/getCurrentBranch.js +1 -1
  99. package/lib/utils/getDependenciesImpactList.js +14 -12
  100. package/lib/utils/getFileType.js +49 -0
  101. package/lib/utils/getOptions.js +118 -10
  102. package/lib/utils/index.js +44 -20
  103. package/lib/utils/jsonHelper.js +12 -3
  104. package/lib/utils/reinstallDependencies.js +1 -1
  105. package/lib/utils/repoClone.js +16 -4
  106. package/lib/utils/resultSchema.json +73 -73
  107. package/lib/utils/rtl.js +19 -2
  108. package/lib/utils/useExitCleanup.js +55 -0
  109. package/npm8.md +9 -0
  110. package/package.json +121 -142
  111. package/postpublish.js +8 -0
  112. package/result.json +1 -0
  113. package/templates/app/.eslintrc.js +140 -140
  114. package/templates/app/README.md +12 -12
  115. package/templates/app/app/index.html +24 -24
  116. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  117. package/templates/app/app/properties/i18nkeys.json +3 -3
  118. package/templates/app/docs/all.html +69 -69
  119. package/templates/app/mockapi/index.js +18 -18
  120. package/templates/app/package.json +37 -37
  121. package/templates/app/src/actions/SampleActions/index.js +37 -37
  122. package/templates/app/src/actions/index.js +65 -65
  123. package/templates/app/src/appUrls.js +19 -19
  124. package/templates/app/src/components/Alert/Alert.js +134 -134
  125. package/templates/app/src/components/Alert/Alert.module.css +79 -79
  126. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
  127. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
  128. package/templates/app/src/components/Sample/Sample.module.css +11 -11
  129. package/templates/app/src/components/Sample/SampleList.js +61 -61
  130. package/templates/app/src/components/Slider/Slider.css +41 -41
  131. package/templates/app/src/components/Slider/Slider.js +55 -55
  132. package/templates/app/src/containers/AlertContainer/index.js +15 -15
  133. package/templates/app/src/containers/AppContainer/index.js +96 -96
  134. package/templates/app/src/containers/AppContainer/index.module.css +27 -27
  135. package/templates/app/src/containers/CustomMatch/index.js +65 -65
  136. package/templates/app/src/containers/DevTools/index.js +10 -10
  137. package/templates/app/src/containers/Header/index.js +67 -67
  138. package/templates/app/src/containers/Header/index.module.css +43 -43
  139. package/templates/app/src/containers/Redirect/index.js +63 -63
  140. package/templates/app/src/containers/Redirector/index.js +47 -47
  141. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
  142. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
  143. package/templates/app/src/historyChange.js +5 -5
  144. package/templates/app/src/index.html +10 -10
  145. package/templates/app/src/index.js +24 -24
  146. package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
  147. package/templates/app/src/reducers/alertData.js +11 -11
  148. package/templates/app/src/reducers/index.js +6 -6
  149. package/templates/app/src/reducers/samples.js +19 -19
  150. package/templates/app/src/store/configureStore.dev.js +51 -51
  151. package/templates/app/src/store/configureStore.js +5 -5
  152. package/templates/app/src/store/configureStore.prod.js +26 -26
  153. package/templates/app/src/util/Common.js +5 -5
  154. package/templates/app/src/util/RequestAPI.js +132 -132
  155. package/templates/docs/all.html +249 -249
  156. package/templates/docs/component.html +178 -178
  157. package/templates/docs/components.html +221 -221
  158. package/templates/docs/css/b.min.css +6 -6
  159. package/templates/docs/css/component.css +42 -42
  160. package/templates/docs/css/componentTest.css +6 -6
  161. package/templates/docs/css/hopscotch.css +585 -585
  162. package/templates/docs/css/style.css +1022 -1022
  163. package/templates/docs/impactReportTemplate.html +154 -154
  164. package/templates/docs/index.html +1501 -1493
  165. package/templates/docs/js/active-line.js +72 -72
  166. package/templates/docs/js/b.min.js +7 -7
  167. package/templates/docs/js/codemirror.js +9680 -9680
  168. package/templates/docs/js/designTokens.js +334 -334
  169. package/templates/docs/js/j.min.js +4 -4
  170. package/templates/docs/js/javascript.js +874 -874
  171. package/templates/docs/js/matchbrackets.js +145 -145
  172. package/unittest/index.html +37 -0
  173. package/cert/cert.pem +0 -105
  174. package/cert/key.pem +0 -30
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
+ var _child_process = require("child_process");
9
+
8
10
  var _fs = _interopRequireDefault(require("fs"));
9
11
 
10
12
  var _path = _interopRequireDefault(require("path"));
@@ -13,10 +15,83 @@ var _schemas = _interopRequireDefault(require("../schemas"));
13
15
 
14
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
17
 
16
- let defaulter = (target, source) => {
17
- let defaultObject = {};
18
+ // import { argv } from 'process';
19
+ const args = process.argv.slice(2); // console.log('argv', argv);
20
+
21
+ const NPM_CONFIG_PREFIX = 'npm_config_'; // TODO: we have to do option parse logic little better
22
+ // if user use react-cli stritly without using npm scripts options won't work,
23
+ // So we have to write our own option parse logic or some other library
24
+ // console.log('type', process.argv, process.env.npm_config_check, process.env.npm_config_clone_type, process.env.npm_config_clone_url);
25
+ // console.log('Object.keys(process.env).filter(s => s.startsWith(\'npm_config_\') && s.includes(\'clone\')', Object.keys(process.env).filter(s => s.startsWith('npm_config_') && s.includes('clone')));
26
+ // // clone:type
27
+
28
+ const processEnv = {};
29
+ const keysWithColon = [];
30
+ Object.keys(process.env).filter(key => key.startsWith(NPM_CONFIG_PREFIX)).forEach(key => {
31
+ const nkey = key.slice(NPM_CONFIG_PREFIX.length);
32
+ processEnv[nkey] = process.env[key];
33
+ nkey.includes(':') && keysWithColon.push(nkey);
34
+ });
35
+ keysWithColon.forEach(key => {
36
+ const nkey = key.replace(/:/g, '_');
37
+
38
+ if (processEnv[nkey]) {
39
+ throw Error('there is some options conflict', key, nkey);
40
+ }
41
+
42
+ processEnv[nkey] = processEnv[key];
43
+ });
44
+
45
+ function getNpmVersion() {
46
+ // require("child_process").
47
+ let vers = '6';
48
+
49
+ try {
50
+ [vers] = (0, _child_process.execSync)('npm -v').toString().trim().split('.');
51
+ } catch (error) {
52
+ console.log(error);
53
+ }
54
+
55
+ return vers;
56
+ }
57
+
58
+ function getCWD() {
59
+ // require("child_process").
60
+ let cwd = process.cwd();
61
+
62
+ try {
63
+ const ress = (0, _child_process.execSync)('npm bin').toString();
64
+ const i = ress.lastIndexOf('node_modules');
65
+ cwd = i === -1 ? cwd : ress.slice(0, i);
66
+ } catch (error) {
67
+ console.log(error);
68
+ }
69
+
70
+ return cwd;
71
+ } // experimental argumnet parsing logic
72
+
73
+
74
+ args.forEach(option => {
75
+ if (/^--./.test(option)) {
76
+ const equIndex = option.indexOf('='); // equIndex = equIndex === -1 ? option.length : equIndex;
77
+
78
+ let key = option.slice(2, equIndex);
79
+ let value = option.slice(equIndex + 1);
80
+
81
+ if (equIndex === -1) {
82
+ key = option.slice(2);
83
+ value = true;
84
+ }
85
+
86
+ key = key.replace(/-|:/g, '_');
87
+ processEnv[key] = value;
88
+ }
89
+ });
90
+
91
+ const defaulter = (target, source) => {
92
+ const defaultObject = {};
18
93
  Object.keys(target).forEach(key => {
19
- let data = target[key];
94
+ const data = target[key];
20
95
 
21
96
  if (data && typeof data === 'object') {
22
97
  if (Array.isArray(data)) {
@@ -24,8 +99,10 @@ let defaulter = (target, source) => {
24
99
  } else if (typeof data.cli === 'string') {
25
100
  let cliData;
26
101
 
27
- if (typeof process.env[`npm_config_${data.cli}`] === 'string') {
28
- cliData = process.env[`npm_config_${data.cli}`];
102
+ if (typeof processEnv[data.cli] === 'string') {
103
+ cliData = processEnv[data.cli];
104
+ } else if (typeof processEnv[data.cli.toLowerCase()] === 'string') {
105
+ cliData = processEnv[data.cli.toLowerCase()];
29
106
  } else {
30
107
  cliData = source && source[key] || data.value;
31
108
  }
@@ -45,23 +122,54 @@ let defaulter = (target, source) => {
45
122
  return defaultObject;
46
123
  };
47
124
 
48
- global.reactCLIOptions = null;
125
+ global.reactCLIOptions = null; // function selectn(obj, key) {
126
+ // let temp = obj;
127
+ // let keys = key.split('.');
128
+ // for (let i = 0; i < keys.length; i++) {
129
+ // const element = keys[i];
130
+ // temp = temp && temp[element];
131
+ // }
132
+ // return temp;
133
+ // }
134
+
135
+ function deprecationSupport(options) {
136
+ // if (selectn(options, ".app.hasRTL") === true) {
137
+ if (options.app.hasRTL === true) {
138
+ options.app.plugins.hasRTL = true;
139
+ }
49
140
 
50
- let getOptions = () => {
141
+ if (options.docs.hasRTL === true) {
142
+ options.docs.plugins.hasRTL = true;
143
+ }
144
+
145
+ if (options.app.rtlExclude.length > 0) {
146
+ options.app.exclude.rtl = options.app.rtlExclude;
147
+ }
148
+
149
+ if (options.docs.rtlExclude.length > 0) {
150
+ options.docs.exclude.rtl = options.docs.rtlExclude;
151
+ }
152
+ }
153
+
154
+ const getOptions = () => {
51
155
  if (global.reactCLIOptions) {
52
156
  return global.reactCLIOptions;
53
157
  }
54
158
 
55
- let appPath = process.cwd();
159
+ const appPath = process.cwd();
56
160
  let userSchemas;
57
161
 
58
- let packagePath = _path.default.join(appPath, 'package.json');
162
+ const packagePath = _path.default.join(appPath, 'package.json');
59
163
 
60
164
  if (_fs.default.existsSync(packagePath)) {
61
165
  userSchemas = require(packagePath)['react-cli'] || {};
62
166
  }
63
167
 
64
- let options = defaulter(_schemas.default, userSchemas || {});
168
+ const options = defaulter(_schemas.default, userSchemas || {}); // for future may be for npm 8 edge cases
169
+
170
+ options.npmVersion = getNpmVersion();
171
+ options.cwd = getCWD();
172
+ deprecationSupport(options);
65
173
  options.packageVersion = process.env.npm_package_version;
66
174
  global.reactCLIOptions = options;
67
175
  return options;
@@ -21,22 +21,16 @@ var _exportNames = {
21
21
  getComponents: true,
22
22
  ssTestHack: true
23
23
  };
24
- Object.defineProperty(exports, "getOptions", {
25
- enumerable: true,
26
- get: function () {
27
- return _getOptions.default;
28
- }
29
- });
30
24
  Object.defineProperty(exports, "createEventStream", {
31
25
  enumerable: true,
32
26
  get: function () {
33
27
  return _createEventStream.default;
34
28
  }
35
29
  });
36
- Object.defineProperty(exports, "getServerURL", {
30
+ Object.defineProperty(exports, "getComponents", {
37
31
  enumerable: true,
38
32
  get: function () {
39
- return _getServerURL.default;
33
+ return _getComponents.default;
40
34
  }
41
35
  });
42
36
  Object.defineProperty(exports, "getCurrentBranch", {
@@ -45,22 +39,23 @@ Object.defineProperty(exports, "getCurrentBranch", {
45
39
  return _getCurrentBranch.default;
46
40
  }
47
41
  });
48
- Object.defineProperty(exports, "switchBranch", {
42
+ Object.defineProperty(exports, "getDependenciesImpactList", {
49
43
  enumerable: true,
50
44
  get: function () {
51
- return _switchBranch.default;
45
+ return _getDependenciesImpactList.default;
52
46
  }
53
47
  });
54
- Object.defineProperty(exports, "pullOrigin", {
48
+ exports.getLibraryConflict = exports.getInfoFromPublicPaths = void 0;
49
+ Object.defineProperty(exports, "getOptions", {
55
50
  enumerable: true,
56
51
  get: function () {
57
- return _pullOrigin.default;
52
+ return _getOptions.default;
58
53
  }
59
54
  });
60
- Object.defineProperty(exports, "request", {
55
+ Object.defineProperty(exports, "getServerURL", {
61
56
  enumerable: true,
62
57
  get: function () {
63
- return _request.default;
58
+ return _getServerURL.default;
64
59
  }
65
60
  });
66
61
  Object.defineProperty(exports, "jsonHelper", {
@@ -69,16 +64,17 @@ Object.defineProperty(exports, "jsonHelper", {
69
64
  return _jsonHelper.default;
70
65
  }
71
66
  });
72
- Object.defineProperty(exports, "getDependenciesImpactList", {
67
+ exports.makeDir = exports.log = void 0;
68
+ Object.defineProperty(exports, "pullOrigin", {
73
69
  enumerable: true,
74
70
  get: function () {
75
- return _getDependenciesImpactList.default;
71
+ return _pullOrigin.default;
76
72
  }
77
73
  });
78
- Object.defineProperty(exports, "getComponents", {
74
+ Object.defineProperty(exports, "request", {
79
75
  enumerable: true,
80
76
  get: function () {
81
- return _getComponents.default;
77
+ return _request.default;
82
78
  }
83
79
  });
84
80
  Object.defineProperty(exports, "ssTestHack", {
@@ -87,7 +83,13 @@ Object.defineProperty(exports, "ssTestHack", {
87
83
  return _ssTestHack.default;
88
84
  }
89
85
  });
90
- exports.getLibraryConflict = exports.getInfoFromPublicPaths = exports.makeDir = exports.writeFile = exports.log = void 0;
86
+ Object.defineProperty(exports, "switchBranch", {
87
+ enumerable: true,
88
+ get: function () {
89
+ return _switchBranch.default;
90
+ }
91
+ });
92
+ exports.writeFile = void 0;
91
93
 
92
94
  var _stream = require("stream");
93
95
 
@@ -235,9 +237,10 @@ let getInfoFromPublicPaths = publicPaths => {
235
237
 
236
238
  exports.getInfoFromPublicPaths = getInfoFromPublicPaths;
237
239
 
238
- let getLibraryConflict = (moduleObject, impactObj) => {
240
+ let getLibraryConflict = (moduleObject, impactObj, changesOnly) => {
239
241
  let srcChanges = [];
240
242
  let libraryChanges = [];
243
+ let overallSourceList = [];
241
244
  let allImpactArray = [];
242
245
  let impactThere = true;
243
246
  let whichLibrary = "";
@@ -260,6 +263,24 @@ let getLibraryConflict = (moduleObject, impactObj) => {
260
263
  });
261
264
  });
262
265
 
266
+ if (!changesOnly) {
267
+ srcChanges = [];
268
+
269
+ if (libraryChanges.length > 0) {
270
+ libraryChanges.forEach(mdataLibKey => {
271
+ if (moduleObject[mdataLibKey]) {
272
+ moduleObject[mdataLibKey].referencedby.forEach(refByFileName => {
273
+ if (refByFileName.indexOf("@zohodesk") == -1) {
274
+ if (srcChanges.indexOf(refByFileName) == -1) {
275
+ srcChanges.push(refByFileName);
276
+ }
277
+ }
278
+ });
279
+ }
280
+ });
281
+ } else {}
282
+ }
283
+
263
284
  if (srcChanges.length > 0) {
264
285
  srcChanges.forEach(srcFile => {
265
286
  let cacheObject = {};
@@ -283,6 +304,9 @@ let getLibraryConflict = (moduleObject, impactObj) => {
283
304
  if (cacheLibraryList.length > 0) {
284
305
  cacheObject.impactedBy = cacheLibraryList;
285
306
  allImpactArray.push(cacheObject);
307
+ } else {
308
+ impactThere = false;
309
+ whichLibrary = "No component file changes!";
286
310
  }
287
311
  });
288
312
  } else {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setTestInfoStatus = exports.jsonHelper = exports.jsonConcate = exports.fileHandler = exports.getRunnerDetail = void 0;
6
+ exports.setTestInfoStatus = exports.jsonHelper = exports.jsonConcate = exports.getRunnerDetail = exports.fileHandler = void 0;
7
7
 
8
8
  let fs = require('fs');
9
9
 
@@ -45,12 +45,21 @@ let fileHandler = {
45
45
  };
46
46
  exports.fileHandler = fileHandler;
47
47
 
48
+ const isObject = obj => obj && obj.constructor === {}.constructor;
49
+
50
+ const isArray = obj => obj && obj.constructor === [].constructor; // In below funtion
51
+ // this function is for concat two json object like _.extend,
52
+ // if botha array we concat them
53
+ // if both object we use call this function recurcively
54
+ // if both differend data type we will just assign it
55
+
56
+
48
57
  let jsonConcate = (receiverObj, senterObj) => {
49
58
  Object.keys(senterObj).map(key => {
50
59
  if (Object.prototype.hasOwnProperty.call(receiverObj, key)) {
51
- if (receiverObj[key].constructor === {}.constructor && senterObj[key].constructor === {}.constructor) {
60
+ if (isObject(receiverObj[key]) && isObject(senterObj[key])) {
52
61
  jsonConcate(receiverObj[key], senterObj[key]);
53
- } else if (receiverObj[key].constructor === [].constructor && senterObj[key].constructor === [].constructor) {
62
+ } else if (isArray(receiverObj[key]) && isArray(senterObj[key])) {
54
63
  receiverObj[key] = receiverObj[key].concat(senterObj[key]);
55
64
  } else {
56
65
  receiverObj[key] = senterObj[key];
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.reinstallDependencies = exports.reinstallDependencies1 = exports.collectPackageDiff = void 0;
6
+ exports.reinstallDependencies1 = exports.reinstallDependencies = exports.collectPackageDiff = void 0;
7
7
 
8
8
  var _fs = _interopRequireDefault(require("fs"));
9
9
 
@@ -12,6 +12,14 @@ var _index = require("./index");
12
12
 
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
 
15
+ function spawnSyncWithErrorLog(...args) {
16
+ let result = (0, _child_process.spawnSync)(...args);
17
+
18
+ if (result.stderr) {
19
+ console.error(result.stderr);
20
+ }
21
+ }
22
+
15
23
  let options = (0, _index.getOptions)();
16
24
  let {
17
25
  clone: {
@@ -20,6 +28,7 @@ let {
20
28
  branch,
21
29
  revision,
22
30
  projectName,
31
+ shallowClone,
23
32
  cacheDir,
24
33
  remoteName,
25
34
  shouldDelete
@@ -65,8 +74,11 @@ let cloneRepo = () => {
65
74
  }
66
75
  }
67
76
 
68
- (0, _index.log)(`Going to clone ${url} repo to ${cacheDir} path`);
69
- (0, _child_process.spawnSync)(type, ['clone', url, revisionOrBranch, projectName], {
77
+ (0, _index.log)(`Going to clone ${url} repo to ${cacheDir} path`); // this is for some time error will because of hg or git so we addid error log for this
78
+
79
+ let oargs = ['clone', url, revisionOrBranch, projectName];
80
+ type === 'git' && shallowClone && oargs.push('--depth=1');
81
+ spawnSyncWithErrorLog(type, oargs, {
70
82
  cwd: cacheDir,
71
83
  stdio: 'inherit'
72
84
  });
@@ -87,7 +99,7 @@ if (_fs.default.existsSync(projectPath)) {
87
99
 
88
100
  if (remoteUrl === url) {
89
101
  if (type === 'git') {
90
- (0, _child_process.spawnSync)(type, ['pull', remoteName, branch], {
102
+ spawnSyncWithErrorLog(type, ['pull', remoteName, branch], {
91
103
  cwd: projectPath,
92
104
  stdio: 'inherit'
93
105
  });
@@ -100,7 +112,7 @@ if (_fs.default.existsSync(projectPath)) {
100
112
  revisionOrBranch = `-b${branch}`;
101
113
  }
102
114
 
103
- (0, _child_process.spawnSync)(type, ['pull', revisionOrBranch, '-u', url], {
115
+ spawnSyncWithErrorLog(type, ['pull', revisionOrBranch, '-u', url], {
104
116
  cwd: projectPath,
105
117
  stdio: 'inherit'
106
118
  });
@@ -1,73 +1,73 @@
1
- {
2
- "jobDetails": {
3
- "isTriggeredFromGit": true,
4
- "isCIPassed": true,
5
- "developerName": "GITLAB_USER_NAME",
6
- "jobID": "CI_PIPELINE_ID",
7
- "branchName": "CI_COMMIT_REF_NAME",
8
- "commitMessage": "CI_COMMIT_MESSAGE",
9
- "jobURL": "CI_JOB_URL",
10
- "isByManual": "CI_JOB_MANUAL",
11
- "commitID": "CI_COMMIT_SHA",
12
- "executionTime": "Date.now()-Date.now()",
13
- "hostName": "kathir-zt252"
14
- },
15
- "tests": {
16
- "unitCase": {
17
- "startTime": "123455",
18
- "endTime": "123446",
19
- "isExecuted": true,
20
- "numberOfSuccess": "",
21
- "numberOfFails": "",
22
- "numberOfCases": "",
23
- "numberOfSuites": "",
24
- "fileDetail": {
25
- "fileName": "sample.spec.js",
26
- "caseDetail": {
27
- "failedCaseLists": [],
28
- "passedCaseList": []
29
- }
30
- },
31
- "coverageDetail": {
32
- "codeCoveragePercentage": "",
33
- "fileCoveragePercentage": ""
34
- }
35
- },
36
- "modifiedFileUnitCase": {
37
- "hasChanges": "true",
38
- "startTime": "123455",
39
- "endTime": "123446",
40
- "isExecuted": true,
41
- "isPassed": true,
42
- "numberOfSuccess": "",
43
- "numberOfFails": "",
44
- "numberOfCases": "",
45
- "numberOfSuites": "",
46
- "fileDetail": {
47
- "fileName": "sample.spec.js",
48
- "caseDetail": {
49
- "failedCaseLists": [],
50
- "passedCaseList": []
51
- }
52
- },
53
- "coverageDetail": {
54
- "codeCoveragePercentage": "",
55
- "fileCoveragePercentage": ""
56
- }
57
- },
58
- "screenshotTest": {
59
- "message": "some",
60
- "startTime": "123455",
61
- "endTime": "123446",
62
- "isThisExecuted": true,
63
- "compareBranch": "master",
64
- "isPassed": true,
65
- "result": {
66
- "numberOfComponents": 200,
67
- "numberOfDiffFiles": 20,
68
- "improperDocsList": [],
69
- "erroredComponents": []
70
- }
71
- }
72
- }
73
- }
1
+ {
2
+ "jobDetails": {
3
+ "isTriggeredFromGit": true,
4
+ "isCIPassed": true,
5
+ "developerName": "GITLAB_USER_NAME",
6
+ "jobID": "CI_PIPELINE_ID",
7
+ "branchName": "CI_COMMIT_REF_NAME",
8
+ "commitMessage": "CI_COMMIT_MESSAGE",
9
+ "jobURL": "CI_JOB_URL",
10
+ "isByManual": "CI_JOB_MANUAL",
11
+ "commitID": "CI_COMMIT_SHA",
12
+ "executionTime": "Date.now()-Date.now()",
13
+ "hostName": "kathir-zt252"
14
+ },
15
+ "tests": {
16
+ "unitCase": {
17
+ "startTime": "123455",
18
+ "endTime": "123446",
19
+ "isExecuted": true,
20
+ "numberOfSuccess": "",
21
+ "numberOfFails": "",
22
+ "numberOfCases": "",
23
+ "numberOfSuites": "",
24
+ "fileDetail": {
25
+ "fileName": "sample.spec.js",
26
+ "caseDetail": {
27
+ "failedCaseLists": [],
28
+ "passedCaseList": []
29
+ }
30
+ },
31
+ "coverageDetail": {
32
+ "codeCoveragePercentage": "",
33
+ "fileCoveragePercentage": ""
34
+ }
35
+ },
36
+ "modifiedFileUnitCase": {
37
+ "hasChanges": "true",
38
+ "startTime": "123455",
39
+ "endTime": "123446",
40
+ "isExecuted": true,
41
+ "isPassed": true,
42
+ "numberOfSuccess": "",
43
+ "numberOfFails": "",
44
+ "numberOfCases": "",
45
+ "numberOfSuites": "",
46
+ "fileDetail": {
47
+ "fileName": "sample.spec.js",
48
+ "caseDetail": {
49
+ "failedCaseLists": [],
50
+ "passedCaseList": []
51
+ }
52
+ },
53
+ "coverageDetail": {
54
+ "codeCoveragePercentage": "",
55
+ "fileCoveragePercentage": ""
56
+ }
57
+ },
58
+ "screenshotTest": {
59
+ "message": "some",
60
+ "startTime": "123455",
61
+ "endTime": "123446",
62
+ "isThisExecuted": true,
63
+ "compareBranch": "master",
64
+ "isPassed": true,
65
+ "result": {
66
+ "numberOfComponents": 200,
67
+ "numberOfDiffFiles": 20,
68
+ "improperDocsList": [],
69
+ "erroredComponents": []
70
+ }
71
+ }
72
+ }
73
+ }
package/lib/utils/rtl.js CHANGED
@@ -18,7 +18,10 @@ let src = _path.default.join(cwd, process.argv[2]);
18
18
 
19
19
  let dist = _path.default.join(cwd, process.argv[3]);
20
20
 
21
- (0, _folderIterator.default)(src, dist, ['.css'], false, (fromPath, toPath) => {
21
+ let canWacth = '-w' === process.argv[4];
22
+
23
+ // import { useExitCleanup } from './useExitCleanup';
24
+ function watchHandler(fromPath, toPath) {
22
25
  let css = _fs.default.readFileSync(fromPath);
23
26
 
24
27
  (0, _postcss.default)([(0, _postcssRtl.default)({
@@ -39,4 +42,18 @@ let dist = _path.default.join(cwd, process.argv[3]);
39
42
  _fs.default.writeFile(`${toPath}.map`, result.map, () => true);
40
43
  }
41
44
  });
42
- });
45
+ }
46
+
47
+ (0, _folderIterator.default)(src, dist, ['.css'], false, (fromPath, toPath) => {
48
+ if (canWacth && fromPath) {
49
+ _fs.default.watchFile(fromPath, () => {
50
+ watchHandler(fromPath, toPath);
51
+ });
52
+ }
53
+
54
+ watchHandler(fromPath, toPath);
55
+ }); // if (canWacth) {
56
+ // useExitCleanup(() => {
57
+ // fs.unwatchFile(src, watchHandler);
58
+ // });
59
+ // }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useExitCleanup = useExitCleanup;
7
+ //so the program will not close instantly
8
+ let listeners = [];
9
+ let hasCalled = false;
10
+
11
+ function useExitCleanup(listener) {
12
+ if (!hasCalled) {
13
+ process.stdin.resume();
14
+ hasCalled = true;
15
+ }
16
+
17
+ listeners.push(listeners);
18
+ return () => {
19
+ listeners = listeners.filter(l => l !== listener);
20
+ };
21
+ }
22
+
23
+ function exitHandler(options, exitCode) {
24
+ if (options.cleanup) {
25
+ console.log('clean');
26
+ }
27
+
28
+ if (exitCode || exitCode === 0) {
29
+ console.log(exitCode);
30
+ }
31
+
32
+ if (options.exit) {
33
+ process.exit();
34
+ }
35
+ } //do something when app is closing
36
+
37
+
38
+ process.on('exit', exitHandler.bind(null, {
39
+ cleanup: true
40
+ })); //catches ctrl+c event
41
+
42
+ process.on('SIGINT', exitHandler.bind(null, {
43
+ exit: true
44
+ })); // catches "kill pid" (for example: nodemon restart)
45
+
46
+ process.on('SIGUSR1', exitHandler.bind(null, {
47
+ exit: true
48
+ }));
49
+ process.on('SIGUSR2', exitHandler.bind(null, {
50
+ exit: true
51
+ })); //catches uncaught exceptions
52
+
53
+ process.on('uncaughtException', exitHandler.bind(null, {
54
+ exit: true
55
+ }));
package/npm8.md ADDED
@@ -0,0 +1,9 @@
1
+ # npm 8 change related things
2
+
3
+ 1. in npm run script config options `:` not working (properly|correctly), So we need to use `_` in the place of `:`
4
+ For Example:
5
+ - `--app:port` wouldn't work we have to do like this `--app_port`
6
+ - `--clone:proj:name` wouldn't work we have to do like this `----clone_proj_name`
7
+
8
+ @zohodes/react-cli or fz-react-cli regardless of what cli you use.
9
+ So, we need to change all package.json script which is using this (`:`) we need to change as (`_`)