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

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
@@ -1,13 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  let getOptions = require('./getOptions').default;
4
+
4
5
  let fs = require('fs');
6
+
5
7
  let coverageCollector = require('../jest/coverageCollector');
8
+
6
9
  let path = require('path');
10
+
7
11
  let {
8
12
  htmlTemplate,
9
13
  endTag
10
14
  } = require('../templates/linterConstant');
15
+
11
16
  let {
12
17
  esLint: {
13
18
  srcBranch,
@@ -19,9 +24,12 @@ let {
19
24
  reportPath
20
25
  }
21
26
  } = getOptions();
27
+
22
28
  function writeFile(filePath, data) {
23
29
  filePath = path.join(process.cwd(), filePath); //eslint-disable-line
30
+
24
31
  let dirName = path.dirname(filePath);
32
+
25
33
  if (!fs.existsSync(dirName)) {
26
34
  fs.mkdirSync(dirName);
27
35
  fs.writeFileSync(filePath, data);
@@ -29,6 +37,7 @@ function writeFile(filePath, data) {
29
37
  fs.writeFileSync(filePath, data);
30
38
  }
31
39
  }
40
+
32
41
  let formatter = {
33
42
  jsonFormatter: data => {
34
43
  let finalList = [];
@@ -39,6 +48,7 @@ let formatter = {
39
48
  tempMessageList.push(messageObj);
40
49
  }
41
50
  });
51
+
42
52
  if (tempMessageList.length > 0) {
43
53
  finalList.push(errorFileObj);
44
54
  }
@@ -47,6 +57,7 @@ let formatter = {
47
57
  },
48
58
  htmlFormatter: data => {
49
59
  data = formatter.jsonFormatter(data); //eslint-disable-line
60
+
50
61
  if (data.length > 0) {
51
62
  let liTag = '';
52
63
  data.forEach(errorFileObj => {
@@ -54,16 +65,19 @@ let formatter = {
54
65
  let messageTag = '';
55
66
  errorFileObj.messages.forEach(messageObj => {
56
67
  let errorType = messageObj.severity == 2 ? 'Error' : 'Warning'; //eslint-disable-line
68
+
57
69
  messageTag = `${messageTag}<div class="pkDetailsRow"><div class="pkDetailsCol">${messageObj.line}</div><div class="pkDetailsCol pkError">${errorType}</div><div class="pkDetailsCol">${messageObj.message}</div><div class="pkDetailsCol">${messageObj.ruleId}</div></div>`;
58
70
  });
59
71
  liTag = `${liTag + messageTag}</div></div></li>`;
60
72
  });
61
73
  return `${htmlTemplate}<ul class="pkUl">${liTag}</ul>${endTag}`;
62
74
  }
75
+
63
76
  return `${htmlTemplate}<div class="pkEmpty"><div>No test results with found</div></div>${endTag}`;
64
77
  },
65
78
  xmlFormatter: data => {
66
79
  data = formatter.jsonFormatter(data); //eslint-disable-line
80
+
67
81
  let startTag = '<jscheck>';
68
82
  let engTag = '</jscheck>';
69
83
  let bodyContent = '';
@@ -79,8 +93,10 @@ let formatter = {
79
93
  return startTag + bodyContent + engTag;
80
94
  }
81
95
  };
96
+
82
97
  function formatSplitter(inputJson) {
83
98
  let outputData;
99
+
84
100
  if (reportType === 'json') {
85
101
  outputData = JSON.stringify(formatter.jsonFormatter(inputJson));
86
102
  } else if (reportType === 'html') {
@@ -88,8 +104,10 @@ function formatSplitter(inputJson) {
88
104
  } else if (reportType === 'xml') {
89
105
  outputData = formatter.xmlFormatter(inputJson);
90
106
  }
107
+
91
108
  writeFile(reportPath, outputData);
92
109
  }
110
+
93
111
  module.exports = function (results) {
94
112
  let erroredFileObjectList = [];
95
113
  results.forEach(fileObject => {
@@ -102,9 +120,11 @@ module.exports = function (results) {
102
120
  });
103
121
  }
104
122
  });
123
+
105
124
  if (impactRun) {
106
125
  coverageCollector(srcBranch, targetBranch, serviceName, impactServerDomain).then((res = {}) => {
107
126
  let impactList = [];
127
+
108
128
  if (res.STATUS) {
109
129
  if (res.LIST.length > 0) {
110
130
  erroredFileObjectList.forEach(errFileObj => {
@@ -1,15 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  var _nodemailer = _interopRequireDefault(require("nodemailer"));
4
+
4
5
  var _index = require("./index");
6
+
5
7
  var _jsonHelper = require("./jsonHelper");
8
+
6
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+
7
11
  if (process.argv.length <= 6) {
8
12
  (0, _index.log)('Usage: node mailSender <from> <pass> <to> <subject> <html>');
9
13
  process.exit(-1);
10
14
  }
15
+
11
16
  let [from, pass, to, subject, html, cc, user, reportURL] = process.argv.slice(2);
12
17
  (0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'Report_URL', reportURL);
18
+
13
19
  let transporter = _nodemailer.default.createTransport({
14
20
  host: 'smtp.tsi.zohocorpin.com',
15
21
  port: 25,
@@ -19,6 +25,7 @@ let transporter = _nodemailer.default.createTransport({
19
25
  pass
20
26
  }
21
27
  });
28
+
22
29
  let mailOptions = {
23
30
  from: from,
24
31
  to: to,
@@ -4,8 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _child_process = require("child_process");
9
+
8
10
  var _utils = require("../utils");
11
+
9
12
  var _default = (type = 'git', branchName) => new Promise(resolve => {
10
13
  if (type === 'git') {
11
14
  (0, _child_process.spawnSync)('git', ['pull', 'origin', branchName], {
@@ -21,4 +24,5 @@ var _default = (type = 'git', branchName) => new Promise(resolve => {
21
24
  resolve();
22
25
  }
23
26
  });
27
+
24
28
  exports.default = _default;
@@ -4,13 +4,21 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.reinstallDependencies1 = exports.reinstallDependencies = exports.collectPackageDiff = void 0;
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 _gitRootDir = _interopRequireDefault(require("git-root-dir"));
15
+
11
16
  var _index = require("./index");
17
+
12
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
13
20
  let packageJsons = {};
21
+
14
22
  let packageDiffChecker = (pre, current) => {
15
23
  let {
16
24
  dependencies = {},
@@ -19,23 +27,28 @@ let packageDiffChecker = (pre, current) => {
19
27
  let diffs = {};
20
28
  Object.keys(dependencies).forEach(pack => {
21
29
  let version = dependencies[pack];
30
+
22
31
  if (version !== pre.dependencies && pre.dependencies[pack]) {
23
32
  diffs[pack] = version;
24
33
  }
25
34
  });
26
35
  Object.keys(devDependencies).forEach(pack => {
27
36
  let version = devDependencies[pack];
37
+
28
38
  if (version !== pre.devDependencies && pre.devDependencies[pack]) {
29
39
  diffs[pack] = version;
30
40
  }
31
41
  });
32
42
  return diffs;
33
43
  };
44
+
34
45
  let collectPackageDiff = pathToSubProjects => new Promise(resolve => {
35
46
  (0, _gitRootDir.default)(process.cwd()).then(rootDir => {
36
47
  let projects = _fs.default.readdirSync(_path.default.join(rootDir, pathToSubProjects));
48
+
37
49
  projects.forEach(project => {
38
50
  let packageJson = _path.default.join(_path.default.join(rootDir, pathToSubProjects), project, 'package.json');
51
+
39
52
  if (_fs.default.existsSync(packageJson)) {
40
53
  packageJsons[project] = require(packageJson);
41
54
  }
@@ -43,21 +56,29 @@ let collectPackageDiff = pathToSubProjects => new Promise(resolve => {
43
56
  resolve();
44
57
  });
45
58
  });
59
+
46
60
  exports.collectPackageDiff = collectPackageDiff;
61
+
47
62
  let reinstallDependencies1 = pathToSubProjects => {
48
63
  (0, _gitRootDir.default)(process.cwd()).then(rootDir => {
49
64
  let projects = _fs.default.readdirSync(_path.default.join(rootDir, pathToSubProjects));
65
+
50
66
  projects.forEach(project => {
51
67
  let prePackageJson = packageJsons[project];
52
68
  let currentPackageJson;
69
+
53
70
  if (prePackageJson) {
54
71
  currentPackageJson = _path.default.join(_path.default.join(rootDir, pathToSubProjects), project, 'package.json');
72
+
55
73
  if (_fs.default.existsSync(currentPackageJson)) {
56
74
  currentPackageJson = require(currentPackageJson);
57
75
  }
58
76
  }
77
+
59
78
  let projPath = _path.default.join(_path.default.join(rootDir, pathToSubProjects), project);
79
+
60
80
  let diffs = packageDiffChecker(prePackageJson, currentPackageJson);
81
+
61
82
  if (Object.keys(diffs).length) {
62
83
  (0, _index.log)(diffs, `package diffs between branches for ${project} project`);
63
84
  (0, _child_process.spawnSync)('rm', ['-rf', 'package-lock.json'], {
@@ -66,10 +87,12 @@ let reinstallDependencies1 = pathToSubProjects => {
66
87
  });
67
88
  let packages = Object.keys(diffs);
68
89
  let dummy = [];
90
+
69
91
  for (let name of packages) {
70
92
  let version = diffs[name];
71
93
  dummy.push(`${name}@${version}`);
72
94
  }
95
+
73
96
  (0, _index.log)(`npm ${['install'].concat(dummy).join(' ')}`);
74
97
  (0, _child_process.spawnSync)('npm', ['install'].concat(dummy), {
75
98
  cwd: projPath,
@@ -88,12 +111,16 @@ let reinstallDependencies1 = pathToSubProjects => {
88
111
  });
89
112
  });
90
113
  };
114
+
91
115
  exports.reinstallDependencies1 = reinstallDependencies1;
116
+
92
117
  let reinstallDependencies = pathToSubProjects => new Promise(resolve => {
93
118
  (0, _gitRootDir.default)(process.cwd()).then(rootDir => {
94
119
  let projects = _fs.default.readdirSync(_path.default.join(rootDir, pathToSubProjects));
120
+
95
121
  projects.forEach(project => {
96
122
  let projPath = _path.default.join(_path.default.join(rootDir, pathToSubProjects), project);
123
+
97
124
  (0, _child_process.spawnSync)('npm', ['install'], {
98
125
  cwd: projPath,
99
126
  stdio: 'inherit'
@@ -102,4 +129,5 @@ let reinstallDependencies = pathToSubProjects => new Promise(resolve => {
102
129
  });
103
130
  });
104
131
  });
132
+
105
133
  exports.reinstallDependencies = reinstallDependencies;
@@ -1,27 +1,34 @@
1
1
  "use strict";
2
2
 
3
3
  var _getOptions = _interopRequireDefault(require("./getOptions"));
4
+
4
5
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
+
5
7
  let options = (0, _getOptions.default)();
6
8
  let {
7
9
  app: {
8
10
  attrbuteNames
9
11
  }
10
12
  } = options;
13
+
11
14
  module.exports = () => ({
12
15
  visitor: {
13
16
  Program(path, state) {
14
17
  let properties = state.opts.properties || [];
18
+
15
19
  if (properties.length === 0) {
16
20
  properties = properties.concat(attrbuteNames);
17
21
  }
22
+
18
23
  path.traverse({
19
24
  JSXIdentifier(path2) {
20
25
  if (properties.indexOf(path2.node.name.toLowerCase()) > -1) {
21
26
  path2.parentPath.remove();
22
27
  }
23
28
  }
29
+
24
30
  });
25
31
  }
32
+
26
33
  }
27
34
  });
@@ -1,17 +1,25 @@
1
1
  "use strict";
2
2
 
3
3
  var _os = require("os");
4
+
4
5
  var _path = _interopRequireDefault(require("path"));
6
+
5
7
  var _fs = _interopRequireDefault(require("fs"));
8
+
6
9
  var _child_process = require("child_process");
10
+
7
11
  var _index = require("./index");
12
+
8
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
9
15
  function spawnSyncWithErrorLog(...args) {
10
16
  let result = (0, _child_process.spawnSync)(...args);
17
+
11
18
  if (result.stderr) {
12
19
  console.error(result.stderr);
13
20
  }
14
21
  }
22
+
15
23
  let options = (0, _index.getOptions)();
16
24
  let {
17
25
  clone: {
@@ -26,28 +34,36 @@ let {
26
34
  shouldDelete
27
35
  }
28
36
  } = options;
37
+
29
38
  if (type && (type === 'git' || type === 'hg')) {
30
39
  (0, _index.log)(`Going to clone ${type} repository`);
31
40
  } else {
32
41
  throw new Error('You must give valid type to clone a repository');
33
42
  }
43
+
34
44
  if (!cacheDir) {
35
45
  cacheDir = _path.default.join((0, _os.homedir)(), '.react-cli');
36
46
  } else {
37
47
  cacheDir = _path.default.join(process.cwd(), cacheDir);
38
48
  }
49
+
39
50
  if (!projectName) {
40
51
  let {
41
52
  name
42
53
  } = _path.default.parse(url);
54
+
43
55
  projectName = name;
44
56
  }
57
+
45
58
  let projectPath = _path.default.join(cacheDir, projectName);
59
+
46
60
  let cloneRepo = () => {
47
61
  if (!_fs.default.existsSync(cacheDir)) {
48
62
  _fs.default.mkdirSync(cacheDir);
49
63
  }
64
+
50
65
  let revisionOrBranch;
66
+
51
67
  if (type === 'git') {
52
68
  revisionOrBranch = `-b${branch}`;
53
69
  } else {
@@ -57,23 +73,30 @@ let cloneRepo = () => {
57
73
  revisionOrBranch = `-b${branch}`;
58
74
  }
59
75
  }
60
- (0, _index.log)(`Going to clone ${url} repo to ${cacheDir} path`);
61
- // this is for some time error will because of hg or git so we addid error log for this
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
+
62
79
  let oargs = ['clone', url, revisionOrBranch, projectName];
63
80
  type === 'git' && shallowClone && oargs.push('--depth=1');
64
81
  spawnSyncWithErrorLog(type, oargs, {
65
82
  cwd: cacheDir,
66
83
  stdio: 'inherit'
67
84
  });
85
+
68
86
  _fs.default.writeFileSync(_path.default.join(projectPath, type === 'hg' ? '.hg' : '.git', 'remoteUrl'), url);
87
+
69
88
  (0, _index.log)('Repository cloned!');
70
89
  };
90
+
71
91
  let getRemoteURL = () => {
72
92
  let remoteUrl = _fs.default.readFileSync(_path.default.join(projectPath, type === 'hg' ? '.hg' : '.git', 'remoteUrl')).toString();
93
+
73
94
  return remoteUrl.trim();
74
95
  };
96
+
75
97
  if (_fs.default.existsSync(projectPath)) {
76
98
  let remoteUrl = getRemoteURL();
99
+
77
100
  if (remoteUrl === url) {
78
101
  if (type === 'git') {
79
102
  spawnSyncWithErrorLog(type, ['pull', remoteName, branch], {
@@ -82,11 +105,13 @@ if (_fs.default.existsSync(projectPath)) {
82
105
  });
83
106
  } else {
84
107
  let revisionOrBranch;
108
+
85
109
  if (revision) {
86
110
  revisionOrBranch = `-r${revision}`;
87
111
  } else {
88
112
  revisionOrBranch = `-b${branch}`;
89
113
  }
114
+
90
115
  spawnSyncWithErrorLog(type, ['pull', revisionOrBranch, '-u', url], {
91
116
  cwd: projectPath,
92
117
  stdio: 'inherit'
@@ -1,12 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  const https = require('https');
4
+
4
5
  const http = require('http');
6
+
5
7
  const url = require('url');
8
+
6
9
  const querystring = require('querystring');
10
+
7
11
  let isObject = data => data && data.toString && data.toString() === '[object Object]';
12
+
8
13
  let isArray = data => data && Array.isArray(data);
14
+
9
15
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
16
+
10
17
  let callback = resolve => res => {
11
18
  res.setEncoding('utf8');
12
19
  let str = '';
@@ -23,6 +30,7 @@ let callback = resolve => res => {
23
30
  process.stdout.write(err);
24
31
  });
25
32
  };
33
+
26
34
  let request = options => new Promise((resolve, reject) => {
27
35
  let {
28
36
  protocol,
@@ -44,11 +52,13 @@ let request = options => new Promise((resolve, reject) => {
44
52
  headers: headers
45
53
  };
46
54
  let req;
55
+
47
56
  if (protocol === 'https:') {
48
57
  req = https.request(newOptions, callback(resolve));
49
58
  } else if (protocol === 'http:') {
50
59
  req = http.request(newOptions, callback(resolve));
51
60
  }
61
+
52
62
  if (method.toUpperCase() === 'POST') {
53
63
  if (isObject(payload) || isArray(payload)) {
54
64
  payload = JSON.stringify(payload);
@@ -58,6 +68,7 @@ let request = options => new Promise((resolve, reject) => {
58
68
  req.write(formdata);
59
69
  }
60
70
  }
71
+
61
72
  req.on('error', err => {
62
73
  //eslint-disable-next-line
63
74
  console.log(err);
@@ -65,4 +76,5 @@ let request = options => new Promise((resolve, reject) => {
65
76
  });
66
77
  req.end();
67
78
  });
79
+
68
80
  module.exports = request;
@@ -1,73 +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
- }
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
+ }
package/lib/utils/rtl.js CHANGED
@@ -1,24 +1,35 @@
1
1
  "use strict";
2
2
 
3
3
  var _postcss = _interopRequireDefault(require("postcss"));
4
+
4
5
  var _path = _interopRequireDefault(require("path"));
6
+
5
7
  var _fs = _interopRequireDefault(require("fs"));
8
+
6
9
  var _folderIterator = _interopRequireDefault(require("./folderIterator"));
10
+
7
11
  var _postcssRtl = _interopRequireDefault(require("@zohodesk/postcss-rtl"));
12
+
8
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
9
15
  let cwd = process.cwd();
16
+
10
17
  let src = _path.default.join(cwd, process.argv[2]);
18
+
11
19
  let dist = _path.default.join(cwd, process.argv[3]);
20
+
12
21
  let canWacth = '-w' === process.argv[4];
13
- // import { useExitCleanup } from './useExitCleanup';
14
22
 
23
+ // import { useExitCleanup } from './useExitCleanup';
15
24
  function watchHandler(fromPath, toPath) {
16
25
  let css = _fs.default.readFileSync(fromPath);
26
+
17
27
  (0, _postcss.default)([(0, _postcssRtl.default)({
18
28
  addPrefixToSelector: function addPrefixToSelector(selector, prefix) {
19
29
  if (prefix === '[dir]') {
20
30
  return selector;
21
31
  }
32
+
22
33
  return `${prefix} ${selector}`; // Make selectors like [dir=rtl] > .selector
23
34
  }
24
35
  })]).process(css, {
@@ -26,21 +37,22 @@ function watchHandler(fromPath, toPath) {
26
37
  to: toPath
27
38
  }).then(result => {
28
39
  _fs.default.writeFile(toPath, result.css, () => true);
40
+
29
41
  if (result.map) {
30
42
  _fs.default.writeFile(`${toPath}.map`, result.map, () => true);
31
43
  }
32
44
  });
33
45
  }
46
+
34
47
  (0, _folderIterator.default)(src, dist, ['.css'], false, (fromPath, toPath) => {
35
48
  if (canWacth && fromPath) {
36
49
  _fs.default.watchFile(fromPath, () => {
37
50
  watchHandler(fromPath, toPath);
38
51
  });
39
52
  }
40
- watchHandler(fromPath, toPath);
41
- });
42
53
 
43
- // if (canWacth) {
54
+ watchHandler(fromPath, toPath);
55
+ }); // if (canWacth) {
44
56
  // useExitCleanup(() => {
45
57
  // fs.unwatchFile(src, watchHandler);
46
58
  // });