@zohodesk/react-cli 0.0.1-beta.17 → 0.0.1-beta.171

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 (292) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +49 -10
  3. package/.prettierrc +6 -0
  4. package/CHANGELOG.md +5 -0
  5. package/README.md +859 -0
  6. package/bin/cli.js +215 -46
  7. package/cert/Tsicsezwild-22-23.crt +37 -0
  8. package/cert/Tsicsezwild-22-23.key +27 -0
  9. package/docs/CustomChunks.md +26 -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/TODOS.md +10 -0
  14. package/docs/ValueReplacer.md +60 -0
  15. package/docs/warnings_while_install.txt +35 -0
  16. package/files/eslintrc.js +62 -0
  17. package/files/prettierrc.js +3 -0
  18. package/lib/babel/cmjs-plugins-presets.js +24 -0
  19. package/lib/babel/es-plugins-presets.js +34 -0
  20. package/lib/common/getEntries.js +33 -46
  21. package/lib/common/getPublicPathConfig.js +40 -0
  22. package/lib/common/index.js +24 -19
  23. package/lib/common/splitChunks.js +110 -25
  24. package/lib/common/sslcertUpdater.js +59 -0
  25. package/lib/common/templateParameters.js +25 -0
  26. package/lib/common/testPattern.js +69 -0
  27. package/lib/common/valueReplacer.js +55 -0
  28. package/lib/configs/jest.config.js +31 -27
  29. package/lib/configs/libAlias.js +31 -0
  30. package/lib/configs/webpack.component.umd.config.js +46 -53
  31. package/lib/configs/webpack.css.umd.config.js +47 -46
  32. package/lib/configs/webpack.dev.config.js +99 -84
  33. package/lib/configs/webpack.docs.config.js +65 -57
  34. package/lib/configs/webpack.impact.config.js +109 -0
  35. package/lib/configs/webpack.prod.config.js +147 -104
  36. package/lib/hooks/docsProptypeHook.js +32 -38
  37. package/lib/jest/commitedFilesResult.js +144 -71
  38. package/lib/jest/coverageCollector.js +68 -35
  39. package/lib/jest/jsonMaker.js +54 -0
  40. package/lib/jest/preProcessors/cssPreprocessor.js +16 -18
  41. package/lib/jest/preProcessors/jsPreprocessor.js +5 -6
  42. package/lib/jest/preProcessors/otherFilesPreprocessor.js +5 -6
  43. package/lib/jest/result.js +92 -42
  44. package/lib/jest/run.js +75 -28
  45. package/lib/jest/setup.js +103 -102
  46. package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
  47. package/lib/loaderUtils/getCSSLoaders.js +113 -0
  48. package/lib/loaderUtils/getDevJsLoaders.js +35 -23
  49. package/lib/loaderUtils/index.js +14 -7
  50. package/lib/loaders/docsLoader.js +15 -15
  51. package/lib/loaders/docsPropsLoader.js +14 -17
  52. package/lib/loaders/fileBountryLoader.js +17 -0
  53. package/lib/loaders/fileLoader.js +47 -38
  54. package/lib/loaders/scriptInstrumentLoader.js +23 -20
  55. package/lib/loaders/selectorMappingLoader.js +75 -0
  56. package/lib/loaders/workerLoader.js +136 -0
  57. package/lib/middlewares/HMRMiddleware.js +90 -72
  58. package/lib/middlewares/SSTMiddleware.js +21 -0
  59. package/lib/pluginUtils/getDevPlugins.js +177 -30
  60. package/lib/pluginUtils/getDocsPlugins.js +36 -15
  61. package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
  62. package/lib/pluginUtils/getLibraryPlugins.js +8 -10
  63. package/lib/pluginUtils/getProdPlugins.js +244 -37
  64. package/lib/pluginUtils/getServerPlugins.js +8 -11
  65. package/lib/pluginUtils/getUMDCSSPlugins.js +14 -18
  66. package/lib/pluginUtils/getUMDComponentPlugins.js +14 -9
  67. package/lib/pluginUtils/index.js +36 -43
  68. package/lib/plugins/CdnChangePlugin.js +77 -0
  69. package/lib/plugins/CleanupStatsPlugin.js +28 -0
  70. package/lib/plugins/EFCPlugin.js +241 -0
  71. package/lib/plugins/EFCPlugin.md +6 -0
  72. package/lib/plugins/EFCTemplatePlugin.js +151 -0
  73. package/lib/plugins/I18NInjectIntoIndexPlugin.js +141 -0
  74. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +60 -0
  75. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +44 -0
  76. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +266 -0
  77. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +183 -0
  78. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +100 -0
  79. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -0
  80. package/lib/plugins/I18nSplitPlugin/README.md +25 -0
  81. package/lib/plugins/I18nSplitPlugin/index.js +185 -0
  82. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +64 -0
  83. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +13 -0
  84. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +26 -0
  85. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +40 -0
  86. package/lib/plugins/I18nSplitPlugin/utils/index.js +31 -0
  87. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +112 -0
  88. package/lib/plugins/ManifestPlugin.js +86 -0
  89. package/lib/plugins/ModuleStatsPlugin.js +98 -97
  90. package/lib/plugins/OptimizeJSPlugin.js +41 -0
  91. package/lib/plugins/PublicPathCallbackPlugin.js +63 -0
  92. package/lib/plugins/PublicPathChangePlugin.js +226 -0
  93. package/lib/plugins/ReportGeneratePlugin.js +181 -0
  94. package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
  95. package/lib/plugins/ResourceHintsPlugin.js +67 -0
  96. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +80 -0
  97. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +82 -0
  98. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
  99. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +26 -0
  100. package/lib/plugins/ScriptInstrumentPlugin.js +22 -37
  101. package/lib/plugins/ServiceWorkerPlugin.js +107 -0
  102. package/lib/plugins/ShadowDOMSupportPlugin.js +270 -0
  103. package/lib/plugins/SourceMapHookPlugin.js +25 -59
  104. package/lib/plugins/TPHashMappingPlugin.js +67 -0
  105. package/lib/plugins/UglifyCSSPlugin.js +39 -0
  106. package/lib/plugins/UnusedFilesFindPlugin.js +150 -97
  107. package/lib/plugins/index.js +127 -37
  108. package/lib/plugins/libraryImpactPlugin.js +190 -0
  109. package/lib/plugins/webpackwatchrunplugin.js +26 -0
  110. package/lib/postcss-plugins/ExcludePlugin.js +23 -0
  111. package/lib/postcss-plugins/RTLSplitPlugin.js +138 -0
  112. package/lib/postcss-plugins/ValueReplacer.js +46 -0
  113. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
  114. package/lib/postcss-plugins/__test__/test1Input.css +39 -0
  115. package/lib/postcss-plugins/__test__/test1Output.css +39 -0
  116. package/lib/postcss-plugins/hoverActivePlugin.js +368 -0
  117. package/lib/postcss-plugins/variableModifier.js +243 -0
  118. package/lib/schemas/index.js +541 -65
  119. package/lib/servers/clusterHubServer.js +22 -26
  120. package/lib/servers/devBuild.js +102 -0
  121. package/lib/servers/docsServer.js +3 -5
  122. package/lib/servers/docsServerCore.js +94 -79
  123. package/lib/servers/getCliPath.js +28 -0
  124. package/lib/servers/helpServer.js +19 -21
  125. package/lib/servers/httpsOptions.js +18 -0
  126. package/lib/servers/impactServer.js +123 -115
  127. package/lib/servers/mockserver.js +44 -0
  128. package/lib/servers/nowatchserver.js +200 -0
  129. package/lib/servers/scrServer.js +147 -0
  130. package/lib/servers/server.js +134 -132
  131. package/lib/servers/ssServer.js +106 -70
  132. package/lib/sh/reportPublish.sh +16 -10
  133. package/lib/templates/CoverageScriptTemplate.js +45 -18
  134. package/lib/templates/WMSTemplate.js +17 -18
  135. package/lib/templates/linterConstant.js +10 -0
  136. package/lib/utils/babelPresets.js +12 -4
  137. package/lib/utils/buildstats.html +148 -0
  138. package/lib/utils/clean.js +12 -11
  139. package/lib/utils/copy.js +16 -109
  140. package/lib/utils/copyTimezones.js +21 -0
  141. package/lib/utils/createEventStream.js +24 -19
  142. package/lib/utils/cssClassNameGenerate.js +77 -0
  143. package/lib/utils/cssURLReplacer.js +136 -0
  144. package/lib/utils/dependencyPostPublish.js +42 -0
  145. package/lib/utils/fileUtils.js +125 -0
  146. package/lib/utils/folderIterator.js +47 -0
  147. package/lib/utils/getComponents.js +126 -0
  148. package/lib/utils/getCurrentBranch.js +11 -17
  149. package/lib/utils/getDependenciesImpactList.js +151 -0
  150. package/lib/utils/getHash.js +26 -0
  151. package/lib/utils/getIp.js +20 -0
  152. package/lib/utils/getOptions.js +113 -28
  153. package/lib/utils/getServerURL.js +25 -8
  154. package/lib/utils/index.js +283 -68
  155. package/lib/utils/init.js +2 -2
  156. package/lib/utils/initPreCommitHook.js +47 -27
  157. package/lib/utils/jsonHelper.js +106 -0
  158. package/lib/utils/libraryImpactConfig.js +63 -0
  159. package/lib/utils/lint/addScripts.js +27 -0
  160. package/lib/utils/lint/checkExistingConfig.js +67 -0
  161. package/lib/utils/lint/copyConfigs.js +24 -0
  162. package/lib/utils/lint/index.js +54 -0
  163. package/lib/utils/lint/lintScripts.js +11 -0
  164. package/lib/utils/lint/lintSetup.js +31 -0
  165. package/lib/utils/lint/lintStagedPreCommitHook.js +7 -0
  166. package/lib/utils/lint/question.js +30 -0
  167. package/lib/utils/lintReporter.js +142 -0
  168. package/lib/utils/mailSender.js +16 -25
  169. package/lib/utils/pullOrigin.js +28 -0
  170. package/lib/utils/reinstallDependencies.js +133 -0
  171. package/lib/utils/removeAttributes.js +25 -23
  172. package/lib/utils/repoClone.js +59 -63
  173. package/lib/utils/request.js +64 -77
  174. package/lib/utils/resultSchema.json +73 -0
  175. package/lib/utils/rtl.js +59 -0
  176. package/lib/utils/setEnvVariables.js +13 -0
  177. package/lib/utils/ssTestHack.js +48 -0
  178. package/lib/utils/switchBranch.js +28 -0
  179. package/lib/utils/urlConcat.js +22 -0
  180. package/lib/utils/useExitCleanup.js +55 -0
  181. package/npm8.md +9 -0
  182. package/package.json +96 -64
  183. package/postpublish.js +6 -0
  184. package/templates/app/.eslintrc.js +140 -0
  185. package/templates/app/README.md +12 -12
  186. package/templates/app/app/index.html +24 -8
  187. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  188. package/templates/app/app/properties/i18nkeys.json +3 -3
  189. package/templates/app/docs/all.html +69 -69
  190. package/templates/app/mockapi/index.js +18 -13
  191. package/templates/app/package.json +37 -17
  192. package/templates/app/src/actions/SampleActions/index.js +37 -0
  193. package/templates/app/src/actions/index.js +65 -0
  194. package/templates/app/src/appUrls.js +19 -0
  195. package/templates/app/src/components/Alert/Alert.js +134 -0
  196. package/templates/app/src/components/Alert/Alert.module.css +79 -0
  197. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -0
  198. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -0
  199. package/templates/app/src/components/Sample/Sample.module.css +11 -0
  200. package/templates/app/src/components/Sample/SampleList.js +61 -0
  201. package/templates/app/src/components/Slider/Slider.css +41 -0
  202. package/templates/app/src/components/Slider/Slider.js +55 -0
  203. package/templates/app/src/containers/AlertContainer/index.js +15 -0
  204. package/templates/app/src/containers/AppContainer/index.js +96 -0
  205. package/templates/app/src/containers/AppContainer/index.module.css +27 -0
  206. package/templates/app/src/containers/CustomMatch/index.js +65 -0
  207. package/templates/app/src/containers/DevTools/index.js +10 -0
  208. package/templates/app/src/containers/Header/index.js +67 -0
  209. package/templates/app/src/containers/Header/index.module.css +43 -0
  210. package/templates/app/src/containers/Redirect/index.js +63 -0
  211. package/templates/app/src/containers/Redirector/index.js +47 -0
  212. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -0
  213. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -0
  214. package/templates/app/src/historyChange.js +5 -0
  215. package/templates/app/src/index.html +10 -0
  216. package/templates/app/src/index.js +24 -0
  217. package/templates/app/src/middleware/PromiseMiddleware.js +59 -0
  218. package/templates/app/src/reducers/alertData.js +11 -0
  219. package/templates/app/src/reducers/index.js +6 -0
  220. package/templates/app/src/reducers/samples.js +19 -0
  221. package/templates/app/src/store/configureStore.dev.js +51 -0
  222. package/templates/app/src/store/configureStore.js +5 -0
  223. package/templates/app/src/store/configureStore.prod.js +26 -0
  224. package/templates/app/src/util/Common.js +5 -0
  225. package/templates/app/src/util/RequestAPI.js +132 -0
  226. package/templates/appold/README.md +12 -0
  227. package/templates/appold/app/index.html +8 -0
  228. package/templates/appold/app/properties/ApplicationResources_en_US.properties +1 -0
  229. package/templates/appold/app/properties/i18nkeys.json +3 -0
  230. package/templates/appold/docs/all.html +69 -0
  231. package/templates/appold/mockapi/index.js +13 -0
  232. package/templates/{app → appold}/mockapi/tickets.json +0 -0
  233. package/templates/appold/package.json +17 -0
  234. package/templates/appold/src/components/Text/Text.css +0 -0
  235. package/templates/appold/src/components/Text/Text.js +23 -0
  236. package/templates/appold/src/components/Text/__tests__/Text.spec.js +30 -0
  237. package/templates/appold/src/components/Text/docs/Text__default.docs.js +16 -0
  238. package/templates/appold/src/components/docs.js +1 -0
  239. package/templates/appold/src/components/index.js +5 -0
  240. package/templates/appold/src/index.js +13 -0
  241. package/templates/docs/all.html +1 -1
  242. package/templates/docs/component.html +110 -69
  243. package/templates/docs/components.html +221 -0
  244. package/templates/docs/css/component.css +12 -14
  245. package/templates/docs/css/componentTest.css +7 -0
  246. package/templates/docs/css/style.css +150 -206
  247. package/templates/docs/impactReportTemplate.html +154 -0
  248. package/templates/docs/index.html +1482 -1336
  249. package/templates/library/src/index.js +0 -0
  250. package/.npmignore +0 -3
  251. package/cert/cert.pem +0 -129
  252. package/cert/key.pem +0 -27
  253. package/lib/common/getInsertAt.js +0 -36
  254. package/lib/common/getInsertIntoFunction.js +0 -13
  255. package/lib/configs/webpack.server.config.js +0 -93
  256. package/lib/plugins/ChunkManifestReplacePlugin.js +0 -94
  257. package/lib/plugins/RuntimePublicPathPlugin.js +0 -46
  258. package/lib/rmcntrlm.sh +0 -14
  259. package/lib/servers/nodeServer.js +0 -238
  260. package/lib/templates/HMRTemplate.js +0 -256
  261. package/lib/templates/publicPathTemplate.js +0 -16
  262. package/lib/utils/setConfig.js +0 -14
  263. package/node_modules/history/CHANGES.md +0 -395
  264. package/node_modules/history/DOMUtils.js +0 -3
  265. package/node_modules/history/ExecutionEnvironment.js +0 -3
  266. package/node_modules/history/LICENSE +0 -21
  267. package/node_modules/history/LocationUtils.js +0 -3
  268. package/node_modules/history/PathUtils.js +0 -3
  269. package/node_modules/history/README.md +0 -282
  270. package/node_modules/history/cjs/history.js +0 -933
  271. package/node_modules/history/cjs/history.min.js +0 -1
  272. package/node_modules/history/createBrowserHistory.js +0 -3
  273. package/node_modules/history/createHashHistory.js +0 -3
  274. package/node_modules/history/createMemoryHistory.js +0 -3
  275. package/node_modules/history/createTransitionManager.js +0 -3
  276. package/node_modules/history/es/DOMUtils.js +0 -7
  277. package/node_modules/history/es/ExecutionEnvironment.js +0 -7
  278. package/node_modules/history/es/LocationUtils.js +0 -7
  279. package/node_modules/history/es/PathUtils.js +0 -7
  280. package/node_modules/history/es/createBrowserHistory.js +0 -7
  281. package/node_modules/history/es/createHashHistory.js +0 -7
  282. package/node_modules/history/es/createMemoryHistory.js +0 -7
  283. package/node_modules/history/es/createTransitionManager.js +0 -7
  284. package/node_modules/history/es/warnAboutDeprecatedESMImport.js +0 -35
  285. package/node_modules/history/esm/history.js +0 -904
  286. package/node_modules/history/index.js +0 -7
  287. package/node_modules/history/package.json +0 -134
  288. package/node_modules/history/umd/history.js +0 -1059
  289. package/node_modules/history/umd/history.min.js +0 -1
  290. package/node_modules/history/warnAboutDeprecatedCJSRequire.js +0 -35
  291. package/templates/app/.npmignore +0 -9
  292. package/templates/library/.npmignore +0 -9
