@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,121 +1,118 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
3
+ var _os = require("os");
4
4
 
5
- var _os = require('os');
5
+ var _path = _interopRequireDefault(require("path"));
6
6
 
7
- var _path = require('path');
7
+ var _fs = _interopRequireDefault(require("fs"));
8
8
 
9
- var _path2 = _interopRequireDefault(_path);
9
+ var _child_process = require("child_process");
10
10
 
11
- var _fs = require('fs');
12
-
13
- var _fs2 = _interopRequireDefault(_fs);
14
-
15
- var _child_process = require('child_process');
16
-
17
- var _index = require('./index');
11
+ var _index = require("./index");
18
12
 
19
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
14
 
21
- var options = (0, _index.getOptions)();
15
+ function spawnSyncWithErrorLog(...args) {
16
+ let result = (0, _child_process.spawnSync)(...args);
22
17
 
23
- var _options$clone = options.clone,
24
- type = _options$clone.type,
25
- url = _options$clone.url,
26
- branch = _options$clone.branch,
27
- revision = _options$clone.revision,
28
- projectName = _options$clone.projectName,
29
- cacheDir = _options$clone.cacheDir,
30
- remoteName = _options$clone.remoteName,
31
- shouldDelete = _options$clone.shouldDelete;
18
+ if (result.stderr) {
19
+ console.error(result.stderr);
20
+ }
21
+ }
32
22
 
23
+ let options = (0, _index.getOptions)();
24
+ let {
25
+ clone: {
26
+ type,
27
+ url,
28
+ branch,
29
+ revision,
30
+ projectName,
31
+ shallowClone,
32
+ cacheDir,
33
+ remoteName,
34
+ shouldDelete
35
+ }
36
+ } = options;
33
37
 
34
38
  if (type && (type === 'git' || type === 'hg')) {
35
- (0, _index.log)('Going to clone ' + type + ' repository');
39
+ (0, _index.log)(`Going to clone ${type} repository`);
36
40
  } else {
37
41
  throw new Error('You must give valid type to clone a repository');
38
42
  }
39
43
 
40
44
  if (!cacheDir) {
41
- cacheDir = _path2.default.join((0, _os.homedir)(), '.react-cli');
45
+ cacheDir = _path.default.join((0, _os.homedir)(), '.react-cli');
42
46
  } else {
43
- cacheDir = _path2.default.join(process.cwd(), cacheDir);
47
+ cacheDir = _path.default.join(process.cwd(), cacheDir);
44
48
  }
45
49
 
46
50
  if (!projectName) {
47
- var _path$parse = _path2.default.parse(url),
48
- name = _path$parse.name;
51
+ let {
52
+ name
53
+ } = _path.default.parse(url);
49
54
 
50
55
  projectName = name;
51
56
  }
52
57
 
53
- var projectPath = _path2.default.join(cacheDir, projectName);
58
+ let projectPath = _path.default.join(cacheDir, projectName);
54
59
 
