@zohodesk/react-cli 0.0.1-beta.16 → 0.0.1-beta.160

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 (226) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +46 -3
  3. package/CHANGELOG.md +5 -0
  4. package/README.md +650 -0
  5. package/bin/cli.js +134 -27
  6. package/cert/cert.pem +37 -129
  7. package/cert/key.pem +27 -27
  8. package/cert/passphrase.pem +1 -0
  9. package/files/eslintrc.js +62 -0
  10. package/files/prettierrc.js +3 -0
  11. package/lib/babel/cmjs-plugins-presets.js +16 -9
  12. package/lib/babel/es-plugins-presets.js +26 -14
  13. package/lib/common/getEntries.js +33 -24
  14. package/lib/common/getPublicPathConfig.js +40 -0
  15. package/lib/common/index.js +27 -13
  16. package/lib/common/splitChunks.js +64 -26
  17. package/lib/common/sslcertUpdater.js +59 -0
  18. package/lib/common/templateParameters.js +25 -0
  19. package/lib/configs/jest.config.js +18 -28
  20. package/lib/configs/webpack.component.umd.config.js +31 -37
  21. package/lib/configs/webpack.css.umd.config.js +44 -44
  22. package/lib/configs/webpack.dev.config.js +113 -57
  23. package/lib/configs/webpack.docs.config.js +104 -98
  24. package/lib/configs/webpack.impact.config.js +116 -0
  25. package/lib/configs/webpack.prod.config.js +154 -86
  26. package/lib/hooks/docsProptypeHook.js +32 -38
  27. package/lib/jest/commitedFilesResult.js +144 -71
  28. package/lib/jest/coverageCollector.js +62 -29
  29. package/lib/jest/jsonMaker.js +54 -0
  30. package/lib/jest/preProcessors/cssPreprocessor.js +16 -18
  31. package/lib/jest/preProcessors/jsPreprocessor.js +5 -6
  32. package/lib/jest/preProcessors/otherFilesPreprocessor.js +5 -6
  33. package/lib/jest/result.js +91 -41
  34. package/lib/jest/run.js +74 -27
  35. package/lib/jest/setup.js +103 -102
  36. package/lib/loaderUtils/getCSSLoaders.js +77 -0
  37. package/lib/loaderUtils/getDevJsLoaders.js +30 -23
  38. package/lib/loaderUtils/index.js +14 -7
  39. package/lib/loaders/docsLoader.js +15 -15
  40. package/lib/loaders/docsPropsLoader.js +14 -17
  41. package/lib/loaders/fileBountryLoader.js +17 -0
  42. package/lib/loaders/fileLoader.js +47 -38
  43. package/lib/loaders/scriptInstrumentLoader.js +21 -20
  44. package/lib/loaders/selectorMappingLoader.js +75 -0
  45. package/lib/loaders/workerLoader.js +136 -0
  46. package/lib/middlewares/HMRMiddleware.js +59 -41
  47. package/lib/middlewares/SSTMiddleware.js +21 -0
  48. package/lib/pluginUtils/getDevPlugins.js +173 -26
  49. package/lib/pluginUtils/getDocsPlugins.js +32 -17
  50. package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
  51. package/lib/pluginUtils/getLibraryPlugins.js +8 -10
  52. package/lib/pluginUtils/getProdPlugins.js +238 -37
  53. package/lib/pluginUtils/getServerPlugins.js +8 -11
  54. package/lib/pluginUtils/getUMDCSSPlugins.js +11 -15
  55. package/lib/pluginUtils/getUMDComponentPlugins.js +11 -15
  56. package/lib/pluginUtils/index.js +36 -43
  57. package/lib/plugins/CdnChangePlugin.js +77 -0
  58. package/lib/plugins/CleanupStatsPlugin.js +28 -0
  59. package/lib/plugins/EFCPlugin.js +211 -0
  60. package/lib/plugins/EFCPlugin.md +6 -0
  61. package/lib/plugins/I18NInjectIntoIndexPlugin.js +141 -0
  62. package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +60 -0
  63. package/lib/plugins/I18nSplitPlugin/I18nDependency.js +44 -0
  64. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +266 -0
  65. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +183 -0
  66. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +100 -0
  67. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +86 -0
  68. package/lib/plugins/I18nSplitPlugin/README.md +25 -0
  69. package/lib/plugins/I18nSplitPlugin/index.js +185 -0
  70. package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +64 -0
  71. package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +13 -0
  72. package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +26 -0
  73. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +40 -0
  74. package/lib/plugins/I18nSplitPlugin/utils/index.js +31 -0
  75. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +112 -0
  76. package/lib/plugins/ManifestPlugin.js +52 -63
  77. package/lib/plugins/ModuleStatsPlugin.js +98 -97
  78. package/lib/plugins/OptimizeJSPlugin.js +24 -41
  79. package/lib/plugins/PublicPathCallbackPlugin.js +63 -0
  80. package/lib/plugins/PublicPathChangePlugin.js +187 -174
  81. package/lib/plugins/ReportGeneratePlugin.js +181 -0
  82. package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
  83. package/lib/plugins/ResourceHintsPlugin.js +53 -35
  84. package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +80 -0
  85. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +82 -0
  86. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
  87. package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +26 -0
  88. package/lib/plugins/ScriptInstrumentPlugin.js +22 -37
  89. package/lib/plugins/ServiceWorkerPlugin.js +107 -0
  90. package/lib/plugins/ShadowDOMSupportPlugin.js +270 -0
  91. package/lib/plugins/SourceMapHookPlugin.js +25 -31
  92. package/lib/plugins/TPHashMappingPlugin.js +67 -0
  93. package/lib/plugins/UglifyCSSPlugin.js +23 -30
  94. package/lib/plugins/UnusedFilesFindPlugin.js +150 -97
  95. package/lib/plugins/index.js +118 -55
  96. package/lib/plugins/libraryImpactPlugin.js +190 -0
  97. package/lib/plugins/webpackwatchrunplugin.js +26 -0
  98. package/lib/postcss-plugins/ExcludeRTLPlugin.js +23 -0
  99. package/lib/postcss-plugins/RTLSplitPlugin.js +138 -0
  100. package/lib/schemas/index.js +463 -52
  101. package/lib/servers/clusterHubServer.js +22 -26
  102. package/lib/servers/docsServer.js +3 -5
  103. package/lib/servers/docsServerCore.js +93 -85
  104. package/lib/servers/helpServer.js +19 -21
  105. package/lib/servers/httpsOptions.js +19 -0
  106. package/lib/servers/impactServer.js +99 -92
  107. package/lib/servers/mockserver.js +44 -0
  108. package/lib/servers/nowatchserver.js +275 -0
  109. package/lib/servers/scrServer.js +147 -0
  110. package/lib/servers/server.js +118 -124
  111. package/lib/servers/ssServer.js +107 -65
  112. package/lib/sh/reportPublish.sh +16 -10
  113. package/lib/templates/CoverageScriptTemplate.js +45 -18
  114. package/lib/templates/WMSTemplate.js +17 -18
  115. package/lib/templates/linterConstant.js +10 -0
  116. package/lib/utils/babelPresets.js +12 -5
  117. package/lib/utils/buildstats.html +148 -0
  118. package/lib/utils/clean.js +12 -11
  119. package/lib/utils/copy.js +13 -127
  120. package/lib/utils/copyTimezones.js +21 -0
  121. package/lib/utils/createEventStream.js +24 -19
  122. package/lib/utils/cssClassNameGenerate.js +70 -0
  123. package/lib/utils/cssURLReplacer.js +67 -54
  124. package/lib/utils/dependencyPostPublish.js +42 -0
  125. package/lib/utils/fileUtils.js +125 -0
  126. package/lib/utils/folderIterator.js +47 -0
  127. package/lib/utils/getComponents.js +126 -0
  128. package/lib/utils/getCurrentBranch.js +11 -17
  129. package/lib/utils/getDependenciesImpactList.js +151 -0
  130. package/lib/utils/getHash.js +26 -0
  131. package/lib/utils/getIp.js +20 -0
  132. package/lib/utils/getOptions.js +55 -30
  133. package/lib/utils/getServerURL.js +25 -8
  134. package/lib/utils/index.js +259 -82
  135. package/lib/utils/init.js +2 -2
  136. package/lib/utils/initPreCommitHook.js +40 -31
  137. package/lib/utils/jsonHelper.js +97 -0
  138. package/lib/utils/libraryImpactConfig.js +63 -0
  139. package/lib/utils/lint/addScripts.js +27 -0
  140. package/lib/utils/lint/checkExistingConfig.js +67 -0
  141. package/lib/utils/lint/copyConfigs.js +24 -0
  142. package/lib/utils/lint/index.js +54 -0
  143. package/lib/utils/lint/lintScripts.js +11 -0
  144. package/lib/utils/lint/lintSetup.js +31 -0
  145. package/lib/utils/lint/lintStagedPreCommitHook.js +7 -0
  146. package/lib/utils/lint/question.js +30 -0
  147. package/lib/utils/lintReporter.js +142 -0
  148. package/lib/utils/mailSender.js +16 -25
  149. package/lib/utils/pullOrigin.js +28 -0
  150. package/lib/utils/reinstallDependencies.js +133 -0
  151. package/lib/utils/removeAttributes.js +25 -23
  152. package/lib/utils/repoClone.js +56 -63
  153. package/lib/utils/request.js +64 -77
  154. package/lib/utils/resultSchema.json +73 -0
  155. package/lib/utils/rtl.js +42 -0
  156. package/lib/utils/setEnvVariables.js +5 -6
  157. package/lib/utils/ssTestHack.js +48 -0
  158. package/lib/utils/switchBranch.js +28 -0
  159. package/lib/utils/urlConcat.js +22 -0
  160. package/package.json +92 -64
  161. package/templates/app/.eslintrc.js +140 -0
  162. package/templates/app/README.md +12 -12
  163. package/templates/app/app/index.html +24 -8
  164. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  165. package/templates/app/app/properties/i18nkeys.json +3 -3
  166. package/templates/app/docs/all.html +69 -69
  167. package/templates/app/mockapi/index.js +18 -13
  168. package/templates/app/package.json +37 -17
  169. package/templates/app/src/actions/SampleActions/index.js +37 -0
  170. package/templates/app/src/actions/index.js +65 -0
  171. package/templates/app/src/appUrls.js +19 -0
  172. package/templates/app/src/components/Alert/Alert.js +134 -0
  173. package/templates/app/src/components/Alert/Alert.module.css +79 -0
  174. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -0
  175. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -0
  176. package/templates/app/src/components/Sample/Sample.module.css +11 -0
  177. package/templates/app/src/components/Sample/SampleList.js +61 -0
  178. package/templates/app/src/components/Slider/Slider.css +41 -0
  179. package/templates/app/src/components/Slider/Slider.js +55 -0
  180. package/templates/app/src/containers/AlertContainer/index.js +15 -0
  181. package/templates/app/src/containers/AppContainer/index.js +96 -0
  182. package/templates/app/src/containers/AppContainer/index.module.css +27 -0
  183. package/templates/app/src/containers/CustomMatch/index.js +65 -0
  184. package/templates/app/src/containers/DevTools/index.js +10 -0
  185. package/templates/app/src/containers/Header/index.js +67 -0
  186. package/templates/app/src/containers/Header/index.module.css +43 -0
  187. package/templates/app/src/containers/Redirect/index.js +63 -0
  188. package/templates/app/src/containers/Redirector/index.js +47 -0
  189. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -0
  190. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -0
  191. package/templates/app/src/historyChange.js +5 -0
  192. package/templates/app/src/index.html +10 -0
  193. package/templates/app/src/index.js +24 -0
  194. package/templates/app/src/middleware/PromiseMiddleware.js +59 -0
  195. package/templates/app/src/reducers/alertData.js +11 -0
  196. package/templates/app/src/reducers/index.js +6 -0
  197. package/templates/app/src/reducers/samples.js +19 -0
  198. package/templates/app/src/store/configureStore.dev.js +51 -0
  199. package/templates/app/src/store/configureStore.js +5 -0
  200. package/templates/app/src/store/configureStore.prod.js +26 -0
  201. package/templates/app/src/util/Common.js +5 -0
  202. package/templates/app/src/util/RequestAPI.js +132 -0
  203. package/templates/appold/README.md +12 -0
  204. package/templates/appold/app/index.html +8 -0
  205. package/templates/appold/app/properties/ApplicationResources_en_US.properties +1 -0
  206. package/templates/appold/app/properties/i18nkeys.json +3 -0
  207. package/templates/appold/docs/all.html +69 -0
  208. package/templates/appold/mockapi/index.js +13 -0
  209. package/templates/{app → appold}/mockapi/tickets.json +0 -0
  210. package/templates/appold/package.json +17 -0
  211. package/templates/appold/src/components/Text/Text.css +0 -0
  212. package/templates/appold/src/components/Text/Text.js +23 -0
  213. package/templates/appold/src/components/Text/__tests__/Text.spec.js +30 -0
  214. package/templates/appold/src/components/Text/docs/Text__default.docs.js +16 -0
  215. package/templates/appold/src/components/docs.js +1 -0
  216. package/templates/appold/src/components/index.js +5 -0
  217. package/templates/appold/src/index.js +13 -0
  218. package/templates/docs/all.html +1 -1
  219. package/templates/docs/component.html +110 -69
  220. package/templates/docs/components.html +221 -0
  221. package/templates/docs/css/component.css +12 -14
  222. package/templates/docs/css/componentTest.css +7 -0
  223. package/templates/docs/css/style.css +150 -206
  224. package/templates/docs/impactReportTemplate.html +154 -0
  225. package/templates/docs/index.html +1482 -1336
  226. package/templates/library/src/index.js +0 -0
