@zohodesk/react-cli 0.0.1-exp.169.2 → 0.0.1-exp.175.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. package/.eslintignore +7 -7
  2. package/.eslintrc.js +180 -179
  3. package/.prettierrc +6 -6
  4. package/README.md +1028 -951
  5. package/bin/cli.js +483 -483
  6. package/cert/Tsicsezwild-22-23.crt +37 -37
  7. package/cert/Tsicsezwild-22-23.key +27 -27
  8. package/docs/CustomChunks.md +26 -26
  9. package/docs/DevStart.md +18 -18
  10. package/docs/HoverActive.md +12 -12
  11. package/docs/InstallNode.md +28 -28
  12. package/docs/TODOS.md +10 -10
  13. package/docs/ValueReplacer.md +60 -60
  14. package/docs/VariableConversion.md +678 -0
  15. package/docs/warnings_while_install.txt +35 -35
  16. package/files/eslintrc.js +62 -62
  17. package/files/prettierrc.js +3 -3
  18. package/lib/babel/cmjs-plugins-presets.js +0 -4
  19. package/lib/babel/es-plugins-presets.js +0 -4
  20. package/lib/common/getEntries.js +0 -10
  21. package/lib/common/getPublicPathConfig.js +0 -6
  22. package/lib/common/index.js +0 -5
  23. package/lib/common/splitChunks.js +2 -13
  24. package/lib/common/sslcertUpdater.js +6 -17
  25. package/lib/common/templateParameters.js +0 -2
  26. package/lib/common/testPattern.js +10 -21
  27. package/lib/common/valueReplacer.js +0 -15
  28. package/lib/configs/jest.config.js +8 -21
  29. package/lib/configs/libAlias.js +11 -2
  30. package/lib/configs/webpack.component.umd.config.js +0 -5
  31. package/lib/configs/webpack.css.umd.config.js +5 -13
  32. package/lib/configs/webpack.dev.config.js +13 -24
  33. package/lib/configs/webpack.docs.config.js +6 -12
  34. package/lib/configs/webpack.impact.config.js +6 -10
  35. package/lib/configs/webpack.prod.config.js +15 -26
  36. package/lib/hooks/docsProptypeHook.js +3 -7
  37. package/lib/jest/commitedFilesResult.js +3 -45
  38. package/lib/jest/coverageCollector.js +0 -11
  39. package/lib/jest/jsonMaker.js +0 -6
  40. package/lib/jest/preProcessors/cssPreprocessor.js +14 -13
  41. package/lib/jest/preProcessors/jsPreprocessor.js +0 -2
  42. package/lib/jest/preProcessors/otherFilesPreprocessor.js +0 -3
  43. package/lib/jest/result.js +0 -22
  44. package/lib/jest/run.js +6 -17
  45. package/lib/jest/setup.js +5 -57
  46. package/lib/loaderUtils/configsAssetsLoaders.js +34 -44
  47. package/lib/loaderUtils/getCSSLoaders.js +41 -28
  48. package/lib/loaderUtils/getDevJsLoaders.js +0 -8
  49. package/lib/loaderUtils/index.js +0 -3
  50. package/lib/loaders/docsLoader.js +0 -7
  51. package/lib/loaders/docsPropsLoader.js +3 -7
  52. package/lib/loaders/fileBountryLoader.js +0 -2
  53. package/lib/loaders/fileLoader.js +11 -22
  54. package/lib/loaders/scriptInstrumentLoader.js +5 -13
  55. package/lib/loaders/selectorMappingLoader.js +7 -25
  56. package/lib/loaders/workerLoader.js +13 -29
  57. package/lib/middlewares/HMRMiddleware.js +13 -26
  58. package/lib/middlewares/SSTMiddleware.js +0 -3
  59. package/lib/pluginUtils/configHtmlWebpackPlugins.js +53 -0
  60. package/lib/pluginUtils/getDevPlugins.js +20 -64
  61. package/lib/pluginUtils/getDocsPlugins.js +1 -10
  62. package/lib/pluginUtils/getLibraryImactPlugins.js +4 -5
  63. package/lib/pluginUtils/getLibraryPlugins.js +0 -5
  64. package/lib/pluginUtils/getProdPlugins.js +32 -78
  65. package/lib/pluginUtils/getServerPlugins.js +0 -5
  66. package/lib/pluginUtils/getUMDCSSPlugins.js +0 -7
  67. package/lib/pluginUtils/getUMDComponentPlugins.js +0 -7
  68. package/lib/pluginUtils/index.js +0 -8
  69. package/lib/plugins/CdnChangePlugin.js +0 -14
  70. package/lib/plugins/CleanupStatsPlugin.js +0 -5
  71. package/lib/plugins/EFCPlugin.js +23 -34
  72. package/lib/plugins/EFCPlugin.md +6 -6
  73. package/lib/plugins/EFCTemplatePlugin.js +23 -32
  74. package/lib/plugins/I18NInjectIntoIndexPlugin.js +12 -38
  75. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +12 -17
  76. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +4 -10
  77. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +46 -77
  78. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +44 -59
  79. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +21 -30
  80. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
  81. package/lib/plugins/I18nSplitPlugin/README.md +25 -25
  82. package/lib/plugins/I18nSplitPlugin/index.js +70 -80
  83. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +2 -12
  84. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +0 -1
  85. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +0 -5
  86. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +0 -6
  87. package/lib/plugins/I18nSplitPlugin/utils/index.js +0 -4
  88. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +2 -20
  89. package/lib/plugins/ManifestPlugin.js +0 -17
  90. package/lib/plugins/ModuleStatsPlugin.js +0 -23
  91. package/lib/plugins/OptimizeJSPlugin.js +0 -7
  92. package/lib/plugins/PublicPathCallbackPlugin.js +0 -10
  93. package/lib/plugins/PublicPathChangePlugin.js +4 -36
  94. package/lib/plugins/ReportGeneratePlugin.js +4 -30
  95. package/lib/plugins/RequireVariablePublicPlugin.js +0 -6
  96. package/lib/plugins/ResourceHintsPlugin.js +20 -27
  97. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +12 -17
  98. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +23 -38
  99. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
  100. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +2 -5
  101. package/lib/plugins/ScriptInstrumentPlugin.js +0 -7
  102. package/lib/plugins/ServiceWorkerPlugin.js +13 -29
  103. package/lib/plugins/ShadowDOMSupportPlugin.js +3 -40
  104. package/lib/plugins/SourceMapHookPlugin.js +0 -9
  105. package/lib/plugins/TPHashMappingPlugin.js +5 -19
  106. package/lib/plugins/UglifyCSSPlugin.js +0 -9
  107. package/lib/plugins/UnusedFilesFindPlugin.js +2 -35
  108. package/lib/plugins/index.js +0 -19
  109. package/lib/plugins/libraryImpactPlugin.js +0 -32
  110. package/lib/plugins/webpackwatchrunplugin.js +0 -5
  111. package/lib/postcss-plugins/ExcludePlugin.js +0 -4
  112. package/lib/postcss-plugins/RTLSplitPlugin.js +24 -37
  113. package/lib/postcss-plugins/ValueReplacer.js +9 -6
  114. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +0 -3
  115. package/lib/postcss-plugins/__test__/test1Input.css +38 -38
  116. package/lib/postcss-plugins/__test__/test1Output.css +38 -38
  117. package/lib/postcss-plugins/hoverActivePlugin.js +80 -92
  118. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +31 -0
  119. package/lib/postcss-plugins/variableModificationPlugin/index.js +232 -0
  120. package/lib/postcss-plugins/variableModifier.js +14 -20
  121. package/lib/schemas/index.js +28 -13
  122. package/lib/servers/clusterHubServer.js +0 -10
  123. package/lib/servers/devBuild.js +13 -24
  124. package/lib/servers/docsServer.js +0 -2
  125. package/lib/servers/docsServerCore.js +0 -21
  126. package/lib/servers/getCliPath.js +1 -10
  127. package/lib/servers/helpServer.js +0 -5
  128. package/lib/servers/httpsOptions.js +0 -4
  129. package/lib/servers/impactServer.js +2 -34
  130. package/lib/servers/mockserver.js +0 -9
  131. package/lib/servers/nowatchserver.js +12 -34
  132. package/lib/servers/scrServer.js +13 -20
  133. package/lib/servers/server.js +7 -35
  134. package/lib/servers/ssServer.js +0 -16
  135. package/lib/sh/pre-commit.sh +34 -34
  136. package/lib/sh/reportPublish.sh +45 -45
  137. package/lib/templates/CoverageScriptTemplate.js +0 -14
  138. package/lib/templates/WMSTemplate.js +6 -12
  139. package/lib/utils/babelPresets.js +0 -2
  140. package/lib/utils/buildstats.html +148 -148
  141. package/lib/utils/clean.js +2 -8
  142. package/lib/utils/copy.js +0 -6
  143. package/lib/utils/copyTimezones.js +0 -8
  144. package/lib/utils/createEventStream.js +0 -4
  145. package/lib/utils/cssClassNameGenerate.js +3 -19
  146. package/lib/utils/cssURLReplacer.js +0 -25
  147. package/lib/utils/dependencyPostPublish.js +0 -9
  148. package/lib/utils/fileUtils.js +0 -26
  149. package/lib/utils/folderIterator.js +0 -10
  150. package/lib/utils/getComponents.js +0 -21
  151. package/lib/utils/getCurrentBranch.js +0 -5
  152. package/lib/utils/getDependenciesImpactList.js +0 -21
  153. package/lib/utils/getHash.js +0 -7
  154. package/lib/utils/getIp.js +0 -2
  155. package/lib/utils/getOptions.js +38 -35
  156. package/lib/utils/getServerURL.js +0 -7
  157. package/lib/utils/index.js +2 -47
  158. package/lib/utils/init.js +0 -1
  159. package/lib/utils/initPreCommitHook.js +6 -29
  160. package/lib/utils/jsonHelper.js +2 -19
  161. package/lib/utils/libraryImpactConfig.js +0 -2
  162. package/lib/utils/lint/addScripts.js +2 -5
  163. package/lib/utils/lint/checkExistingConfig.js +3 -12
  164. package/lib/utils/lint/copyConfigs.js +0 -3
  165. package/lib/utils/lint/index.js +0 -9
  166. package/lib/utils/lint/lintScripts.js +0 -1
  167. package/lib/utils/lint/lintSetup.js +3 -4
  168. package/lib/utils/lint/lintStagedPreCommitHook.js +0 -1
  169. package/lib/utils/lint/question.js +0 -7
  170. package/lib/utils/lintReporter.js +0 -20
  171. package/lib/utils/mailSender.js +0 -7
  172. package/lib/utils/pullOrigin.js +0 -4
  173. package/lib/utils/reinstallDependencies.js +0 -28
  174. package/lib/utils/removeAttributes.js +0 -7
  175. package/lib/utils/repoClone.js +2 -27
  176. package/lib/utils/request.js +0 -12
  177. package/lib/utils/resultSchema.json +73 -73
  178. package/lib/utils/rtl.js +4 -16
  179. package/lib/utils/setEnvVariables.js +0 -2
  180. package/lib/utils/ssTestHack.js +0 -10
  181. package/lib/utils/switchBranch.js +0 -4
  182. package/lib/utils/urlConcat.js +0 -4
  183. package/lib/utils/useExitCleanup.js +9 -10
  184. package/npm8.md +9 -9
  185. package/package.json +146 -148
  186. package/postpublish.js +6 -6
  187. package/templates/app/.eslintrc.js +140 -140
  188. package/templates/app/README.md +12 -12
  189. package/templates/app/app/index.html +24 -24
  190. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  191. package/templates/app/app/properties/i18nkeys.json +3 -3
  192. package/templates/app/docs/all.html +69 -69
  193. package/templates/app/mockapi/index.js +18 -18
  194. package/templates/app/package.json +37 -37
  195. package/templates/app/src/actions/SampleActions/index.js +37 -37
  196. package/templates/app/src/actions/index.js +65 -65
  197. package/templates/app/src/appUrls.js +19 -19
  198. package/templates/app/src/components/Alert/Alert.js +134 -134
  199. package/templates/app/src/components/Alert/Alert.module.css +79 -79
  200. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
  201. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
  202. package/templates/app/src/components/Sample/Sample.module.css +11 -11
  203. package/templates/app/src/components/Sample/SampleList.js +61 -61
  204. package/templates/app/src/components/Slider/Slider.css +41 -41
  205. package/templates/app/src/components/Slider/Slider.js +55 -55
  206. package/templates/app/src/containers/AlertContainer/index.js +15 -15
  207. package/templates/app/src/containers/AppContainer/index.js +96 -96
  208. package/templates/app/src/containers/AppContainer/index.module.css +27 -27
  209. package/templates/app/src/containers/CustomMatch/index.js +65 -65
  210. package/templates/app/src/containers/DevTools/index.js +10 -10
  211. package/templates/app/src/containers/Header/index.js +67 -67
  212. package/templates/app/src/containers/Header/index.module.css +43 -43
  213. package/templates/app/src/containers/Redirect/index.js +63 -63
  214. package/templates/app/src/containers/Redirector/index.js +47 -47
  215. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
  216. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
  217. package/templates/app/src/historyChange.js +5 -5
  218. package/templates/app/src/index.html +10 -10
  219. package/templates/app/src/index.js +24 -24
  220. package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
  221. package/templates/app/src/reducers/alertData.js +11 -11
  222. package/templates/app/src/reducers/index.js +6 -6
  223. package/templates/app/src/reducers/samples.js +19 -19
  224. package/templates/app/src/store/configureStore.dev.js +51 -51
  225. package/templates/app/src/store/configureStore.js +5 -5
  226. package/templates/app/src/store/configureStore.prod.js +26 -26
  227. package/templates/app/src/util/Common.js +5 -5
  228. package/templates/app/src/util/RequestAPI.js +132 -132
  229. package/templates/docs/all.html +249 -249
  230. package/templates/docs/component.html +178 -178
  231. package/templates/docs/components.html +221 -221
  232. package/templates/docs/css/b.min.css +6 -6
  233. package/templates/docs/css/component.css +42 -42
  234. package/templates/docs/css/componentTest.css +6 -6
  235. package/templates/docs/css/hopscotch.css +585 -585
  236. package/templates/docs/css/style.css +1022 -1022
  237. package/templates/docs/impactReportTemplate.html +154 -154
  238. package/templates/docs/index.html +1501 -1493
  239. package/templates/docs/js/active-line.js +72 -72
  240. package/templates/docs/js/b.min.js +7 -7
  241. package/templates/docs/js/codemirror.js +9680 -9680
  242. package/templates/docs/js/designTokens.js +334 -334
  243. package/templates/docs/js/j.min.js +4 -4
  244. package/templates/docs/js/javascript.js +874 -874
  245. package/templates/docs/js/matchbrackets.js +145 -145