55
- var cloneRepo = function cloneRepo() {
56
- if (!_fs2.default.existsSync(cacheDir)) {
57
- _fs2.default.mkdirSync(cacheDir);
60
+ let cloneRepo = () => {
61
+ if (!_fs.default.existsSync(cacheDir)) {
62
+ _fs.default.mkdirSync(cacheDir);
58
63
  }
59
- var revisionOrBranch = void 0;
64
+
65
+ let revisionOrBranch;
60
66
 
61
67
  if (type === 'git') {
62
- revisionOrBranch = '-b' + branch;
68
+ revisionOrBranch = `-b${branch}`;
63
69
  } else {
64
70
  if (revision) {
65
- revisionOrBranch = '-r' + revision;
71
+ revisionOrBranch = `-r${revision}`;
66
72
  } else {
67
- revisionOrBranch = '-b' + branch;
73
+ revisionOrBranch = `-b${branch}`;
68
74
  }
69
75
  }
70
- (0, _index.log)('Going to clone ' + url + ' repo to ' + cacheDir + ' path');
71
- (0, _child_process.spawnSync)(type, ['clone', url, revisionOrBranch, projectName], {
76
+
77
+ (0, _index.log)(`Going to clone ${url} repo to ${cacheDir} path`); // this is for some time error will because of hg or git so we addid error log for this
78
+
79
+ let oargs = ['clone', url, revisionOrBranch, projectName];
80
+ type === 'git' && shallowClone && oargs.push('--depth=1');
81
+ spawnSyncWithErrorLog(type, oargs, {
72
82
  cwd: cacheDir,
73
83
  stdio: 'inherit'
74
84
  });
75
85
 
76
- if (type === 'hg') {
77
- _fs2.default.writeFileSync(_path2.default.join(projectPath, '.hg', 'remoteUrl'), url);
78
- }
86
+ _fs.default.writeFileSync(_path.default.join(projectPath, type === 'hg' ? '.hg' : '.git', 'remoteUrl'), url);
79
87
 
80
88
  (0, _index.log)('Repository cloned!');
81
89
  };
82
90
 
83
- var getRemoteURL = function getRemoteURL() {
84
- if (type === 'git') {
85
- var results = (0, _child_process.spawnSync)('git', ['config --get remote.' + remoteName + '.url'], {
86
- cwd: projectPath,
87
- stdio: 'inherit'
88
- });
89
-
90
- var _results$output$filte = results.output.filter(function (d) {
91
- return d;
92
- }),
93
- _results$output$filte2 = _slicedToArray(_results$output$filte, 1),
94
- _remoteUrl = _results$output$filte2[0];
91
+ let getRemoteURL = () => {
92
+ let remoteUrl = _fs.default.readFileSync(_path.default.join(projectPath, type === 'hg' ? '.hg' : '.git', 'remoteUrl')).toString();
95
93
 
96
- return _remoteUrl.replace(/(\r\n|\n|\r)/gm, '').trim();
97
- }
98
- var remoteUrl = _fs2.default.readFileSync(_path2.default.join(projectPath, '.hg', 'remoteUrl')).toString();
99
94
  return remoteUrl.trim();
100
95
  };
101
96
 
102
- if (_fs2.default.existsSync(projectPath)) {
103
- var remoteUrl = getRemoteURL();
97
+ if (_fs.default.existsSync(projectPath)) {
98
+ let remoteUrl = getRemoteURL();
104
99
 
105
100
  if (remoteUrl === url) {
106
101
  if (type === 'git') {
107
- (0, _child_process.spawnSync)(type, ['pull', remoteName, branch], {
102
+ spawnSyncWithErrorLog(type, ['pull', remoteName, branch], {
108
103
  cwd: projectPath,
109
104
  stdio: 'inherit'
110
105
  });
111
106
  } else {
112
- var revisionOrBranch = void 0;
107
+ let revisionOrBranch;
108
+
113
109
  if (revision) {
114
- revisionOrBranch = '-r' + revision;
110
+ revisionOrBranch = `-r${revision}`;
115
111
  } else {
116
- revisionOrBranch = '-b' + branch;
112
+ revisionOrBranch = `-b${branch}`;
117
113
  }
118
- (0, _child_process.spawnSync)(type, ['pull', revisionOrBranch, '-u', url], {
114
+
115
+ spawnSyncWithErrorLog(type, ['pull', revisionOrBranch, '-u', url], {
119
116
  cwd: projectPath,
120
117
  stdio: 'inherit'
121
118
  });
@@ -125,7 +122,6 @@ if (_fs2.default.existsSync(projectPath)) {
125
122
  cwd: cacheDir,
126
123
  stdio: 'inherit'
127
124
  });
128
-
129
125
  (0, _index.log)('Existing repository deleted!');
130
126
  cloneRepo();
131
127
  }
@@ -1,93 +1,80 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- var https = require('https');
4
- var http = require('http');
5
- var url = require('url');
6
- var querystring = require('querystring');
3
+ const https = require('https');
7
4
 
8
- var isObject = function isObject(data) {
9
- return data && data.toString && data.toString() === '[object Object]';
10
- };
5
+ const http = require('http');
11
6
 
12
- var isArray = function isArray(data) {
13
- return data && Array.isArray(data);
14
- };
7
+ const url = require('url');
15
8
 
16
- process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
9
+ const querystring = require('querystring');
17
10
 
18
- var callback = function callback(resolve) {
19
- return function (res) {
20
- res.setEncoding('utf8');
21
- var str = '';
11
+ let isObject = data => data && data.toString && data.toString() === '[object Object]';
22
12
 
23
- res.on('data', function (chunk) {
24
- str += chunk;
25
- });
13
+ let isArray = data => data && Array.isArray(data);
26
14
 
27
- res.on('end', function () {
28
- resolve({
29
- body: str,
30
- response: res
31
- });
32
- });
15
+ process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
33
16
 
34
- res.on('error', function (err) {
35
- process.stdout.write(err);
17
+ let callback = resolve => res => {
18
+ res.setEncoding('utf8');
19
+ let str = '';
20
+ res.on('data', chunk => {
21
+ str += chunk;
22
+ });
23
+ res.on('end', () => {
24
+ resolve({
25
+ body: str,
26
+ response: res
36
27
  });
37
- };
28
+ });
29
+ res.on('error', err => {
30
+ process.stdout.write(err);
31
+ });
38
32
  };
39
33
 
40
- var request = function request(options) {
41
- return new Promise(function (resolve, reject) {
42
- var _url$parse = url.parse(options.url),
43
- protocol = _url$parse.protocol,
44
- hostname = _url$parse.hostname,
45
- path = _url$parse.path,
46
- port = _url$parse.port;
47
-
48
- var _options$method = options.method,
49
- method = _options$method === undefined ? 'GET' : _options$method,
50
- _options$headers = options.headers,
51
- headers = _options$headers === undefined ? {} : _options$headers,
52
- _options$payload = options.payload,
53
- payload = _options$payload === undefined ? null : _options$payload,
54
- _options$formdata = options.formdata,
55
- formdata = _options$formdata === undefined ? null : _options$formdata;
56
-
57
-
58
- var newOptions = {
59
- host: hostname,
60
- port: port,
61
- path: path,
62
- method: method,
63
- headers: headers
64
- };
65
- var req = void 0;
66
-
67
- if (protocol === 'https:') {
68
- req = https.request(newOptions, callback(resolve));
69
- } else if (protocol === 'http:') {
70
- req = http.request(newOptions, callback(resolve));
71
- }
72
-
73
- if (method.toUpperCase() === 'POST') {
74
- if (isObject(payload) || isArray(payload)) {
75
- payload = JSON.stringify(payload);
76
- req.write(payload);
77
- } else if (isObject(formdata)) {
78
- formdata = querystring.stringify(formdata);
79
- req.write(formdata);
80
- }
34
+ let request = options => new Promise((resolve, reject) => {
35
+ let {
36
+ protocol,
37
+ hostname,
38
+ path,
39
+ port
40
+ } = url.parse(options.url);
41
+ let {
42
+ method = 'GET',
43
+ headers = {},
44
+ payload = null,
45
+ formdata = null
46
+ } = options;
47
+ let newOptions = {
48
+ host: hostname,
49
+ port: port,
50
+ path: path,
51
+ method: method,
52
+ headers: headers
53
+ };
54
+ let req;
55
+
56
+ if (protocol === 'https:') {
57
+ req = https.request(newOptions, callback(resolve));
58
+ } else if (protocol === 'http:') {
59
+ req = http.request(newOptions, callback(resolve));
60
+ }
61
+
62
+ if (method.toUpperCase() === 'POST') {
63
+ if (isObject(payload) || isArray(payload)) {
64
+ payload = JSON.stringify(payload);
65
+ req.write(payload);
66
+ } else if (isObject(formdata)) {
67
+ formdata = querystring.stringify(formdata);
68
+ req.write(formdata);
81
69
  }
70
+ }
82
71
 
83
- req.on('error', function (err) {
84
- //eslint-disable-next-line
85
- console.log(err);
86
- reject();
87
- });
88
-
89
- req.end();
72
+ req.on('error', err => {
73
+ //eslint-disable-next-line
74
+ console.log(err);
75
+ reject();
90
76
  });
91
- };
77
+ req.end();
78
+ });
92
79
 
93
80
  module.exports = request;
@@ -0,0 +1,73 @@
1
+ {
2
+ "jobDetails": {
3
+ "isTriggeredFromGit": true,
4
+ "isCIPassed": true,
5
+ "developerName": "GITLAB_USER_NAME",
6
+ "jobID": "CI_PIPELINE_ID",
7
+ "branchName": "CI_COMMIT_REF_NAME",
8
+ "commitMessage": "CI_COMMIT_MESSAGE",
9
+ "jobURL": "CI_JOB_URL",
10
+ "isByManual": "CI_JOB_MANUAL",
11
+ "commitID": "CI_COMMIT_SHA",
12
+ "executionTime": "Date.now()-Date.now()",
13
+ "hostName": "kathir-zt252"
14
+ },
15
+ "tests": {
16
+ "unitCase": {
17
+ "startTime": "123455",
18
+ "endTime": "123446",
19
+ "isExecuted": true,
20
+ "numberOfSuccess": "",
21
+ "numberOfFails": "",
22
+ "numberOfCases": "",
23
+ "numberOfSuites": "",
24
+ "fileDetail": {
25
+ "fileName": "sample.spec.js",
26
+ "caseDetail": {
27
+ "failedCaseLists": [],
28
+ "passedCaseList": []
29
+ }
30
+ },
31
+ "coverageDetail": {
32
+ "codeCoveragePercentage": "",
33
+ "fileCoveragePercentage": ""
34
+ }
35
+ },
36
+ "modifiedFileUnitCase": {
37
+ "hasChanges": "true",
38
+ "startTime": "123455",
39
+ "endTime": "123446",
40
+ "isExecuted": true,
41
+ "isPassed": true,
42
+ "numberOfSuccess": "",
43
+ "numberOfFails": "",
44
+ "numberOfCases": "",
45
+ "numberOfSuites": "",
46
+ "fileDetail": {
47
+ "fileName": "sample.spec.js",
48
+ "caseDetail": {
49
+ "failedCaseLists": [],
50
+ "passedCaseList": []
51
+ }
52
+ },
53
+ "coverageDetail": {
54
+ "codeCoveragePercentage": "",
55
+ "fileCoveragePercentage": ""
56
+ }
57
+ },
58
+ "screenshotTest": {
59
+ "message": "some",
60
+ "startTime": "123455",
61
+ "endTime": "123446",
62
+ "isThisExecuted": true,
63
+ "compareBranch": "master",
64
+ "isPassed": true,
65
+ "result": {
66
+ "numberOfComponents": 200,
67
+ "numberOfDiffFiles": 20,
68
+ "improperDocsList": [],
69
+ "erroredComponents": []
70
+ }
71
+ }
72
+ }
73
+ }
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ var _postcss = _interopRequireDefault(require("postcss"));
4
+
5
+ var _path = _interopRequireDefault(require("path"));
6
+
7
+ var _fs = _interopRequireDefault(require("fs"));
8
+
9
+ var _folderIterator = _interopRequireDefault(require("./folderIterator"));
10
+
11
+ var _postcssRtl = _interopRequireDefault(require("@zohodesk/postcss-rtl"));
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
15
+ let cwd = process.cwd();
16
+
17
+ let src = _path.default.join(cwd, process.argv[2]);
18
+
19
+ let dist = _path.default.join(cwd, process.argv[3]);
20
+
21
+ let canWacth = '-w' === process.argv[4];
22
+
23
+ // import { useExitCleanup } from './useExitCleanup';
24
+ function watchHandler(fromPath, toPath) {
25
+ let css = _fs.default.readFileSync(fromPath);
26
+
27
+ (0, _postcss.default)([(0, _postcssRtl.default)({
28
+ addPrefixToSelector: function addPrefixToSelector(selector, prefix) {
29
+ if (prefix === '[dir]') {
30
+ return selector;
31
+ }
32
+
33
+ return `${prefix} ${selector}`; // Make selectors like [dir=rtl] > .selector
34
+ }
35
+ })]).process(css, {
36
+ from: fromPath,
37
+ to: toPath
38
+ }).then(result => {
39
+ _fs.default.writeFile(toPath, result.css, () => true);
40
+
41
+ if (result.map) {
42
+ _fs.default.writeFile(`${toPath}.map`, result.map, () => true);
43
+ }
44
+ });
45
+ }
46
+
47
+ (0, _folderIterator.default)(src, dist, ['.css'], false, (fromPath, toPath) => {
48
+ if (canWacth && fromPath) {
49
+ _fs.default.watchFile(fromPath, () => {
50
+ watchHandler(fromPath, toPath);
51
+ });
52
+ }
53
+
54
+ watchHandler(fromPath, toPath);
55
+ }); // if (canWacth) {
56
+ // useExitCleanup(() => {
57
+ // fs.unwatchFile(src, watchHandler);
58
+ // });
59
+ // }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ var _child_process = require("child_process");
4
+
5
+ let args = process.argv.slice(2);
6
+ args.forEach(arg => {
7
+ if (arg.startsWith('-')) {
8
+ //eslint-disable-next-line
9
+ arg = arg.substring(2);
10
+ }
11
+
12
+ (0, _child_process.execSync)(`npm config set ${arg}`);
13
+ });
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = 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
+ function iterateDir(srcPath, callback) {
15
+ function iterate(srcPath) {
16
+ if (_fs.default.existsSync(srcPath)) {
17
+ _fs.default.readdirSync(srcPath).forEach(fileOrDir => {
18
+ let fromPath = _path.default.join(srcPath, fileOrDir);
19
+
20
+ if (_fs.default.statSync(fromPath).isDirectory()) {
21
+ iterate(fromPath);
22
+ } else {
23
+ callback(fromPath);
24
+ }
25
+ });
26
+ }
27
+ }
28
+
29
+ iterate(srcPath);
30
+ }
31
+
32
+ var _default = () => {
33
+ let dependencyFolders = [_path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'components', 'lib'), _path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'dot', 'lib'), _path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'icons', 'lib'), _path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'svg', 'lib'), _path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'variables', 'lib')];
34
+ let pattern = /if.*\(false\)/g;
35
+ dependencyFolders.forEach(componentsFolder => {
36
+ iterateDir(componentsFolder, filepath => {
37
+ let src = _fs.default.readFileSync(filepath).toString();
38
+
39
+ if (pattern.test(src)) {
40
+ src = src.replace(pattern, 'if (true)');
41
+
42
+ _fs.default.writeFileSync(filepath, src);
43
+ }
44
+ });
45
+ });
46
+ };
47
+
48
+ exports.default = _default;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _child_process = require("child_process");
9
+
10
+ var _utils = require("../utils");
11
+
12
+ var _default = (type = 'git', branchName) => new Promise(resolve => {
13
+ if (type === 'git') {
14
+ (0, _utils.log)((0, _utils.getCurrentBranch)(type, process.cwd()), 'Before the branch switch');
15
+ (0, _child_process.spawnSync)('git', ['checkout', branchName, '--force'], {
16
+ encoding: 'utf8'
17
+ });
18
+ (0, _utils.log)((0, _utils.getCurrentBranch)(type, process.cwd()), 'After the branch switch');
19
+ (0, _utils.pullOrigin)(type, branchName).then(resolve);
20
+ } else if (type === 'hg') {
21
+ (0, _child_process.spawnSync)('hg', ['update', branchName], {
22
+ encoding: 'utf8'
23
+ });
24
+ (0, _utils.pullOrigin)(type, branchName).then(resolve);
25
+ }
26
+ });
27
+
28
+ exports.default = _default;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.urlConcat = urlConcat;
7
+
8
+ function urlConcat(p1 = '', p2 = '') {
9
+ if (p1[p1.length - 1] === '/') {
10
+ if (p2[0] === '/') {
11
+ return p1 + p2.slice(1);
12
+ }
13
+
14
+ return p1 + p2;
15
+ }
16
+
17
+ if (p2[0] === '/') {
18
+ return p1 + p2;
19
+ }
20
+
21
+ return `${p1}/${p2}`;
22
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useExitCleanup = useExitCleanup;
7
+ //so the program will not close instantly
8
+ let listeners = [];
9
+ let hasCalled = false;
10
+
11
+ function useExitCleanup(listener) {
12
+ if (!hasCalled) {
13
+ process.stdin.resume();
14
+ hasCalled = true;
15
+ }
16
+
17
+ listeners.push(listeners);
18
+ return () => {
19
+ listeners = listeners.filter(l => l !== listener);
20
+ };
21
+ }
22
+
23
+ function exitHandler(options, exitCode) {
24
+ if (options.cleanup) {
25
+ console.log('clean');
26
+ }
27
+
28
+ if (exitCode || exitCode === 0) {
29
+ console.log(exitCode);
30
+ }
31
+
32
+ if (options.exit) {
33
+ process.exit();
34
+ }
35
+ } //do something when app is closing
36
+
37
+
38
+ process.on('exit', exitHandler.bind(null, {
39
+ cleanup: true
40
+ })); //catches ctrl+c event
41
+
42
+ process.on('SIGINT', exitHandler.bind(null, {
43
+ exit: true
44
+ })); // catches "kill pid" (for example: nodemon restart)
45
+
46
+ process.on('SIGUSR1', exitHandler.bind(null, {
47
+ exit: true
48
+ }));
49
+ process.on('SIGUSR2', exitHandler.bind(null, {
50
+ exit: true
51
+ })); //catches uncaught exceptions
52
+
53
+ process.on('uncaughtException', exitHandler.bind(null, {
54
+ exit: true
55
+ }));
package/npm8.md ADDED
@@ -0,0 +1,9 @@
1
+ # npm 8 change related things
2
+
3
+ 1. in npm run script config options `:` not working (properly|correctly), So we need to use `_` in the place of `:`
4
+ For Example:
5
+ - `--app:port` wouldn't work we have to do like this `--app_port`
6
+ - `--clone:proj:name` wouldn't work we have to do like this `----clone_proj_name`
7
+
8
+ @zohodes/react-cli or fz-react-cli regardless of what cli you use.
9
+ So, we need to change all package.json script which is using this (`:`) we need to change as (`_`)