@zohodesk/react-cli 0.0.1-test.148.2 → 1.0.0

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 (174) hide show
  1. package/.eslintignore +7 -7
  2. package/.eslintrc.js +180 -183
  3. package/.prettierrc +6 -0
  4. package/{CHANGELOG.md → CHANGELOG-fz.md} +0 -0
  5. package/Changelog.md +1019 -0
  6. package/README.md +1152 -678
  7. package/bin/cli.js +483 -392
  8. package/docs/CustomChunks.md +26 -0
  9. package/docs/DevServerPort.md +39 -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/SelectorWeight.md +6 -0
  14. package/docs/TODOS.md +10 -0
  15. package/docs/ValueReplacer.md +60 -0
  16. package/docs/VariableConversion.md +724 -0
  17. package/docs/warnings_while_install.txt +35 -0
  18. package/files/eslintrc.js +62 -62
  19. package/files/prettierrc.js +3 -3
  20. package/lib/common/index.js +6 -6
  21. package/lib/common/splitChunks.js +60 -12
  22. package/lib/common/sslcertUpdater.js +59 -0
  23. package/lib/common/testPattern.js +69 -0
  24. package/lib/common/valueReplacer.js +55 -0
  25. package/lib/configs/jest.config.js +18 -8
  26. package/lib/configs/libAlias.js +38 -0
  27. package/lib/configs/resolvers.js +40 -0
  28. package/lib/configs/webpack.css.umd.config.js +4 -4
  29. package/lib/configs/webpack.dev.config.js +59 -54
  30. package/lib/configs/webpack.docs.config.js +56 -53
  31. package/lib/configs/webpack.impact.config.js +54 -50
  32. package/lib/configs/webpack.prod.config.js +72 -47
  33. package/lib/constants.js +31 -0
  34. package/lib/jest/preProcessors/cssPreprocessor.js +16 -7
  35. package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
  36. package/lib/loaderUtils/getCSSLoaders.js +89 -21
  37. package/lib/loaderUtils/index.js +4 -4
  38. package/lib/loaderUtils/windowsModification.js +11 -0
  39. package/lib/loaders/fileBountryLoader.js +17 -0
  40. package/lib/loaders/scriptInstrumentLoader.js +2 -2
  41. package/lib/loaders/selectorMappingLoader.js +75 -0
  42. package/lib/loaders/workerLoader.js +9 -9
  43. package/lib/pluginUtils/configHtmlWebpackPlugins.js +59 -0
  44. package/lib/pluginUtils/getDevPlugins.js +69 -45
  45. package/lib/pluginUtils/getDocsPlugins.js +6 -8
  46. package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
  47. package/lib/pluginUtils/getProdPlugins.js +73 -58
  48. package/lib/pluginUtils/index.js +12 -12
  49. package/lib/plugins/CdnChangePlugin.js +16 -2
  50. package/lib/plugins/EFCPlugin.js +52 -20
  51. package/lib/plugins/EFCPlugin.md +6 -0
  52. package/lib/plugins/EFCTemplatePlugin.js +151 -0
  53. package/lib/plugins/I18NInjectIntoIndexPlugin.js +4 -4
  54. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
  55. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
  56. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +8 -8
  57. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -86
  58. package/lib/plugins/I18nSplitPlugin/README.md +25 -25
  59. package/lib/plugins/I18nSplitPlugin/index.js +57 -57
  60. package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +2 -2
  61. package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +1 -1
  62. package/lib/plugins/ManifestPlugin.js +8 -0
  63. package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
  64. package/lib/plugins/ResourceHintsPlugin.js +17 -17
  65. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +11 -7
  66. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
  67. package/lib/plugins/SelectorPlugin.js +97 -0
  68. package/lib/plugins/ServiceWorkerPlugin.js +13 -9
  69. package/lib/plugins/SourceMapHookPlugin.js +9 -3
  70. package/lib/plugins/TPHashMappingPlugin.js +4 -4
  71. package/lib/plugins/VariableConversionCollector.js +352 -0
  72. package/lib/plugins/composeCommonPlugin.js +30 -0
  73. package/lib/plugins/index.js +36 -36
  74. package/lib/plugins/libraryImpactPlugin.js +14 -2
  75. package/lib/postcss-plugins/{ExcludeRTLPlugin.js → ExcludePlugin.js} +1 -1
  76. package/lib/postcss-plugins/RTLSplitPlugin.js +36 -32
  77. package/lib/postcss-plugins/ValueReplacer.js +46 -0
  78. package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
  79. package/lib/postcss-plugins/__test__/test1Input.css +39 -0
  80. package/lib/postcss-plugins/__test__/test1Output.css +39 -0
  81. package/lib/postcss-plugins/hoverActivePlugin.js +389 -0
  82. package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +60 -0
  83. package/lib/postcss-plugins/variableModificationPlugin/index.js +307 -0
  84. package/lib/postcss-plugins/variableModifier.js +244 -0
  85. package/lib/schemas/index.js +166 -11
  86. package/lib/servers/devBuild.js +102 -0
  87. package/lib/servers/docsServerCore.js +16 -18
  88. package/lib/servers/getCliPath.js +28 -0
  89. package/lib/servers/httpsOptions.js +49 -0
  90. package/lib/servers/nowatchserver.js +206 -0
  91. package/lib/servers/server.js +114 -82
  92. package/lib/sh/pre-commit.sh +34 -34
  93. package/lib/sh/reportPublish.sh +45 -45
  94. package/lib/templates/linterConstant.js +1 -1
  95. package/lib/utils/buildstats.html +148 -148
  96. package/lib/utils/cssClassNameGenerate.js +9 -2
  97. package/lib/utils/cssURLReplacer.js +30 -43
  98. package/lib/utils/getCurrentBranch.js +1 -1
  99. package/lib/utils/getDependenciesImpactList.js +14 -12
  100. package/lib/utils/getFileType.js +49 -0
  101. package/lib/utils/getOptions.js +118 -10
  102. package/lib/utils/index.js +44 -20
  103. package/lib/utils/jsonHelper.js +12 -3
  104. package/lib/utils/reinstallDependencies.js +1 -1
  105. package/lib/utils/repoClone.js +16 -4
  106. package/lib/utils/resultSchema.json +73 -73
  107. package/lib/utils/rtl.js +19 -2
  108. package/lib/utils/useExitCleanup.js +55 -0
  109. package/npm8.md +9 -0
  110. package/package.json +121 -142
  111. package/postpublish.js +8 -0
  112. package/result.json +1 -0
  113. package/templates/app/.eslintrc.js +140 -140
  114. package/templates/app/README.md +12 -12
  115. package/templates/app/app/index.html +24 -24
  116. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  117. package/templates/app/app/properties/i18nkeys.json +3 -3
  118. package/templates/app/docs/all.html +69 -69
  119. package/templates/app/mockapi/index.js +18 -18
  120. package/templates/app/package.json +37 -37
  121. package/templates/app/src/actions/SampleActions/index.js +37 -37
  122. package/templates/app/src/actions/index.js +65 -65
  123. package/templates/app/src/appUrls.js +19 -19
  124. package/templates/app/src/components/Alert/Alert.js +134 -134
  125. package/templates/app/src/components/Alert/Alert.module.css +79 -79
  126. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
  127. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
  128. package/templates/app/src/components/Sample/Sample.module.css +11 -11
  129. package/templates/app/src/components/Sample/SampleList.js +61 -61
  130. package/templates/app/src/components/Slider/Slider.css +41 -41
  131. package/templates/app/src/components/Slider/Slider.js +55 -55
  132. package/templates/app/src/containers/AlertContainer/index.js +15 -15
  133. package/templates/app/src/containers/AppContainer/index.js +96 -96
  134. package/templates/app/src/containers/AppContainer/index.module.css +27 -27
  135. package/templates/app/src/containers/CustomMatch/index.js +65 -65
  136. package/templates/app/src/containers/DevTools/index.js +10 -10
  137. package/templates/app/src/containers/Header/index.js +67 -67
  138. package/templates/app/src/containers/Header/index.module.css +43 -43
  139. package/templates/app/src/containers/Redirect/index.js +63 -63
  140. package/templates/app/src/containers/Redirector/index.js +47 -47
  141. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
  142. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
  143. package/templates/app/src/historyChange.js +5 -5
  144. package/templates/app/src/index.html +10 -10
  145. package/templates/app/src/index.js +24 -24
  146. package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
  147. package/templates/app/src/reducers/alertData.js +11 -11
  148. package/templates/app/src/reducers/index.js +6 -6
  149. package/templates/app/src/reducers/samples.js +19 -19
  150. package/templates/app/src/store/configureStore.dev.js +51 -51
  151. package/templates/app/src/store/configureStore.js +5 -5
  152. package/templates/app/src/store/configureStore.prod.js +26 -26
  153. package/templates/app/src/util/Common.js +5 -5
  154. package/templates/app/src/util/RequestAPI.js +132 -132
  155. package/templates/docs/all.html +249 -249
  156. package/templates/docs/component.html +178 -178
  157. package/templates/docs/components.html +221 -221
  158. package/templates/docs/css/b.min.css +6 -6
  159. package/templates/docs/css/component.css +42 -42
  160. package/templates/docs/css/componentTest.css +6 -6
  161. package/templates/docs/css/hopscotch.css +585 -585
  162. package/templates/docs/css/style.css +1022 -1022
  163. package/templates/docs/impactReportTemplate.html +154 -154
  164. package/templates/docs/index.html +1501 -1493
  165. package/templates/docs/js/active-line.js +72 -72
  166. package/templates/docs/js/b.min.js +7 -7
  167. package/templates/docs/js/codemirror.js +9680 -9680
  168. package/templates/docs/js/designTokens.js +334 -334
  169. package/templates/docs/js/j.min.js +4 -4
  170. package/templates/docs/js/javascript.js +874 -874
  171. package/templates/docs/js/matchbrackets.js +145 -145
  172. package/unittest/index.html +37 -0
  173. package/cert/cert.pem +0 -105
  174. package/cert/key.pem +0 -30