@@ -4,29 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _path = _interopRequireDefault(require("path"));
9
-
10
8
  var _https = _interopRequireDefault(require("https"));
11
-
12
9
  var _webpack = _interopRequireDefault(require("webpack"));
13
-
14
10
  var _express = _interopRequireDefault(require("express"));
15
-
16
11
  var _child_process = require("child_process");
17
-
18
12
  var _webpackDevMiddleware = _interopRequireDefault(require("webpack-dev-middleware"));
19
-
20
13
  var _HMRMiddleware = _interopRequireDefault(require("../middlewares/HMRMiddleware"));
21
-
22
14
  var _utils = require("../utils");
23
-
24
15
  var _webpackDocs = _interopRequireDefault(require("../configs/webpack.docs.config"));
25
-
26
16
  var _httpsOptions = require("./httpsOptions");
27
-
28
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
-
30
18
  // import fs from 'fs';
31
19
  var _default = isSSTest => {
32
20
  let options = (0, _utils.getOptions)();
@@ -81,41 +69,33 @@ var _default = isSSTest => {
81
69
  version: require('../../package.json').version
82
70
  });
83
71
  });
84
-
85
72
  if (branch) {
86
73
  app.post('/repo/merge', (req, res) => {
87
74
  let {
88
75
  ref
89
76
  } = req.body;
90
-
91
77
  if (ref && ref.endsWith(branch)) {
92
78
  (0, _child_process.spawnSync)('git', ['pull', 'origin', branch], {
93
79
  stdio: 'inherit'
94
80
  });
95
81
  }
96
-
97
82
  res.send('done');
98
83
  });
99
84
  }
