@zohodesk/react-cli 0.0.1-exp.176.3 → 0.0.1-exp.178.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. package/.eslintignore +7 -7
  2. package/.eslintrc.js +180 -180
  3. package/.prettierrc +6 -6
  4. package/{CHANGELOG.md → CHANGELOG-fz.md} +0 -0
  5. package/Changelog.md +1019 -0
  6. package/README.md +1112 -1025
  7. package/bin/cli.js +482 -482
  8. package/docs/CustomChunks.md +26 -26
  9. package/docs/DevServerPort.md +39 -0
  10. package/docs/DevStart.md +18 -18
  11. package/docs/HoverActive.md +12 -12
  12. package/docs/InstallNode.md +28 -28
  13. package/docs/SelectorWeight.md +6 -6
  14. package/docs/TODOS.md +10 -10
  15. package/docs/ValueReplacer.md +60 -60
  16. package/docs/VariableConversion.md +724 -719
  17. package/docs/warnings_while_install.txt +35 -35
  18. package/files/eslintrc.js +62 -62
  19. package/files/prettierrc.js +3 -3
  20. package/lib/configs/resolvers.js +40 -0
  21. package/lib/configs/webpack.css.umd.config.js +4 -4
  22. package/lib/configs/webpack.dev.config.js +4 -11
  23. package/lib/configs/webpack.docs.config.js +4 -11
  24. package/lib/configs/webpack.impact.config.js +5 -7
  25. package/lib/configs/webpack.prod.config.js +9 -13
  26. package/lib/constants.js +31 -0
  27. package/lib/loaderUtils/configsAssetsLoaders.js +34 -34
  28. package/lib/loaders/workerLoader.js +9 -9
  29. package/lib/pluginUtils/getDevPlugins.js +5 -5
  30. package/lib/pluginUtils/getProdPlugins.js +5 -5
  31. package/lib/plugins/EFCPlugin.md +6 -6
  32. package/lib/plugins/I18NInjectIntoIndexPlugin.js +4 -4
  33. package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
  34. package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
  35. package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +8 -8
  36. package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
  37. package/lib/plugins/I18nSplitPlugin/README.md +25 -25
  38. package/lib/plugins/I18nSplitPlugin/index.js +57 -57
  39. package/lib/plugins/ResourceHintsPlugin.js +17 -17
  40. package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +6 -6
  41. package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
  42. package/lib/plugins/ServiceWorkerPlugin.js +9 -9
  43. package/lib/plugins/TPHashMappingPlugin.js +4 -4
  44. package/lib/plugins/VariableConversionCollector.js +104 -74
  45. package/lib/postcss-plugins/RTLSplitPlugin.js +10 -10
  46. package/lib/postcss-plugins/__test__/test1Input.css +38 -38
  47. package/lib/postcss-plugins/__test__/test1Output.css +38 -38
  48. package/lib/postcss-plugins/hoverActivePlugin.js +3 -3
  49. package/lib/schemas/index.js +8 -0
  50. package/lib/servers/docsServerCore.js +13 -12
  51. package/lib/servers/httpsOptions.js +40 -9
  52. package/lib/servers/nowatchserver.js +12 -11
  53. package/lib/servers/server.js +23 -20
  54. package/lib/sh/pre-commit.sh +34 -34
  55. package/lib/sh/reportPublish.sh +45 -45
  56. package/lib/utils/buildstats.html +148 -148
  57. package/lib/utils/cssURLReplacer.js +30 -43
  58. package/lib/utils/getFileType.js +49 -0
  59. package/lib/utils/getOptions.js +13 -13
  60. package/lib/utils/resultSchema.json +73 -73
  61. package/npm8.md +9 -9
  62. package/package.json +122 -146
  63. package/postpublish.js +8 -6
  64. package/result.json +1 -0
  65. package/templates/app/.eslintrc.js +140 -140
  66. package/templates/app/README.md +12 -12
  67. package/templates/app/app/index.html +24 -24
  68. package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
  69. package/templates/app/app/properties/i18nkeys.json +3 -3
  70. package/templates/app/docs/all.html +69 -69
  71. package/templates/app/mockapi/index.js +18 -18
  72. package/templates/app/package.json +37 -37
  73. package/templates/app/src/actions/SampleActions/index.js +37 -37
  74. package/templates/app/src/actions/index.js +65 -65
  75. package/templates/app/src/appUrls.js +19 -19
  76. package/templates/app/src/components/Alert/Alert.js +134 -134
  77. package/templates/app/src/components/Alert/Alert.module.css +79 -79
  78. package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
  79. package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
  80. package/templates/app/src/components/Sample/Sample.module.css +11 -11
  81. package/templates/app/src/components/Sample/SampleList.js +61 -61
  82. package/templates/app/src/components/Slider/Slider.css +41 -41
  83. package/templates/app/src/components/Slider/Slider.js +55 -55
  84. package/templates/app/src/containers/AlertContainer/index.js +15 -15
  85. package/templates/app/src/containers/AppContainer/index.js +96 -96
  86. package/templates/app/src/containers/AppContainer/index.module.css +27 -27
  87. package/templates/app/src/containers/CustomMatch/index.js +65 -65
  88. package/templates/app/src/containers/DevTools/index.js +10 -10
  89. package/templates/app/src/containers/Header/index.js +67 -67
  90. package/templates/app/src/containers/Header/index.module.css +43 -43
  91. package/templates/app/src/containers/Redirect/index.js +63 -63
  92. package/templates/app/src/containers/Redirector/index.js +47 -47
  93. package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
  94. package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
  95. package/templates/app/src/historyChange.js +5 -5
  96. package/templates/app/src/index.html +10 -10
  97. package/templates/app/src/index.js +24 -24
  98. package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
  99. package/templates/app/src/reducers/alertData.js +11 -11
  100. package/templates/app/src/reducers/index.js +6 -6
  101. package/templates/app/src/reducers/samples.js +19 -19
  102. package/templates/app/src/store/configureStore.dev.js +51 -51
  103. package/templates/app/src/store/configureStore.js +5 -5
  104. package/templates/app/src/store/configureStore.prod.js +26 -26
  105. package/templates/app/src/util/Common.js +5 -5
  106. package/templates/app/src/util/RequestAPI.js +132 -132
  107. package/templates/docs/all.html +249 -249
  108. package/templates/docs/component.html +178 -178
  109. package/templates/docs/components.html +221 -221
  110. package/templates/docs/css/b.min.css +6 -6
  111. package/templates/docs/css/component.css +42 -42
  112. package/templates/docs/css/componentTest.css +6 -6
  113. package/templates/docs/css/hopscotch.css +585 -585
  114. package/templates/docs/css/style.css +1022 -1022
  115. package/templates/docs/impactReportTemplate.html +154 -154
  116. package/templates/docs/index.html +1501 -1501
  117. package/templates/docs/js/active-line.js +72 -72
  118. package/templates/docs/js/b.min.js +7 -7
  119. package/templates/docs/js/codemirror.js +9680 -9680
  120. package/templates/docs/js/designTokens.js +334 -334
  121. package/templates/docs/js/j.min.js +4 -4
  122. package/templates/docs/js/javascript.js +874 -874
  123. package/templates/docs/js/matchbrackets.js +145 -145
  124. package/unittest/index.html +37 -0
  125. package/cert/Tsicsezwild-22-23.crt +0 -37
  126. package/cert/Tsicsezwild-22-23.key +0 -27