@@ -1,87 +1,123 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- var _child_process = require('child_process');
3
+ var _screenshotTest = _interopRequireDefault(require("@zohodesk/screenshot-test"));
4
4
 
5
- var _fzScreenshotTest = require('fz-screenshot-test');
5
+ var _jsonHelper = require("../utils/jsonHelper");
6
6
 
7
- var _fzScreenshotTest2 = _interopRequireDefault(_fzScreenshotTest);
7
+ var _utils = require("../utils");
8
8
 
9
- var _utils = require('../utils');
9
+ var _docsServerCore = _interopRequireDefault(require("./docsServerCore"));
10
10
 
11
- var _docsServerCore = require('./docsServerCore');
12
-
13
- var _docsServerCore2 = _interopRequireDefault(_docsServerCore);
11
+ var _SSTMiddleware = _interopRequireDefault(require("../middlewares/SSTMiddleware"));
14
12
 
15
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
14
 
17
- var options = (0, _utils.getOptions)();
18
- var _options$ssTest = options.ssTest,
19
- seleniumHub = _options$ssTest.seleniumHub,
20
- remoteBranch = _options$ssTest.remoteBranch,
21
- referBranch = _options$ssTest.referBranch,
22
- server = options.docs.server;
23
-
15
+ let options = (0, _utils.getOptions)();
16
+ let impactedComponentObject = null;
17
+ let docsServerInstance;
18
+ let {
19
+ ssTest: {
20
+ seleniumHub,
21
+ referBranch,
22
+ currentBranch,
23
+ enableImage,
24
+ pathToSubProjects
25
+ },
26
+ docs: {
27
+ server
28
+ }
29
+ } = options;
30
+
31
+ function closeServer(serverInstance) {
32
+ (0, _utils.log)('Docs service stopped!');
33
+ let {
34
+ http,
35
+ https,
36
+ wdm
37
+ } = serverInstance;
38
+ http.close();
39
+ https.close();
40
+ wdm.close();
41
+ }
24
42
 