100
-
101
85
  const httpsServer = _https.default.createServer(_httpsOptions.httpsOptions, app);
102
-
103
86
  if (!isSSTest) {
104
87
  httpsServer.listen(port, err => {
105
88
  if (err) {
106
89
  throw err;
107
90
  }
108
-
109
91
  (0, _utils.log)(`Listening at ${(0, _utils.getServerURL)(server, 'htt' + 'ps')}/docs/`);
110
92
  });
111
93
  }
112
-
113
94
  let httpPort = Number(port) + 1;
114
95
  let http = app.listen(httpPort, err => {
115
96
  if (err) {
116
97
  throw err;
117
98
  }
118
-
119
99
  if (isSSTest) {
120
100
  (0, _utils.log)(`Listening at ${(0, _utils.getServerURL)(Object.assign(server, {
121
101
  host: iphost,
@@ -137,5 +117,4 @@ var _default = isSSTest => {
137
117
  wdm
138
118
  };
139
119
  };
140
-
141
120
  exports.default = _default;
@@ -4,25 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getCliPath = getCliPath;
7
-
8
7
  var _path = _interopRequireDefault(require("path"));
9
-
10
8
  var _os = require("os");
11
-
12
9
  var _fs = require("fs");
13
-
14
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
11
  const appPath = process.cwd();
17
12
  const isNodeModuleUnderAppFolder = __dirname.indexOf(appPath) !== -1;
18
13
  const isWindows = (0, _os.platform)().toLowerCase() === 'win32';
19
-
20
14
  const _getCliPath = !isNodeModuleUnderAppFolder ? libName => _path.default.join(__dirname, '..', '..', 'node_modules', '.bin', libName) : libName => libName;
21
-
22
15
  const suffixExt = isWindows ? '.cmd' : '';
23
-
24
16
  function getCliPath(libName) {
25
17
  const cliPath = _getCliPath(libName + suffixExt);
26
-
27
- return (0, _fs.existsSync)(cliPath) ? cliPath : libName;
18
+ return (0, _fs.existsSync)(cliPath) ? cliPath : libName + suffixExt;
28
19
  }
@@ -1,13 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
-
5
4
  var _express = _interopRequireDefault(require("express"));
6
-
7
5
  var _utils = require("../utils");
8
-
9
6
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
11
7
  let options = (0, _utils.getOptions)();
12
8
  let {
13
9
  help: {
@@ -24,6 +20,5 @@ app.listen(port, err => {
24
20
  if (err) {
25
21
  throw err;
26
22
  }
27
-
28
23
  (0, _utils.log)(`Listening at ${serverUrl}/help/`);
29
24
  });
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.httpsOptions = void 0;
7
-
8
7
  var _fs = _interopRequireDefault(require("fs"));
9
-
10
8
  var _path = _interopRequireDefault(require("path"));
11
-
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
10
  const httpsOptions = {
15
11
  key: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/Tsicsezwild-22-23.key')),
16
12
  cert: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/Tsicsezwild-22-23.crt'))
@@ -1,15 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  var _express = _interopRequireDefault(require("express"));
4
-
5
4
  var _gitlab = require("gitlab");
6
-
7
5
  var _esprima = _interopRequireDefault(require("esprima"));
8
-
9
6
  var _utils = require("../utils");
10
-
11
7
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
-
13
8
  let options = (0, _utils.getOptions)();
14
9
  let {
15
10
  impact: {
@@ -29,35 +24,28 @@ app.use(_express.default.json());
29
24
  app.use(_express.default.urlencoded({
30
25
  extended: true
31
26
  }));
32
-
33
27
  function traverseJSON(parsed, file) {
34
28
  let parsedObj = {};
35
29
  parsed.forEach(Block => {
36
30
  if (Block.type === 'FunctionDeclaration' || Block.type === 'ExportDefaultDeclaration' || Block.type === 'ExportNamedDeclaration') {
37
31
  let ParsedTemp;
38
-
39
32
  if (Block.type === 'FunctionDeclaration') {
40
33
  ParsedTemp = Block;
41
34
  } else {
42
35
  ParsedTemp = Block.declaration;
43
36
  }
44
-
45
37
  if (ParsedTemp) {
46
38
  if (ParsedTemp.id) {
47
39
  let funcname = ParsedTemp.id.name;
48
-
49
40
  if (funcname !== 'mapStateToProps') {
50
41
  if (!funcname.includes('_')) {
51
42
  if (!Object.prototype.hasOwnProperty.call(parsedObj, 'file')) {
52
43
  parsedObj[file] = {};
53
44
  }
54
-
55
45
  let tempArray = [];
56
-
57
46
  for (let j = ParsedTemp.loc.start.line; j < ParsedTemp.loc.end.line; j++) {
58
47
  tempArray.push(j);
59
48
  }
60
-
61
49
  parsedObj[file][funcname] = tempArray;
62
50
  }
63
51
  }
@@ -67,7 +55,6 @@ function traverseJSON(parsed, file) {
67
55
  });
68
56
  return parsedObj;
69
57
  }
70
-
71
58
  function getDetails(url, callback) {
72
59
  let changeObj = {};
73
60
  let compObj = {};
@@ -75,7 +62,6 @@ function getDetails(url, callback) {
75
62
  url
76
63
  }).then(res => {
77
64
  let body = JSON.parse(res.body);
78
-
79
65
  if (body.includes('Source_Changeset')) {
80
66
  let branch, changeSet;
81
67
  body = body.split('\n');
@@ -84,16 +70,15 @@ function getDetails(url, callback) {
84
70
  let [, __changeSet] = content.split('=');
85
71
  changeSet = __changeSet;
86
72
  }
87
-
88
73
  if (content.includes('SourceCoLabel')) {
89
74
  let [__branch] = content.split('=');
90
75
  branch = __branch;
91
76
  }
92
77
  });
93
- services.Commits.diff(1143, changeSet //'587efd32ce14620750a38ab74bc744fc52f2943a '
78
+ services.Commits.diff(1143, changeSet
79
+ //'587efd32ce14620750a38ab74bc744fc52f2943a '
94
80
  ).then(result => {
95
81
  let promises = [];
96
-
97
82
  if (result) {
98
83
  result.forEach(change => {
99
84
  let p = new Promise(resolve => {
@@ -111,27 +96,22 @@ function getDetails(url, callback) {
111
96
  tempObj.changedId = null;
112
97
  }
113
98
  }
114
-
115
99
  if (!diff.indexOf('-')) {
116
100
  //eslint-disable-next-line
117
101
  tempObj.defaultId = diff.match(/(data-id=.*)/g)[0].match(/["']([^"']+?)['"]/g)[0];
118
102
  let tempIndex = diffList.indexOf(diff);
119
-
120
103
  if (diffList[tempIndex + 1].indexOf('data-id') === -1) {
121
104
  tempObj.changedId = null;
122
105
  }
123
106
  }
124
-
125
107
  if (!diff.indexOf('+')) {
126
108
  //eslint-disable-next-line
127
109
  tempObj.changedId = diff.match(/(data-id=.*)/g)[0].match(/["']([^"']+?)['"]/g)[0];
128
110
  let tempIndex = diffList.indexOf(diff);
129
-
130
111
  if (diffList[tempIndex - 1].indexOf('data-id') === -1) {
131
112
  tempObj.defaultId = null;
132
113
  }
133
114
  }
134
-
135
115
  if (Object.prototype.hasOwnProperty.call(tempObj, 'defaultId') && Object.prototype.hasOwnProperty.call(tempObj, 'changedId')) {
136
116
  if (tempObj.defaultId !== tempObj.changedId) {
137
117
  compObj[filename].push(tempObj);
@@ -139,39 +119,31 @@ function getDetails(url, callback) {
139
119
  }
140
120
  }
141
121
  }
142
-
143
122
  if (diff.startsWith('@')) {
144
123
  let [, content] = diff.split('@@');
145
124
  let tempList = content.split(' ');
146
125
  let startingLine = parseInt(tempList[1].split(',')[0]) * -1 + 3;
147
126
  let furtherLines = parseInt(tempList[2].split(',')[0]) + 3;
148
-
149
127
  if (parseInt(tempList[1].split(',')[1]) > 6) {
150
128
  changeObj[filename].push(startingLine);
151
129
  }
152
-
153
130
  if (parseInt(tempList[2].split(',')[1]) > 6) {
154
131
  let endValue = parseInt(tempList[2].split(',')[1]) - 6;
155
-
156
132
  for (let i = furtherLines; i < furtherLines + endValue; i++) {
157
133
  changeObj[filename].push(i);
158
134
  }
159
135
  }
160
136
  }
161
137
  });
162
-
163
138
  if (!filename.includes('.spec.js') && !filename.includes('.docs.js') && !filename.includes('.css') && filename.includes('.js')) {
164
139
  try {
165
140
  services.RepositoryFiles.show(1143, filename, branch).then(res => {
166
141
  let code = Buffer.from(res.content, 'base64').toString('ascii');
167
-
168
142
  let parsed = _esprima.default.parseModule(code, {
169
143
  jsx: true,
170
144
  loc: true
171
145
  });
172
-
173
146
  let methodDetail = traverseJSON(parsed.body, filename);
174
-
175
147
  if (Object.keys(methodDetail).length) {
176
148
  resolve(methodDetail);
177
149
  } else {
@@ -195,7 +167,6 @@ function getDetails(url, callback) {
195
167
  }
196
168
  }).catch(err => err);
197
169
  }
198
-
199
170
  app.post('/impact/build', (req, res) => {
200
171
  req.setTimeout(0);
201
172
  let subUrl = '/logs/reactbuildinfo.txt';
@@ -208,7 +179,6 @@ app.post('/impact/build', (req, res) => {
208
179
  if (err) {
209
180
  return err;
210
181
  }
211
-
212
182
  let responseObj = {};
213
183
  Object.keys(esprimaObj).forEach(file => {
214
184
  responseObj[file] = [];
@@ -221,7 +191,6 @@ app.post('/impact/build', (req, res) => {
221
191
  }
222
192
  });
223
193
  });
224
-
225
194
  if (!responseObj[file].length) {
226
195
  delete responseObj[file];
227
196
  }
@@ -238,7 +207,6 @@ app.listen(port, err => {
238
207
  if (err) {
239
208
  throw err;
240
209
  }
241
-
242
210
  (0, _utils.log)(`Listening at ${serverUrl}/impact/build/`);
243
211
  (0, _utils.log)('payload like => {buildUrl:test_build_url}');
244
212
  });
@@ -1,15 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  var _express = _interopRequireDefault(require("express"));
4
-
5
4
  var _fs = _interopRequireDefault(require("fs"));
6
-
7
5
  var _path = _interopRequireDefault(require("path"));
8
-
9
6
  var _utils = require("../utils");
10
-
11
7
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
-
13
8
  let options = (0, _utils.getOptions)();
14
9
  let {
15
10
  app: {
@@ -24,17 +19,13 @@ app.use(_express.default.urlencoded({
24
19
  extended: true
25
20
  }));
26
21
  let appPath = process.cwd();
27
-
28
22
  let mockServerPath = _path.default.join(appPath, 'mockapi', 'index.js');
29
-
30
23
  if (_fs.default.existsSync(mockServerPath)) {
31
24
  let mockServer = require(mockServerPath);
32
-
33
25
  mockServer(app);
34
26
  } else {
35
27
  (0, _utils.log)('You must export a function from mockapi folder by only we can provide mock api hook');
36
28
  }
37
-
38
29
  app.listen(mockPort, err => {
39
30
  if (err) {
40
31
  (0, _utils.log)('error', err);
@@ -1,25 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  var _path = _interopRequireDefault(require("path"));
4
-
5
4
  var _https = _interopRequireDefault(require("https"));
6
-
7
5
  var _express = _interopRequireDefault(require("express"));
8
-
9
6
  var _ws = _interopRequireDefault(require("ws"));
10
-
11
7
  var _httpProxyMiddleware = require("http-proxy-middleware");
12
-
13
8
  var _utils = require("../utils");
14
-
15
9
  var _httpsOptions = require("./httpsOptions");
16
-
17
10
  var _devBuild = require("./devBuild");
18
-
19
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
-
21
12
  // import webpack from 'webpack';
22
- let options = (0, _utils.getOptions)(); // let args = process.argv.slice(3);
13
+
14
+ let options = (0, _utils.getOptions)();
15
+ // let args = process.argv.slice(3);
23
16
 
24
17
  let {
25
18
  app: {
@@ -44,37 +37,31 @@ const {
44
37
  outputFolderLocation
45
38
  } = (0, _devBuild.getPaths)();
46
39
  const app = (0, _express.default)();
47
-
48
40
  if (hasMock) {
49
41
  app.use(server.mockPrefix, (0, _httpProxyMiddleware.createProxyMiddleware)({
50
42
  target: 'ht' + `tp://localhost:${mockPort}`,
51
43
  changeOrigin: true
52
44
  }));
53
- } // Nb@$#3NGscc
54
-
55
-
45
+ }
46
+ // Nb@$#3NGscc
56
47
  app.use(_express.default.json());
