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

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