@@ -1,41 +1,40 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- var _querystring = require('querystring');
4
-
5
- var _querystring2 = _interopRequireDefault(_querystring);
3
+ var _querystring = _interopRequireDefault(require("querystring"));
6
4
 
7
5
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
6
 
9
- var log = function log() {
10
- var print = console;
11
- print.log.apply(print, arguments);
12
- };
7
+ let log = (...args) => {
8
+ let print = console;
9
+ print.log(...args);
10
+ }; // eslint-disable-next-line no-undef
11
+
12
+
13
+ let options = _querystring.default.parse(__resourceQuery.slice(1));
13
14
 
14
- // eslint-disable-next-line no-undef
15
- var options = _querystring2.default.parse(__resourceQuery.slice(1));
16
15
  window.WebSocket = window.WebSocket || window.MozWebSocket;
17
- var connection = new WebSocket(options.wmsPath);
16
+ let connection = new WebSocket(options.wmsPath);
18
17
 
19
- connection.onopen = function () {
18
+ connection.onopen = () => {
20
19
  // connection is opened and ready to use
21
20
  log('open');
22
21
  };
23
22
 
24
- connection.onerror = function (error) {
23
+ connection.onerror = error => {
25
24
  // an error occurred when sending/receiving data
26
25
  throw error;
27
26
  };
28
27
 
29
- connection.onmessage = function (message) {
28
+ connection.onmessage = message => {
30
29
  // try to decode json (I assume that each message
31
30
  // from server is json)
32
31
  try {
33
- var json = JSON.parse(message.data);
34
- // eslint-disable-next-line no-undef
32
+ let json = JSON.parse(message.data); // eslint-disable-next-line no-undef
33
+
35
34
  Collaboration.handleCustomMessage(json);
36
35
  } catch (e) {
37
36
  log('This doesn\'t look like a valid JSON: ', message.data);
38
37
  return;
39
- }
40
- // handle incoming message
38
+ } // handle incoming message
39
+
41
40
  };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.endTag = exports.htmlTemplate = void 0;
7
+ const htmlTemplate = '<!DOCTYPE html><html> <head> <title>Eslint Security Rule</title> <style type="text/css"> body{margin: 0; font: 93.75%/1.6 -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;}body, html{width: 100%; height: 100%;}.pkCont{}.pkEmpty{height: 300px;display: flex;align-items: center;justify-content: center;font-size: 20px;}.pkUl{margin: 0; padding: 0; list-style-type: none;}.pkLi{}.pkRow{display: flex; padding: 12px 16px;}.pkArrowCont{cursor: pointer; width: 50px; display: flex; align-items: center; justify-content: center; background-color: #f4f5f5; border-radius: 4px;}.pkArrow{width: 1px; height: 1px; border: 5px solid; border-color: #000 transparent transparent; margin-top: 7px;}.pkDetailsOpen .pkArrow{margin: 0 0 7px; border-color: transparent transparent #000;}.pkFileName{font-weight: 600; margin: 0 8px;}.pkUrl{flex: 1; min-width: 0; min-height: 0; word-break: break-word; word-wrap: break-word; color: blue;}.pkDetails{margin-left: 66px; display: none;}.pkDetailsOpen .pkDetails{display: block;}.pkDetailsHead{font-weight: 600; display: flex; border: 1px solid #e5e5e5; padding: 3px 8px;}.pkDetailsBody{max-height: 400px; overflow: auto;}.pkDetailsRow{display: flex; padding: 10px 8px;}.pkDetailsRow:nth-child(even){background-color: #f4f5f5;}.pkDetailsCol{word-break: break-word; word-wrap: break-word;}.pkError{color: red;}.pkDetailsCol:nth-child(1){width: 10%;}.pkDetailsCol:nth-child(2){width: 10%;}.pkDetailsCol:nth-child(3){width: 40%;}.pkDetailsCol:nth-child(4){width: 40%;}</style> <script>function toggleWrapper(element){var classArray=element.parentElement.parentElement.className; if (classArray.includes("pkDetailsOpen")){element.parentElement.parentElement.className="pkLi";}else{element.parentElement.parentElement.className="pkLi pkDetailsOpen";}}</script> </head> <body> <div class="pkCont">';
8
+ exports.htmlTemplate = htmlTemplate;
9
+ const endTag = '</div></body></html>';
10
+ exports.endTag = endTag;
@@ -1,15 +1,22 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var a = exports.a = require.resolve('babel-plugin-transform-define');
7
- exports.default = {
8
- presets: [['env', { modules: false }], 'react'],
6
+ exports.default = exports.a = void 0;
7
+
8
+ let a = require.resolve('babel-plugin-transform-define');
9
+
10
+ exports.a = a;
11
+ var _default = {
12
+ presets: [['env', {
13
+ modules: false
14
+ }], 'react'],
9
15
  plugins: [['transform-runtime', {
10
16
  helpers: true,
11
17
  polyfill: true,
12
18
  regenerator: false,
13
19
  moduleName: 'babel-runtime'
14
20
  }]]
15
- };
21
+ };
22
+ exports.default = _default;
@@ -0,0 +1,148 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
5
+ <style>
6
+ #file {
7
+ font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif;
8
+ border-collapse: collapse;
9
+ width: 100%;
10
+ }
11
+ #redTd {
12
+ color: red;
13
+ }
14
+ #greenTD {
15
+ color: green;
16
+ }
17
+ #file td,
18
+ #file th {
19
+ border: 1px solid #ddd;
20
+ padding: 8px;
21
+ text-align: center;
22
+ }
23
+
24
+ #file tr:nth-child(even) {
25
+ background-color: #f2f2f2;
26
+ }
27
+
28
+ #file tr:hover {
29
+ background-color: #ddd;
30
+ }
31
+
32
+ #file th {
33
+ padding-top: 12px;
34
+ padding-bottom: 12px;
35
+ background-color: #2a2d36;
36
+ color: white;
37
+ }
38
+ #sizeTable {
39
+ float: left;
40
+ width: 50%;
41
+ }
42
+ #hashTable {
43
+ display: inline-block;
44
+ width: 50%;
45
+ }
46
+ </style>
47
+ <script type="text/javascript" src="./buildtrack.js"></script>
48
+ </head>
49
+ <body>
50
+ <div>
51
+ <div style="float: left;margin-right: 10px;">Branch Name:</div>
52
+ <h4 id="h4" style="margin: 0px;"></h4>
53
+ </div>
54
+ <div id="sizeTable">
55
+ <div>
56
+ <h3>Size changes</h3>
57
+ <h3></h3>
58
+ </div>
59
+ <table id="file" class="table table-bordered table-hover table-condensed">
60
+ <thead>
61
+ <tr>
62
+ <th title="Field #1">Name</th>
63
+ <th title="Field #2">Size / Diff</th>
64
+ <th title="Field #3">Size / Old</th>
65
+ <th title="Field #4">Size / New</th>
66
+ </tr>
67
+ </thead>
68
+ <tbody id="sizeTbody"></tbody>
69
+ </table>
70
+ </div>
71
+ <div id="hashTable">
72
+ <div>
73
+ <h3>Hash changes</h3>
74
+ <h3></h3>
75
+ </div>
76
+ <table id="file" class="table table-bordered table-hover table-condensed">
77
+ <thead>
78
+ <tr>
79
+ <th style="background-color: #4CAF50;" title="Field #1">Name</th>
80
+ <th style="background-color: #4CAF50;" title="Field #2">
81
+ Hash / Old
82
+ </th>
83
+ <th style="background-color: #4CAF50;" title="Field #3">
84
+ Hash / New
85
+ </th>
86
+ </tr>
87
+ </thead>
88
+ <tbody id="hashTbody"></tbody>
89
+ </table>
90
+ </div>
91
+
92
+ <script type="text/javascript">
93
+ function load() {
94
+ if (statsJson) {
95
+ var tdStringSize = '';
96
+ var tdStringHash = '';
97
+ if (statsJson.increased.length > 0) {
98
+ statsJson.increased.forEach(fileObj => {
99
+ let colorTD = '</td><td>';
100
+ if (fileObj.size.diff.split(' ').length > 2) {
101
+ colorTD = '</td><td id="greenTd">';
102
+ } else {
103
+ colorTD = '</td><td id="redTd">';
104
+ }
105
+
106
+ tdStringSize =
107
+ tdStringSize +
108
+ '<tr><td>' +
109
+ fileObj.name +
110
+ colorTD +
111
+ fileObj.size.diff +
112
+ '</td><td>' +
113
+ fileObj.size.old +
114
+ '</td><td>' +
115
+ fileObj.size.new +
116
+ '</td><tr>';
117
+ });
118
+ } else {
119
+ tdStringSize = '<tr><td></td><td></td><td></td></tr>';
120
+ }
121
+ document.getElementById('sizeTbody').innerHTML = tdStringSize;
122
+ if (statsJson.hashChanged.length > 0) {
123
+ statsJson.hashChanged.forEach(fileObj => {
124
+ tdStringHash =
125
+ tdStringHash +
126
+ '<tr><td>' +
127
+ fileObj.name +
128
+ '</td><td>' +
129
+ fileObj.hash.old +
130
+ '</td><td>' +
131
+ fileObj.hash.new +
132
+ '</td><tr>';
133
+ });
134
+ } else {
135
+ tdStringHash = '<tr><td></td><td></td><td></td></tr>';
136
+ }
137
+ document.getElementById('hashTbody').innerHTML = tdStringHash;
138
+ if (statsJson.branchName) {
139
+ document.getElementById('h4').innerHTML = statsJson.branchName;
140
+ } else {
141
+ document.getElementById('h4').innerHTML = 'Not specified';
142
+ }
143
+ }
144
+ }
145
+ load();
146
+ </script>
147
+ </body>
148
+ </html>
@@ -1,15 +1,13 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- var _rimraf = require('rimraf');
4
-
5
- var _rimraf2 = _interopRequireDefault(_rimraf);
3
+ var _rimraf = _interopRequireDefault(require("rimraf"));
6
4
 