57
48
  app.use(_express.default.urlencoded({
58
49
  extended: true
59
50
  }));
60
-
61
51
  const staticPart = _express.default.static(outputFolderLocation, {
62
52
  cacheControl: true,
63
53
  setHeaders: function (res) {
64
54
  if (options.app.enableDevCache) {
65
55
  res.setHeader('Cache-Control', 'public, max-age=604800');
66
56
  }
67
-
68
57
  res.setHeader('Access-Control-Allow-Origin', '*');
69
58
  }
70
59
  });
71
-
72
60
  if (contextURL === '') {
73
61
  app.use(staticPart);
74
62
  } else {
75
63
  app.use(contextURL, staticPart);
76
64
  }
77
-
78
65
  app.use((req, res, next) => {
79
66
  res.setHeader('Access-Control-Allow-Origin', '*');
80
67
  next();
@@ -82,9 +69,7 @@ app.use((req, res, next) => {
82
69
  app.use('/wms/*', (req, res) => {
83
70
  res.sendFile(_path.default.join(__dirname, '..', '..', 'templates', 'wms', 'index.html'));
84
71
  });
85
-
86
72
  const httpsServer = _https.default.createServer(_httpsOptions.httpsOptions, app);
87
-
88
73
  const wss = new _ws.default.Server({
89
74
  server: httpsServer
90
75
  });
@@ -104,7 +89,6 @@ app.post('/wmsmockapi', (req, res) => {
104
89
  let {
105
90
  body
106
91
  } = req;
107
-
108
92
  try {
109
93
  ws.send(JSON.stringify(body));
110
94
  } catch (e) {
@@ -112,7 +96,9 @@ app.post('/wmsmockapi', (req, res) => {
112
96
  }
113
97
  });
114
98
  res.send('success');
115
- }); // let webpackCompilation;
99
+ });
100
+
101
+ // let webpackCompilation;
116
102
  // compiler.hooks.afterCompile.tap('ReactCLI', compilation => {
117
103
  // webpackCompilation = compilation;
118
104
  // });
@@ -123,7 +109,6 @@ if (zipname) {
123
109
  if (err) {
124
110
  throw err;
125
111
  }
126
-
127
112
  console.log(`${zipname}.zip downloaded`);
128
113
  });
129
114
  });
