@zohodesk/react-cli 0.0.1-beta.99 → 0.0.1-betaa.138.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 +183 -183
- package/CHANGELOG.md +5 -0
- package/README.md +636 -491
- package/bin/cli.js +372 -367
- package/files/eslintrc.js +57 -0
- package/files/prettierrc.js +3 -0
- package/lib/babel/cmjs-plugins-presets.js +16 -9
- package/lib/babel/es-plugins-presets.js +26 -14
- package/lib/common/getEntries.js +31 -22
- package/lib/common/getPublicPathConfig.js +27 -13
- package/lib/common/index.js +21 -25
- package/lib/common/splitChunks.js +62 -53
- package/lib/common/templateParameters.js +10 -8
- package/lib/configs/jest.config.js +15 -25
- package/lib/configs/webpack.component.umd.config.js +31 -37
- package/lib/configs/webpack.css.umd.config.js +44 -47
- package/lib/configs/webpack.dev.config.js +70 -52
- package/lib/configs/webpack.docs.config.js +106 -106
- package/lib/configs/webpack.prod.config.js +95 -75
- package/lib/hooks/docsProptypeHook.js +32 -38
- package/lib/jest/commitedFilesResult.js +103 -74
- package/lib/jest/coverageCollector.js +41 -21
- package/lib/jest/jsonMaker.js +15 -16
- package/lib/jest/preProcessors/cssPreprocessor.js +16 -18
- package/lib/jest/preProcessors/jsPreprocessor.js +3 -5
- package/lib/jest/preProcessors/otherFilesPreprocessor.js +5 -6
- package/lib/jest/result.js +90 -45
- package/lib/jest/run.js +43 -43
- package/lib/jest/setup.js +102 -95
- package/lib/loaderUtils/getCSSLoaders.js +21 -22
- package/lib/loaderUtils/getDevJsLoaders.js +25 -23
- package/lib/loaderUtils/index.js +11 -13
- package/lib/loaders/docsLoader.js +15 -15
- package/lib/loaders/docsPropsLoader.js +14 -17
- package/lib/loaders/fileLoader.js +33 -35
- package/lib/loaders/scriptInstrumentLoader.js +21 -20
- package/lib/loaders/workerLoader.js +136 -0
- package/lib/middlewares/HMRMiddleware.js +54 -45
- package/lib/middlewares/SSTMiddleware.js +8 -5
- package/lib/pluginUtils/getDevPlugins.js +114 -52
- package/lib/pluginUtils/getDocsPlugins.js +25 -29
- package/lib/pluginUtils/getLibraryPlugins.js +8 -10
- package/lib/pluginUtils/getProdPlugins.js +163 -74
- package/lib/pluginUtils/getServerPlugins.js +8 -11
- package/lib/pluginUtils/getUMDCSSPlugins.js +11 -15
- package/lib/pluginUtils/getUMDComponentPlugins.js +11 -15
- package/lib/pluginUtils/index.js +36 -43
- package/lib/plugins/CdnChangePlugin.js +63 -0
- package/lib/plugins/CleanupStatsPlugin.js +18 -32
- package/lib/plugins/CustomAttributePlugin.js +79 -0
- package/lib/plugins/CustomAttributePlugin.md +35 -0
- package/lib/plugins/EFCPlugin.js +185 -0
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +118 -52
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +60 -0
- package/lib/plugins/I18nSplitPlugin/I18nDependency.js +44 -0
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +266 -0
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +183 -0
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +100 -0
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +86 -0
- package/lib/plugins/I18nSplitPlugin/README.md +25 -0
- package/lib/plugins/I18nSplitPlugin/index.js +185 -0
- package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +64 -0
- package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +13 -0
- package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +26 -0
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +40 -0
- package/lib/plugins/I18nSplitPlugin/utils/index.js +31 -0
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +112 -0
- package/lib/plugins/ManifestPlugin.js +52 -63
- package/lib/plugins/ModuleStatsPlugin.js +83 -173
- package/lib/plugins/OptimizeJSPlugin.js +24 -41
- package/lib/plugins/PublicPathCallbackPlugin.js +42 -116
- package/lib/plugins/PublicPathChangePlugin.js +175 -284
- package/lib/plugins/ReportGeneratePlugin.js +150 -151
- package/lib/plugins/ResourceHintsPlugin.js +53 -35
- package/lib/plugins/ScriptInstrumentPlugin.js +22 -37
- package/lib/plugins/ServiceWorkerPlugin.js +81 -57
- package/lib/plugins/ShadowDOMSupportPlugin.js +153 -234
- package/lib/plugins/SourceMapHookPlugin.js +21 -33
- package/lib/plugins/TPHashMappingPlugin.js +67 -0
- package/lib/plugins/UglifyCSSPlugin.js +23 -30
- package/lib/plugins/UnusedFilesFindPlugin.js +137 -152
- package/lib/plugins/index.js +100 -91
- package/lib/plugins/webpackwatchrunplugin.js +18 -30
- package/lib/postcss-plugins/ExcludeRTLPlugin.js +14 -17
- package/lib/schemas/index.js +336 -81
- package/lib/servers/clusterHubServer.js +22 -26
- package/lib/servers/docsServer.js +3 -5
- package/lib/servers/docsServerCore.js +84 -91
- package/lib/servers/helpServer.js +19 -21
- package/lib/servers/impactServer.js +99 -92
- package/lib/servers/mockserver.js +24 -24
- package/lib/servers/scrServer.js +78 -98
- package/lib/servers/server.js +101 -122
- package/lib/servers/ssServer.js +63 -61
- package/lib/sh/pre-commit.sh +34 -34
- package/lib/sh/reportPublish.sh +45 -46
- package/lib/templates/CoverageScriptTemplate.js +45 -18
- package/lib/templates/WMSTemplate.js +17 -18
- package/lib/templates/linterConstant.js +6 -4
- package/lib/utils/babelPresets.js +12 -5
- package/lib/utils/buildstats.html +148 -148
- package/lib/utils/clean.js +12 -11
- package/lib/utils/copy.js +12 -34
- package/lib/utils/copyTimezones.js +9 -16
- package/lib/utils/createEventStream.js +24 -19
- package/lib/utils/cssClassNameGenerate.js +44 -73
- package/lib/utils/cssURLReplacer.js +60 -54
- package/lib/utils/dependencyPostPublish.js +20 -19
- package/lib/utils/fileUtils.js +66 -54
- package/lib/utils/folderIterator.js +20 -21
- package/lib/utils/getComponents.js +70 -27
- package/lib/utils/getCurrentBranch.js +11 -17
- package/lib/utils/getDependenciesImpactList.js +114 -187
- package/lib/utils/getHash.js +9 -13
- package/lib/utils/getIp.js +9 -9
- package/lib/utils/getOptions.js +26 -29
- package/lib/utils/getServerURL.js +19 -10
- package/lib/utils/index.js +147 -126
- package/lib/utils/init.js +2 -2
- package/lib/utils/initPreCommitHook.js +40 -32
- package/lib/utils/jsonHelper.js +37 -21
- package/lib/utils/lint/addScripts.js +27 -0
- package/lib/utils/lint/checkExistingConfig.js +67 -0
- package/lib/utils/lint/copyConfigs.js +24 -0
- package/lib/utils/lint/index.js +54 -0
- package/lib/utils/lint/lintScripts.js +11 -0
- package/lib/utils/lint/lintSetup.js +31 -0
- package/lib/utils/lint/lintStagedPreCommitHook.js +7 -0
- package/lib/utils/lint/question.js +30 -0
- package/lib/utils/lintReporter.js +70 -56
- package/lib/utils/mailSender.js +12 -27
- package/lib/utils/pullOrigin.js +21 -18
- package/lib/utils/reinstallDependencies.js +76 -85
- package/lib/utils/removeAttributes.js +25 -23
- package/lib/utils/repoClone.js +47 -45
- package/lib/utils/request.js +64 -77
- package/lib/utils/resultSchema.json +73 -73
- package/lib/utils/rtl.js +22 -29
- package/lib/utils/setEnvVariables.js +5 -6
- package/lib/utils/ssTestHack.js +21 -19
- package/lib/utils/switchBranch.js +21 -20
- package/lib/utils/urlConcat.js +22 -0
- package/package.json +141 -136
- 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/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/servers/ssServer.js
CHANGED
@@ -1,121 +1,123 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
|
-
var _screenshotTest = require(
|
3
|
+
var _screenshotTest = _interopRequireDefault(require("@zohodesk/screenshot-test"));
|
4
4
|
|
5
|
-
var
|
5
|
+
var _jsonHelper = require("../utils/jsonHelper");
|
6
6
|
|
7
|
-
var
|
7
|
+
var _utils = require("../utils");
|
8
8
|
|
9
|
-
var
|
9
|
+
var _docsServerCore = _interopRequireDefault(require("./docsServerCore"));
|
10
10
|
|
11
|
-
var
|
12
|
-
|
13
|
-
var _docsServerCore2 = _interopRequireDefault(_docsServerCore);
|
14
|
-
|
15
|
-
var _SSTMiddleware = require('../middlewares/SSTMiddleware');
|
16
|
-
|
17
|
-
var _SSTMiddleware2 = _interopRequireDefault(_SSTMiddleware);
|
11
|
+
var _SSTMiddleware = _interopRequireDefault(require("../middlewares/SSTMiddleware"));
|
18
12
|
|
19
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20
14
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
15
|
+
let options = (0, _utils.getOptions)();
|
16
|
+
let impactedComponentObject = null;
|
17
|
+
let docsServerInstance;
|
18
|
+
let {
|
19
|
+
ssTest: {
|
20
|
+
seleniumHub,
|
21
|
+
referBranch,
|
22
|
+
currentBranch,
|
23
|
+
enableImage,
|
24
|
+
pathToSubProjects
|
25
|
+
},
|
26
|
+
docs: {
|
27
|
+
server
|
28
|
+
}
|
29
|
+
} = options;
|
32
30
|
|
33
31
|
function closeServer(serverInstance) {
|
34
32
|
(0, _utils.log)('Docs service stopped!');
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
let {
|
34
|
+
http,
|
35
|
+
https,
|
36
|
+
wdm
|
37
|
+
} = serverInstance;
|
39
38
|
http.close();
|
40
39
|
https.close();
|
41
40
|
wdm.close();
|
42
41
|
}
|
43
42
|
|
44
|
-
(0, _jsonHelper.jsonHelper)(process.cwd()
|
45
|
-
(0, _jsonHelper.jsonHelper)(process.cwd()
|
46
|
-
(0, _jsonHelper.jsonHelper)(process.cwd()
|
47
|
-
|
43
|
+
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.compareBranch', referBranch);
|
44
|
+
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.TestBranch', currentBranch);
|
45
|
+
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.isExecuted', true);
|
48
46
|
(0, _utils.log)('Test Branch Name :- ', currentBranch);
|
49
47
|
|
50
|
-
|
48
|
+
let afterFirstScreenShotCollected = () => {
|
51
49
|
closeServer(docsServerInstance);
|
52
|
-
(0, _utils.switchBranch)('git', referBranch).then(
|
50
|
+
(0, _utils.switchBranch)('git', referBranch).then(() => {
|
53
51
|
(0, _utils.log)('Reference Branch Name :- ', (0, _utils.getCurrentBranch)());
|
54
|
-
(0, _utils.reinstallDependencies)(pathToSubProjects).then(
|
52
|
+
(0, _utils.reinstallDependencies)(pathToSubProjects).then(() => {
|
55
53
|
(0, _utils.ssTestHack)();
|
56
54
|
});
|
57
55
|
});
|
58
56
|
};
|
59
57
|
|
60
|
-
|
58
|
+
let onSStestEnd = (status, resultObject, isLastRun, runSSTest) => {
|
61
59
|
if (status) {
|
62
60
|
if (!isLastRun) {
|
63
|
-
(0, _jsonHelper.jsonHelper)(process.cwd()
|
61
|
+
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.result', resultObject);
|
64
62
|
runSSTest(afterFirstScreenShotCollected, true, 'reference', referBranch, impactedComponentObject);
|
65
63
|
} else {
|
66
|
-
(0, _jsonHelper.jsonHelper)(process.cwd()
|
67
|
-
(0, _jsonHelper.jsonHelper)(process.cwd()
|
68
|
-
(0, _jsonHelper.jsonHelper)(process.cwd()
|
69
|
-
(0, _jsonHelper.jsonHelper)(process.cwd()
|
70
|
-
(0, _jsonHelper.setTestInfoStatus)(process.cwd()
|
64
|
+
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.endTime', Date.now());
|
65
|
+
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.isPassed', true);
|
66
|
+
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.result', resultObject);
|
67
|
+
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.message', 'Screenshot test succesfully completed.');
|
68
|
+
(0, _jsonHelper.setTestInfoStatus)(`${process.cwd()}/result.json`, true);
|
71
69
|
(0, _utils.log)('Screenshot test completed succesfully.');
|
72
70
|
closeServer(docsServerInstance);
|
73
71
|
}
|
74
72
|
} else {
|
75
|
-
(0, _jsonHelper.jsonHelper)(process.cwd()
|
76
|
-
(0, _jsonHelper.jsonHelper)(process.cwd()
|
77
|
-
(0, _jsonHelper.setTestInfoStatus)(process.cwd()
|
78
|
-
(0, _jsonHelper.jsonHelper)(process.cwd()
|
73
|
+
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.isPassed', false);
|
74
|
+
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.message', 'Component list undefined! Please check component Docs');
|
75
|
+
(0, _jsonHelper.setTestInfoStatus)(`${process.cwd()}/result.json`, false);
|
76
|
+
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'testInfo.failures', {
|
79
77
|
type: 'screenshotTest',
|
80
78
|
message: 'Component list undefined! Please check component Docs'
|
81
79
|
});
|
82
80
|
closeServer(docsServerInstance);
|
83
|
-
(0, _jsonHelper.jsonHelper)(process.cwd()
|
81
|
+
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.endTime', Date.now());
|
84
82
|
throw new Error('Component list undefined! Please check component Docs');
|
85
83
|
}
|
86
84
|
};
|
87
85
|
|
88
86
|
(0, _utils.ssTestHack)();
|
89
|
-
|
87
|
+
|
88
|
+
let getDocsServerInstance = beforeJobs => {
|
90
89
|
if (typeof beforeJobs === 'function') {
|
91
90
|
beforeJobs();
|
92
91
|
}
|
93
|
-
|
92
|
+
|
93
|
+
return (0, _docsServerCore.default)(true);
|
94
94
|
};
|
95
95
|
|
96
|
-
|
97
|
-
|
96
|
+
let runSSTest = (onBefore, isLastRun, mode, branch, listOfComponents) => {
|
97
|
+
let url = (0, _utils.getServerURL)(Object.assign(server, {
|
98
|
+
host: server.iphost
|
99
|
+
}), 'ht' + 'tp');
|
98
100
|
docsServerInstance = getDocsServerInstance(onBefore);
|
99
|
-
docsServerInstance.app.use((0,
|
101
|
+
docsServerInstance.app.use((0, _SSTMiddleware.default)(docsServerInstance.compiler, mData => {
|
100
102
|
impactedComponentObject = (0, _utils.getComponents)(mData, listOfComponents);
|
101
|
-
|
102
|
-
|
103
|
+
|
104
|
+
_screenshotTest.default.run({
|
105
|
+
branch,
|
103
106
|
seleniumHub: seleniumHub,
|
104
|
-
url: url
|
107
|
+
url: `${url}/docs/components.html`,
|
105
108
|
browserList: ['chrome'],
|
106
|
-
mode
|
107
|
-
enableImage
|
108
|
-
impactedComponentObject
|
109
|
+
mode,
|
110
|
+
enableImage,
|
111
|
+
impactedComponentObject,
|
109
112
|
script: 'var Objlist = {};for (i in Component) {try { if (Component[i].prototype.isReactComponent) Objlist[i] = Component[i].docs.componentGroup;}catch (err) {console.log(i, err);}};if (Object.keys(Objlist).length < 5) {Objlist = false;}return Objlist;'
|
110
|
-
},
|
113
|
+
}, (status, finalObj) => {
|
111
114
|
onSStestEnd(status, finalObj, isLastRun, runSSTest);
|
112
115
|
});
|
113
116
|
}));
|
114
117
|
};
|
115
118
|
|
116
|
-
(0, _jsonHelper.jsonHelper)(process.cwd()
|
117
|
-
|
118
|
-
(0, _utils.getDependenciesImpactList)(currentBranch, referBranch).then(function (impactedList) {
|
119
|
+
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.screenshotTest.startTime', Date.now());
|
120
|
+
(0, _utils.getDependenciesImpactList)(currentBranch, referBranch).then(impactedList => {
|
119
121
|
(0, _utils.log)('from here ');
|
120
122
|
runSSTest(null, null, 'test', currentBranch, impactedList);
|
121
123
|
});
|
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,46 +1,45 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
branchName=$2
|
3
|
-
url=$1
|
4
|
-
zipUrl=$3
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
rm -rf ./
|
10
|
-
rm -rf ./
|
11
|
-
rm -rf ./
|
12
|
-
rm -rf ./
|
13
|
-
rm -rf ./
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
cp -rf ./reports/
|
19
|
-
cp -rf ./reports/
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
[ ! -
|
29
|
-
[ ! -d "./
|
30
|
-
[ ! -d "./
|
31
|
-
[ ! -d "./
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
replace
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
<p><b>Report
|
42
|
-
<p><b>Report
|
43
|
-
<
|
44
|
-
|
45
|
-
BASEDIR
|
46
|
-
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"
|
@@ -1,44 +1,71 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
window.ClientCoverage = {
|
4
4
|
LocalStorageWrapper: {
|
5
|
-
getLocalStorage
|
5
|
+
getLocalStorage(property, defaultVal) {
|
6
6
|
if (localStorage.hasOwnProperty(property)) {
|
7
7
|
Object.assign(defaultVal, JSON.parse(localStorage.getItem(property)));
|
8
|
-
localStorage.setItem(property, JSON.stringify(defaultVal));
|
8
|
+
localStorage.setItem(property, JSON.stringify(defaultVal));
|
9
|
+
return defaultVal;
|
9
10
|
}
|
10
|
-
|
11
|
+
|
12
|
+
localStorage.setItem(property, JSON.stringify(defaultVal));
|
13
|
+
return defaultVal || {};
|
11
14
|
},
|
12
|
-
|
15
|
+
|
16
|
+
clearLocalStorage(property) {
|
13
17
|
localStorage.removeItem(property);
|
14
18
|
}
|
15
|
-
|
16
|
-
|
19
|
+
|
20
|
+
},
|
21
|
+
JS: {
|
22
|
+
jsMethodInstrumentObject: {},
|
23
|
+
jsStorageKey: 'jsClientCoverageObject',
|
24
|
+
|
25
|
+
init() {
|
17
26
|
this.jsMethodInstrumentObject = ClientCoverage.LocalStorageWrapper.getLocalStorage(this.jsStorageKey, this.jsMethodInstrumentObject);
|
18
27
|
},
|
19
|
-
|
20
|
-
|
28
|
+
|
29
|
+
visitMethod(jsFileName, jsMethodName) {
|
30
|
+
this.init();
|
31
|
+
|
32
|
+
if (this.jsMethodInstrumentObject.hasOwnProperty(jsFileName)) {
|
21
33
|
if (!this.jsMethodInstrumentObject[jsFileName].includes(jsMethodName)) {
|
22
34
|
this.jsMethodInstrumentObject[jsFileName].push(jsMethodName);
|
23
35
|
}
|
24
36
|
} else {
|
25
|
-
this.jsMethodInstrumentObject[jsFileName] = [];
|
37
|
+
this.jsMethodInstrumentObject[jsFileName] = [];
|
38
|
+
this.jsMethodInstrumentObject[jsFileName].push(jsMethodName);
|
26
39
|
}
|
40
|
+
|
27
41
|
localStorage.setItem(this.jsStorageKey, JSON.stringify(this.jsMethodInstrumentObject));
|
28
42
|
},
|
29
|
-
|
30
|
-
|
43
|
+
|
44
|
+
clear() {
|
45
|
+
this.jsMethodInstrumentObject = {};
|
46
|
+
ClientCoverage.LocalStorageWrapper.clearLocalStorage(this.jsStorageKey);
|
31
47
|
},
|
32
|
-
|
33
|
-
|
48
|
+
|
49
|
+
getData() {
|
50
|
+
return {
|
51
|
+
methods: this.jsMethodInstrumentObject
|
52
|
+
};
|
34
53
|
}
|
35
|
-
|
36
|
-
|
54
|
+
|
55
|
+
},
|
56
|
+
|
57
|
+
getCoverageData() {
|
58
|
+
return {
|
59
|
+
JS: this.JS.getData()
|
60
|
+
};
|
37
61
|
},
|
38
|
-
|
62
|
+
|
63
|
+
clear() {
|
39
64
|
this.JS.clear();
|
40
65
|
},
|
41
|
-
|
66
|
+
|
67
|
+
init() {
|
42
68
|
this.JS.init();
|
43
69
|
}
|
70
|
+
|
44
71
|
};
|
@@ -1,41 +1,40 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
|
-
var _querystring = require(
|
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
|
-
|
10
|
-
|
11
|
-
print.log
|
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
|
-
|
16
|
+
let connection = new WebSocket(options.wmsPath);
|
18
17
|
|
19
|
-
connection.onopen =
|
18
|
+
connection.onopen = () => {
|
20
19
|
// connection is opened and ready to use
|
21
20
|
log('open');
|
22
21
|
};
|
23
22
|
|
24
|
-
connection.onerror =
|
23
|
+
connection.onerror = error => {
|
25
24
|
// an error occurred when sending/receiving data
|
26
25
|
throw error;
|
27
26
|
};
|
28
27
|
|
29
|
-
connection.onmessage =
|
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
|
-
|
34
|
-
|
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
|
-
|
38
|
+
} // handle incoming message
|
39
|
+
|
41
40
|
};
|
@@ -1,8 +1,10 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
exports.htmlTemplate = exports.endTag = 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
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
|
7
|
-
|
8
|
-
|
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;
|