@zohodesk/react-cli 0.0.1-exp.168.3 → 0.0.1-exp.169.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintignore +7 -7
- package/.eslintrc.js +179 -179
- package/.prettierrc +6 -0
- package/README.md +946 -925
- package/bin/cli.js +482 -492
- package/cert/Tsicsezwild-22-23.crt +37 -37
- package/cert/Tsicsezwild-22-23.key +27 -27
- package/docs/CustomChunks.md +26 -26
- package/docs/DevStart.md +18 -18
- package/docs/HoverActive.md +12 -0
- package/docs/InstallNode.md +28 -28
- package/docs/TODOS.md +10 -10
- package/docs/ValueReplacer.md +60 -60
- package/docs/warnings_while_install.txt +35 -35
- package/files/eslintrc.js +62 -62
- package/files/prettierrc.js +3 -3
- package/lib/configs/jest.config.js +1 -3
- package/lib/configs/webpack.css.umd.config.js +4 -4
- package/lib/configs/webpack.dev.config.js +1 -1
- package/lib/configs/webpack.docs.config.js +1 -1
- package/lib/configs/webpack.impact.config.js +3 -1
- package/lib/configs/webpack.prod.config.js +4 -2
- package/lib/jest/preProcessors/cssPreprocessor.js +2 -0
- package/lib/loaderUtils/configsAssetsLoaders.js +62 -33
- package/lib/loaders/workerLoader.js +9 -9
- package/lib/pluginUtils/getDevPlugins.js +5 -5
- package/lib/pluginUtils/getProdPlugins.js +5 -5
- package/lib/plugins/EFCPlugin.md +6 -6
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +4 -4
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +38 -38
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +30 -30
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +8 -8
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -86
- package/lib/plugins/I18nSplitPlugin/README.md +25 -25
- package/lib/plugins/I18nSplitPlugin/index.js +57 -57
- package/lib/plugins/ResourceHintsPlugin.js +17 -17
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +6 -6
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
- package/lib/plugins/ServiceWorkerPlugin.js +9 -9
- package/lib/plugins/TPHashMappingPlugin.js +4 -4
- package/lib/postcss-plugins/RTLSplitPlugin.js +10 -10
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
- package/lib/postcss-plugins/__test__/test1Input.css +39 -0
- package/lib/postcss-plugins/__test__/test1Output.css +39 -0
- package/lib/postcss-plugins/hoverActivePlugin.js +50 -42
- package/lib/schemas/index.js +8 -3
- package/lib/servers/getCliPath.js +7 -3
- package/lib/sh/pre-commit.sh +34 -34
- package/lib/sh/reportPublish.sh +45 -45
- package/lib/utils/buildstats.html +148 -148
- package/lib/utils/resultSchema.json +73 -73
- package/npm8.md +9 -9
- package/package.json +148 -148
- package/postpublish.js +6 -6
- package/templates/app/.eslintrc.js +140 -140
- package/templates/app/README.md +12 -12
- package/templates/app/app/index.html +24 -24
- package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
- package/templates/app/app/properties/i18nkeys.json +3 -3
- package/templates/app/docs/all.html +69 -69
- package/templates/app/mockapi/index.js +18 -18
- package/templates/app/package.json +37 -37
- package/templates/app/src/actions/SampleActions/index.js +37 -37
- package/templates/app/src/actions/index.js +65 -65
- package/templates/app/src/appUrls.js +19 -19
- package/templates/app/src/components/Alert/Alert.js +134 -134
- package/templates/app/src/components/Alert/Alert.module.css +79 -79
- package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -37
- package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -84
- package/templates/app/src/components/Sample/Sample.module.css +11 -11
- package/templates/app/src/components/Sample/SampleList.js +61 -61
- package/templates/app/src/components/Slider/Slider.css +41 -41
- package/templates/app/src/components/Slider/Slider.js +55 -55
- package/templates/app/src/containers/AlertContainer/index.js +15 -15
- package/templates/app/src/containers/AppContainer/index.js +96 -96
- package/templates/app/src/containers/AppContainer/index.module.css +27 -27
- package/templates/app/src/containers/CustomMatch/index.js +65 -65
- package/templates/app/src/containers/DevTools/index.js +10 -10
- package/templates/app/src/containers/Header/index.js +67 -67
- package/templates/app/src/containers/Header/index.module.css +43 -43
- package/templates/app/src/containers/Redirect/index.js +63 -63
- package/templates/app/src/containers/Redirector/index.js +47 -47
- package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -42
- package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -3
- package/templates/app/src/historyChange.js +5 -5
- package/templates/app/src/index.html +10 -10
- package/templates/app/src/index.js +24 -24
- package/templates/app/src/middleware/PromiseMiddleware.js +59 -59
- package/templates/app/src/reducers/alertData.js +11 -11
- package/templates/app/src/reducers/index.js +6 -6
- package/templates/app/src/reducers/samples.js +19 -19
- package/templates/app/src/store/configureStore.dev.js +51 -51
- package/templates/app/src/store/configureStore.js +5 -5
- package/templates/app/src/store/configureStore.prod.js +26 -26
- package/templates/app/src/util/Common.js +5 -5
- package/templates/app/src/util/RequestAPI.js +132 -132
- package/templates/docs/all.html +249 -249
- package/templates/docs/component.html +178 -178
- package/templates/docs/components.html +221 -221
- package/templates/docs/css/b.min.css +6 -6
- package/templates/docs/css/component.css +42 -42
- package/templates/docs/css/componentTest.css +6 -6
- package/templates/docs/css/hopscotch.css +585 -585
- package/templates/docs/css/style.css +1022 -1022
- package/templates/docs/impactReportTemplate.html +154 -154
- package/templates/docs/index.html +1493 -1493
- package/templates/docs/js/active-line.js +72 -72
- package/templates/docs/js/b.min.js +7 -7
- package/templates/docs/js/codemirror.js +9680 -9680
- package/templates/docs/js/designTokens.js +334 -334
- package/templates/docs/js/j.min.js +4 -4
- package/templates/docs/js/javascript.js +874 -874
- package/templates/docs/js/matchbrackets.js +145 -145
- package/lib/postcss-plugins/keyframesPlugin.js +0 -126
@@ -0,0 +1,39 @@
|
|
1
|
+
/*Hover_active:ignore*/
|
2
|
+
g,a:hover{
|
3
|
+
color : red
|
4
|
+
}
|
5
|
+
/*Hover:ignore*/
|
6
|
+
h:hover{
|
7
|
+
background : yellow
|
8
|
+
}
|
9
|
+
|
10
|
+
/* Hover_active:ignore */
|
11
|
+
g,d+e:hover{
|
12
|
+
color : black
|
13
|
+
}
|
14
|
+
|
15
|
+
g,d e:hover{
|
16
|
+
color : black
|
17
|
+
}
|
18
|
+
|
19
|
+
@media screen and (max-width:61.25em){
|
20
|
+
/* Hover_active:ignore */
|
21
|
+
a,b,a:hover, b:hover{
|
22
|
+
background-color : blue
|
23
|
+
}
|
24
|
+
a + b,a:hover + b:hover{
|
25
|
+
background-color : blue
|
26
|
+
}
|
27
|
+
a b:hover{
|
28
|
+
background-color : blue
|
29
|
+
}
|
30
|
+
|
31
|
+
.cc:hover {
|
32
|
+
color: red;
|
33
|
+
}
|
34
|
+
|
35
|
+
c:hover{
|
36
|
+
color : red
|
37
|
+
}
|
38
|
+
|
39
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/*Hover_active:ignore*/
|
2
|
+
g,a:hover{
|
3
|
+
color : red
|
4
|
+
}
|
5
|
+
/*Hover:ignore*/
|
6
|
+
h:hover{
|
7
|
+
background : yellow
|
8
|
+
}
|
9
|
+
|
10
|
+
/* Hover_active:ignore */
|
11
|
+
g,d+e:hover{
|
12
|
+
color : black
|
13
|
+
}
|
14
|
+
|
15
|
+
g,d e:hover{
|
16
|
+
color : black
|
17
|
+
}
|
18
|
+
|
19
|
+
@media screen and (max-width:61.25em){
|
20
|
+
/* Hover_active:ignore */
|
21
|
+
a,b,a:hover, b:hover{
|
22
|
+
background-color : blue
|
23
|
+
}
|
24
|
+
a + b,a:hover + b:hover{
|
25
|
+
background-color : blue
|
26
|
+
}
|
27
|
+
a b:hover{
|
28
|
+
background-color : blue
|
29
|
+
}
|
30
|
+
|
31
|
+
.cc:hover {
|
32
|
+
color: red;
|
33
|
+
}
|
34
|
+
|
35
|
+
c:hover{
|
36
|
+
color : red
|
37
|
+
}
|
38
|
+
|
39
|
+
}
|
@@ -4,12 +4,22 @@ var _postcss = _interopRequireDefault(require("postcss"));
|
|
4
4
|
|
5
5
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
/**
|
8
|
+
* we have give support for ignore(exclude) comments
|
9
|
+
* These are the comments' keyword
|
10
|
+
*/
|
11
|
+
const hoverIgnoreQuery = 'Hover:ignore',
|
12
|
+
activeIgnoreQuery = 'Active:ignore',
|
13
|
+
hoverActiveIgnoreQuery = 'HoverActive:ignore';
|
14
|
+
const medHoverIgnoreQuery = 'MedHover:ignore',
|
15
|
+
medActiveIgnoreQuery = 'MedActive:ignore',
|
16
|
+
medHoverActiveIgnoreQuery = 'MedHoverActive:ignore';
|
17
|
+
const hoverMedQuerySuffix = '(min--moz-device-pixel-ratio:0) and (hover: hover), (hover: hover)';
|
18
|
+
const ruleIgnoreCommentRegex = /(Hover:ignore|Active:ignore|HoverActive:ignore)/g;
|
19
|
+
const mediaQueryIgnoreCommentRegex = /(MedHover:ignore|MedActive:ignore|MedHoverActive:ignore)/g;
|
10
20
|
|
11
21
|
function isComment(node) {
|
12
|
-
return node
|
22
|
+
return node && node.type === 'comment' && node.text !== undefined;
|
13
23
|
}
|
14
24
|
|
15
25
|
function isHoverPresent(atrule) {
|
@@ -25,22 +35,18 @@ function isHoverPresent(atrule) {
|
|
25
35
|
module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOriginal => {
|
26
36
|
const hoverRules = [];
|
27
37
|
let positionsObj = {};
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
function QueryIgnoreCheck(index, type) {
|
36
|
-
if (previousNodeCheck(rootOriginal.nodes, index)) {
|
37
|
-
return rootOriginal.nodes[index - 1].text === type;
|
38
|
+
|
39
|
+
function isRuleHasIgnoreComment(index, type) {
|
40
|
+
const prevNode = rootOriginal.nodes[index - 1];
|
41
|
+
|
42
|
+
if (isComment(prevNode)) {
|
43
|
+
return prevNode.text === type;
|
38
44
|
}
|
39
45
|
|
40
46
|
return false;
|
41
47
|
}
|
42
48
|
|
43
|
-
function
|
49
|
+
function isMediaQueryHasIgnoreComment(node, type) {
|
44
50
|
if (isComment(node)) {
|
45
51
|
return node.text === type;
|
46
52
|
}
|
@@ -48,34 +54,39 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOrigi
|
|
48
54
|
return false;
|
49
55
|
}
|
50
56
|
|
51
|
-
function
|
57
|
+
function hasIgnoreComment({
|
52
58
|
index,
|
53
59
|
atrule,
|
54
60
|
type
|
55
61
|
}) {
|
56
|
-
if (type.match(
|
57
|
-
return
|
62
|
+
if (type.match(mediaQueryIgnoreCommentRegex)) {
|
63
|
+
return isMediaQueryHasIgnoreComment(atrule.nodes[index - 1], type.slice(3));
|
58
64
|
}
|
59
65
|
|
60
|
-
if (type.match(
|
61
|
-
return
|
66
|
+
if (type.match(ruleIgnoreCommentRegex)) {
|
67
|
+
return isRuleHasIgnoreComment(index, type);
|
62
68
|
}
|
69
|
+
|
70
|
+
return false;
|
63
71
|
}
|
64
72
|
|
65
|
-
function
|
66
|
-
|
67
|
-
|
68
|
-
|
73
|
+
function getPositionsOfHoverAndActiveMedQueries(parent) {
|
74
|
+
const allNodes = rootOriginal.nodes;
|
75
|
+
const hoverMediaQuery = `${parent.params} and all and ${hoverMedQuerySuffix}`;
|
76
|
+
const hoverNoneMediaQuery = `${parent.params} and (hover: none)`;
|
77
|
+
const positions = {
|
78
|
+
hovMed: allNodes[positionsObj[hoverMediaQuery]],
|
79
|
+
actMed: allNodes[positionsObj[hoverNoneMediaQuery]]
|
69
80
|
};
|
70
81
|
return positions;
|
71
82
|
}
|
72
83
|
|
73
84
|
function handleMedHoverAndHoverActiveIgnore(atrule, index) {
|
74
|
-
return !
|
85
|
+
return !hasIgnoreComment({
|
75
86
|
atrule,
|
76
87
|
index,
|
77
88
|
type: medHoverIgnoreQuery
|
78
|
-
}) && !
|
89
|
+
}) && !hasIgnoreComment({
|
79
90
|
atrule,
|
80
91
|
index,
|
81
92
|
type: medHoverActiveIgnoreQuery
|
@@ -83,11 +94,11 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOrigi
|
|
83
94
|
}
|
84
95
|
|
85
96
|
function handleMedActiveAndHoverActiveIgnore(atrule, index) {
|
86
|
-
return !
|
97
|
+
return !hasIgnoreComment({
|
87
98
|
atrule,
|
88
99
|
index,
|
89
100
|
type: medActiveIgnoreQuery
|
90
|
-
}) && !
|
101
|
+
}) && !hasIgnoreComment({
|
91
102
|
atrule,
|
92
103
|
index,
|
93
104
|
type: medHoverActiveIgnoreQuery
|
@@ -95,33 +106,33 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOrigi
|
|
95
106
|
}
|
96
107
|
|
97
108
|
function handleHoverAndHoverActiveIgnore(index) {
|
98
|
-
return !
|
109
|
+
return !hasIgnoreComment({
|
99
110
|
index,
|
100
111
|
type: hoverIgnoreQuery
|
101
|
-
}) && !
|
112
|
+
}) && !hasIgnoreComment({
|
102
113
|
index,
|
103
114
|
type: hoverActiveIgnoreQuery
|
104
115
|
});
|
105
116
|
}
|
106
117
|
|
107
118
|
function handleActiveAndHoverActiveIgnore(index) {
|
108
|
-
return !
|
119
|
+
return !hasIgnoreComment({
|
109
120
|
index,
|
110
121
|
type: activeIgnoreQuery
|
111
|
-
}) && !
|
122
|
+
}) && !hasIgnoreComment({
|
112
123
|
index,
|
113
124
|
type: hoverActiveIgnoreQuery
|
114
125
|
});
|
115
126
|
}
|
116
127
|
|
117
128
|
function handleAllIgnoreCases(index) {
|
118
|
-
return !
|
129
|
+
return !hasIgnoreComment({
|
119
130
|
index,
|
120
131
|
type: activeIgnoreQuery
|
121
|
-
}) && !
|
132
|
+
}) && !hasIgnoreComment({
|
122
133
|
index,
|
123
134
|
type: hoverIgnoreQuery
|
124
|
-
}) && !
|
135
|
+
}) && !hasIgnoreComment({
|
125
136
|
index,
|
126
137
|
type: hoverActiveIgnoreQuery
|
127
138
|
});
|
@@ -134,7 +145,7 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOrigi
|
|
134
145
|
let {
|
135
146
|
hovMed,
|
136
147
|
actMed
|
137
|
-
} =
|
148
|
+
} = getPositionsOfHoverAndActiveMedQueries(rule.parent);
|
138
149
|
let hovQueries = [];
|
139
150
|
let actQueries = [];
|
140
151
|
rule.selector.split(/\s*,\s*/).forEach(_subrule => {
|
@@ -182,12 +193,11 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOrigi
|
|
182
193
|
}
|
183
194
|
|
184
195
|
function mediaQuery(rule, index) {
|
185
|
-
// console.log(rule.parent.params + " and all and (min--moz-device-pixel-ratio:0) and (hover: hover), (hover: hover)");
|
186
196
|
if (rule.parent.params !== undefined && !rule.parent.params.includes('hover')) {
|
187
197
|
let {
|
188
198
|
hovMed,
|
189
199
|
actMed
|
190
|
-
} =
|
200
|
+
} = getPositionsOfHoverAndActiveMedQueries(rule.parent);
|
191
201
|
|
192
202
|
if (rule.selector.includes('hover') && hovMed !== undefined && rule.parent.type === 'atrule') {
|
193
203
|
if (handleMedHoverAndHoverActiveIgnore(rule.parent, index)) {
|
@@ -238,8 +248,7 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOrigi
|
|
238
248
|
|
239
249
|
|
240
250
|
rootOriginal.walkAtRules(atrule => {
|
241
|
-
|
242
|
-
const hoverQuery = `${atrule.params} and all and (min--moz-device-pixel-ratio:0) and (hover: hover), (hover: hover)`;
|
251
|
+
const hoverQuery = `${atrule.params} and all and ${hoverMedQuerySuffix}`;
|
243
252
|
const activeQuery = `${atrule.params} and (hover: none)`;
|
244
253
|
|
245
254
|
if (isHoverPresent(atrule)) {
|
@@ -258,7 +267,6 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOrigi
|
|
258
267
|
}
|
259
268
|
});
|
260
269
|
rootOriginal.walkRules(/:hover/i, (rule, index) => {
|
261
|
-
// console.log({ rule, index });
|
262
270
|
// media hover query with ',' ' ' '+'
|
263
271
|
// console.log("media query" , rule.selector)
|
264
272
|
if (rule.parent.type === 'atrule' && rule.selector.includes(',')) {
|
@@ -300,7 +308,7 @@ module.exports = _postcss.default.plugin('postcss-mobile-hover', () => rootOrigi
|
|
300
308
|
// hover
|
301
309
|
const hoverQuery = rootOriginal.append({
|
302
310
|
name: 'media',
|
303
|
-
params:
|
311
|
+
params: `all and ${hoverMedQuerySuffix}`
|
304
312
|
}).last; // Create a media query targetting devices that don't support hover
|
305
313
|
// (ie. devices where we should fall back to :active instead)
|
306
314
|
|
package/lib/schemas/index.js
CHANGED
@@ -71,8 +71,14 @@ var _default = {
|
|
71
71
|
},
|
72
72
|
createSDkFile: false,
|
73
73
|
nameScope: 'ZOHODESK',
|
74
|
-
version:
|
75
|
-
|
74
|
+
version: {
|
75
|
+
value: 'stable',
|
76
|
+
cli: 'efc_version'
|
77
|
+
},
|
78
|
+
outputFile: {
|
79
|
+
value: 'efc-sdk-[version].js',
|
80
|
+
cli: 'efc_output_file'
|
81
|
+
},
|
76
82
|
templateFilePath: '',
|
77
83
|
localeAttr: 'data-efc-locale',
|
78
84
|
localeDefaultValue: 'en_US',
|
@@ -272,7 +278,6 @@ var _default = {
|
|
272
278
|
enableChunkHash: false,
|
273
279
|
combinerMq: false,
|
274
280
|
hoverActive: false,
|
275
|
-
keyframesRedMtn: false,
|
276
281
|
folder: 'src',
|
277
282
|
disableES5Transpile: false,
|
278
283
|
hasRTL: false,
|
@@ -9,16 +9,20 @@ var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
|
10
10
|
var _os = require("os");
|
11
11
|
|
12
|
+
var _fs = require("fs");
|
13
|
+
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
15
|
|
14
|
-
|
16
|
+
const appPath = process.cwd();
|
15
17
|
const isNodeModuleUnderAppFolder = __dirname.indexOf(appPath) !== -1;
|
16
|
-
|
18
|
+
const isWindows = (0, _os.platform)().toLowerCase() === 'win32';
|
17
19
|
|
18
20
|
const _getCliPath = !isNodeModuleUnderAppFolder ? libName => _path.default.join(__dirname, '..', '..', 'node_modules', '.bin', libName) : libName => libName;
|
19
21
|
|
20
22
|
const suffixExt = isWindows ? '.cmd' : '';
|
21
23
|
|
22
24
|
function getCliPath(libName) {
|
23
|
-
|
25
|
+
const cliPath = _getCliPath(libName + suffixExt);
|
26
|
+
|
27
|
+
return (0, _fs.existsSync)(cliPath) ? cliPath : libName;
|
24
28
|
}
|
package/lib/sh/pre-commit.sh
CHANGED
@@ -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 $?
|
package/lib/sh/reportPublish.sh
CHANGED
@@ -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"
|