7
5
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
6
 
9
- var help = false;
10
- var dashdash = false;
11
- //eslint-disable-next-line array-callback-return
12
- var args = process.argv.slice(2).filter(function (arg) {
7
+ let help = false;
8
+ let dashdash = false; //eslint-disable-next-line array-callback-return
9
+
10
+ let args = process.argv.slice(2).filter(arg => {
13
11
  if (dashdash) {
14
12
  return !!arg;
15
13
  } else if (arg === '--') {
@@ -20,14 +18,17 @@ var args = process.argv.slice(2).filter(function (arg) {
20
18
  return !!arg;
21
19
  }
22
20
  });
23
- var go = function go(n) {
21
+
22
+ let go = n => {
24
23
  if (n >= args.length) {
25
24
  return;
26
25
  }
27
- (0, _rimraf2.default)(args[n], function (er) {
26
+
27
+ (0, _rimraf.default)(args[n], er => {
28
28
  if (er) {
29
29
  throw er;
30
30
  }
31
+
31
32
  go(n + 1);
32
33
  });
33
34
  };
@@ -35,7 +36,7 @@ var go = function go(n) {
35
36
  if (help || args.length === 0) {
36
37
  // If they didn't ask for help, then this is not a "success"
37
38
  // eslint-disable-next-line no-console
38
- var log = help ? console.log : console.error;
39
+ let log = help ? console.log : console.error;
39
40
  log('Usage: rimraf <path> [<path> ...]');
40
41
  log('');
41
42
  log(' Deletes all files and folders at "path" recursively.');
package/lib/utils/copy.js CHANGED
@@ -1,139 +1,25 @@
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 _path = _interopRequireDefault(require("path"));
4
4
 
5
- var _path = require('path');
5
+ var _fs = _interopRequireDefault(require("fs"));
6
6
 
7
- var _path2 = _interopRequireDefault(_path);
8
-
9
- var _fs = require('fs');
10
-
11
- var _fs2 = _interopRequireDefault(_fs);
12
-
13
- var _index = require('./index');
7
+ var _fileUtils = require("./fileUtils");
14
8
 
15
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
10
 
17
- var args = process.argv.slice(2);
18
- var appPath = _fs2.default.realpathSync(process.cwd());
11
+ let args = process.argv.slice(2);
19
12
 
20
- var _args = _slicedToArray(args, 6),
21
- srcPath = _args[0],
22
- targetPath = _args[1],
23
- exts = _args[2],
24
- _args$ = _args[3],
25
- isCopy = _args$ === undefined ? true : _args$,
26
- _args$2 = _args[4],
27
- flatten = _args$2 === undefined ? '' : _args$2,
28
- _args$3 = _args[5],
29
- changeExt = _args$3 === undefined ? '' : _args$3;
13
+ let appPath = _fs.default.realpathSync(process.cwd());
30
14
 
31
- exts = exts ? exts.split(',').map(function (ext) {
32
- return '.' + ext.trim();
33
- }) : false;
34
- srcPath = _path2.default.join(appPath, srcPath);
15
+ let [srcPath, targetPath, exts, isCopy = true, flatten = '', changeExt = ''] = args;
16
+ exts = exts ? exts.split(',').map(ext => `.${ext.trim()}`) : false;
17
+ srcPath = _path.default.join(appPath, srcPath);
35
18
  targetPath = targetPath === '."' || !targetPath ? '' : targetPath;
36
- targetPath = _path2.default.join(appPath, targetPath);
37
- changeExt = changeExt.split(',').reduce(function (obj, ext) {
38
- var _ext$split = ext.split('~'),
39
- _ext$split2 = _slicedToArray(_ext$split, 2),
40
- key = _ext$split2[0],
41
- value = _ext$split2[1];
42
-
19
+ targetPath = _path.default.join(appPath, targetPath);
20
+ changeExt = changeExt.split(',').reduce((obj, ext) => {
21
+ let [key, value] = ext.split('~');
43
22
  obj[key] = value;
44
23
  return obj;
45
24
  }, {});
46
-
47
- var removeDirectory = function removeDirectory(dirPath) {
48
- _fs2.default.readdirSync(dirPath).forEach(function (fileOrDir) {
49
- var fileOrDirPath = _path2.default.join(dirPath, fileOrDir);
50
- if (_fs2.default.statSync(fileOrDirPath).isDirectory()) {
51
- removeDirectory(fileOrDirPath);
52
- } else {
53
- _fs2.default.unlinkSync(fileOrDirPath);
54
- }
55
- });
56
- _fs2.default.rmdirSync(dirPath);
57
- };
58
-
59
- var copyFile = function copyFile(srcPath, targetPath) {
60
- var isCopy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
61
-
62
- var _path$parse = _path2.default.parse(targetPath),
63
- ext = _path$parse.ext,
64
- dir = _path$parse.dir,
65
- name = _path$parse.name,
66
- root = _path$parse.root;
67
-
68
- if (changeExt[ext]) {
69
- ext = changeExt[ext];
70
- targetPath = _path2.default.format({ ext: ext, dir: dir, name: name, root: root }); //eslint-disable-line
71
- }
72
- var readStream = _fs2.default.createReadStream(srcPath);
73
- var writeStream = _fs2.default.createWriteStream(targetPath);
74
- readStream.pipe(writeStream);
75
-
76
- writeStream.on('finish', function () {
77
- if (!isCopy) {
78
- _fs2.default.unlinkSync(srcPath);
79
- }
80
- });
81
- };
82
-
83
- var iterateDirectory = function iterateDirectory(srcPath, targetPath, isCopy, extensions, flatten) {
84
- _fs2.default.readdirSync(srcPath).forEach(function (fileOrDir) {
85
- var fromPath = _path2.default.join(srcPath, fileOrDir);
86
- var toPath = targetPath;
87
-
88
- if (flatten !== 'flatten' || !_fs2.default.statSync(fromPath).isDirectory()) {
89
- toPath = _path2.default.join(targetPath, fileOrDir);
90
- }
91
-
92
- if (_fs2.default.statSync(fromPath).isDirectory()) {
93
- if (!_fs2.default.existsSync(toPath)) {
94
- _fs2.default.mkdirSync(toPath);
95
- }
96
- iterateDirectory(fromPath, toPath, isCopy, extensions, flatten);
97
- } else {
98
- if (extensions) {
99
- var _path$parse2 = _path2.default.parse(fromPath),
100
- ext = _path$parse2.ext;
101
-
102
- if (extensions.indexOf(ext) !== -1) {
103
- copyFile(fromPath, toPath);
104
- }
105
- } else {
106
- copyFile(fromPath, toPath);
107
- }
108
- }
109
- });
110
- };
111
-
112
- var copy = function copy(srcPath, targetPath, isCopy, exts, flatten) {
113
- if (_fs2.default.statSync(srcPath).isDirectory()) {
114
- if (!_fs2.default.existsSync(targetPath)) {
115
- _fs2.default.mkdirSync(targetPath);
116
- }
117
-
118
- var _path$parse3 = _path2.default.parse(srcPath),
119
- name = _path$parse3.name;
120
-
121
- var originPath = targetPath;
122
- if (flatten !== 'flatten') {
123
- originPath = _path2.default.join(targetPath, name);
124
- if (!_fs2.default.existsSync(originPath)) {
125
- _fs2.default.mkdirSync(originPath);
126
- }
127
- }
128
- iterateDirectory(srcPath, originPath, isCopy, exts, flatten);
129
- } else {
130
- /* direct file copy issue there but that feature not needed i think*/
131
- copyFile(srcPath, targetPath, isCopy);
132
- }
133
- if (!isCopy) {
134
- removeDirectory(srcPath);
135
- }
136
- (0, _index.log)(isCopy ? 'Folder/file are copied!' : 'Folder/file are moved!');
137
- };
138
-
139
- copy(srcPath, targetPath, isCopy, exts, flatten);
25
+ (0, _fileUtils.copy)(srcPath, targetPath, isCopy, exts, flatten, changeExt);
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ var _path = _interopRequireDefault(require("path"));
4
+
5
+ var _fs = _interopRequireDefault(require("fs"));
6
+
7
+ var _fileUtils = require("./fileUtils");
8
+
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+
11
+ let args = process.argv.slice(2);
12
+
13
+ let appPath = _fs.default.realpathSync(process.cwd());
14
+
15
+ let [targetPath] = args;
16
+ targetPath = targetPath === '."' || !targetPath ? '' : targetPath;
17
+ targetPath = _path.default.join(appPath, targetPath);
18
+
19
+ let srcPath = _path.default.resolve(_path.default.dirname(require.resolve('@zohodesk/datetimejs')), '../data/timezones/');
20
+
21
+ (0, _fileUtils.copy)(srcPath, targetPath, true, null, 'flatten');
@@ -1,32 +1,36 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var createEventStream = function createEventStream(heartbeat) {
7
- var heartbeatInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
6
+ exports.default = void 0;
8
7
 
9
- var clientId = 0;
10
- var clients = {};
11
- var everyClient = function everyClient(fn) {
12
- Object.keys(clients).forEach(function (id) {
8
+ let createEventStream = (heartbeat, heartbeatInfo = null) => {
9
+ let clientId = 0;
10
+ let clients = {};
11
+
12
+ let everyClient = fn => {
13
+ Object.keys(clients).forEach(id => {
13
14
  fn(clients[id]);
14
15
  });
15
16
  };
16
- setInterval(function () {
17
- everyClient(function (client) {
17
+
18
+ setInterval(() => {
19
+ everyClient(client => {
18
20
  if (heartbeatInfo) {
19
- client.write('data: ' + JSON.stringify({
21
+ client.write(`data: ${JSON.stringify({
20
22
  type: 'heartbeat',
21
23
  info: heartbeatInfo()
22
- }) + '\n\n');
24
+ })}\n\n`);
23
25
  } else {
24
- client.write('data: ' + JSON.stringify({ type: 'heartbeat' }) + '\n\n');
26
+ client.write(`data: ${JSON.stringify({
27
+ type: 'heartbeat'
28
+ })}\n\n`);
25
29
  }
26
30
  });
27
31
  }, heartbeat).unref();
28
32
  return {
29
- handler: function handler(req, res) {
33
+ handler: (req, res) => {
30
34
  req.socket.setKeepAlive(true);
31
35
  res.writeHead(200, {
32
36
  'Access-Control-Allow-Origin': '*',
@@ -35,18 +39,19 @@ var createEventStream = function createEventStream(heartbeat) {
35
39
  Connection: 'keep-alive'
36
40
  });
37
41
  res.write('\n');
38
- var id = clientId++;
42
+ let id = clientId++;
39
43
  clients[id] = res;
40
- req.on('close', function () {
44
+ req.on('close', () => {
41
45
  delete clients[id];
42
46
  });
43
47
  },
44
- publish: function publish(payload) {
45
- everyClient(function (client) {
46
- client.write('data: ' + JSON.stringify(payload) + '\n\n');
48
+ publish: payload => {
49
+ everyClient(client => {
50
+ client.write(`data: ${JSON.stringify(payload)}\n\n`);
47
51
  });
48
52
  }
49
53
  };
50
54
  };
51
55
 
52
- exports.default = createEventStream;
56
+ var _default = createEventStream;
57
+ exports.default = _default;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _os = _interopRequireDefault(require("os"));
9
+
10
+ var _path = _interopRequireDefault(require("path"));
11
+
12
+ var _getHash = _interopRequireDefault(require("./getHash"));
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ let isWindows = _os.default.platform().toLowerCase() === 'win32';
17
+
18
+ let isSelectorPackage = (resourcePath, packages) => {
19
+ if (!resourcePath.includes('node_modules')) {
20
+ return false;
21
+ }
22
+
23
+ let isValid = false;
24
+
25
+ for (let pack of packages) {
26
+ if (isWindows) {
27
+ pack = pack.replace(/\//g, '\\');
28
+ }
29
+
30
+ if (resourcePath.includes(pack)) {
31
+ isValid = true;
32
+ break;
33
+ }
34
+ }
35
+
36
+ return isValid;
37
+ };
38
+
39
+ var _default = (unique = true, {
40
+ filenames,
41
+ packages
42
+ }, classNamePrefix) => (context, localIdentName, localName) => {
43
+ if (context.resourcePath.endsWith('.plain.css')) {
44
+ return localName;
45
+ }
46
+ /* old production mode start without breaking so added. may be removed in future*/
47
+
48
+
49
+ if (unique) {
50
+ let h = (0, _getHash.default)(context.resourcePath + localName, 10);
51
+ return `${classNamePrefix}${h}`;
52
+ }
53
+ /* old production mode end*/
54
+
55
+
56
+ let filePaths = context.resourcePath.split(_path.default.sep);
57
+ let fileName = filePaths[filePaths.length - 1];
58
+ let [fileNameWithoutExt] = fileName.split('.');
59
+ let cleanFileName = fileNameWithoutExt.replace(/-/g, '_').toLowerCase(); //css file has casesensitive selector issue so can't toLowerCase
60
+ //let local = localName.toLowerCase()
61
+
62
+ if (isSelectorPackage(context.resourcePath, packages) || filenames.indexOf(cleanFileName) !== -1) {
63
+ let h = (0, _getHash.default)(context.resourcePath + localName, 10);
64
+ return `${classNamePrefix}${h}`;
65
+ }
66
+
67
+ return `${classNamePrefix}-${cleanFileName}-${localName}`;
68
+ };
69
+
70
+ exports.default = _default;