@@ -1,148 +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
+ <!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>
@@ -40,6 +40,13 @@ var _default = (unique = true, {
40
40
  filenames,
41
41
  packages
42
42
  }, classNamePrefix) => (context, localIdentName, localName) => {
43
+ // NOTE: in build macine we use date as folder path.
44
+ // So every time we create new build there is path will alway different
45
+ // in order to minmaze that problem we try in relative path;
46
+ // console.log('context.resourcePath', context.resourcePath, context);
47
+ // let contextResourcePath = context.resourcePath;
48
+ let relativePath = _path.default.relative(context.rootContext, context.resourcePath);
49
+
43
50
  if (context.resourcePath.endsWith('.plain.css')) {
44
51
  return localName;
45
52
  }
@@ -47,7 +54,7 @@ var _default = (unique = true, {
47
54
 
48
55
 
49
56
  if (unique) {
50
- let h = (0, _getHash.default)(context.resourcePath + localName, 10);
57
+ let h = (0, _getHash.default)(`${relativePath}-${localName}`, 10);
51
58
  return `${classNamePrefix}${h}`;
52
59
  }
53
60
  /* old production mode end*/
@@ -60,7 +67,7 @@ var _default = (unique = true, {
60
67
  //let local = localName.toLowerCase()
61
68
 
62
69
  if (isSelectorPackage(context.resourcePath, packages) || filenames.indexOf(cleanFileName) !== -1) {
63
- let h = (0, _getHash.default)(context.resourcePath + localName, 10);
70
+ let h = (0, _getHash.default)(`${relativePath}-${localName}`, 10);
64
71
  return `${classNamePrefix}${h}`;
65
72
  }
66
73
 
@@ -3,19 +3,26 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.cssUrlReplacer = exports.getUrls = exports.getFileType = void 0;
6
+ exports.cssUrlReplacer = void 0;
7
+ Object.defineProperty(exports, "getFileType", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _getFileType.getFileType;
11
+ }
12
+ });
13
+ exports.getUrls = void 0;
7
14
 
8
15
  var _fs = _interopRequireDefault(require("fs"));
9
16
 
10
- var _path = _interopRequireDefault(require("path"));
11
-
12
17
  var _crypto = _interopRequireDefault(require("crypto"));
13
18
 
19
+ var _getFileType = require("./getFileType");
20
+
14
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
22
 
16
- let urlRegex = /url\(.*?\)/g;
23
+ const urlRegex = /url\(.*?\)/g;
17
24
 
18
- let getHash = (file, isPath = false, needSubStr = true) => {
25
+ const getHash = (file, isPath = false, needSubStr = true) => {
19
26
  let hash = _crypto.default.createHash('md5');
20
27
 
21
28
  if (isPath) {
@@ -28,45 +35,25 @@ let getHash = (file, isPath = false, needSubStr = true) => {
28
35
  return hash ? needSubStr ? hash.substring(0, 20) : hash : null;
29
36
  };
30
37
 
31
- let getFileType = file => {
32
- let {
33
- ext
34
- } = _path.default.parse(file);
35
-
36
- if (ext === '.gif' || ext === '.png' || ext === '.jpg' || ext === '.jpeg' || ext === '.ico') {
37
- return 'image';
38
- } else if (ext === '.svg' || ext === '.woff' || ext === '.eot' || ext === '.ttf' || ext === '.woff2') {
39
- return 'font';
40
- } else if (ext === '.js') {
41
- return 'js';
42
- } else if (ext === '.css') {
43
- return 'css';
44
- }
45
-
46
- return null;
47
- };
48
-
49
- exports.getFileType = getFileType;
50
-
51
- let formatUrl = str => {
38
+ const formatUrl = str => {
52
39
  let char = str.includes('"') ? '"' : str.includes('\'') ? '\'' : '(';
53
- let statingIdx = str.indexOf(char) + 1;
54
- let substr = str.substring(statingIdx, str.length);
40
+ const statingIdx = str.indexOf(char) + 1;
41
+ const substr = str.substring(statingIdx, str.length);
55
42
  char = char === '(' ? ')' : char;
56
43
  return substr.substring(0, substr.indexOf(char));
57
44
  };
58
45
 
59
- let getUrls = css => {
60
- let urlMatches = css.match(urlRegex);
46
+ const getUrls = css => {
47
+ const urlMatches = css.match(urlRegex);
61
48
  let src = css;
62
49
 
63
50
  if (urlMatches) {
64
- let patterns = {};
51
+ const patterns = {};
65
52
  urlMatches.forEach(pattern => {
66
- let url = formatUrl(pattern);
67
- let hash = getHash(url);
53
+ const url = formatUrl(pattern);
54
+ const hash = getHash(url);
68
55
  patterns[url] = hash;
69
- let regex = new RegExp(pattern.replace(/([<>*()?${}|])/g, '\\$1'), 'g');
56
+ const regex = new RegExp(pattern.replace(/([<>*()?${}|])/g, '\\$1'), 'g');
70
57
  src = src.replace(regex, hash);
71
58
  });
72
59
  return {
@@ -78,12 +65,12 @@ let getUrls = css => {
78
65
 
79
66
  exports.getUrls = getUrls;
80
67
 
81
- let cssUrlReplacer = (css, domains, chunkHash = {}) => {
82
- let obj = getUrls(css);
68
+ const cssUrlReplacer = (css, domains, chunkHash = {}) => {
69
+ const obj = getUrls(css);
83
70
  let src = css;
84
71
 
85
72
  if (obj) {
86
- let patterns = obj.urls;
73
+ const patterns = obj.urls;
87
74
  src = obj.css;
88
75
  Object.keys(patterns).forEach(pattern => {
89
76
  let urlParts = pattern.split('/');
@@ -97,20 +84,20 @@ let cssUrlReplacer = (css, domains, chunkHash = {}) => {
97
84
  fileName = fileName.replace(/\?.*$/g, '');
98
85
  }
99
86
 
100
- let hash = patterns[pattern];
101
- let filename = fileName.replace(/(\?|#).*?$/g, '');
102
- let regex = new RegExp(hash, 'g');
87
+ const hash = patterns[pattern];
88
+ const filename = fileName.replace(/(\?|#).*?$/g, '');
89
+ const regex = new RegExp(hash, 'g');
103
90
  let {
104
91
  hashedName
105
92
  } = chunkHash[filename] || fileName;
106
93
 
107
94
  if (domains && typeof urlParts[0] === 'string' && !urlParts[0].includes('http')) {
108
- let {
95
+ const {
109
96
  font,
110
97
  image
111
98
  } = domains;
112
- let type = getFileType(filename);
113
- let customPath = type === 'image' ? `${image}/images` : type === 'font' ? `${font}/fonts` : urlParts.join('/');
99
+ const type = (0, _getFileType.getFileType)(filename);
100
+ const customPath = type === 'image' ? `${image}/images` : type === 'font' ? `${font}/fonts` : urlParts.join('/');
114
101
  urlParts = customPath.split('/');
115
102
  }
116
103
 
@@ -22,7 +22,7 @@ var _default = (type = 'git', cwd = process.cwd()) => {
22
22
  });
23
23
  }
24
24
 
25
- let [currentBranch] = results.output.filter(d => d);
25
+ let [currentBranch] = results && results.output ? results.output.filter(d => d) : [''];
26
26
  return currentBranch.replace(/(\r\n|\n|\r)/gm, '');
27
27
  };
28
28
 
@@ -51,20 +51,22 @@ let getLiveDependenciesInfo = (branch, tokenGit) => new Promise((resolve, reject
51
51
  }).catch(reject);
52
52
  });
53
53
 
54
- let getDependencyChangeset = (depencency, version) => new Promise(resolve => {
55
- let url = `${'ht'}${'tp'}://tsi-desk-mock.tsi.zohocorpin.com:8080/Hbase/getKey?method=getkey&tablename=${depencency}_changesets&row=dependencies_changesets&column=${version}`;
56
- (0, _request.default)({
57
- url
58
- }).then(({
59
- body
60
- }) => {
61
- if (body == "") {
62
- console.log("Changeset for the " + dependency + " version " + version + " not stored in Hbase!");
63
- }
54
+ let getDependencyChangeset = (dependency, version) => {
55
+ return new Promise(resolve => {
56
+ let url = `${'ht'}${'tp'}://tsi-desk-mock.tsi.zohocorpin.com:8080/Hbase/getKey?method=getkey&tablename=${dependency}_changesets&row=dependencies_changesets&column=${version}`;
57
+ (0, _request.default)({
58
+ url
59
+ }).then(({
60
+ body
61
+ }) => {
62
+ if (body == "") {
63
+ console.log("Changeset for the " + dependency + " version " + version + " not stored in Hbase!");
64
+ }
64
65
 
65
- resolve(body);
66
+ resolve(body);
67
+ });
66
68
  });
67
- });
69
+ };
68
70
 
69
71
  let getImpactDiff = (srcBranch, targetBranch, appName) => new Promise(resolve => {
70
72
  let diff = {
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getFileType = getFileType;
7
+
8
+ var _path = _interopRequireDefault(require("path"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ /* eslint-disable no-use-before-define */
13
+ function getFileType(file) {
14
+ const {
15
+ ext
16
+ } = _path.default.parse(file);
17
+
18
+ if (isImageFileExt(ext)) {
19
+ return 'image';
20
+ } else if (isFontFileExt(ext)) {
21
+ return 'font';
22
+ } else if (isVideoFileExt(ext)) {
23
+ return 'video';
24
+ } else if (isAudioFileExt(ext)) {
25
+ return 'audio';
26
+ } else if (ext === '.js') {
27
+ return 'js';
28
+ } else if (ext === '.css') {
29
+ return 'css';
30
+ }
31
+
32
+ return null;
33
+ }
34
+
35
+ function isImageFileExt(ext) {
36
+ return ext === '.gif' || ext === '.png' || ext === '.jpg' || ext === '.jpeg' || ext === '.webp' || ext === '.ico';
37
+ }
38
+
39
+ function isFontFileExt(ext) {
40
+ return ext === '.svg' || ext === '.woff' || ext === '.eot' || ext === '.ttf' || ext === '.woff2';
41
+ }
42
+
43
+ function isVideoFileExt(ext) {
44
+ return ext === '.mp4' || ext === '.webm';
45
+ }
46
+
47
+ function isAudioFileExt(ext) {
48
+ return ext === '.ogg';
49
+ }