@@ -29,28 +29,29 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
29
29
 
30
30
  // import fs from 'fs';
31
31
  var _default = isSSTest => {
32
- let options = (0, _utils.getOptions)();
33
- let {
32
+ const options = (0, _utils.getOptions)();
33
+ const httpsOptions = (0, _httpsOptions.httpsOptionsWithUserFriendlyError)(options);
34
+ const {
34
35
  docs: {
35
36
  server
36
37
  }
37
38
  } = options;
38
- let {
39
+ const {
39
40
  port,
40
41
  branch,
41
42
  host,
42
43
  domain,
43
44
  iphost
44
45
  } = server;
45
- let appPath = process.cwd();
46
+ const appPath = process.cwd();
46
47
  const app = (0, _express.default)();
47
48
  app.use(_express.default.json());
48
49
  app.use(_express.default.urlencoded({
49
50
  extended: true
50
51
  }));
51
- let docsConfig = (0, _webpackDocs.default)(isSSTest);
52
- let compiler = (0, _webpack.default)(docsConfig);
53
- let wdm = (0, _webpackDevMiddleware.default)(compiler, {
52
+ const docsConfig = (0, _webpackDocs.default)(isSSTest);
53
+ const compiler = (0, _webpack.default)(docsConfig);
54
+ const wdm = (0, _webpackDevMiddleware.default)(compiler, {
54
55
  logLevel: 'error',
55
56
  publicPath: docsConfig.output.publicPath,
56
57
  headers: {
@@ -67,7 +68,7 @@ var _default = isSSTest => {
67
68
  res.sendFile(_path.default.join(__dirname, '..', '..', 'templates', 'docs', 'index.html'));
68
69
  });
69
70
  app.use('/author/get', (req, res) => {
70
- let {
71
+ const {
71
72
  query: {
72
73
  componentName = ''
73
74
  }
@@ -84,7 +85,7 @@ var _default = isSSTest => {
84
85
 
85
86
  if (branch) {
86
87
  app.post('/repo/merge', (req, res) => {
87
- let {
88
+ const {
88
89
  ref
89
90
  } = req.body;
90
91
 
@@ -98,7 +99,7 @@ var _default = isSSTest => {
98
99
  });
99
100
  }
100
101
 
101
- const httpsServer = _https.default.createServer(_httpsOptions.httpsOptions, app);
102
+ const httpsServer = _https.default.createServer(httpsOptions, app);
102
103
 
103
104
  if (!isSSTest) {
104
105
  httpsServer.listen(port, err => {
@@ -110,8 +111,8 @@ var _default = isSSTest => {
110
111
  });
111
112
  }
112
113
 
113
- let httpPort = Number(port) + 1;
114
- let http = app.listen(httpPort, err => {
114
+ const httpPort = Number(port) + 1;
115
+ const http = app.listen(httpPort, err => {
115
116
  if (err) {
116
117
  throw err;
117
118
  }
@@ -3,16 +3,47 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.httpsOptions = void 0;
6
+ exports.httpsOptions = httpsOptions;
7
+ exports.httpsOptionsWithUserFriendlyError = httpsOptionsWithUserFriendlyError;
7
8
 
8
- var _fs = _interopRequireDefault(require("fs"));
9
+ // import fs from 'fs';
10
+ // import path from 'path';
11
+ // export const httpsOptions = {
12
+ // key: fs.readFileSync(path.join(__dirname, './cert/Tsicsezwild-22-23.key')),
13
+ // cert: fs.readFileSync(path.join(__dirname, './cert/Tsicsezwild-22-23.crt'))
14
+ // };
15
+ function httpsOptions(options) {
16
+ const {
17
+ httpsCerts
18
+ } = options.app.server;
9
19
 
10
- var _path = _interopRequireDefault(require("path"));
20
+ const certificate = require(require.resolve(httpsCerts, {
21
+ paths: [process.cwd()]
22
+ })); // TODO: in future we may do some version based check. certificate.version
11
23
 
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
24
 
14
- const httpsOptions = {
15
- key: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/Tsicsezwild-22-23.key')),
16
- cert: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/Tsicsezwild-22-23.crt'))
17
- };
18
- exports.httpsOptions = httpsOptions;
25
+ return certificate.httpsOptions;
26
+ }
27
+
28
+ function httpsOptionsWithUserFriendlyError(options) {
29
+ const {
30
+ httpsCerts
31
+ } = options.app.server;
32
+
33
+ if (typeof httpsCerts === 'string' && httpsCerts) {
34
+ try {
35
+ const certificate = httpsOptions(options);
36
+ return certificate;
37
+ } catch (error) {
38
+ if (error.message.indexOf('Cannot find module') !== -1) {
39
+ console.error(`You have given react-cli.app.server.httpsCerts as "${httpsCerts}". \n But it seems that file path have some problem.\n we are unable to locate "${httpsCerts}" in "${process.cwd()}"`);
40
+ } else {
41
+ console.error(error);
42
+ }
43
+
44
+ process.exit(0);
45
+ }
46
+ } else {
47
+ return null;
48
+ }
49
+ }
@@ -19,15 +19,16 @@ var _devBuild = require("./devBuild");
19
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
20
 
21
21
  // import webpack from 'webpack';
22
- let options = (0, _utils.getOptions)(); // let args = process.argv.slice(3);
22
+ const options = (0, _utils.getOptions)(); // let args = process.argv.slice(3);
23
23
 
24
- let {
24
+ const httpsOptions = (0, _httpsOptions.httpsOptionsWithUserFriendlyError)(options);
25
+ const {
25
26
  app: {
26
27
  context,
27
28
  server
28
29
  }
29
30
  } = options;
30
- let {
31
+ const {
31
32
  host,
32
33
  port,
33
34
  domain,
@@ -35,9 +36,9 @@ let {
35
36
  hasMock,
36
37
  mockPort
37
38
  } = server;
38
- let isCompatableHttp2 = Number(process.version.slice(1).split('.')[0]) >= 8;
39
- let contextURL = disableContextURL ? '' : `/${context}`;
40
- let serverUrl = (0, _utils.getServerURL)(server, 'htt' + 'ps');
39
+ const isCompatableHttp2 = Number(process.version.slice(1).split('.')[0]) >= 8;
40
+ const contextURL = disableContextURL ? '' : `/${context}`;
41
+ const serverUrl = (0, _utils.getServerURL)(server, 'htt' + 'ps');
41
42
  const {
42
43
  zipname,
43
44
  cssSelectorZipPath,
@@ -83,7 +84,7 @@ app.use('/wms/*', (req, res) => {
83
84
  res.sendFile(_path.default.join(__dirname, '..', '..', 'templates', 'wms', 'index.html'));
84
85
  });
85
86
 
86
- const httpsServer = _https.default.createServer(_httpsOptions.httpsOptions, app);
87
+ const httpsServer = _https.default.createServer(httpsOptions, app);
87
88
 
88
89
  const wss = new _ws.default.Server({
89
90
  server: httpsServer
@@ -101,7 +102,7 @@ wss.on('connection', ws => {
101
102
  });
102
103
  app.post('/wmsmockapi', (req, res) => {
103
104
  wsPool.forEach(ws => {
104
- let {
105
+ const {
105
106
  body
106
107
  } = req;
107
108
 
@@ -161,7 +162,7 @@ httpsServer.listen(port, err => {
161
162
  if (isCompatableHttp2) {
162
163
  const http2 = require('http2');
163
164
 
164
- const http2Server = http2.createSecureServer(_httpsOptions.httpsOptions); // eslint-disable-next-line no-unused-vars
165
+ const http2Server = http2.createSecureServer(httpsOptions); // eslint-disable-next-line no-unused-vars
165
166
 
166
167
  http2Server.on('stream', (stream, headers) => {
167
168
  stream.respond({
@@ -170,7 +171,7 @@ if (isCompatableHttp2) {
170
171
  });
171
172
  stream.end('<h1>Hello World! <br>Working with http2</h1>');
172
173
  });
173
- let http2Port = Number(port) + 1;
174
+ const http2Port = Number(port) + 1;
174
175
  http2Server.listen(http2Port, err => {
175
176
  if (err) {
176
177
  throw err;
@@ -186,7 +187,7 @@ if (isCompatableHttp2) {
186
187
  (0, _utils.log)('Your node version didn\'t adopted http2 support. Kindly update that to 8 LTS or above you can engage the http2');
187
188
  }
188
189
 
189
- let httpPort = Number(port) + (isCompatableHttp2 ? 2 : 1);
190
+ const httpPort = Number(port) + (isCompatableHttp2 ? 2 : 1);
190
191
  app.listen(httpPort, err => {
191
192
  if (err) {
192
193
  throw err;
@@ -25,14 +25,15 @@ var _httpsOptions = require("./httpsOptions");
25
25
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26
26
 
27
27
  // import fs from 'fs';
28
- let options = (0, _utils.getOptions)();
29
- let {
28
+ const options = (0, _utils.getOptions)();
29
+ const httpsOptions = (0, _httpsOptions.httpsOptionsWithUserFriendlyError)(options);
30
+ const {
30
31
  app: {
31
32
  context,
32
33
  server
33
34
  }
34
35
  } = options;
35
- let {
36
+ const {
36
37
  host,
37
38
  port,
38
39
  domain,
@@ -41,9 +42,9 @@ let {
41
42
  hasMock,
42
43
  mockPort
43
44
  } = server;
44
- let isCompatableHttp2 = Number(process.version.substr(1).split('.')[0]) >= 8;
45
- let contextURL = disableContextURL ? '' : `/${context}`;
46
- let serverUrl = (0, _utils.getServerURL)(server, 'htt' + 'ps');
45
+ const isCompatableHttp2 = Number(process.version.substr(1).split('.')[0]) >= 8;
46
+ const contextURL = disableContextURL ? '' : `/${context}`;
47
+ const serverUrl = (0, _utils.getServerURL)(server, 'htt' + 'ps');
47
48
  const {
48
49
  writeToDisk
49
50
  } = options.impactService;
@@ -72,8 +73,8 @@ if (mode === 'prod') {
72
73
  } // console.log({ contextURL });
73
74
 
74
75
 
75
- let compiler = (0, _webpack.default)(config);
76
- let webpackServerOptions = {
76
+ const compiler = (0, _webpack.default)(config);
77
+ const webpackServerOptions = {
77
78
  logLevel: 'error',
78
79
  publicPath: mode === 'prod' ? contextURL === '' ? `${serverUrl}/${contextURL}` : serverUrl + contextURL : config.output.publicPath,
79
80
  headers: options.app.enableDevCache ? {
@@ -114,7 +115,7 @@ app.use('/wms/*', (req, res) => {
114
115
  res.sendFile(_path.default.join(__dirname, '..', '..', 'templates', 'wms', 'index.html'));
115
116
  });
116
117
 
117
- const httpsServer = _https.default.createServer(_httpsOptions.httpsOptions, app);
118
+ const httpsServer = _https.default.createServer(httpsOptions, app);
118
119
 
119
120
  const wss = new _ws.default.Server({
120
121
  server: httpsServer
@@ -132,7 +133,7 @@ wss.on('connection', ws => {
132
133
  });
133
134
  app.post('/wmsmockapi', (req, res) => {
134
135
  wsPool.forEach(ws => {
135
- let {
136
+ const {
136
137
  body
137
138
  } = req;
138
139
 
@@ -167,18 +168,20 @@ if (contextURL) {
167
168
  app.use('/*', _express.default.static(context));
168
169
  }
169
170
 
170
- httpsServer.listen(port, err => {
171
- if (err) {
172
- throw err;
173
- }
171
+ if (httpsOptions) {
172
+ httpsServer.listen(port, err => {
173
+ if (err) {
174
+ throw err;
175
+ }
174
176
 
175
- (0, _utils.log)(`Listening at ${serverUrl}${contextURL}/`);
176
- });
177
+ (0, _utils.log)(`Listening at ${serverUrl}${contextURL}/`);
178
+ });
179
+ }
177
180
 
178
- if (isCompatableHttp2) {
181
+ if (isCompatableHttp2 && httpsOptions) {
179
182
  const http2 = require('http2');
180
183
 
181
- const http2Server = http2.createSecureServer(_httpsOptions.httpsOptions); // eslint-disable-next-line no-unused-vars
184
+ const http2Server = http2.createSecureServer(httpsOptions); // eslint-disable-next-line no-unused-vars
182
185
 
183
186
  http2Server.on('stream', (stream, headers) => {
184
187
  stream.respond({
@@ -187,7 +190,7 @@ if (isCompatableHttp2) {
187
190
  });
188
191
  stream.end('<h1>Hello World! <br>Working with http2</h1>');
189
192
  });
190
- let http2Port = Number(port) + 1;
193
+ const http2Port = Number(port) + 1;
191
194
  http2Server.listen(http2Port, err => {
192
195
  if (err) {
193
196
  throw err;
@@ -203,7 +206,7 @@ if (isCompatableHttp2) {
203
206
  (0, _utils.log)('Your node version didn\'t adopted http2 support. Kindly update that to 8 LTS or above you can engage the http2');
204
207
  }
205
208
 
206
- let httpPort = Number(port) + (isCompatableHttp2 ? 2 : 1);
209
+ const httpPort = Number(port) + (isCompatableHttp2 ? 2 : 1);
207
210
  app.listen(httpPort, err => {
208
211
  if (err) {
209
212
  throw err;
@@ -1,34 +1,34 @@
1
- #!/bin/sh
2
-
3
- STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E "\.(js)$") # Get staged files
4
-
5
- CURRENT_BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') # Get branch name
6
-
7
- echo "Branch Name - $CURRENT_BRANCH"
8
-
9
- if [[ "$STAGED_FILES" = "" ]]; then
10
- exit 0
11
- fi
12
-
13
- IS_FAILED=false
14
- FILES=""
15
-
16
- for FILE in $STAGED_FILES # Add files with space separation
17
- do
18
- FILES+="$FILE "
19
- done
20
-
21
- npm run lint --prefix ${PREFIX_PATH} $FILES # Run ESLint
22
-
23
- if [[ "$?" != 0 ]]; then
24
- IS_FAILED=true
25
- fi
26
-
27
- if $IS_FAILED; then
28
- echo "\033[41mCOMMIT FAILED:\033[0m Your commit contains files that should pass ESLint but do not. Please fix the ESLint errors and try again.\n"
29
- exit 1
30
- else
31
- echo "\033[42mCOMMIT SUCCEEDED\033[0m\n"
32
- fi
33
-
34
- exit $?
1
+ #!/bin/sh
2
+
3
+ STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E "\.(js)$") # Get staged files
4
+
5
+ CURRENT_BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p') # Get branch name
6
+
7
+ echo "Branch Name - $CURRENT_BRANCH"
8
+
9
+ if [[ "$STAGED_FILES" = "" ]]; then
10
+ exit 0
11
+ fi
12
+
13
+ IS_FAILED=false
14
+ FILES=""
15
+
16
+ for FILE in $STAGED_FILES # Add files with space separation
17
+ do
18
+ FILES+="$FILE "
19
+ done
20
+
21
+ npm run lint --prefix ${PREFIX_PATH} $FILES # Run ESLint
22
+
23
+ if [[ "$?" != 0 ]]; then
24
+ IS_FAILED=true
25
+ fi
26
+
27
+ if $IS_FAILED; then
28
+ echo "\033[41mCOMMIT FAILED:\033[0m Your commit contains files that should pass ESLint but do not. Please fix the ESLint errors and try again.\n"
29
+ exit 1
30
+ else
31
+ echo "\033[42mCOMMIT SUCCEEDED\033[0m\n"
32
+ fi
33
+
34
+ exit $?
@@ -1,45 +1,45 @@
1
- #!/bin/bash
2
- branchName=$2
3
- url=$1
4
- zipUrl=$3
5
- unique=$(date +"%d_%m_%y_Time_%H_%M_%S")
6
- publishFolder=$branchName"_"$unique
7
-
8
- rm -rf ./reports
9
- rm -rf ./scrTemplate
10
- rm -rf ./errTemplate
11
- rm -rf ./css
12
- rm -rf ./js
13
- rm -rf ./index.html
14
-
15
- curl $zipUrl | tar xz
16
-
17
- cp -rf ./reports/css ./css
18
- cp -rf ./reports/js ./js
19
- cp -rf ./reports/index.html ./index.html
20
- if [ -d "./screenShots" ] ; then
21
- cp -rf ./scrTemplate/* ./screenShots/
22
- else
23
- mkdir ./screenShots
24
- cp -rf ./scrTemplate/* ./screenShots/
25
- fi
26
-
27
- [ ! -f "./result.json" ] && touch result.json && cp -rf ./errTemplate/* ./result.json
28
- [ ! -d "./commitCoverage" ] && mkdir commitCoverage && cp -rf ./errTemplate/* ./commitCoverage/
29
- [ ! -d "./unittest" ] && mkdir unittest && cp -rf ./errTemplate/* ./unittest/
30
- [ ! -d "./coverageTest" ] && mkdir coverageTest && cp -rf ./errTemplate/* ./coverageTest/
31
- [ ! -d "./coverage" ] && mkdir coverage && cp -rf ./errTemplate/* ./coverage/
32
-
33
- tar -czvf $publishFolder.tar.gz coverage screenShots unittest coverageTest commitCoverage ./css ./js ./index.html ./result.json
34
-
35
- curl -i -F name=file -F file=@$publishFolder.tar.gz $url"/cgi-bin/upload.py"
36
- replace=$publishFolder
37
- reportUrl=$url"/"$replace
38
- subject="Client Report - React - $publishFolder"
39
- msg="<p><b>Report URL - <a href='$reportUrl'>Link</a></b></p>
40
- <p><b>Report Branchname - $branchName</b></p>
41
- <p><b>Report Unique ID - $unique</b></p>
42
- <p><b>Report Developer - $6</b></p>"
43
- #node mailSender.js <from> <pass> <to> <subject> <text>
44
- BASEDIR=$(dirname "$0")
45
- node $BASEDIR"/../utils/mailSender" $4 $5 $6 "$subject" "$msg" $7 $8 "$reportUrl"
1
+ #!/bin/bash
2
+ branchName=$2
3
+ url=$1
4
+ zipUrl=$3
5
+ unique=$(date +"%d_%m_%y_Time_%H_%M_%S")
6
+ publishFolder=$branchName"_"$unique
7
+
8
+ rm -rf ./reports
9
+ rm -rf ./scrTemplate
10
+ rm -rf ./errTemplate
11
+ rm -rf ./css
12
+ rm -rf ./js
13
+ rm -rf ./index.html
14
+
15
+ curl $zipUrl | tar xz
16
+
17
+ cp -rf ./reports/css ./css
18
+ cp -rf ./reports/js ./js
19
+ cp -rf ./reports/index.html ./index.html
20
+ if [ -d "./screenShots" ] ; then
21
+ cp -rf ./scrTemplate/* ./screenShots/
22
+ else
23
+ mkdir ./screenShots
24
+ cp -rf ./scrTemplate/* ./screenShots/
25
+ fi
26
+
27
+ [ ! -f "./result.json" ] && touch result.json && cp -rf ./errTemplate/* ./result.json
28
+ [ ! -d "./commitCoverage" ] && mkdir commitCoverage && cp -rf ./errTemplate/* ./commitCoverage/
29
+ [ ! -d "./unittest" ] && mkdir unittest && cp -rf ./errTemplate/* ./unittest/
30
+ [ ! -d "./coverageTest" ] && mkdir coverageTest && cp -rf ./errTemplate/* ./coverageTest/
31
+ [ ! -d "./coverage" ] && mkdir coverage && cp -rf ./errTemplate/* ./coverage/
32
+
33
+ tar -czvf $publishFolder.tar.gz coverage screenShots unittest coverageTest commitCoverage ./css ./js ./index.html ./result.json
34
+
35
+ curl -i -F name=file -F file=@$publishFolder.tar.gz $url"/cgi-bin/upload.py"
36
+ replace=$publishFolder
37
+ reportUrl=$url"/"$replace
38
+ subject="Client Report - React - $publishFolder"
39
+ msg="<p><b>Report URL - <a href='$reportUrl'>Link</a></b></p>
40
+ <p><b>Report Branchname - $branchName</b></p>
41
+ <p><b>Report Unique ID - $unique</b></p>
42
+ <p><b>Report Developer - $6</b></p>"
43
+ #node mailSender.js <from> <pass> <to> <subject> <text>
44
+ BASEDIR=$(dirname "$0")
45
+ node $BASEDIR"/../utils/mailSender" $4 $5 $6 "$subject" "$msg" $7 $8 "$reportUrl"