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

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 +855 -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 +98 -84
  33. package/lib/configs/webpack.docs.config.js +64 -57
  34. package/lib/configs/webpack.impact.config.js +108 -0
  35. package/lib/configs/webpack.prod.config.js +146 -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 +365 -0
  117. package/lib/postcss-plugins/variableModifier.js +243 -0
  118. package/lib/schemas/index.js +534 -66
  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,46 +1,42 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- var _path = require('path');
3
+ var _path = _interopRequireDefault(require("path"));
4
4
 
5
- var _path2 = _interopRequireDefault(_path);
5
+ var _fs = _interopRequireDefault(require("fs"));
6
6
 
7
- var _fs = require('fs');
7
+ var _express = _interopRequireDefault(require("express"));
8
8
 
9
- var _fs2 = _interopRequireDefault(_fs);
10
-
11
- var _express = require('express');
12
-
13
- var _express2 = _interopRequireDefault(_express);
14
-
15
- var _utils = require('../utils');
9
+ var _utils = require("../utils");
16
10
 
17
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
12
 
19
- var options = (0, _utils.getOptions)();
20
- var server = options.cluster.server;
21
-
13
+ let options = (0, _utils.getOptions)();
14
+ let {
15
+ cluster: {
16
+ server
17
+ }
18
+ } = options;
19
+ let app = (0, _express.default)();
20
+ let appPath = process.cwd();
22
21
 
23
- var app = (0, _express2.default)();
24
- var appPath = process.cwd();
22
+ let clusterConfigPath = _path.default.join(appPath, 'clusterConfig.js');
25
23
 
26
- var clusterConfigPath = _path2.default.join(appPath, 'clusterConfig.js');
27
- var config = void 0;
24
+ let config;
28
25
 