25
- var docsServerInstance = (0, _docsServerCore2.default)();
43
+ (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.compareBranch', referBranch);
44
+ (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.TestBranch', currentBranch);
45
+ (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.isExecuted', true);
46
+ (0, _utils.log)('Test Branch Name :- ', currentBranch);
47
+
48
+ let afterFirstScreenShotCollected = () => {
49
+ closeServer(docsServerInstance);
50
+ (0, _utils.switchBranch)('git', referBranch).then(() => {
51
+ (0, _utils.log)('Reference Branch Name :- ', (0, _utils.getCurrentBranch)());
52
+ (0, _utils.reinstallDependencies)(pathToSubProjects).then(() => {
53
+ (0, _utils.ssTestHack)();
54
+ });
55
+ });
56
+ };
26
57
 
27
- (0, _utils.log)((0, _utils.getCurrentBranch)(), 'Current Branch');
58
+ let onSStestEnd = (status, resultObject, isLastRun, runSSTest) => {
59
+ if (status) {
60
+ if (!isLastRun) {
61
+ (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.result', resultObject);
62
+ runSSTest(afterFirstScreenShotCollected, true, 'reference', referBranch, impactedComponentObject);
63
+ } else {
64
+ (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.endTime', Date.now());
65
+ (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.isPassed', true);
66
+ (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.result', resultObject);
67
+ (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.message', 'Screenshot test succesfully completed.');
68
+ (0, _jsonHelper.setTestInfoStatus)(`${process.cwd()}/result.json`, true);
69
+ (0, _utils.log)('Screenshot test completed succesfully.');
70
+ closeServer(docsServerInstance);
71
+ }
72
+ } else {
73
+ (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.isPassed', false);
74
+ (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.message', 'Component list undefined! Please check component Docs');
75
+ (0, _jsonHelper.setTestInfoStatus)(`${process.cwd()}/result.json`, false);
76
+ (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'testInfo.failures', {
77
+ type: 'screenshotTest',
78
+ message: 'Component list undefined! Please check component Docs'
79
+ });
80
+ closeServer(docsServerInstance);
81
+ (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.endTime', Date.now());
82
+ throw new Error('Component list undefined! Please check component Docs');
83
+ }
84
+ };
28
85
 
29
- if (remoteBranch) {
30
- docsServerInstance.http.post('/repo/merge', function (req, res) {
31
- var ref = req.body.ref;
86
+ (0, _utils.ssTestHack)();
32
87
 
33
- if (ref && ref.endsWith(remoteBranch)) {
34
- (0, _child_process.spawnSync)('git', ['pull', 'origin', remoteBranch], {
35
- stdio: 'inherit'
36
- });
37
- }
38
- res.send('done');
39
- });
40
- }
88
+ let getDocsServerInstance = beforeJobs => {
89
+ if (typeof beforeJobs === 'function') {
90
+ beforeJobs();
91
+ }
41
92
 
42
- var afterFirstScreenShotCollected = function afterFirstScreenShotCollected() {
43
- (0, _child_process.spawnSync)('git', ['checkout', referBranch], { encoding: 'utf8' });
44
- (0, _utils.log)((0, _utils.getCurrentBranch)());
45
- (0, _utils.log)('Reference Branch test mode test called..!');
46
- docsServerInstance = (0, _docsServerCore2.default)();
93
+ return (0, _docsServerCore.default)(true);
47
94
  };
48
95
 
49
- var runSSTest = function runSSTest(onBefore, isLastRun) {
50
- typeof onBefore === 'function' && onBefore();
51
- _fzScreenshotTest2.default.run({
52
- seleniumHub: seleniumHub,
53
- url: (0, _utils.getServerURL)(server, 'ht' + 'tps') + '/docs/component.html',
54
- browserList: ['chrome'],
55
- mode: 'test',
56
- script: 'var Objlist={};for (i in Component){try{if(Component[i].prototype.isReactComponent){Objlist[i]=Component[i].docs.componentGroup;}}catch(err){console.log(i,err);}}; return Objlist'
57
- }, function (status) {
58
- if (status !== false) {
59
- (0, _utils.log)('Current Mode call back server kill function called..!');
60
- var _docsServerInstance = docsServerInstance,
61
- http = _docsServerInstance.http,
62
- https = _docsServerInstance.https,
63
- wdm = _docsServerInstance.wdm;
64
-
65
- http.close();
66
- https.close();
67
- wdm.close();
68
- if (!isLastRun) {
69
- runSSTest(afterFirstScreenShotCollected, true);
70
- } else {
71
- (0, _utils.log)('Screenshot test succesfully completed.');
72
- }
73
- } else {
74
- var _docsServerInstance2 = docsServerInstance,
75
- _http = _docsServerInstance2.http,
76
- _https = _docsServerInstance2.https,
77
- _wdm = _docsServerInstance2.wdm;
78
-
79
- _http.close();
80
- _https.close();
81
- _wdm.close();
82
- (0, _utils.log)('Component list undefined.');
83
- }
84
- });
96
+ let runSSTest = (onBefore, isLastRun, mode, branch, listOfComponents) => {
97
+ let url = (0, _utils.getServerURL)(Object.assign(server, {
98
+ host: server.iphost
99
+ }), 'ht' + 'tp');
100
+ docsServerInstance = getDocsServerInstance(onBefore);
101
+ docsServerInstance.app.use((0, _SSTMiddleware.default)(docsServerInstance.compiler, mData => {
102
+ impactedComponentObject = (0, _utils.getComponents)(mData, listOfComponents);
103
+
104
+ _screenshotTest.default.run({
105
+ branch,
106
+ seleniumHub: seleniumHub,
107
+ url: `${url}/docs/components.html`,
108
+ browserList: ['chrome'],
109
+ mode,
110
+ enableImage,
111
+ impactedComponentObject,
112
+ script: 'var Objlist = {};for (i in Component) {try { if (Component[i].prototype.isReactComponent) Objlist[i] = Component[i].docs.componentGroup;}catch (err) {console.log(i, err);}};if (Object.keys(Objlist).length < 5) {Objlist = false;}return Objlist;'
113
+ }, (status, finalObj) => {
114
+ onSStestEnd(status, finalObj, isLastRun, runSSTest);
115
+ });
116
+ }));
85
117
  };
86
118
 
87
- runSSTest();
119
+ (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.startTime', Date.now());
120
+ (0, _utils.getDependenciesImpactList)(currentBranch, referBranch).then(impactedList => {
121
+ (0, _utils.log)('from here ');
122
+ runSSTest(null, null, 'test', currentBranch, impactedList);
123
+ });
@@ -2,13 +2,12 @@
2
2
  branchName=$2
3
3
  url=$1
4
4
  zipUrl=$3
5
- commitMessage=$8
6
-
7
5
  unique=$(date +"%d_%m_%y_Time_%H_%M_%S")
8
6
  publishFolder=$branchName"_"$unique
9
7
 
10
8
  rm -rf ./reports
11
9
  rm -rf ./scrTemplate
10
+ rm -rf ./errTemplate
12
11
  rm -rf ./css
13
12
  rm -rf ./js
14
13
  rm -rf ./index.html
@@ -18,13 +17,20 @@ curl $zipUrl | tar xz
18
17
  cp -rf ./reports/css ./css
19
18
  cp -rf ./reports/js ./js
20
19
  cp -rf ./reports/index.html ./index.html
20
+ if [ -d "./screenShots" ] ; then
21
+ cp -rf ./scrTemplate/* ./screenShots/
22
+ else
23
+ mkdir ./screenShots
24
+ cp -rf ./scrTemplate/* ./screenShots/
25
+ fi
21
26
 
22
- cp -rf ./scrTemplate/css ./screenShots/css
23
- cp -rf ./scrTemplate/js ./screenShots/js
24
- cp -rf ./scrTemplate/images ./screenShots/images
25
- cp -rf ./scrTemplate/index.html ./screenShots/index.html
27
+ [ ! -f "./result.json" ] && touch result.json && cp -rf ./errTemplate/* ./result.json
28
+ [ ! -d "./commitCoverage" ] && mkdir commitCoverage && cp -rf ./errTemplate/* ./commitCoverage/
29
+ [ ! -d "./unittest" ] && mkdir unittest && cp -rf ./errTemplate/* ./unittest/
30
+ [ ! -d "./coverageTest" ] && mkdir coverageTest && cp -rf ./errTemplate/* ./coverageTest/
31
+ [ ! -d "./coverage" ] && mkdir coverage && cp -rf ./errTemplate/* ./coverage/
26
32
 
27
- tar -czvf $publishFolder.tar.gz coverage screenShots unittest coverageTest commitCoverage ./css ./js ./index.html
33
+ tar -czvf $publishFolder.tar.gz coverage screenShots unittest coverageTest commitCoverage ./css ./js ./index.html ./result.json
28
34
 
29
35
  curl -i -F name=file -F file=@$publishFolder.tar.gz $url"/cgi-bin/upload.py"
30
36
  replace=$publishFolder
@@ -33,7 +39,7 @@ subject="Client Report - React - $publishFolder"
33
39
  msg="<p><b>Report URL - <a href='$reportUrl'>Link</a></b></p>
34
40
  <p><b>Report Branchname - $branchName</b></p>
35
41
  <p><b>Report Unique ID - $unique</b></p>
36
- <p><b>Report Developer - $6</b></p>
37
- <p><b>Report commitMessage - $commitMessage</b></p>"
42
+ <p><b>Report Developer - $6</b></p>"
38
43
  #node mailSender.js <from> <pass> <to> <subject> <text>
39
- node ./node_modules/@zohodesk/react-cli/lib/utils/mailSender $4 $5 $6 "$subject" "$msg" $7
44
+ BASEDIR=$(dirname "$0")
45
+ node $BASEDIR"/../utils/mailSender" $4 $5 $6 "$subject" "$msg" $7 $8 "$reportUrl"
@@ -1,44 +1,71 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  window.ClientCoverage = {
4
4
  LocalStorageWrapper: {
5
- getLocalStorage: function getLocalStorage(property, defaultVal) {
5
+ getLocalStorage(property, defaultVal) {
6
6
  if (localStorage.hasOwnProperty(property)) {
7
7
  Object.assign(defaultVal, JSON.parse(localStorage.getItem(property)));
8
- localStorage.setItem(property, JSON.stringify(defaultVal));return defaultVal;
8
+ localStorage.setItem(property, JSON.stringify(defaultVal));
9
+ return defaultVal;
9
10
  }
10
- localStorage.setItem(property, JSON.stringify(defaultVal));return defaultVal || {};
11
+
12
+ localStorage.setItem(property, JSON.stringify(defaultVal));
13
+ return defaultVal || {};
11
14
  },
12
- clearLocalStorage: function clearLocalStorage(property) {
15
+
16
+ clearLocalStorage(property) {
13
17
  localStorage.removeItem(property);
14
18
  }
15
- }, JS: {
16
- jsMethodInstrumentObject: {}, jsStorageKey: 'jsClientCoverageObject', init: function init() {
19
+
20
+ },
21
+ JS: {
22
+ jsMethodInstrumentObject: {},
23
+ jsStorageKey: 'jsClientCoverageObject',
24
+
25
+ init() {
17
26
  this.jsMethodInstrumentObject = ClientCoverage.LocalStorageWrapper.getLocalStorage(this.jsStorageKey, this.jsMethodInstrumentObject);
18
27
  },
19
- visitMethod: function visitMethod(jsFileName, jsMethodName) {
20
- this.init();if (this.jsMethodInstrumentObject.hasOwnProperty(jsFileName)) {
28
+
29
+ visitMethod(jsFileName, jsMethodName) {
30
+ this.init();
31
+
32
+ if (this.jsMethodInstrumentObject.hasOwnProperty(jsFileName)) {
21
33
  if (!this.jsMethodInstrumentObject[jsFileName].includes(jsMethodName)) {
22
34
  this.jsMethodInstrumentObject[jsFileName].push(jsMethodName);
23
35
  }
24
36
  } else {
25
- this.jsMethodInstrumentObject[jsFileName] = [];this.jsMethodInstrumentObject[jsFileName].push(jsMethodName);
37
+ this.jsMethodInstrumentObject[jsFileName] = [];
38
+ this.jsMethodInstrumentObject[jsFileName].push(jsMethodName);
26
39
  }
40
+
27
41
  localStorage.setItem(this.jsStorageKey, JSON.stringify(this.jsMethodInstrumentObject));
28
42
  },
29
- clear: function clear() {
30
- this.jsMethodInstrumentObject = {};ClientCoverage.LocalStorageWrapper.clearLocalStorage(this.jsStorageKey);
43
+
44
+ clear() {
45
+ this.jsMethodInstrumentObject = {};
46
+ ClientCoverage.LocalStorageWrapper.clearLocalStorage(this.jsStorageKey);
31
47
  },
32
- getData: function getData() {
33
- return { methods: this.jsMethodInstrumentObject };
48
+
49
+ getData() {
50
+ return {
51
+ methods: this.jsMethodInstrumentObject
52
+ };
34
53
  }
35
- }, getCoverageData: function getCoverageData() {
36
- return { JS: this.JS.getData() };
54
+
55
+ },
56
+
57
+ getCoverageData() {
58
+ return {
59
+ JS: this.JS.getData()
60
+ };
37
61
  },
38
- clear: function clear() {
62
+
63
+ clear() {
39
64
  this.JS.clear();
40
65
  },
41
- init: function init() {
66
+
67
+ init() {
42
68
  this.JS.init();
43
69
  }
70
+
44
71
  };
@@ -1,41 +1,40 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- var _querystring = require('querystring');
4
-
5
- var _querystring2 = _interopRequireDefault(_querystring);
3
+ var _querystring = _interopRequireDefault(require("querystring"));
6
4
 
7
5
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
6
 
9
- var log = function log() {
10
- var print = console;
11
- print.log.apply(print, arguments);
12
- };
7
+ let log = (...args) => {
8
+ let print = console;
9
+ print.log(...args);
10
+ }; // eslint-disable-next-line no-undef
11
+
12
+
13
+ let options = _querystring.default.parse(__resourceQuery.slice(1));
13
14
 
14
- // eslint-disable-next-line no-undef
15
- var options = _querystring2.default.parse(__resourceQuery.slice(1));
16
15
  window.WebSocket = window.WebSocket || window.MozWebSocket;
17
- var connection = new WebSocket(options.wmsPath);
16
+ let connection = new WebSocket(options.wmsPath);
18
17
 
19
- connection.onopen = function () {
18
+ connection.onopen = () => {
20
19
  // connection is opened and ready to use
21
20
  log('open');
22
21
  };
23
22
 
24
- connection.onerror = function (error) {
23
+ connection.onerror = error => {
25
24
  // an error occurred when sending/receiving data
26
25
  throw error;
27
26
  };
28
27
 
29
- connection.onmessage = function (message) {
28
+ connection.onmessage = message => {
30
29
  // try to decode json (I assume that each message
31
30
  // from server is json)
32
31
  try {
33
- var json = JSON.parse(message.data);
34
- // eslint-disable-next-line no-undef
32
+ let json = JSON.parse(message.data); // eslint-disable-next-line no-undef
33
+
35
34
  Collaboration.handleCustomMessage(json);
36
35
  } catch (e) {
37
36
  log('This doesn\'t look like a valid JSON: ', message.data);
38
37
  return;
39
- }
40
- // handle incoming message
38
+ } // handle incoming message
39
+
41
40
  };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.htmlTemplate = exports.endTag = void 0;
7
+ const htmlTemplate = '<!DOCTYPE html><html> <head> <title>Eslint Security Rule</title> <style type="text/css"> body{margin: 0; font: 93.75%/1.6 -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;}body, html{width: 100%; height: 100%;}.pkCont{}.pkEmpty{height: 300px;display: flex;align-items: center;justify-content: center;font-size: 20px;}.pkUl{margin: 0; padding: 0; list-style-type: none;}.pkLi{}.pkRow{display: flex; padding: 12px 16px;}.pkArrowCont{cursor: pointer; width: 50px; display: flex; align-items: center; justify-content: center; background-color: #f4f5f5; border-radius: 4px;}.pkArrow{width: 1px; height: 1px; border: 5px solid; border-color: #000 transparent transparent; margin-top: 7px;}.pkDetailsOpen .pkArrow{margin: 0 0 7px; border-color: transparent transparent #000;}.pkFileName{font-weight: 600; margin: 0 8px;}.pkUrl{flex: 1; min-width: 0; min-height: 0; word-break: break-word; word-wrap: break-word; color: blue;}.pkDetails{margin-left: 66px; display: none;}.pkDetailsOpen .pkDetails{display: block;}.pkDetailsHead{font-weight: 600; display: flex; border: 1px solid #e5e5e5; padding: 3px 8px;}.pkDetailsBody{max-height: 400px; overflow: auto;}.pkDetailsRow{display: flex; padding: 10px 8px;}.pkDetailsRow:nth-child(even){background-color: #f4f5f5;}.pkDetailsCol{word-break: break-word; word-wrap: break-word;}.pkError{color: red;}.pkDetailsCol:nth-child(1){width: 10%;}.pkDetailsCol:nth-child(2){width: 10%;}.pkDetailsCol:nth-child(3){width: 40%;}.pkDetailsCol:nth-child(4){width: 40%;}</style> <script>function toggleWrapper(element){var classArray=element.parentElement.parentElement.className; if (classArray.includes("pkDetailsOpen")){element.parentElement.parentElement.className="pkLi";}else{element.parentElement.parentElement.className="pkLi pkDetailsOpen";}}</script> </head> <body> <div class="pkCont">';
8
+ exports.htmlTemplate = htmlTemplate;
9
+ const endTag = '</div></body></html>';
10
+ exports.endTag = endTag;
@@ -1,14 +1,22 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = {
7
- presets: [['env', { modules: false }]],
6
+ exports.default = exports.a = void 0;
7
+
8
+ let a = require.resolve('babel-plugin-transform-define');
9
+
10
+ exports.a = a;
11
+ var _default = {
12
+ presets: [['env', {
13
+ modules: false
14
+ }], 'react'],
8
15
  plugins: [['transform-runtime', {
9
16
  helpers: true,
10
17
  polyfill: true,
11
18
  regenerator: false,
12
19
  moduleName: 'babel-runtime'
13
20
  }]]
14
- };
21
+ };
22
+ exports.default = _default;
@@ -0,0 +1,148 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
5
+ <style>
6
+ #file {
7
+ font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif;
8
+ border-collapse: collapse;
9
+ width: 100%;
10
+ }
11
+ #redTd {
12
+ color: red;
13
+ }
14
+ #greenTD {
15
+ color: green;
16
+ }
17
+ #file td,
18
+ #file th {
19
+ border: 1px solid #ddd;
20
+ padding: 8px;
21
+ text-align: center;
22
+ }
23
+
24
+ #file tr:nth-child(even) {
25
+ background-color: #f2f2f2;
26
+ }
27
+
28
+ #file tr:hover {
29
+ background-color: #ddd;
30
+ }
31
+
32
+ #file th {
33
+ padding-top: 12px;
34
+ padding-bottom: 12px;
35
+ background-color: #2a2d36;
36
+ color: white;
37
+ }
38
+ #sizeTable {
39
+ float: left;
40
+ width: 50%;
41
+ }
42
+ #hashTable {
43
+ display: inline-block;
44
+ width: 50%;
45
+ }
46
+ </style>
47
+ <script type="text/javascript" src="./buildtrack.js"></script>
48
+ </head>
49
+ <body>
50
+ <div>
51
+ <div style="float: left;margin-right: 10px;">Branch Name:</div>
52
+ <h4 id="h4" style="margin: 0px;"></h4>
53
+ </div>
54
+ <div id="sizeTable">
55
+ <div>
56
+ <h3>Size changes</h3>
57
+ <h3></h3>
58
+ </div>
59
+ <table id="file" class="table table-bordered table-hover table-condensed">
60
+ <thead>
61
+ <tr>
62
+ <th title="Field #1">Name</th>
63
+ <th title="Field #2">Size / Diff</th>
64
+ <th title="Field #3">Size / Old</th>
65
+ <th title="Field #4">Size / New</th>
66
+ </tr>
67
+ </thead>
68
+ <tbody id="sizeTbody"></tbody>
69
+ </table>
70
+ </div>
71
+ <div id="hashTable">
72
+ <div>
73
+ <h3>Hash changes</h3>
74
+ <h3></h3>
75
+ </div>
76
+ <table id="file" class="table table-bordered table-hover table-condensed">
77
+ <thead>
78
+ <tr>
79
+ <th style="background-color: #4CAF50;" title="Field #1">Name</th>
80
+ <th style="background-color: #4CAF50;" title="Field #2">
81
+ Hash / Old
82
+ </th>
83
+ <th style="background-color: #4CAF50;" title="Field #3">
84
+ Hash / New
85
+ </th>
86
+ </tr>
87
+ </thead>
88
+ <tbody id="hashTbody"></tbody>
89
+ </table>
90
+ </div>
91
+
92
+ <script type="text/javascript">
93
+ function load() {
94
+ if (statsJson) {
95
+ var tdStringSize = '';
96
+ var tdStringHash = '';
97
+ if (statsJson.increased.length > 0) {
98
+ statsJson.increased.forEach(fileObj => {
99
+ let colorTD = '</td><td>';
100
+ if (fileObj.size.diff.split(' ').length > 2) {
101
+ colorTD = '</td><td id="greenTd">';
102
+ } else {
103
+ colorTD = '</td><td id="redTd">';
104
+ }
105
+
106
+ tdStringSize =
107
+ tdStringSize +
108
+ '<tr><td>' +
109
+ fileObj.name +
110
+ colorTD +
111
+ fileObj.size.diff +
112
+ '</td><td>' +
113
+ fileObj.size.old +
114
+ '</td><td>' +
115
+ fileObj.size.new +
116
+ '</td><tr>';
117
+ });
118
+ } else {
119
+ tdStringSize = '<tr><td></td><td></td><td></td></tr>';
120
+ }
121
+ document.getElementById('sizeTbody').innerHTML = tdStringSize;
122
+ if (statsJson.hashChanged.length > 0) {
123
+ statsJson.hashChanged.forEach(fileObj => {
124
+ tdStringHash =
125
+ tdStringHash +
126
+ '<tr><td>' +
127
+ fileObj.name +
128
+ '</td><td>' +
129
+ fileObj.hash.old +
130
+ '</td><td>' +
131
+ fileObj.hash.new +
132
+ '</td><tr>';
133
+ });
134
+ } else {
135
+ tdStringHash = '<tr><td></td><td></td><td></td></tr>';
136
+ }
137
+ document.getElementById('hashTbody').innerHTML = tdStringHash;
138
+ if (statsJson.branchName) {
139
+ document.getElementById('h4').innerHTML = statsJson.branchName;
140
+ } else {
141
+ document.getElementById('h4').innerHTML = 'Not specified';
142
+ }
143
+ }
144
+ }
145
+ load();
146
+ </script>
147
+ </body>
148
+ </html>
@@ -1,15 +1,13 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- var _rimraf = require('rimraf');
4
-
5
- var _rimraf2 = _interopRequireDefault(_rimraf);
3
+ var _rimraf = _interopRequireDefault(require("rimraf"));
6
4
 
7
5
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
6
 
9
- var help = false;
10
- var dashdash = false;
11
- //eslint-disable-next-line array-callback-return
12
- var args = process.argv.slice(2).filter(function (arg) {
7
+ let help = false;
8
+ let dashdash = false; //eslint-disable-next-line array-callback-return
9
+
10
+ let args = process.argv.slice(2).filter(arg => {
13
11
  if (dashdash) {
14
12
  return !!arg;
15
13
  } else if (arg === '--') {
@@ -20,14 +18,17 @@ var args = process.argv.slice(2).filter(function (arg) {
20
18
  return !!arg;
21
19
  }
22
20
  });
23
- var go = function go(n) {
21
+
22
+ let go = n => {
24
23
  if (n >= args.length) {
25
24
  return;
26
25
  }
27
- (0, _rimraf2.default)(args[n], function (er) {
26
+
27
+ (0, _rimraf.default)(args[n], er => {
28
28
  if (er) {
29
29
  throw er;
30
30
  }
31
+
31
32
  go(n + 1);
32
33
  });
33
34
  };
@@ -35,7 +36,7 @@ var go = function go(n) {
35
36
  if (help || args.length === 0) {
36
37
  // If they didn't ask for help, then this is not a "success"
37
38
  // eslint-disable-next-line no-console
38
- var log = help ? console.log : console.error;
39
+ let log = help ? console.log : console.error;
39
40
  log('Usage: rimraf <path> [<path> ...]');
40
41
  log('');
41
42
  log(' Deletes all files and folders at "path" recursively.');