@zohodesk/react-cli 0.0.1-exp.169.2 → 0.0.1-exp.175.1
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.
- package/.eslintignore +7 -7
- package/.eslintrc.js +180 -179
- package/.prettierrc +6 -6
- package/README.md +1028 -951
- package/bin/cli.js +483 -483
- 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 -12
- package/docs/InstallNode.md +28 -28
- package/docs/TODOS.md +10 -10
- package/docs/ValueReplacer.md +60 -60
- package/docs/VariableConversion.md +678 -0
- package/docs/warnings_while_install.txt +35 -35
- package/files/eslintrc.js +62 -62
- package/files/prettierrc.js +3 -3
- package/lib/babel/cmjs-plugins-presets.js +0 -4
- package/lib/babel/es-plugins-presets.js +0 -4
- package/lib/common/getEntries.js +0 -10
- package/lib/common/getPublicPathConfig.js +0 -6
- package/lib/common/index.js +0 -5
- package/lib/common/splitChunks.js +2 -13
- package/lib/common/sslcertUpdater.js +6 -17
- package/lib/common/templateParameters.js +0 -2
- package/lib/common/testPattern.js +10 -21
- package/lib/common/valueReplacer.js +0 -15
- package/lib/configs/jest.config.js +8 -21
- package/lib/configs/libAlias.js +11 -2
- package/lib/configs/webpack.component.umd.config.js +0 -5
- package/lib/configs/webpack.css.umd.config.js +5 -13
- package/lib/configs/webpack.dev.config.js +13 -24
- package/lib/configs/webpack.docs.config.js +6 -12
- package/lib/configs/webpack.impact.config.js +6 -10
- package/lib/configs/webpack.prod.config.js +15 -26
- package/lib/hooks/docsProptypeHook.js +3 -7
- package/lib/jest/commitedFilesResult.js +3 -45
- package/lib/jest/coverageCollector.js +0 -11
- package/lib/jest/jsonMaker.js +0 -6
- package/lib/jest/preProcessors/cssPreprocessor.js +14 -13
- package/lib/jest/preProcessors/jsPreprocessor.js +0 -2
- package/lib/jest/preProcessors/otherFilesPreprocessor.js +0 -3
- package/lib/jest/result.js +0 -22
- package/lib/jest/run.js +6 -17
- package/lib/jest/setup.js +5 -57
- package/lib/loaderUtils/configsAssetsLoaders.js +34 -44
- package/lib/loaderUtils/getCSSLoaders.js +41 -28
- package/lib/loaderUtils/getDevJsLoaders.js +0 -8
- package/lib/loaderUtils/index.js +0 -3
- package/lib/loaders/docsLoader.js +0 -7
- package/lib/loaders/docsPropsLoader.js +3 -7
- package/lib/loaders/fileBountryLoader.js +0 -2
- package/lib/loaders/fileLoader.js +11 -22
- package/lib/loaders/scriptInstrumentLoader.js +5 -13
- package/lib/loaders/selectorMappingLoader.js +7 -25
- package/lib/loaders/workerLoader.js +13 -29
- package/lib/middlewares/HMRMiddleware.js +13 -26
- package/lib/middlewares/SSTMiddleware.js +0 -3
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +53 -0
- package/lib/pluginUtils/getDevPlugins.js +20 -64
- package/lib/pluginUtils/getDocsPlugins.js +1 -10
- package/lib/pluginUtils/getLibraryImactPlugins.js +4 -5
- package/lib/pluginUtils/getLibraryPlugins.js +0 -5
- package/lib/pluginUtils/getProdPlugins.js +32 -78
- package/lib/pluginUtils/getServerPlugins.js +0 -5
- package/lib/pluginUtils/getUMDCSSPlugins.js +0 -7
- package/lib/pluginUtils/getUMDComponentPlugins.js +0 -7
- package/lib/pluginUtils/index.js +0 -8
- package/lib/plugins/CdnChangePlugin.js +0 -14
- package/lib/plugins/CleanupStatsPlugin.js +0 -5
- package/lib/plugins/EFCPlugin.js +23 -34
- package/lib/plugins/EFCPlugin.md +6 -6
- package/lib/plugins/EFCTemplatePlugin.js +23 -32
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +12 -38
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +12 -17
- package/lib/plugins/I18nSplitPlugin/I18nDependency.js +4 -10
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +46 -77
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +44 -59
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +21 -30
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -95
- package/lib/plugins/I18nSplitPlugin/README.md +25 -25
- package/lib/plugins/I18nSplitPlugin/index.js +70 -80
- package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +2 -12
- package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +0 -1
- package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +0 -5
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +0 -6
- package/lib/plugins/I18nSplitPlugin/utils/index.js +0 -4
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +2 -20
- package/lib/plugins/ManifestPlugin.js +0 -17
- package/lib/plugins/ModuleStatsPlugin.js +0 -23
- package/lib/plugins/OptimizeJSPlugin.js +0 -7
- package/lib/plugins/PublicPathCallbackPlugin.js +0 -10
- package/lib/plugins/PublicPathChangePlugin.js +4 -36
- package/lib/plugins/ReportGeneratePlugin.js +4 -30
- package/lib/plugins/RequireVariablePublicPlugin.js +0 -6
- package/lib/plugins/ResourceHintsPlugin.js +20 -27
- package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +12 -17
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +23 -38
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -30
- package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +2 -5
- package/lib/plugins/ScriptInstrumentPlugin.js +0 -7
- package/lib/plugins/ServiceWorkerPlugin.js +13 -29
- package/lib/plugins/ShadowDOMSupportPlugin.js +3 -40
- package/lib/plugins/SourceMapHookPlugin.js +0 -9
- package/lib/plugins/TPHashMappingPlugin.js +5 -19
- package/lib/plugins/UglifyCSSPlugin.js +0 -9
- package/lib/plugins/UnusedFilesFindPlugin.js +2 -35
- package/lib/plugins/index.js +0 -19
- package/lib/plugins/libraryImpactPlugin.js +0 -32
- package/lib/plugins/webpackwatchrunplugin.js +0 -5
- package/lib/postcss-plugins/ExcludePlugin.js +0 -4
- package/lib/postcss-plugins/RTLSplitPlugin.js +24 -37
- package/lib/postcss-plugins/ValueReplacer.js +9 -6
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +0 -3
- package/lib/postcss-plugins/__test__/test1Input.css +38 -38
- package/lib/postcss-plugins/__test__/test1Output.css +38 -38
- package/lib/postcss-plugins/hoverActivePlugin.js +80 -92
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +31 -0
- package/lib/postcss-plugins/variableModificationPlugin/index.js +232 -0
- package/lib/postcss-plugins/variableModifier.js +14 -20
- package/lib/schemas/index.js +28 -13
- package/lib/servers/clusterHubServer.js +0 -10
- package/lib/servers/devBuild.js +13 -24
- package/lib/servers/docsServer.js +0 -2
- package/lib/servers/docsServerCore.js +0 -21
- package/lib/servers/getCliPath.js +1 -10
- package/lib/servers/helpServer.js +0 -5
- package/lib/servers/httpsOptions.js +0 -4
- package/lib/servers/impactServer.js +2 -34
- package/lib/servers/mockserver.js +0 -9
- package/lib/servers/nowatchserver.js +12 -34
- package/lib/servers/scrServer.js +13 -20
- package/lib/servers/server.js +7 -35
- package/lib/servers/ssServer.js +0 -16
- package/lib/sh/pre-commit.sh +34 -34
- package/lib/sh/reportPublish.sh +45 -45
- package/lib/templates/CoverageScriptTemplate.js +0 -14
- package/lib/templates/WMSTemplate.js +6 -12
- package/lib/utils/babelPresets.js +0 -2
- package/lib/utils/buildstats.html +148 -148
- package/lib/utils/clean.js +2 -8
- package/lib/utils/copy.js +0 -6
- package/lib/utils/copyTimezones.js +0 -8
- package/lib/utils/createEventStream.js +0 -4
- package/lib/utils/cssClassNameGenerate.js +3 -19
- package/lib/utils/cssURLReplacer.js +0 -25
- package/lib/utils/dependencyPostPublish.js +0 -9
- package/lib/utils/fileUtils.js +0 -26
- package/lib/utils/folderIterator.js +0 -10
- package/lib/utils/getComponents.js +0 -21
- package/lib/utils/getCurrentBranch.js +0 -5
- package/lib/utils/getDependenciesImpactList.js +0 -21
- package/lib/utils/getHash.js +0 -7
- package/lib/utils/getIp.js +0 -2
- package/lib/utils/getOptions.js +38 -35
- package/lib/utils/getServerURL.js +0 -7
- package/lib/utils/index.js +2 -47
- package/lib/utils/init.js +0 -1
- package/lib/utils/initPreCommitHook.js +6 -29
- package/lib/utils/jsonHelper.js +2 -19
- package/lib/utils/libraryImpactConfig.js +0 -2
- package/lib/utils/lint/addScripts.js +2 -5
- package/lib/utils/lint/checkExistingConfig.js +3 -12
- package/lib/utils/lint/copyConfigs.js +0 -3
- package/lib/utils/lint/index.js +0 -9
- package/lib/utils/lint/lintScripts.js +0 -1
- package/lib/utils/lint/lintSetup.js +3 -4
- package/lib/utils/lint/lintStagedPreCommitHook.js +0 -1
- package/lib/utils/lint/question.js +0 -7
- package/lib/utils/lintReporter.js +0 -20
- package/lib/utils/mailSender.js +0 -7
- package/lib/utils/pullOrigin.js +0 -4
- package/lib/utils/reinstallDependencies.js +0 -28
- package/lib/utils/removeAttributes.js +0 -7
- package/lib/utils/repoClone.js +2 -27
- package/lib/utils/request.js +0 -12
- package/lib/utils/resultSchema.json +73 -73
- package/lib/utils/rtl.js +4 -16
- package/lib/utils/setEnvVariables.js +0 -2
- package/lib/utils/ssTestHack.js +0 -10
- package/lib/utils/switchBranch.js +0 -4
- package/lib/utils/urlConcat.js +0 -4
- package/lib/utils/useExitCleanup.js +9 -10
- package/npm8.md +9 -9
- package/package.json +146 -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 +1501 -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
|
@@ -1,24 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _fs = require("fs");
|
|
4
|
-
|
|
5
4
|
var _path = _interopRequireDefault(require("path"));
|
|
6
|
-
|
|
7
5
|
var _libAlias = require("./libAlias");
|
|
8
|
-
|
|
9
6
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
|
-
let appPath = process.cwd(); // '^@root(.*)$': '<rootDir>/src$1',
|
|
12
|
-
// '^@components(.*)$': '<rootDir>/src/components$1',
|
|
13
|
-
|
|
14
|
-
let moduleNameMapper = Object.keys(_libAlias.libAlias).reduce((previousValue, key) => {
|
|
15
|
-
previousValue[`^${key}(.*)$`] = `${_libAlias.libAlias[key]}$1`;
|
|
16
|
-
return previousValue;
|
|
17
|
-
}, {});
|
|
18
|
-
|
|
7
|
+
const appPath = process.cwd();
|
|
19
8
|
const appGlobals = _path.default.resolve(appPath, '__testUtils__', 'globals.js');
|
|
20
|
-
|
|
21
|
-
let commonConfig = {
|
|
9
|
+
const commonConfig = {
|
|
22
10
|
coverageReporters: ['json', 'html', 'json-summary', 'text'],
|
|
23
11
|
collectCoverage: true,
|
|
24
12
|
moduleDirectories: [_path.default.resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'],
|
|
@@ -27,9 +15,11 @@ let commonConfig = {
|
|
|
27
15
|
'^.+\\.css$': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'cssPreprocessor.js'),
|
|
28
16
|
'^(?!.*\\.(js|jsx|css|json)$)': _path.default.resolve(__dirname, '..', 'jest', 'preProcessors', 'otherFilesPreprocessor.js')
|
|
29
17
|
},
|
|
30
|
-
moduleNameMapper:
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
moduleNameMapper: _libAlias.jestModuleNameMapper,
|
|
19
|
+
// moduleNameMapper: {
|
|
20
|
+
// ...moduleNameMapper,
|
|
21
|
+
// '\\.(css|less)$': 'identity-obj-proxy'
|
|
22
|
+
// },
|
|
33
23
|
transformIgnorePatterns: ['/node_modules/(?!(@zohodesk)/)'],
|
|
34
24
|
// transformIgnorePatterns: ['/node_modules.*?.js$'],
|
|
35
25
|
moduleFileExtensions: ['js'],
|
|
@@ -40,17 +30,14 @@ let commonConfig = {
|
|
|
40
30
|
__TEST__: true
|
|
41
31
|
}
|
|
42
32
|
};
|
|
43
|
-
|
|
44
33
|
module.exports = (...args) => {
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
const [appFolder, forCommittedFiles = false] = args;
|
|
47
35
|
if (forCommittedFiles) {
|
|
48
36
|
return Object.assign({}, commonConfig, {
|
|
49
37
|
coverageDirectory: _path.default.resolve(appPath, 'commitCoverage'),
|
|
50
38
|
testResultsProcessor: _path.default.resolve(__dirname, '..', 'jest', 'commitedFilesResult.js')
|
|
51
39
|
});
|
|
52
40
|
}
|
|
53
|
-
|
|
54
41
|
return Object.assign({}, commonConfig, {
|
|
55
42
|
rootDir: appPath,
|
|
56
43
|
testPathIgnorePatterns: ['/node_modules/', 'docs'],
|
package/lib/configs/libAlias.js
CHANGED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.libAlias = void 0;
|
|
6
|
+
exports.libAlias = exports.jestModuleNameMapper = void 0;
|
|
7
7
|
// the reason for alias at the time was code tree shaking
|
|
8
8
|
// tree shaking was most compactable with ES module system
|
|
9
9
|
// FIXME: But there is a posiblity when these package does not have lib,
|
|
10
10
|
// app will work because of alias, But may be jest won't work because of not alais
|
|
11
11
|
// So need to think about use alais in jest
|
|
12
|
+
|
|
12
13
|
const libAlias = {
|
|
13
14
|
'@zohodesk/components/lib': '@zohodesk/components/es',
|
|
14
15
|
// '@zohodesk/zc-custom/lib': '@zohodesk/zc-custom/es',
|
|
@@ -28,4 +29,12 @@ const libAlias = {
|
|
|
28
29
|
'@zohodesk/variables/lib': '@zohodesk/variables/es',
|
|
29
30
|
'@zohodesk/virtualizer/lib': '@zohodesk/virtualizer/es'
|
|
30
31
|
};
|
|
31
|
-
|
|
32
|
+
|
|
33
|
+
// '^@root(.*)$': '<rootDir>/src$1',
|
|
34
|
+
// '^@components(.*)$': '<rootDir>/src/components$1',
|
|
35
|
+
exports.libAlias = libAlias;
|
|
36
|
+
const jestModuleNameMapper = Object.keys(libAlias).reduce((previousValue, key) => {
|
|
37
|
+
previousValue[`^${key}(.*)$`] = `${libAlias[key]}$1`;
|
|
38
|
+
return previousValue;
|
|
39
|
+
}, {});
|
|
40
|
+
exports.jestModuleNameMapper = jestModuleNameMapper;
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _path = _interopRequireDefault(require("path"));
|
|
4
|
-
|
|
5
4
|
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
|
6
|
-
|
|
7
5
|
var _utils = require("../utils");
|
|
8
|
-
|
|
9
6
|
var _pluginUtils = require("../pluginUtils");
|
|
10
|
-
|
|
11
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
8
|
let options = (0, _utils.getOptions)();
|
|
14
9
|
let {
|
|
15
10
|
umd: {
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _path = _interopRequireDefault(require("path"));
|
|
4
|
-
|
|
5
4
|
var _miniCssExtractPlugin = _interopRequireDefault(require("mini-css-extract-plugin"));
|
|
6
|
-
|
|
7
5
|
var _utils = require("../utils");
|
|
8
|
-
|
|
9
6
|
var _cssClassNameGenerate = _interopRequireDefault(require("../utils/cssClassNameGenerate"));
|
|
10
|
-
|
|
11
7
|
var _pluginUtils = require("../pluginUtils");
|
|
12
|
-
|
|
13
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
9
|
let options = (0, _utils.getOptions)();
|
|
16
10
|
let {
|
|
17
11
|
umd: {
|
|
@@ -66,13 +60,11 @@ module.exports = {
|
|
|
66
60
|
}
|
|
67
61
|
}],
|
|
68
62
|
include: _path.default.join(appPath, 'src')
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}*/
|
|
75
|
-
, {
|
|
63
|
+
} /*,
|
|
64
|
+
{
|
|
65
|
+
test: /\.css$/,
|
|
66
|
+
use: [MiniCssExtractPlugin.loader, 'css-loader']
|
|
67
|
+
}*/, {
|
|
76
68
|
test: /(\.module)?\.css$/,
|
|
77
69
|
use: [{
|
|
78
70
|
loader: _miniCssExtractPlugin.default.loader,
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _path = _interopRequireDefault(require("path"));
|
|
4
|
-
|
|
5
4
|
var _utils = require("../utils");
|
|
6
|
-
|
|
7
5
|
var _common = require("../common");
|
|
8
|
-
|
|
9
6
|
var _pluginUtils = require("../pluginUtils");
|
|
10
|
-
|
|
11
7
|
var _loaderUtils = require("../loaderUtils");
|
|
12
|
-
|
|
13
8
|
var _libAlias = require("./libAlias");
|
|
14
|
-
|
|
15
9
|
var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
|
|
16
|
-
|
|
17
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
let {
|
|
11
|
+
const options = (0, _utils.getOptions)();
|
|
12
|
+
const {
|
|
21
13
|
unstableDepsInverse,
|
|
22
14
|
app: {
|
|
23
15
|
folder,
|
|
@@ -26,6 +18,8 @@ let {
|
|
|
26
18
|
outputFolder,
|
|
27
19
|
plugins,
|
|
28
20
|
exclude,
|
|
21
|
+
mediaQueryHoverActiveString,
|
|
22
|
+
cssVariableReplacementConfig,
|
|
29
23
|
cssUniqueness,
|
|
30
24
|
seperateCssModules,
|
|
31
25
|
changeRuntimeChunkChar,
|
|
@@ -40,13 +34,13 @@ let {
|
|
|
40
34
|
crossorigin
|
|
41
35
|
}
|
|
42
36
|
} = options;
|
|
43
|
-
|
|
37
|
+
const {
|
|
44
38
|
disableContextURL
|
|
45
39
|
} = server;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
const appPath = process.cwd();
|
|
41
|
+
const contextURL = disableContextURL ? '' : context;
|
|
42
|
+
const serverUrl = (0, _utils.getServerURL)(server, 'https');
|
|
43
|
+
const output = {
|
|
50
44
|
path: _path.default.join(appPath, outputFolder),
|
|
51
45
|
filename: 'js/[name].js',
|
|
52
46
|
chunkFilename: 'js/[name].js',
|
|
@@ -54,11 +48,9 @@ let output = {
|
|
|
54
48
|
jsonpFunction: `${context}Jsonp`
|
|
55
49
|
};
|
|
56
50
|
const nameTemplate = (0, _configsAssetsLoaders.createNameTemplate)(enableChunkHash);
|
|
57
|
-
|
|
58
51
|
if (crossorigin) {
|
|
59
52
|
output.crossOriginLoading = 'anonymous';
|
|
60
53
|
}
|
|
61
|
-
|
|
62
54
|
module.exports = {
|
|
63
55
|
entry: (0, _common.getEntries)(options, 'dev'),
|
|
64
56
|
devtool: sourcemap,
|
|
@@ -85,23 +77,20 @@ module.exports = {
|
|
|
85
77
|
test: /\.js$/,
|
|
86
78
|
use: (0, _loaderUtils.getDevJsLoaders)(options),
|
|
87
79
|
include: module => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
let depsPath = _path.default.join(appPath, 'node_modules', '@zohodesk');
|
|
91
|
-
|
|
80
|
+
const srcPath = _path.default.join(appPath, folder);
|
|
81
|
+
const depsPath = _path.default.join(appPath, 'node_modules', '@zohodesk');
|
|
92
82
|
if (module.includes(srcPath) || devConsoleExculde && module.includes(depsPath)) {
|
|
93
83
|
return true;
|
|
94
84
|
}
|
|
95
|
-
|
|
96
85
|
return false;
|
|
97
86
|
}
|
|
98
87
|
}, seperateCssModules ? {
|
|
99
88
|
test: /\.css$/,
|
|
100
89
|
exclude: /\.module\.css$/,
|
|
101
|
-
use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, '[local]', false, null)
|
|
90
|
+
use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, '[local]', false, null)
|
|
102
91
|
} : null, {
|
|
103
92
|
test: seperateCssModules ? /\.module\.css$/ : /(\.module)?\.css$/,
|
|
104
|
-
use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, null, cssUniqueness, selectorReplace, cssHashSelectors, classNamePrefix)
|
|
93
|
+
use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, null, cssUniqueness, selectorReplace, cssHashSelectors, classNamePrefix)
|
|
105
94
|
}, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), {
|
|
106
95
|
test: /\.tmpl$/,
|
|
107
96
|
use: [{
|
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _path = _interopRequireDefault(require("path"));
|
|
4
|
-
|
|
5
4
|
var _utils = require("../utils");
|
|
6
|
-
|
|
7
5
|
var _pluginUtils = require("../pluginUtils");
|
|
8
|
-
|
|
9
6
|
var _loaderUtils = require("../loaderUtils");
|
|
10
|
-
|
|
11
7
|
var _libAlias = require("./libAlias");
|
|
12
|
-
|
|
13
8
|
var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
|
|
14
|
-
|
|
15
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
let {
|
|
10
|
+
const options = (0, _utils.getOptions)();
|
|
11
|
+
const {
|
|
19
12
|
unstableDepsInverse,
|
|
20
13
|
docs: {
|
|
21
14
|
componentFolder,
|
|
@@ -24,6 +17,8 @@ let {
|
|
|
24
17
|
cssUniqueness,
|
|
25
18
|
plugins,
|
|
26
19
|
exclude,
|
|
20
|
+
mediaQueryHoverActiveString,
|
|
21
|
+
cssVariableReplacementConfig,
|
|
27
22
|
cssHashSelectors,
|
|
28
23
|
classNamePrefix
|
|
29
24
|
},
|
|
@@ -31,9 +26,8 @@ let {
|
|
|
31
26
|
folder
|
|
32
27
|
}
|
|
33
28
|
} = options;
|
|
34
|
-
|
|
29
|
+
const appPath = process.cwd();
|
|
35
30
|
const nameTemplate = (0, _configsAssetsLoaders.createNameTemplate)(enableChunkHash);
|
|
36
|
-
|
|
37
31
|
module.exports = isSSTest => ({
|
|
38
32
|
entry: {
|
|
39
33
|
main: [_path.default.resolve(__dirname, '..', 'hooks', 'docsProptypeHook.js'), _path.default.join(appPath, componentFolder, 'index.js')],
|
|
@@ -73,7 +67,7 @@ module.exports = isSSTest => ({
|
|
|
73
67
|
exclude: /node_modules/
|
|
74
68
|
}, {
|
|
75
69
|
test: /(\.module)?\.css$/,
|
|
76
|
-
use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, false, cssUniqueness, null, cssHashSelectors, classNamePrefix)
|
|
70
|
+
use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, false, cssUniqueness, null, cssHashSelectors, classNamePrefix)
|
|
77
71
|
}, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), {
|
|
78
72
|
test: /\.html$/,
|
|
79
73
|
use: {
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _path = _interopRequireDefault(require("path"));
|
|
4
|
-
|
|
5
4
|
var _utils = require("../utils");
|
|
6
|
-
|
|
7
5
|
var _loaderUtils = require("../loaderUtils");
|
|
8
|
-
|
|
9
6
|
var _getLibraryImactPlugins = _interopRequireDefault(require("../pluginUtils/getLibraryImactPlugins"));
|
|
10
|
-
|
|
11
7
|
var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
|
|
12
|
-
|
|
13
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
let {
|
|
9
|
+
const options = (0, _utils.getOptions)();
|
|
10
|
+
const {
|
|
17
11
|
docs: {
|
|
18
12
|
componentFolder,
|
|
19
13
|
cssUniqueness,
|
|
20
14
|
plugins,
|
|
21
15
|
exclude,
|
|
16
|
+
mediaQueryHoverActiveString,
|
|
17
|
+
cssVariableReplacementConfig,
|
|
22
18
|
cssHashSelectors,
|
|
23
19
|
enableChunkHash,
|
|
24
20
|
classNamePrefix
|
|
@@ -27,7 +23,7 @@ let {
|
|
|
27
23
|
folder
|
|
28
24
|
}
|
|
29
25
|
} = options;
|
|
30
|
-
|
|
26
|
+
const appPath = process.cwd();
|
|
31
27
|
const nameTemplate = (0, _configsAssetsLoaders.createNameTemplate)(enableChunkHash);
|
|
32
28
|
module.exports = {
|
|
33
29
|
entry: {
|
|
@@ -68,7 +64,7 @@ module.exports = {
|
|
|
68
64
|
exclude: /node_modules/
|
|
69
65
|
}, {
|
|
70
66
|
test: /(\.module)?\.css$/,
|
|
71
|
-
use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, false, cssUniqueness, null, cssHashSelectors, classNamePrefix)
|
|
67
|
+
use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, false, cssUniqueness, null, cssHashSelectors, classNamePrefix)
|
|
72
68
|
}, (0, _configsAssetsLoaders.configImageLoader)(nameTemplate), (0, _configsAssetsLoaders.configFontLoader)(nameTemplate), (0, _configsAssetsLoaders.configSVGLoader)(nameTemplate), (0, _configsAssetsLoaders.configAudioLoader)(nameTemplate), (0, _configsAssetsLoaders.configVideoLoader)(nameTemplate), {
|
|
73
69
|
test: /\.html$/,
|
|
74
70
|
use: {
|
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _path = _interopRequireDefault(require("path"));
|
|
4
|
-
|
|
5
4
|
var _utils = require("../utils");
|
|
6
|
-
|
|
7
5
|
var _common = require("../common");
|
|
8
|
-
|
|
9
6
|
var _pluginUtils = require("../pluginUtils");
|
|
10
|
-
|
|
11
7
|
var _loaderUtils = require("../loaderUtils");
|
|
12
|
-
|
|
13
8
|
var _libAlias = require("./libAlias");
|
|
14
|
-
|
|
15
9
|
var _configsAssetsLoaders = require("../loaderUtils/configsAssetsLoaders");
|
|
16
|
-
|
|
17
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
-
|
|
19
11
|
// import TerserPlugin from 'terser-webpack-plugin';
|
|
20
|
-
|
|
12
|
+
|
|
13
|
+
const options = (0, _utils.getOptions)();
|
|
21
14
|
let {
|
|
22
15
|
unstableDepsInverse,
|
|
23
16
|
app: {
|
|
@@ -31,6 +24,8 @@ let {
|
|
|
31
24
|
server,
|
|
32
25
|
plugins,
|
|
33
26
|
exclude,
|
|
27
|
+
mediaQueryHoverActiveString,
|
|
28
|
+
cssVariableReplacementConfig,
|
|
34
29
|
cssUniqueness,
|
|
35
30
|
server: {
|
|
36
31
|
mode
|
|
@@ -45,31 +40,28 @@ let {
|
|
|
45
40
|
crossorigin
|
|
46
41
|
}
|
|
47
42
|
} = options;
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
const appPath = process.cwd();
|
|
44
|
+
const isDevelopment = mode === 'prod' || mode === 'dev' || mode === 'dev-no-warn';
|
|
50
45
|
enableChunkHash = !isDevelopment && enableChunkHash;
|
|
51
|
-
|
|
46
|
+
const output = {
|
|
52
47
|
path: _path.default.resolve(appPath, outputFolder),
|
|
53
48
|
filename: enableChunkHash ? 'js/[name].[chunkhash:20]_.js' : 'js/[name]_.js',
|
|
54
49
|
chunkFilename: enableChunkHash ? 'js/[name].[chunkhash:20]_.js' : 'js/[name]_.js',
|
|
55
50
|
jsonpFunction: `${context}Jsonp`,
|
|
56
51
|
sourceMapFilename: enableChunkHash ? 'js/[name].[chunkhash:20]_.js.map' : 'js/[name]_.js.map'
|
|
57
52
|
};
|
|
58
|
-
|
|
59
53
|
if (crossorigin) {
|
|
60
54
|
output.crossOriginLoading = 'anonymous';
|
|
61
55
|
}
|
|
62
|
-
|
|
63
56
|
if (isDevelopment) {
|
|
64
|
-
|
|
57
|
+
const {
|
|
65
58
|
disableContextURL
|
|
66
59
|
} = server;
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
const contextURL = disableContextURL ? '' : context;
|
|
61
|
+
const serverUrl = (0, _utils.getServerURL)(server, 'https');
|
|
69
62
|
output.publicPath = `${[serverUrl, contextURL].filter(a => a).join('/')}/`;
|
|
70
63
|
}
|
|
71
|
-
|
|
72
|
-
let shouldRemovePropTypes = !isDevelopment && removePropTypes;
|
|
64
|
+
const shouldRemovePropTypes = !isDevelopment && removePropTypes;
|
|
73
65
|
module.exports = {
|
|
74
66
|
entry: (0, _common.getEntries)(options, 'production'),
|
|
75
67
|
devtool: isDevelopment ? 'cheap-module-source-map' : enableSMap ? 'hidden-source-map' : 'none',
|
|
@@ -133,23 +125,20 @@ module.exports = {
|
|
|
133
125
|
}].filter(Boolean),
|
|
134
126
|
// include: path.join(appPath, folder)
|
|
135
127
|
include: module => {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
let depsPath = _path.default.join(appPath, 'node_modules', '@zohodesk');
|
|
139
|
-
|
|
128
|
+
const srcPath = _path.default.join(appPath, folder);
|
|
129
|
+
const depsPath = _path.default.join(appPath, 'node_modules', '@zohodesk');
|
|
140
130
|
if (module.includes(srcPath) || devConsoleExculde && module.includes(depsPath)) {
|
|
141
131
|
return true;
|
|
142
132
|
}
|
|
143
|
-
|
|
144
133
|
return false;
|
|
145
134
|
}
|
|
146
135
|
}, seperateCssModules ? {
|
|
147
136
|
test: /\.css$/,
|
|
148
137
|
exclude: /\.module\.css$/,
|
|
149
|
-
use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, '[local]', false, null)
|
|
138
|
+
use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, cssVariableReplacementConfig, mediaQueryHoverActiveString, '[local]', false, null)
|
|
150
139
|
} : null, {
|
|
151
140
|
test: seperateCssModules ? /\.module\.css$/ : /\.css$/,
|
|
152
|
-
use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, false, cssUniqueness, selectorReplace, cssHashSelectors, classNamePrefix)
|
|
141
|
+
use: (0, _loaderUtils.getCSSLoaders)(plugins, exclude, mediaQueryHoverActiveString, cssVariableReplacementConfig, false, cssUniqueness, selectorReplace, cssHashSelectors, classNamePrefix)
|
|
153
142
|
}, {
|
|
154
143
|
test: /\.jpe?g$|\.gif$|\.png$/,
|
|
155
144
|
use: [{
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
4
|
-
|
|
5
4
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
6
|
-
|
|
7
5
|
_propTypes.default.array.hookType = 'array';
|
|
8
6
|
_propTypes.default.bool.hookType = 'bool';
|
|
9
7
|
_propTypes.default.func.hookType = 'func';
|
|
@@ -22,7 +20,6 @@ _propTypes.default.string.isRequired.hookType = 'string';
|
|
|
22
20
|
_propTypes.default.symbol.isRequired.hookType = 'symbol';
|
|
23
21
|
_propTypes.default.element.isRequired.hookType = 'element';
|
|
24
22
|
_propTypes.default.node.isRequired.hookType = 'element';
|
|
25
|
-
|
|
26
23
|
function proxy(fn, type) {
|
|
27
24
|
let oneOf = fn;
|
|
28
25
|
return (...args) => {
|
|
@@ -30,16 +27,15 @@ function proxy(fn, type) {
|
|
|
30
27
|
let type1 = Array.isArray(args) && Array.isArray(args[0]) ? `${type}[${args[0].map(data => typeof data === 'function' ? data.hookType //arrayOf shape complex type not mention
|
|
31
28
|
: JSON.stringify(data))}]` : type;
|
|
32
29
|
a.hookType = type1;
|
|
33
|
-
|
|
34
30
|
if (a.isRequired) {
|
|
35
31
|
a.isRequired.hookType = type1;
|
|
36
32
|
}
|
|
37
|
-
|
|
38
33
|
return a;
|
|
39
34
|
};
|
|
40
35
|
}
|
|
41
|
-
|
|
42
36
|
_propTypes.default.oneOf = proxy(_propTypes.default.oneOf, 'enum');
|
|
43
37
|
_propTypes.default.oneOfType = proxy(_propTypes.default.oneOfType, 'union');
|
|
44
38
|
_propTypes.default.arrayOf = proxy(_propTypes.default.arrayOf, 'arrayOf');
|
|
45
|
-
_propTypes.default.shape = proxy(_propTypes.default.shape, 'shape');
|
|
39
|
+
_propTypes.default.shape = proxy(_propTypes.default.shape, 'shape');
|
|
40
|
+
|
|
41
|
+
// export default PropTypes;
|
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _fs = _interopRequireDefault(require("fs"));
|
|
4
|
-
|
|
5
4
|
var _utils = require("../utils");
|
|
6
|
-
|
|
7
5
|
var _jsonMaker = _interopRequireDefault(require("./jsonMaker"));
|
|
8
|
-
|
|
9
6
|
var _jsonHelper = require("../utils/jsonHelper");
|
|
10
|
-
|
|
11
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
8
|
let result = inp => {
|
|
14
9
|
inp.endTime = Date.now();
|
|
15
10
|
let testPathPattern = process.argv[process.argv.length - 1];
|
|
16
|
-
|
|
17
11
|
if (testPathPattern.indexOf('--') !== -1) {
|
|
18
12
|
testPathPattern = '';
|
|
19
13
|
} else {
|
|
20
14
|
testPathPattern = _fs.default.realpathSync(process.cwd());
|
|
21
15
|
}
|
|
22
|
-
|
|
23
16
|
let testPathRegex = new RegExp(testPathPattern);
|
|
24
17
|
let {
|
|
25
18
|
testResults
|
|
@@ -27,18 +20,14 @@ let result = inp => {
|
|
|
27
20
|
let testFilesArr = [];
|
|
28
21
|
let testCaseFiles = [];
|
|
29
22
|
let jsonData;
|
|
30
|
-
|
|
31
23
|
if (_fs.default.existsSync('./coverageTest/result.json')) {
|
|
32
24
|
jsonData = JSON.parse(_fs.default.readFileSync('./coverageTest/result.json', 'utf8'));
|
|
33
25
|
}
|
|
34
|
-
|
|
35
26
|
testResults.forEach(testResult => {
|
|
36
27
|
let filePath = testResult.testFilePath;
|
|
37
|
-
|
|
38
28
|
if (!testPathRegex.test(filePath)) {
|
|
39
29
|
return;
|
|
40
30
|
}
|
|
41
|
-
|
|
42
31
|
filePath = filePath.replace('.spec', '');
|
|
43
32
|
filePath = filePath.replace('/__tests__', '');
|
|
44
33
|
filePath = filePath.replace('/__test__', '');
|
|
@@ -48,31 +37,24 @@ let result = inp => {
|
|
|
48
37
|
fileJson.sourcePath = filePath;
|
|
49
38
|
fileJson.data = testResult;
|
|
50
39
|
testFilesArr.push(fileJson);
|
|
51
|
-
|
|
52
40
|
if (jsonData.FILES.includes(relatPath) || jsonData.FILES.includes(testResult.testFilePath.replace(process.cwd(), ''))) {
|
|
53
41
|
jsonData.FILES.includes(relatPath) ? testCaseFiles.push(relatPath) : jsonData.FILES.includes(testResult.testFilePath.replace(process.cwd(), '')) ? testCaseFiles.push(testResult.testFilePath.replace(process.cwd(), '')) : '';
|
|
54
42
|
}
|
|
55
43
|
});
|
|
56
44
|
let coverageSummary = {};
|
|
57
|
-
|
|
58
45
|
if (_fs.default.existsSync('./commitCoverage/coverage-summary.json')) {
|
|
59
46
|
coverageSummary = _fs.default.readFileSync('./commitCoverage/coverage-summary.json').toString();
|
|
60
|
-
|
|
61
47
|
if (coverageSummary.indexOf('\\') !== -1) {
|
|
62
48
|
coverageSummary = coverageSummary.replace(/\\/g, '\\\\');
|
|
63
49
|
}
|
|
64
50
|
}
|
|
65
|
-
|
|
66
51
|
let excludeTestArray = '{}';
|
|
67
|
-
|
|
68
52
|
if (_fs.default.existsSync('./__testUtils__/conf/excludeTest.json')) {
|
|
69
53
|
excludeTestArray = _fs.default.readFileSync('./__testUtils__/conf/excludeTest.json').toString();
|
|
70
|
-
|
|
71
54
|
if (excludeTestArray.indexOf('\\') !== -1) {
|
|
72
55
|
excludeTestArray = excludeTestArray.replace(/\\/g, '\\\\');
|
|
73
56
|
}
|
|
74
57
|
}
|
|
75
|
-
|
|
76
58
|
let coverageJson = JSON.parse(coverageSummary);
|
|
77
59
|
let linesPercent = 0;
|
|
78
60
|
let functionPercent = 0;
|
|
@@ -81,7 +63,6 @@ let result = inp => {
|
|
|
81
63
|
let fileList = '<h4>Changed files in last code check-in</h4><ul>';
|
|
82
64
|
let i = 0;
|
|
83
65
|
let excludeTestJSON = JSON.parse(excludeTestArray);
|
|
84
|
-
|
|
85
66
|
if (Object.keys(excludeTestArray).length > 0) {
|
|
86
67
|
jsonData.FILES = jsonData.FILES.filter(function (value) {
|
|
87
68
|
if (!excludeTestJSON.test.exclude.includes(value)) {
|
|
@@ -90,18 +71,14 @@ let result = inp => {
|
|
|
90
71
|
return value;
|
|
91
72
|
}
|
|
92
73
|
});
|
|
93
|
-
|
|
94
74
|
if (excludeDir.length > 0) {
|
|
95
75
|
return null;
|
|
96
76
|
}
|
|
97
|
-
|
|
98
77
|
return value;
|
|
99
78
|
}
|
|
100
|
-
|
|
101
79
|
return null;
|
|
102
80
|
});
|
|
103
81
|
}
|
|
104
|
-
|
|
105
82
|
for (i; i < jsonData.FILES.length; i++) {
|
|
106
83
|
let coverageData;
|
|
107
84
|
let curSourceFile = jsonData.FILES[i];
|
|
@@ -112,41 +89,32 @@ let result = inp => {
|
|
|
112
89
|
coverageData = coverageJson[coverageFile];
|
|
113
90
|
}
|
|
114
91
|
});
|
|
115
|
-
|
|
116
92
|
if (!coverageData) {
|
|
117
93
|
(0, _utils.log)(`Can't able to find source for ${testFilesArr[i].testPath}\n Please check the file name and the path is correct for test file`);
|
|
118
94
|
continue;
|
|
119
95
|
}
|
|
120
|
-
|
|
121
96
|
linesPercent += coverageData.lines.pct;
|
|
122
97
|
functionPercent += coverageData.functions.pct;
|
|
123
98
|
statementPerment += coverageData.statements.pct;
|
|
124
99
|
branchesPercent += coverageData.branches.pct;
|
|
125
100
|
}
|
|
126
|
-
|
|
127
101
|
fileList = `${fileList}</ul>`;
|
|
128
|
-
|
|
129
102
|
if (!jsonData.FILES.length) {
|
|
130
103
|
fileList = '<div></div>';
|
|
131
104
|
}
|
|
132
|
-
|
|
133
105
|
let uncoveredList = '<h4>Uncovered files :- </h4><ul>';
|
|
134
106
|
let fileCoverage = 0;
|
|
135
|
-
|
|
136
107
|
if (jsonData.FILES.length > 0) {
|
|
137
108
|
fileCoverage = testCaseFiles.length / jsonData.FILES.length * 100;
|
|
138
109
|
}
|
|
139
|
-
|
|
140
110
|
fileCoverage = fileCoverage.toFixed(2);
|
|
141
111
|
fileCoverage = Number(fileCoverage);
|
|
142
|
-
|
|
143
112
|
if (Number.isNaN(fileCoverage)) {
|
|
144
113
|
(0, _utils.log)('This build does\'t have any JS changes!');
|
|
145
114
|
fileCoverage = 0;
|
|
146
115
|
} else {
|
|
147
116
|
(0, _utils.log)(`FileCoverage ${fileCoverage}%`);
|
|
148
117
|
}
|
|
149
|
-
|
|
150
118
|
let totalLinesPercent = linesPercent / (i * 100) * 100;
|
|
151
119
|
let totalFunctionPercent = functionPercent / (i * 100) * 100;
|
|
152
120
|
let totalStatementPercent = statementPerment / (i * 100) * 100;
|
|
@@ -154,7 +122,6 @@ let result = inp => {
|
|
|
154
122
|
let totalPercentage = totalLinesPercent + totalFunctionPercent + totalStatementPercent + totalBranchesPercent;
|
|
155
123
|
let coverage = (totalPercentage / 4).toFixed(2);
|
|
156
124
|
coverage = Number(coverage);
|
|
157
|
-
|
|
158
125
|
if (Number.isNaN(coverage)) {
|
|
159
126
|
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.modifiedFileUnitCase.testInfo', 'can\'t get coverage for this test');
|
|
160
127
|
coverage = 0;
|
|
@@ -162,16 +129,13 @@ let result = inp => {
|
|
|
162
129
|
} else {
|
|
163
130
|
(0, _jsonMaker.default)(inp, coverage, true, 'modifiedFileUnitCase', fileCoverage);
|
|
164
131
|
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.modifiedFileUnitCase.isBuildVerified', coverage > 60);
|
|
165
|
-
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.modifiedFileUnitCase.testInfo', 'Test coverage value generated');
|
|
132
|
+
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'tests.modifiedFileUnitCase.testInfo', 'Test coverage value generated');
|
|
133
|
+
// jsonHelper(
|
|
166
134
|
// `${process.cwd()}/result.json`,
|
|
167
135
|
// 'testInfo.isBuildVerified',
|
|
168
136
|
// coverage > 60
|
|
169
137
|
// );
|
|
170
|
-
|
|
171
|
-
(0, _jsonHelper.setTestInfoStatus)(`${process.cwd()}/result.json`, true
|
|
172
|
-
/*coverage > 60*/
|
|
173
|
-
);
|
|
174
|
-
|
|
138
|
+
(0, _jsonHelper.setTestInfoStatus)(`${process.cwd()}/result.json`, true /*coverage > 60*/);
|
|
175
139
|
if (coverage < 60) {
|
|
176
140
|
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'testInfo.failures', [{
|
|
177
141
|
type: 'modifiedUnitcases',
|
|
@@ -181,21 +145,15 @@ let result = inp => {
|
|
|
181
145
|
} else {
|
|
182
146
|
uncoveredList = uncoveredList + 'You can proceed this build </ul>';
|
|
183
147
|
}
|
|
184
|
-
|
|
185
148
|
(0, _utils.log)(`COVERAGE ${coverage}%`);
|
|
186
149
|
}
|
|
187
|
-
|
|
188
150
|
let html = `<html><head><style>.red{font-weight:bold;color:red;}.green{font-weight:bold;color:green;}</style></head><body><br/>CODE COVERAGE <span class="${coverage < 60 ? 'red' : 'green'}">${coverage}%</span> <br/> less than 60% consider failure<br/><br/> FILE COVERAGE:<span class="${fileCoverage < 60 ? 'red' : 'green'}">${fileCoverage}%</span> <br/> less than 60% consider failure${fileList}${uncoveredList}</body></html>`;
|
|
189
|
-
|
|
190
151
|
if (!_fs.default.existsSync('./coverageTest')) {
|
|
191
152
|
_fs.default.mkdirSync('./coverageTest');
|
|
192
|
-
|
|
193
153
|
_fs.default.writeFileSync('./coverageTest/index.html', html, 'utf8');
|
|
194
154
|
} else {
|
|
195
155
|
_fs.default.writeFileSync('./coverageTest/index.html', html, 'utf8');
|
|
196
156
|
}
|
|
197
|
-
|
|
198
157
|
return inp;
|
|
199
158
|
};
|
|
200
|
-
|
|
201
159
|
module.exports = result;
|