29
- if (_fs2.default.existsSync(clusterConfigPath)) {
26
+ if (_fs.default.existsSync(clusterConfigPath)) {
30
27
  config = require(clusterConfigPath);
31
28
  } else {
32
- throw new Error('clusterConfig.js doen\'t exist under following path - ' + clusterConfigPath);
29
+ throw new Error(`clusterConfig.js doen't exist under following path - ${clusterConfigPath}`);
33
30
  }
34
31
 
35
- app.get('/clusterhub/nodes', function (req, res) {
32
+ app.get('/clusterhub/nodes', (req, res) => {
36
33
  res.send(JSON.stringify(config.cluster));
37
34
  });
38
-
39
- app.use('/clusterhub', _express2.default.static(_path2.default.join(__dirname, '..', '..', 'templates', 'clusterhub')));
40
-
41
- app.listen(server.port, function (err) {
35
+ app.use('/clusterhub', _express.default.static(_path.default.join(__dirname, '..', '..', 'templates', 'clusterhub')));
36
+ app.listen(server.port, err => {
42
37
  if (err) {
43
38
  throw err;
44
39
  }
45
- (0, _utils.log)('Listening at ' + (0, _utils.getServerURL)(server, 'ht' + 'tp') + '/clusterhub/');
40
+
41
+ (0, _utils.log)(`Listening at ${(0, _utils.getServerURL)(server, 'ht' + 'tp')}/clusterhub/`);
46
42
  });
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getPaths = getPaths;
7
+
8
+ var _fs = _interopRequireDefault(require("fs"));
9
+
10
+ var _path = _interopRequireDefault(require("path"));
11
+
12
+ var _child_process = require("child_process");
13
+
14
+ var _utils = require("../utils");
15
+
16
+ var _getCliPath = require("./getCliPath");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ const options = (0, _utils.getOptions)(); // const args = process.argv.slice(3);
21
+ // NOTE: need to discuss about in below codes,
22
+ // when we run webpack the usable options that comes for npm run not working as automatical
23
+ // we are use this option always --disable_watch=true reason for now no need for
24
+
25
+ const {
26
+ app: {
27
+ outputFolder
28
+ }
29
+ } = options;
30
+ const {
31
+ cssSelectorZipPath
32
+ } = options.impactService;
33
+ const zipname = cssSelectorZipPath ? _path.default.parse(cssSelectorZipPath).name : null;
34
+
35
+ const outputFolderLocation = _path.default.join(process.cwd(), outputFolder);
36
+
37
+ function execSyncDefalut(command) {
38
+ console.log(' command running ==>', command);
39
+ return (0, _child_process.execSync)(command, {
40
+ stdio: 'inherit'
41
+ });
42
+ }
43
+
44
+ const isQuiet = 'q';
45
+ const webpack = (0, _getCliPath.getCliPath)('webpack'); // console.log('webpack === > ', webpack, fs.existsSync(webpack));
46
+
47
+ if (_fs.default.existsSync(outputFolderLocation)) {
48
+ execSyncDefalut(`rm -rf ${outputFolder}`);
49
+ console.log(`previous ${outputFolder} removed`);
50
+ }
51
+
52
+ if (_fs.default.existsSync(_path.default.join(process.cwd(), 'build.zip'))) {
53
+ execSyncDefalut('rm build.zip');
54
+ console.log('previous build.zip removed');
55
+ } // execSyncDefalut(`${webpack } --version`);
56
+ // execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')}`);
57
+
58
+
59
+ console.log('webpack compilation starts...');
60
+ const startTime = Date.now(); // const result = spawnSync(
61
+ // webpack,
62
+ // ['--config', require.resolve('../configs/webpack.dev.config.js')].concat(
63
+ // args
64
+ // ),
65
+ // { stdio: 'inherit' }
66
+ // );
67
+ // --disable_watch=true
68
+
69
+ const result = execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')} ${process.argv.slice(2).map(o => o.replace(/(.*?)=(.*)/, '$1="$2"')).join(' ')} `);
70
+ result && console.log(result);
71
+
72
+ if (result && result.stderr) {
73
+ throw result.stderr;
74
+ }
75
+
76
+ console.log(`compailation done in ${Date.now() - startTime}ms`);
77
+
78
+ if (zipname) {
79
+ execSyncDefalut(`zip -r${isQuiet} build.zip ${outputFolder}/*`);
80
+ console.log('build.zip file created');
81
+ const result = execSyncDefalut(`zip -r${isQuiet} ${cssSelectorZipPath} ${zipname}/*`);
82
+ execSyncDefalut(`rm -rf ${zipname}`);
83
+
84
+ if (result && result.stderr) {
85
+ console.log('zip file not created', cssSelectorZipPath);
86
+ console.error(result.stderr);
87
+ } else {
88
+ console.log('zip file created', cssSelectorZipPath);
89
+ }
90
+ } // npm run start --app:domain=tsi --impact:cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
91
+ // npm run start --app_domain=tsi --impact_cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
92
+
93
+
94
+ console.log(`compailation done in ${Date.now() - startTime}ms`);
95
+
96
+ function getPaths() {
97
+ return {
98
+ zipname,
99
+ cssSelectorZipPath,
100
+ outputFolderLocation
101
+ };
102
+ }
@@ -1,9 +1,7 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- var _docsServerCore = require('./docsServerCore');
4
-
5
- var _docsServerCore2 = _interopRequireDefault(_docsServerCore);
3
+ var _docsServerCore = _interopRequireDefault(require("./docsServerCore"));
6
4
 
7
5
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
6
 
9
- (0, _docsServerCore2.default)();
7
+ (0, _docsServerCore.default)();
@@ -1,126 +1,141 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.default = void 0;
6
7
 
7
- var _fs = require('fs');
8
+ var _path = _interopRequireDefault(require("path"));
8
9
 
9
- var _fs2 = _interopRequireDefault(_fs);
10
+ var _https = _interopRequireDefault(require("https"));
10
11
 
11
- var _path = require('path');
12
+ var _webpack = _interopRequireDefault(require("webpack"));
12
13
 
13
- var _path2 = _interopRequireDefault(_path);
14
+ var _express = _interopRequireDefault(require("express"));
14
15
 
15
- var _https = require('https');
16
+ var _child_process = require("child_process");
16
17
 
17
- var _https2 = _interopRequireDefault(_https);
18
+ var _webpackDevMiddleware = _interopRequireDefault(require("webpack-dev-middleware"));
18
19
 
19
- var _webpack = require('webpack');
20
+ var _HMRMiddleware = _interopRequireDefault(require("../middlewares/HMRMiddleware"));
20
21
 
21
- var _webpack2 = _interopRequireDefault(_webpack);
22
+ var _utils = require("../utils");
22
23
 
23
- var _express = require('express');
24
+ var _webpackDocs = _interopRequireDefault(require("../configs/webpack.docs.config"));
24
25
 
25
- var _express2 = _interopRequireDefault(_express);
26
-
27
- var _child_process = require('child_process');
28
-
29
- var _webpackDevMiddleware = require('webpack-dev-middleware');
30
-
31
- var _webpackDevMiddleware2 = _interopRequireDefault(_webpackDevMiddleware);
32
-
33
- var _utils = require('../utils');
34
-
35
- var _webpackDocs = require('../configs/webpack.docs.config');
36
-
37
- var _webpackDocs2 = _interopRequireDefault(_webpackDocs);
26
+ var _httpsOptions = require("./httpsOptions");
38
27
 
39
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
40
29
 
41
- exports.default = function () {
42
- var options = (0, _utils.getOptions)();
43
- var server = options.docs.server;
44
- var port = server.port,
45
- branch = server.branch;
46
-
47
-
48
- var appPath = process.cwd();
49
-
50
- var app = (0, _express2.default)();
51
-
52
- app.use(_express2.default.json());
53
- app.use(_express2.default.urlencoded({
30
+ // import fs from 'fs';
31
+ var _default = isSSTest => {
32
+ let options = (0, _utils.getOptions)();
33
+ let {
34
+ docs: {
35
+ server
36
+ }
37
+ } = options;
38
+ let {
39
+ port,
40
+ branch,
41
+ host,
42
+ domain,
43
+ iphost
44
+ } = server;
45
+ let appPath = process.cwd();
46
+ const app = (0, _express.default)();
47
+ app.use(_express.default.json());
48
+ app.use(_express.default.urlencoded({
54
49
  extended: true
55
50
  }));
56
-
57
- var compiler = (0, _webpack2.default)(_webpackDocs2.default);
58
-
59
- var wdm = (0, _webpackDevMiddleware2.default)(compiler, {
51
+ let docsConfig = (0, _webpackDocs.default)(isSSTest);
52
+ let compiler = (0, _webpack.default)(docsConfig);
53
+ let wdm = (0, _webpackDevMiddleware.default)(compiler, {
60
54
  logLevel: 'error',
61
- publicPath: _webpackDocs2.default.output.publicPath,
62
- headers: { 'Access-Control-Allow-Origin': '*' }
55
+ publicPath: docsConfig.output.publicPath,
56
+ headers: {
57
+ 'Access-Control-Allow-Origin': '*'
58
+ }
63
59
  });
64
-
65
60
  app.use(wdm);
66
-
67
- app.use(require('webpack-hot-middleware')(compiler));
68
- app.use('/docs/external/', _express2.default.static(_path2.default.join(appPath, 'docs', 'external')));
69
- app.use('/docs', _express2.default.static(_path2.default.join(__dirname, '..', '..', 'templates', 'docs')));
70
-
71
- app.use('/docs/*', function (req, res) {
72
- res.sendFile(_path2.default.join(__dirname, '..', '..', 'templates', 'docs', 'index.html'));
61
+ app.use((0, _HMRMiddleware.default)(compiler, {
62
+ path: '/sockjs-node/info'
63
+ }));
64
+ app.use('/docs/external/', _express.default.static(_path.default.join(appPath, 'docs', 'external')));
65
+ app.use('/docs', _express.default.static(_path.default.join(__dirname, '..', '..', 'templates', 'docs')));
66
+ app.use('/docs/*', (req, res) => {
67
+ res.sendFile(_path.default.join(__dirname, '..', '..', 'templates', 'docs', 'index.html'));
73
68
  });
74
-
75
- app.use('/author/get', function (req, res) {
76
- var _req$query$componentN = req.query.componentName,
77
- componentName = _req$query$componentN === undefined ? '' : _req$query$componentN;
78
-
79
- res.json({ stdout: (0, _child_process.execSync)('git blame ' + componentName).toString() });
69
+ app.use('/author/get', (req, res) => {
70
+ let {
71
+ query: {
72
+ componentName = ''
73
+ }
74
+ } = req;
75
+ res.json({
76
+ stdout: (0, _child_process.execSync)(`git blame ${componentName}`).toString()
77
+ });
80
78
  });
81
-
82
- app.use('/cli/version', function (req, res) {
83
- res.json({ version: require('../../package.json').version });
79
+ app.use('/cli/version', (req, res) => {
80
+ res.json({
81
+ version: require('../../package.json').version
82
+ });
84
83
  });
85
84
 
86
85
  if (branch) {
87
- app.post('/repo/merge', function (req, res) {
88
- var ref = req.body.ref;
86
+ app.post('/repo/merge', (req, res) => {
87
+ let {
88
+ ref
89
+ } = req.body;
89
90
 
90
91
  if (ref && ref.endsWith(branch)) {
91
92
  (0, _child_process.spawnSync)('git', ['pull', 'origin', branch], {
92
93
  stdio: 'inherit'
93
94
  });
94
95
  }
96
+
95
97
  res.send('done');
96
98
  });
97
99
  }
98
100
 
99
- var httpsServer = _https2.default.createServer({
100
- key: _fs2.default.readFileSync(_path2.default.join(__dirname, '../../cert/key.pem')),
101
- cert: _fs2.default.readFileSync(_path2.default.join(__dirname, '../../cert/cert.pem')),
102
- passphrase: 'zddqa1585f82'
103
- }, app);
101
+ const httpsServer = _https.default.createServer(_httpsOptions.httpsOptions, app);
104
102
 
105
- httpsServer.listen(port, function (err) {
106
- if (err) {
107
- throw err;
108
- }
109
- (0, _utils.log)('Listening at ' + (0, _utils.getServerURL)(server, 'htt' + 'ps') + '/docs/');
110
- });
103
+ if (!isSSTest) {
104
+ httpsServer.listen(port, err => {
105
+ if (err) {
106
+ throw err;
107
+ }
111
108
 
112
- var httpPort = Number(port) + 1;
109
+ (0, _utils.log)(`Listening at ${(0, _utils.getServerURL)(server, 'htt' + 'ps')}/docs/`);
110
+ });
111
+ }
113
112
 
114
- var http = app.listen(httpPort, function (err) {
113
+ let httpPort = Number(port) + 1;
114
+ let http = app.listen(httpPort, err => {
115
115
  if (err) {
116
116
  throw err;
117
117
  }
118
- (0, _utils.log)('Listening at ' + (0, _utils.getServerURL)(server, 'htt' + 'p') + '/docs/');
119
- });
120
118
 
119
+ if (isSSTest) {
120
+ (0, _utils.log)(`Listening at ${(0, _utils.getServerURL)(Object.assign(server, {
121
+ host: iphost,
122
+ port: port
123
+ }), 'htt' + 'p')}/docs/`);
124
+ } else {
125
+ (0, _utils.log)(`Listening at ${(0, _utils.getServerURL)({
126
+ host,
127
+ domain,
128
+ port
129
+ }, 'htt' + 'p')}/docs/`);
130
+ }
131
+ });
121
132
  return {
122
- http: http,
133
+ compiler,
134
+ app,
135
+ http,
123
136
  https: httpsServer,
124
- wdm: wdm
137
+ wdm
125
138
  };
126
- };
139
+ };
140
+
141
+ exports.default = _default;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getCliPath = getCliPath;
7
+
8
+ var _path = _interopRequireDefault(require("path"));
9
+
10
+ var _os = require("os");
11
+
12
+ var _fs = require("fs");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ const appPath = process.cwd();
17
+ const isNodeModuleUnderAppFolder = __dirname.indexOf(appPath) !== -1;
18
+ const isWindows = (0, _os.platform)().toLowerCase() === 'win32';
19
+
20
+ const _getCliPath = !isNodeModuleUnderAppFolder ? libName => _path.default.join(__dirname, '..', '..', 'node_modules', '.bin', libName) : libName => libName;
21
+
22
+ const suffixExt = isWindows ? '.cmd' : '';
23
+
24
+ function getCliPath(libName) {
25
+ const cliPath = _getCliPath(libName + suffixExt);
26
+
27
+ return (0, _fs.existsSync)(cliPath) ? cliPath : libName + suffixExt;
28
+ }
@@ -1,31 +1,29 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- var _path = require('path');
3
+ var _path = _interopRequireDefault(require("path"));
4
4
 
5
- var _path2 = _interopRequireDefault(_path);
5
+ var _express = _interopRequireDefault(require("express"));
6
6
 
7
- var _express = require('express');
8
-
9
- var _express2 = _interopRequireDefault(_express);
10
-
11
- var _utils = require('../utils');
7
+ var _utils = require("../utils");
12
8
 
13
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
10
 
15
- var options = (0, _utils.getOptions)();
16
- var server = options.help.server;
17
-
18
- var serverUrl = (0, _utils.getServerURL)(server, 'htt' + 'p');
19
- var port = server.port;
20
-
21
-
22
- var app = (0, _express2.default)();
23
-
24
- app.use('/help', _express2.default.static(_path2.default.join(__dirname, '..', '..', 'templates', 'help')));
25
-
26
- app.listen(port, function (err) {
11
+ let options = (0, _utils.getOptions)();
12
+ let {
13
+ help: {
14
+ server
15
+ }
16
+ } = options;
17
+ let serverUrl = (0, _utils.getServerURL)(server, 'htt' + 'p');
18
+ let {
19
+ port
20
+ } = server;
21
+ let app = (0, _express.default)();
22
+ app.use('/help', _express.default.static(_path.default.join(__dirname, '..', '..', 'templates', 'help')));
23
+ app.listen(port, err => {
27
24
  if (err) {
28
25
  throw err;
29
26
  }
30
- (0, _utils.log)('Listening at ' + serverUrl + '/help/');
27
+
28
+ (0, _utils.log)(`Listening at ${serverUrl}/help/`);
31
29
  });
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.httpsOptions = void 0;
7
+
8
+ var _fs = _interopRequireDefault(require("fs"));
9
+
10
+ var _path = _interopRequireDefault(require("path"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ const httpsOptions = {
15
+ key: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/Tsicsezwild-22-23.key')),
16
+ cert: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/Tsicsezwild-22-23.crt'))
17
+ };
18
+ exports.httpsOptions = httpsOptions;