@@ -132,37 +117,33 @@ if (zipname) {
132
117
  if (err) {
133
118
  throw err;
134
119
  }
135
-
136
120
  console.log('build.zip downloaded');
137
121
  });
138
122
  });
139
123
  }
140
-
141
124
  if (contextURL) {
142
125
  app.use(contextURL, _express.default.static(context));
143
126
  app.use(`${contextURL}/*`, (req, res) => {
144
127
  // let indexHtml = webpackCompilation.assets['index.html'];
145
- res.sendFile(_path.default.join(outputFolderLocation, 'index.html')); // let indexHtml = webpackCompilation.assets['index.html'];
128
+ res.sendFile(_path.default.join(outputFolderLocation, 'index.html'));
129
+ // let indexHtml = webpackCompilation.assets['index.html'];
146
130
  // res.send(indexHtml && indexHtml.source());
147
131
  });
148
132
  } else {
149
133
  app.use(_express.default.static(context));
150
134
  app.use('/*', _express.default.static(context));
151
135
  }
152
-
153
136
  httpsServer.listen(port, err => {
154
137
  if (err) {
155
138
  throw err;
156
139
  }
157
-
158
140
  (0, _utils.log)(`Listening at ${serverUrl}${contextURL}/`);
159
141
  });
160
-
161
142
  if (isCompatableHttp2) {
162
143
  const http2 = require('http2');
144
+ const http2Server = http2.createSecureServer(_httpsOptions.httpsOptions);
163
145
 
164
- const http2Server = http2.createSecureServer(_httpsOptions.httpsOptions); // eslint-disable-next-line no-unused-vars
165
-
146
+ // eslint-disable-next-line no-unused-vars
166
147
  http2Server.on('stream', (stream, headers) => {
167
148
  stream.respond({
168
149
  'content-type': 'text/html',
@@ -175,7 +156,6 @@ if (isCompatableHttp2) {
175
156
  if (err) {
176
157
  throw err;
177
158
  }
178
-
179
159
  (0, _utils.log)(`Listening at ${(0, _utils.getServerURL)({
180
160
  host,
181
161
  domain,
@@ -185,13 +165,11 @@ if (isCompatableHttp2) {
185
165
  } else {
186
166
  (0, _utils.log)('Your node version didn\'t adopted http2 support. Kindly update that to 8 LTS or above you can engage the http2');
187
167
  }
188
-
189
168
  let httpPort = Number(port) + (isCompatableHttp2 ? 2 : 1);
190
169
  app.listen(httpPort, err => {
191
170
  if (err) {
192
171
  throw err;
193
172
  }
194
-
195
173
  (0, _utils.log)(`Listening at ${(0, _utils.getServerURL)({
196
174
  host,
197
175
  domain,
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _screenshotTest = _interopRequireDefault(require("@zohodesk/screenshot-test"));
4
-
5
4
  var _jsonHelper = require("../utils/jsonHelper");
6
-
7
5
  var _child_process = require("child_process");
8
-
9
6
  var _utils = require("../utils");
10
-
11
7
  var _docsServerCore = _interopRequireDefault(require("./docsServerCore"));
12
-
13
8
  var _SSTMiddleware = _interopRequireDefault(require("../middlewares/SSTMiddleware"));
14
-
15
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
-
17
10
  //Getting variables from flag and exe
11
+
18
12
  let cwd = process.cwd();
19
13
  let options = (0, _utils.getOptions)();
20
14
  let {
@@ -36,8 +30,8 @@ let {
36
30
  }
37
31
  } = options;
38
32
  let resultFileName = `${cwd}/result.json`;
39
- let docsServerInstance; // let impactedComponentList = null;
40
-
33
+ let docsServerInstance;
34
+ // let impactedComponentList = null;
41
35
  let url = (0, _utils.getServerURL)(Object.assign(server, {
42
36
  host: server.iphost
43
37
  }), 'ht' + 'tp');
@@ -45,12 +39,16 @@ let commitID = (0, _child_process.execSync)('git log --first-parent --pretty="fo
45
39
  cwd: cwd
46
40
  }).toString() || '';
47
41
  let [latestCommitHash, lastCommitHash] = commitID.split('\n');
48
- let script = 'var Objlist = {};for (i in componentList) {try { if (componentList[i].prototype.isReactComponent) Objlist[i] = componentList[i].docs.componentGroup;}catch (err) {console.log(i, err);}};if (Object.keys(Objlist).length < 5) {Objlist = false;}return Objlist;'; // Variable getting part end //
42
+ let script = 'var Objlist = {};for (i in componentList) {try { if (componentList[i].prototype.isReactComponent) Objlist[i] = componentList[i].docs.componentGroup;}catch (err) {console.log(i, err);}};if (Object.keys(Objlist).length < 5) {Objlist = false;}return Objlist;';
43
+
44
+ // Variable getting part end //
49
45
 
50
46
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.screenshotTest.compareBranch', referBranch);
51
47
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.screenshotTest.TestBranch', currentBranch);
52
48
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.screenshotTest.isExecuted', true);
53
- (0, _utils.log)('Test Branch Name :- ', currentBranch); // function declaration part //
49
+ (0, _utils.log)('Test Branch Name :- ', currentBranch);
50
+
51
+ // function declaration part //
54
52
 
55
53
  let closeServer = serverInstance => {
56
54
  (0, _utils.log)('Docs service stopped!');
@@ -62,9 +60,9 @@ let closeServer = serverInstance => {
62
60
  http.close();
63
61
  https.close();
64
62
  wdm.close();
65
- }; //eslint-disable-next-line
66
-
63
+ };
67
64
 
65
+ //eslint-disable-next-line
68
66
  let afterFirstScreenShotCollected = () => {
69
67
  closeServer(docsServerInstance);
70
68
  (0, _utils.switchBranch)('git', referBranch).then(() => {
@@ -74,7 +72,6 @@ let afterFirstScreenShotCollected = () => {
74
72
  });
75
73
  });
76
74
  };
77
-
78
75
  let onSStestEnd = (status, resultObject, message) => {
79
76
  if (status) {
80
77
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.screenshotTest.endTime', Date.now());
@@ -82,8 +79,8 @@ let onSStestEnd = (status, resultObject, message) => {
82
79
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.screenshotTest.result', resultObject);
83
80
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.screenshotTest.message', message);
84
81
  (0, _jsonHelper.setTestInfoStatus)(resultFileName, true);
85
- (0, _utils.log)(message); //'Screenshot test completed successfully.'
86
-
82
+ (0, _utils.log)(message);
83
+ //'Screenshot test completed successfully.'
87
84
  closeServer(docsServerInstance);
88
85
  } else {
89
86
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.screenshotTest.isPassed', false);
@@ -98,7 +95,6 @@ let onSStestEnd = (status, resultObject, message) => {
98
95
  throw new Error('Component list undefined! Please check component Docs');
99
96
  }
100
97
  };
101
-
102
98
  let run = (listOfComponents = [], configObject) => {
103
99
  docsServerInstance = (0, _docsServerCore.default)(true);
104
100
  docsServerInstance.app.use((0, _SSTMiddleware.default)(docsServerInstance.compiler, mData => {
@@ -107,13 +103,11 @@ let run = (listOfComponents = [], configObject) => {
107
103
  configObject.impactedComponentList = finalResultObject.impactedComponentList;
108
104
  configObject.unDocsComList = finalResultObject.unDocsComList;
109
105
  }
110
-
111
106
  _screenshotTest.default.run(configObject, (status, finalObj, message) => {
112
107
  onSStestEnd(status, finalObj, message);
113
108
  });
114
109
  }));
115
110
  };
116
-
117
111
  (0, _jsonHelper.jsonHelper)(resultFileName, 'tests.screenshotTest.startTime', Date.now());
118
112
  (0, _utils.ssTestHack)();
119
113
  let scrObject = {
@@ -131,7 +125,6 @@ let scrObject = {
131
125
  script,
132
126
  tableName
133
127
  };
134
-
135
128
  if (isImpactRun) {
136
129
  if (!isStore) {
137
130
  (0, _utils.getDependenciesImpactList)(currentBranch, referBranch, tokenGit, serviceName).then(impactedList => {