@zohodesk/react-cli 1.1.29-exp.2 → 1.1.29-exp.3
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/README.md +18 -0
- package/lib/babel/babel-option-utils/babel-preset-react-option.js +3 -0
- package/lib/babel/cmjs-plugins-presets.js +13 -2
- package/lib/babel/es-plugins-presets.js +14 -3
- package/lib/common/buildEs.js +0 -1
- package/lib/common/getEntries.js +13 -2
- package/lib/common/getPublicPathConfig.js +6 -0
- package/lib/common/index.js +6 -1
- package/lib/common/runPreProcess.js +15 -6
- package/lib/common/splitChunks.js +21 -2
- package/lib/common/sslcertUpdater.js +18 -7
- package/lib/common/templateParameters.js +2 -0
- package/lib/common/testPattern.js +21 -10
- package/lib/common/valueReplacer.js +16 -1
- package/lib/configs/jest.config.js +11 -2
- package/lib/configs/libAlias.js +16 -10
- package/lib/configs/resolvers.js +16 -6
- package/lib/configs/webpack.component.umd.config.js +6 -1
- package/lib/configs/webpack.css.umd.config.js +14 -6
- package/lib/configs/webpack.dev.config.js +14 -1
- package/lib/configs/webpack.docs.config.js +9 -1
- package/lib/configs/webpack.impact.config.js +8 -1
- package/lib/configs/webpack.prod.config.js +17 -4
- package/lib/constants.js +18 -9
- package/lib/deprecationLogger.js +7 -0
- package/lib/hooks/docsProptypeHook.js +8 -4
- package/lib/jest/commitedFilesResult.js +46 -4
- package/lib/jest/coverageCollector.js +12 -1
- package/lib/jest/jsonMaker.js +6 -0
- package/lib/jest/preProcessors/cssPreprocessor.js +9 -1
- package/lib/jest/preProcessors/jsPreprocessor.js +11 -2
- package/lib/jest/preProcessors/otherFilesPreprocessor.js +4 -1
- package/lib/jest/result.js +23 -1
- package/lib/jest/run.js +18 -7
- package/lib/jest/setup.js +60 -8
- package/lib/loaderUtils/configsAssetsLoaders.js +12 -2
- package/lib/loaderUtils/getCSSLoaders.js +22 -10
- package/lib/loaderUtils/getDevJsLoaders.js +13 -4
- package/lib/loaderUtils/index.js +4 -1
- package/lib/loaderUtils/tests/windowsModification.test.js +1 -0
- package/lib/loaderUtils/windowsModification.js +3 -2
- package/lib/loaders/__test__/markdownLoader.spec.js +1 -0
- package/lib/loaders/composeLoader.js +37 -13
- package/lib/loaders/docsLoader.js +12 -1
- package/lib/loaders/docsPropsLoader.js +8 -4
- package/lib/loaders/enhancedReactLiveConverter.js +23 -2
- package/lib/loaders/fileBountryLoader.js +3 -1
- package/lib/loaders/fileLoader.js +23 -12
- package/lib/loaders/markdownLoader.js +19 -14
- package/lib/loaders/reactLiveConvertor.js +15 -5
- package/lib/loaders/scriptInstrumentLoader.js +16 -7
- package/lib/loaders/selectorMappingLoader.js +26 -7
- package/lib/loaders/workerLoader.js +24 -9
- package/lib/logger.js +4 -0
- package/lib/middlewares/HMRMiddleware.js +27 -13
- package/lib/middlewares/SSTMiddleware.js +5 -1
- package/lib/pluginUtils/configHtmlWebpackPlugins.js +24 -1
- package/lib/pluginUtils/getDevPlugins.js +42 -9
- package/lib/pluginUtils/getDocsPlugins.js +13 -3
- package/lib/pluginUtils/getLibraryImactPlugins.js +6 -5
- package/lib/pluginUtils/getLibraryPlugins.js +8 -2
- package/lib/pluginUtils/getProdPlugins.js +47 -8
- package/lib/pluginUtils/getServerPlugins.js +8 -2
- package/lib/pluginUtils/getUMDCSSPlugins.js +10 -2
- package/lib/pluginUtils/getUMDComponentPlugins.js +10 -2
- package/lib/pluginUtils/index.js +9 -1
- package/lib/plugins/CdnChangePlugin.js +18 -2
- package/lib/plugins/CleanupStatsPlugin.js +5 -0
- package/lib/plugins/CssOrderControlPlugin.js +6 -3
- package/lib/plugins/CustomAttributePlugin.js +19 -14
- package/lib/plugins/CustomScriptLoadingStrategyPlugin.js +23 -3
- package/lib/plugins/EFCPlugin.js +34 -20
- package/lib/plugins/EFCTemplatePlugin.js +30 -19
- package/lib/plugins/EfcResourceCleanupPlugin.js +3 -0
- package/lib/plugins/EventsHandlingPlugin.js +4 -2
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +37 -14
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +15 -10
- package/lib/plugins/I18nSplitPlugin/I18nDependency.js +10 -4
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +155 -78
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +81 -198
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +23 -12
- package/lib/plugins/I18nSplitPlugin/index.js +24 -13
- package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +12 -2
- package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +1 -0
- package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +5 -0
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +8 -1
- package/lib/plugins/I18nSplitPlugin/utils/index.js +4 -0
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +20 -0
- package/lib/plugins/I18nSplitPlugin/utils/unicodeConversion.js +1 -0
- package/lib/plugins/ManifestPlugin.js +18 -1
- package/lib/plugins/MinifyPlugin.js +10 -1
- package/lib/plugins/ModuleStatsPlugin.js +24 -1
- package/lib/plugins/OptimizeJSPlugin.js +10 -2
- package/lib/plugins/PublicPathCallbackPlugin.js +12 -1
- package/lib/plugins/PublicPathChangePlugin.js +39 -6
- package/lib/plugins/ReportGeneratePlugin.js +32 -5
- package/lib/plugins/RequireVariablePublicPlugin.js +8 -1
- package/lib/plugins/ResourceHintsPlugin.js +13 -4
- package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +17 -12
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +17 -10
- package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +5 -2
- package/lib/plugins/ScriptInstrumentPlugin.js +8 -1
- package/lib/plugins/SelectorPlugin.js +32 -6
- package/lib/plugins/ServiceWorkerPlugin.js +22 -5
- package/lib/plugins/ShadowDOMSupportPlugin.js +41 -4
- package/lib/plugins/SourceMapHookPlugin.js +12 -2
- package/lib/plugins/StatsPlugin.js +14 -0
- package/lib/plugins/TPHashMappingPlugin.js +18 -3
- package/lib/plugins/UnusedFilesFindPlugin.js +39 -4
- package/lib/plugins/VariableConversionCollector.js +42 -15
- package/lib/plugins/index.js +20 -1
- package/lib/plugins/libraryImpactPlugin.js +33 -1
- package/lib/plugins/utils/classHandling.js +6 -0
- package/lib/plugins/utils/fileHandling.js +15 -6
- package/lib/plugins/utils/tests/fileHandling.test.js +4 -0
- package/lib/plugins/variableConvertorUtils.js +29 -14
- package/lib/plugins/webpackwatchrunplugin.js +5 -0
- package/lib/postcss-plugins/EmptyPlugin.js +4 -3
- package/lib/postcss-plugins/ExcludePlugin.js +5 -1
- package/lib/postcss-plugins/IncludePlugin.js +5 -1
- package/lib/postcss-plugins/RTLSplitPlugin.js +27 -14
- package/lib/postcss-plugins/SelectorReplace.js +16 -1
- package/lib/postcss-plugins/ValueReplacer.js +6 -7
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +3 -0
- package/lib/postcss-plugins/__test__/selectorReplace.test.js +3 -6
- package/lib/postcss-plugins/__test__/valueReplacer.spec.js +5 -2
- package/lib/postcss-plugins/hoverActivePlugin.js +67 -31
- package/lib/postcss-plugins/variableModificationPlugin/ErrorHandler.js +7 -0
- package/lib/postcss-plugins/variableModificationPlugin/index.js +49 -28
- package/lib/schemas/index.js +10 -3
- package/lib/servers/clusterHubServer.js +11 -1
- package/lib/servers/devBuild.js +26 -14
- package/lib/servers/docsServer.js +3 -1
- package/lib/servers/docsServerCore.js +22 -1
- package/lib/servers/getCliPath.js +9 -0
- package/lib/servers/helpServer.js +6 -1
- package/lib/servers/httpsOptions.js +8 -2
- package/lib/servers/impactServer.js +35 -3
- package/lib/servers/mockserver.js +10 -1
- package/lib/servers/nowatchserver.js +37 -12
- package/lib/servers/requireLocalOrGlobal.js +17 -6
- package/lib/servers/scrServer.js +21 -14
- package/lib/servers/server.js +36 -6
- package/lib/servers/ssServer.js +17 -1
- package/lib/templates/CoverageScriptTemplate.js +14 -0
- package/lib/templates/WMSTemplate.js +13 -7
- package/lib/templates/linterConstant.js +4 -2
- package/lib/utils/babelPresets.js +7 -3
- package/lib/utils/clean.js +9 -3
- package/lib/utils/copy.js +7 -1
- package/lib/utils/copyTimezones.js +9 -1
- package/lib/utils/createEventStream.js +6 -1
- package/lib/utils/cssClassNameGenerate.js +30 -10
- package/lib/utils/cssURLReplacer.js +22 -1
- package/lib/utils/dependencyPostPublish.js +10 -1
- package/lib/utils/deprecationSupport.js +32 -7
- package/lib/utils/fileUtils.js +28 -1
- package/lib/utils/folderIterator.js +13 -2
- package/lib/utils/getComponents.js +21 -0
- package/lib/utils/getCurrentBranch.js +5 -0
- package/lib/utils/getDependenciesImpactList.js +22 -1
- package/lib/utils/getFileType.js +10 -2
- package/lib/utils/getHash.js +8 -1
- package/lib/utils/getIp.js +2 -0
- package/lib/utils/getOptions.js +53 -16
- package/lib/utils/getServerURL.js +10 -1
- package/lib/utils/index.js +51 -4
- package/lib/utils/init.js +1 -0
- package/lib/utils/initPreCommitHook.js +30 -7
- package/lib/utils/jsonHelper.js +22 -3
- package/lib/utils/libraryImpactConfig.js +5 -2
- package/lib/utils/lint/addScripts.js +5 -2
- package/lib/utils/lint/checkExistingConfig.js +12 -3
- package/lib/utils/lint/copyConfigs.js +3 -0
- package/lib/utils/lint/index.js +9 -0
- package/lib/utils/lint/lintScripts.js +1 -0
- package/lib/utils/lint/lintSetup.js +4 -3
- package/lib/utils/lint/lintStagedPreCommitHook.js +1 -0
- package/lib/utils/lint/question.js +7 -0
- package/lib/utils/lintReporter.js +20 -0
- package/lib/utils/log.js +1 -0
- package/lib/utils/mailSender.js +8 -1
- package/lib/utils/object-manipulation.js +17 -1
- package/lib/utils/pullOrigin.js +4 -0
- package/lib/utils/reinstallDependencies.js +29 -1
- package/lib/utils/removeAttributes.js +8 -1
- package/lib/utils/repoClone.js +28 -3
- package/lib/utils/request.js +12 -0
- package/lib/utils/rtl.js +17 -5
- package/lib/utils/selectorReplacer.js +16 -10
- package/lib/utils/setEnvVariables.js +2 -0
- package/lib/utils/ssTestHack.js +11 -1
- package/lib/utils/switchBranch.js +5 -0
- package/lib/utils/typeCheck.js +1 -0
- package/lib/utils/urlConcat.js +4 -0
- package/lib/utils/useExitCleanup.js +10 -9
- package/lib/utils/variableConverter.js +31 -22
- package/{package-lock.json → npm-shrinkwrap.json} +2333 -2101
- package/package.json +3 -2
- package/lib/plugins/I18nSplitPlugin/utils/applyMetaManifest.js +0 -279
- package/lib/plugins/I18nSplitPlugin/utils/createMetaManifest.js +0 -51
- package/lib/plugins/I18nSplitPlugin/utils/createRegularManifest.js +0 -48
- package/lib/plugins/newi18nsplitplugin/18nPlugin1.js +0 -306
- package/lib/plugins/newi18nsplitplugin/18nPlugin2.js +0 -363
- package/lib/plugins/newi18nsplitplugin/18nPlugin3.js +0 -694
- package/lib/plugins/newi18nsplitplugin/18nPlugin_hashed.js +0 -1258
- package/lib/plugins/newi18nsplitplugin/18nPlugin_working.js +0 -542
- package/lib/plugins/newi18nsplitplugin/18nplugin.js +0 -974
- package/lib/plugins/newi18nsplitplugin/ChunkManager.js +0 -131
- package/lib/plugins/newi18nsplitplugin/GenerateModuleIdToKeysMapPlugin.js +0 -59
- package/lib/plugins/newi18nsplitplugin/I18nDiffPlugin.js +0 -262
- package/lib/plugins/newi18nsplitplugin/I18nDownloadLogic.js +0 -166
- package/lib/plugins/newi18nsplitplugin/I18nPropertiesPlugin.js +0 -111
- package/lib/plugins/newi18nsplitplugin/KeyCollector.js +0 -163
- package/lib/plugins/newi18nsplitplugin/ManifestGenerator.js +0 -88
- package/lib/plugins/newi18nsplitplugin/UnicodeConversionPlugin.js +0 -101
- package/lib/plugins/newi18nsplitplugin/constants.js +0 -162
- package/lib/plugins/newi18nsplitplugin/utils/I18nKeyHasher.js +0 -78
- package/lib/plugins/newi18nsplitplugin/utils/getJsResourceKeys.js +0 -22
- package/lib/plugins/newi18nsplitplugin/utils/i18nChunkUtils.js +0 -18
- package/lib/plugins/newi18nsplitplugin/utils/manifestGenerator.js +0 -580
- package/lib/plugins/newi18nsplitplugin/utils/propertiesUtils.js +0 -54
@@ -1,13 +1,18 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
let getOptions = require('./getOptions').default;
|
4
|
+
|
4
5
|
let fs = require('fs');
|
6
|
+
|
5
7
|
let coverageCollector = require('../jest/coverageCollector');
|
8
|
+
|
6
9
|
let path = require('path');
|
10
|
+
|
7
11
|
let {
|
8
12
|
htmlTemplate,
|
9
13
|
endTag
|
10
14
|
} = require('../templates/linterConstant');
|
15
|
+
|
11
16
|
let {
|
12
17
|
esLint: {
|
13
18
|
srcBranch,
|
@@ -19,9 +24,12 @@ let {
|
|
19
24
|
reportPath
|
20
25
|
}
|
21
26
|
} = getOptions();
|
27
|
+
|
22
28
|
function writeFile(filePath, data) {
|
23
29
|
filePath = path.join(process.cwd(), filePath); //eslint-disable-line
|
30
|
+
|
24
31
|
let dirName = path.dirname(filePath);
|
32
|
+
|
25
33
|
if (!fs.existsSync(dirName)) {
|
26
34
|
fs.mkdirSync(dirName);
|
27
35
|
fs.writeFileSync(filePath, data);
|
@@ -29,6 +37,7 @@ function writeFile(filePath, data) {
|
|
29
37
|
fs.writeFileSync(filePath, data);
|
30
38
|
}
|
31
39
|
}
|
40
|
+
|
32
41
|
let formatter = {
|
33
42
|
jsonFormatter: data => {
|
34
43
|
let finalList = [];
|
@@ -39,6 +48,7 @@ let formatter = {
|
|
39
48
|
tempMessageList.push(messageObj);
|
40
49
|
}
|
41
50
|
});
|
51
|
+
|
42
52
|
if (tempMessageList.length > 0) {
|
43
53
|
finalList.push(errorFileObj);
|
44
54
|
}
|
@@ -47,6 +57,7 @@ let formatter = {
|
|
47
57
|
},
|
48
58
|
htmlFormatter: data => {
|
49
59
|
data = formatter.jsonFormatter(data); //eslint-disable-line
|
60
|
+
|
50
61
|
if (data.length > 0) {
|
51
62
|
let liTag = '';
|
52
63
|
data.forEach(errorFileObj => {
|
@@ -54,16 +65,19 @@ let formatter = {
|
|
54
65
|
let messageTag = '';
|
55
66
|
errorFileObj.messages.forEach(messageObj => {
|
56
67
|
let errorType = messageObj.severity == 2 ? 'Error' : 'Warning'; //eslint-disable-line
|
68
|
+
|
57
69
|
messageTag = `${messageTag}<div class="pkDetailsRow"><div class="pkDetailsCol">${messageObj.line}</div><div class="pkDetailsCol pkError">${errorType}</div><div class="pkDetailsCol">${messageObj.message}</div><div class="pkDetailsCol">${messageObj.ruleId}</div></div>`;
|
58
70
|
});
|
59
71
|
liTag = `${liTag + messageTag}</div></div></li>`;
|
60
72
|
});
|
61
73
|
return `${htmlTemplate}<ul class="pkUl">${liTag}</ul>${endTag}`;
|
62
74
|
}
|
75
|
+
|
63
76
|
return `${htmlTemplate}<div class="pkEmpty"><div>No test results with found</div></div>${endTag}`;
|
64
77
|
},
|
65
78
|
xmlFormatter: data => {
|
66
79
|
data = formatter.jsonFormatter(data); //eslint-disable-line
|
80
|
+
|
67
81
|
let startTag = '<jscheck>';
|
68
82
|
let engTag = '</jscheck>';
|
69
83
|
let bodyContent = '';
|
@@ -79,8 +93,10 @@ let formatter = {
|
|
79
93
|
return startTag + bodyContent + engTag;
|
80
94
|
}
|
81
95
|
};
|
96
|
+
|
82
97
|
function formatSplitter(inputJson) {
|
83
98
|
let outputData;
|
99
|
+
|
84
100
|
if (reportType === 'json') {
|
85
101
|
outputData = JSON.stringify(formatter.jsonFormatter(inputJson));
|
86
102
|
} else if (reportType === 'html') {
|
@@ -88,8 +104,10 @@ function formatSplitter(inputJson) {
|
|
88
104
|
} else if (reportType === 'xml') {
|
89
105
|
outputData = formatter.xmlFormatter(inputJson);
|
90
106
|
}
|
107
|
+
|
91
108
|
writeFile(reportPath, outputData);
|
92
109
|
}
|
110
|
+
|
93
111
|
module.exports = function (results) {
|
94
112
|
let erroredFileObjectList = [];
|
95
113
|
results.forEach(fileObject => {
|
@@ -102,9 +120,11 @@ module.exports = function (results) {
|
|
102
120
|
});
|
103
121
|
}
|
104
122
|
});
|
123
|
+
|
105
124
|
if (impactRun) {
|
106
125
|
coverageCollector(srcBranch, targetBranch, serviceName, impactServerDomain).then((res = {}) => {
|
107
126
|
let impactList = [];
|
127
|
+
|
108
128
|
if (res.STATUS) {
|
109
129
|
if (res.LIST.length > 0) {
|
110
130
|
erroredFileObjectList.forEach(errFileObj => {
|
package/lib/utils/log.js
CHANGED
package/lib/utils/mailSender.js
CHANGED
@@ -1,15 +1,21 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _nodemailer = _interopRequireDefault(require("nodemailer"));
|
4
|
+
|
4
5
|
var _index = require("./index");
|
6
|
+
|
5
7
|
var _jsonHelper = require("./jsonHelper");
|
6
|
-
|
8
|
+
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
|
+
|
7
11
|
if (process.argv.length <= 6) {
|
8
12
|
(0, _index.log)('Usage: node mailSender <from> <pass> <to> <subject> <html>');
|
9
13
|
process.exit(-1);
|
10
14
|
}
|
15
|
+
|
11
16
|
let [from, pass, to, subject, html, cc, user, reportURL] = process.argv.slice(2);
|
12
17
|
(0, _jsonHelper.jsonHelper)(`${process.cwd()}/result.json`, 'Report_URL', reportURL);
|
18
|
+
|
13
19
|
let transporter = _nodemailer.default.createTransport({
|
14
20
|
host: 'smtp.tsi.zohocorpin.com',
|
15
21
|
port: 25,
|
@@ -19,6 +25,7 @@ let transporter = _nodemailer.default.createTransport({
|
|
19
25
|
pass
|
20
26
|
}
|
21
27
|
});
|
28
|
+
|
22
29
|
let mailOptions = {
|
23
30
|
from: from,
|
24
31
|
to: to,
|
@@ -5,68 +5,84 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.convertObjectToStringGen = convertObjectToStringGen;
|
7
7
|
exports.removeKeysFromObject = removeKeysFromObject;
|
8
|
+
|
8
9
|
function objectPathMatcher(currentKey, objHierarchy = [], keysToBeRemoved = []) {
|
9
10
|
const objPathKey = objHierarchy.length > 0 ? `${objHierarchy.join('.')}.${currentKey}` : currentKey;
|
10
11
|
return keysToBeRemoved.some(key => {
|
11
12
|
const isWildPath = /^\*/.test(key);
|
13
|
+
|
12
14
|
if (isWildPath) {
|
13
15
|
const newKey = key.replace(/\*\.?/, '');
|
14
16
|
return objPathKey.includes(newKey);
|
15
17
|
}
|
18
|
+
|
16
19
|
return key === objPathKey;
|
17
20
|
});
|
18
21
|
}
|
19
|
-
|
20
22
|
/*
|
21
23
|
1) *.keyTobeRemoved -> means match every object path, this key will be removed
|
22
24
|
2) keyToBeremoved -> means root object key
|
23
25
|
3) nestedPath.keyToBeRemoved -> means only that nested path key
|
24
26
|
4) don't need to account for array iteration, just object key path is enough in the key to be removed.
|
25
27
|
*/
|
28
|
+
|
29
|
+
|
26
30
|
function removeKeysFromObject(obj, keysToBeRemoved, prevKeys = []) {
|
27
31
|
if (Array.isArray(obj)) {
|
28
32
|
return obj.map(item => removeKeysFromObject(item, keysToBeRemoved, prevKeys));
|
29
33
|
}
|
34
|
+
|
30
35
|
if (obj && typeof obj === 'object') {
|
31
36
|
const filteredKeyObject = {};
|
32
37
|
const ObjectKeys = Object.keys(obj);
|
38
|
+
|
33
39
|
for (const objectKey of ObjectKeys) {
|
34
40
|
const isKeyToBeRemoved = objectPathMatcher(objectKey, prevKeys, keysToBeRemoved);
|
41
|
+
|
35
42
|
if (!isKeyToBeRemoved) {
|
36
43
|
filteredKeyObject[objectKey] = removeKeysFromObject(obj[objectKey], keysToBeRemoved, [...prevKeys, objectKey]);
|
37
44
|
}
|
38
45
|
}
|
46
|
+
|
39
47
|
return filteredKeyObject;
|
40
48
|
}
|
49
|
+
|
41
50
|
return obj;
|
42
51
|
}
|
52
|
+
|
43
53
|
function* convertObjectToStringGen(obj) {
|
44
54
|
if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || obj === null) {
|
45
55
|
yield JSON.stringify(obj);
|
46
56
|
} else if (Array.isArray(obj)) {
|
47
57
|
yield '[';
|
48
58
|
let isFirst = true;
|
59
|
+
|
49
60
|
for (let item of obj) {
|
50
61
|
if (item === undefined) {
|
51
62
|
item = null;
|
52
63
|
}
|
64
|
+
|
53
65
|
yield `${isFirst ? '' : ','}`;
|
54
66
|
yield* convertObjectToStringGen(item);
|
55
67
|
isFirst = false;
|
56
68
|
}
|
69
|
+
|
57
70
|
yield ']';
|
58
71
|
} else {
|
59
72
|
yield '{';
|
60
73
|
let isFirst = true;
|
61
74
|
const entries = Object.entries(obj);
|
75
|
+
|
62
76
|
for (const [itemKey, itemValue] of entries) {
|
63
77
|
if (itemValue === undefined) {
|
64
78
|
continue;
|
65
79
|
}
|
80
|
+
|
66
81
|
yield `${isFirst ? '' : ','}${JSON.stringify(itemKey)}: `;
|
67
82
|
yield* convertObjectToStringGen(itemValue);
|
68
83
|
isFirst = false;
|
69
84
|
}
|
85
|
+
|
70
86
|
yield '}';
|
71
87
|
}
|
72
88
|
}
|
package/lib/utils/pullOrigin.js
CHANGED
@@ -4,8 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
+
|
7
8
|
var _child_process = require("child_process");
|
9
|
+
|
8
10
|
var _log = require("./log");
|
11
|
+
|
9
12
|
var _default = (type = 'git', branchName) => new Promise(resolve => {
|
10
13
|
if (type === 'git') {
|
11
14
|
(0, _child_process.spawnSync)('git', ['pull', 'origin', branchName], {
|
@@ -21,4 +24,5 @@ var _default = (type = 'git', branchName) => new Promise(resolve => {
|
|
21
24
|
resolve();
|
22
25
|
}
|
23
26
|
});
|
27
|
+
|
24
28
|
exports.default = _default;
|
@@ -4,13 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.reinstallDependencies1 = exports.reinstallDependencies = exports.collectPackageDiff = void 0;
|
7
|
+
|
7
8
|
var _fs = _interopRequireDefault(require("fs"));
|
9
|
+
|
8
10
|
var _path = _interopRequireDefault(require("path"));
|
11
|
+
|
9
12
|
var _child_process = require("child_process");
|
13
|
+
|
10
14
|
var _gitRootDir = _interopRequireDefault(require("git-root-dir"));
|
15
|
+
|
11
16
|
var _log = require("./log");
|
12
|
-
|
17
|
+
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
|
+
|
13
20
|
let packageJsons = {};
|
21
|
+
|
14
22
|
let packageDiffChecker = (pre, current) => {
|
15
23
|
let {
|
16
24
|
dependencies = {},
|
@@ -19,23 +27,28 @@ let packageDiffChecker = (pre, current) => {
|
|
19
27
|
let diffs = {};
|
20
28
|
Object.keys(dependencies).forEach(pack => {
|
21
29
|
let version = dependencies[pack];
|
30
|
+
|
22
31
|
if (version !== pre.dependencies && pre.dependencies[pack]) {
|
23
32
|
diffs[pack] = version;
|
24
33
|
}
|
25
34
|
});
|
26
35
|
Object.keys(devDependencies).forEach(pack => {
|
27
36
|
let version = devDependencies[pack];
|
37
|
+
|
28
38
|
if (version !== pre.devDependencies && pre.devDependencies[pack]) {
|
29
39
|
diffs[pack] = version;
|
30
40
|
}
|
31
41
|
});
|
32
42
|
return diffs;
|
33
43
|
};
|
44
|
+
|
34
45
|
let collectPackageDiff = pathToSubProjects => new Promise(resolve => {
|
35
46
|
(0, _gitRootDir.default)(process.cwd()).then(rootDir => {
|
36
47
|
let projects = _fs.default.readdirSync(_path.default.join(rootDir, pathToSubProjects));
|
48
|
+
|
37
49
|
projects.forEach(project => {
|
38
50
|
let packageJson = _path.default.join(_path.default.join(rootDir, pathToSubProjects), project, 'package.json');
|
51
|
+
|
39
52
|
if (_fs.default.existsSync(packageJson)) {
|
40
53
|
packageJsons[project] = require(packageJson);
|
41
54
|
}
|
@@ -43,21 +56,29 @@ let collectPackageDiff = pathToSubProjects => new Promise(resolve => {
|
|
43
56
|
resolve();
|
44
57
|
});
|
45
58
|
});
|
59
|
+
|
46
60
|
exports.collectPackageDiff = collectPackageDiff;
|
61
|
+
|
47
62
|
let reinstallDependencies1 = pathToSubProjects => {
|
48
63
|
(0, _gitRootDir.default)(process.cwd()).then(rootDir => {
|
49
64
|
let projects = _fs.default.readdirSync(_path.default.join(rootDir, pathToSubProjects));
|
65
|
+
|
50
66
|
projects.forEach(project => {
|
51
67
|
let prePackageJson = packageJsons[project];
|
52
68
|
let currentPackageJson;
|
69
|
+
|
53
70
|
if (prePackageJson) {
|
54
71
|
currentPackageJson = _path.default.join(_path.default.join(rootDir, pathToSubProjects), project, 'package.json');
|
72
|
+
|
55
73
|
if (_fs.default.existsSync(currentPackageJson)) {
|
56
74
|
currentPackageJson = require(currentPackageJson);
|
57
75
|
}
|
58
76
|
}
|
77
|
+
|
59
78
|
let projPath = _path.default.join(_path.default.join(rootDir, pathToSubProjects), project);
|
79
|
+
|
60
80
|
let diffs = packageDiffChecker(prePackageJson, currentPackageJson);
|
81
|
+
|
61
82
|
if (Object.keys(diffs).length) {
|
62
83
|
(0, _log.log)(diffs, `package diffs between branches for ${project} project`);
|
63
84
|
(0, _child_process.spawnSync)('rm', ['-rf', 'package-lock.json'], {
|
@@ -66,10 +87,12 @@ let reinstallDependencies1 = pathToSubProjects => {
|
|
66
87
|
});
|
67
88
|
let packages = Object.keys(diffs);
|
68
89
|
let dummy = [];
|
90
|
+
|
69
91
|
for (let name of packages) {
|
70
92
|
let version = diffs[name];
|
71
93
|
dummy.push(`${name}@${version}`);
|
72
94
|
}
|
95
|
+
|
73
96
|
(0, _log.log)(`npm ${['install'].concat(dummy).join(' ')}`);
|
74
97
|
(0, _child_process.spawnSync)('npm', ['install'].concat(dummy), {
|
75
98
|
cwd: projPath,
|
@@ -88,12 +111,16 @@ let reinstallDependencies1 = pathToSubProjects => {
|
|
88
111
|
});
|
89
112
|
});
|
90
113
|
};
|
114
|
+
|
91
115
|
exports.reinstallDependencies1 = reinstallDependencies1;
|
116
|
+
|
92
117
|
let reinstallDependencies = pathToSubProjects => new Promise(resolve => {
|
93
118
|
(0, _gitRootDir.default)(process.cwd()).then(rootDir => {
|
94
119
|
let projects = _fs.default.readdirSync(_path.default.join(rootDir, pathToSubProjects));
|
120
|
+
|
95
121
|
projects.forEach(project => {
|
96
122
|
let projPath = _path.default.join(_path.default.join(rootDir, pathToSubProjects), project);
|
123
|
+
|
97
124
|
(0, _child_process.spawnSync)('npm', ['install'], {
|
98
125
|
cwd: projPath,
|
99
126
|
stdio: 'inherit'
|
@@ -102,4 +129,5 @@ let reinstallDependencies = pathToSubProjects => new Promise(resolve => {
|
|
102
129
|
});
|
103
130
|
});
|
104
131
|
});
|
132
|
+
|
105
133
|
exports.reinstallDependencies = reinstallDependencies;
|
@@ -1,27 +1,34 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _getOptions = _interopRequireDefault(require("./getOptions"));
|
4
|
-
|
4
|
+
|
5
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
6
|
+
|
5
7
|
let options = (0, _getOptions.default)();
|
6
8
|
let {
|
7
9
|
app: {
|
8
10
|
attrbuteNames
|
9
11
|
}
|
10
12
|
} = options;
|
13
|
+
|
11
14
|
module.exports = () => ({
|
12
15
|
visitor: {
|
13
16
|
Program(path, state) {
|
14
17
|
let properties = state.opts.properties || [];
|
18
|
+
|
15
19
|
if (properties.length === 0) {
|
16
20
|
properties = properties.concat(attrbuteNames);
|
17
21
|
}
|
22
|
+
|
18
23
|
path.traverse({
|
19
24
|
JSXIdentifier(path2) {
|
20
25
|
if (properties.indexOf(path2.node.name.toLowerCase()) > -1) {
|
21
26
|
path2.parentPath.remove();
|
22
27
|
}
|
23
28
|
}
|
29
|
+
|
24
30
|
});
|
25
31
|
}
|
32
|
+
|
26
33
|
}
|
27
34
|
});
|
package/lib/utils/repoClone.js
CHANGED
@@ -1,17 +1,25 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _os = require("os");
|
4
|
+
|
4
5
|
var _path = _interopRequireDefault(require("path"));
|
6
|
+
|
5
7
|
var _fs = _interopRequireDefault(require("fs"));
|
8
|
+
|
6
9
|
var _child_process = require("child_process");
|
10
|
+
|
7
11
|
var _index = require("./index");
|
8
|
-
|
12
|
+
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
|
+
|
9
15
|
function spawnSyncWithErrorLog(...args) {
|
10
16
|
let result = (0, _child_process.spawnSync)(...args);
|
17
|
+
|
11
18
|
if (result.stderr) {
|
12
19
|
console.error(result.stderr);
|
13
20
|
}
|
14
21
|
}
|
22
|
+
|
15
23
|
let options = (0, _index.getOptions)();
|
16
24
|
let {
|
17
25
|
clone: {
|
@@ -26,28 +34,36 @@ let {
|
|
26
34
|
shouldDelete
|
27
35
|
}
|
28
36
|
} = options;
|
37
|
+
|
29
38
|
if (type && (type === 'git' || type === 'hg')) {
|
30
39
|
(0, _index.log)(`Going to clone ${type} repository`);
|
31
40
|
} else {
|
32
41
|
throw new Error('You must give valid type to clone a repository');
|
33
42
|
}
|
43
|
+
|
34
44
|
if (!cacheDir) {
|
35
45
|
cacheDir = _path.default.join((0, _os.homedir)(), '.react-cli');
|
36
46
|
} else {
|
37
47
|
cacheDir = _path.default.join(process.cwd(), cacheDir);
|
38
48
|
}
|
49
|
+
|
39
50
|
if (!projectName) {
|
40
51
|
let {
|
41
52
|
name
|
42
53
|
} = _path.default.parse(url);
|
54
|
+
|
43
55
|
projectName = name;
|
44
56
|
}
|
57
|
+
|
45
58
|
let projectPath = _path.default.join(cacheDir, projectName);
|
59
|
+
|
46
60
|
let cloneRepo = () => {
|
47
61
|
if (!_fs.default.existsSync(cacheDir)) {
|
48
62
|
_fs.default.mkdirSync(cacheDir);
|
49
63
|
}
|
64
|
+
|
50
65
|
let revisionOrBranch;
|
66
|
+
|
51
67
|
if (type === 'git') {
|
52
68
|
revisionOrBranch = `-b${branch}`;
|
53
69
|
} else {
|
@@ -57,23 +73,30 @@ let cloneRepo = () => {
|
|
57
73
|
revisionOrBranch = `-b${branch}`;
|
58
74
|
}
|
59
75
|
}
|
60
|
-
|
61
|
-
// this is for some time error will because of hg or git so we addid error log for this
|
76
|
+
|
77
|
+
(0, _index.log)(`Going to clone ${url} repo to ${cacheDir} path`); // this is for some time error will because of hg or git so we addid error log for this
|
78
|
+
|
62
79
|
let oargs = ['clone', url, revisionOrBranch, projectName];
|
63
80
|
type === 'git' && shallowClone && oargs.push('--depth=1');
|
64
81
|
spawnSyncWithErrorLog(type, oargs, {
|
65
82
|
cwd: cacheDir,
|
66
83
|
stdio: 'inherit'
|
67
84
|
});
|
85
|
+
|
68
86
|
_fs.default.writeFileSync(_path.default.join(projectPath, type === 'hg' ? '.hg' : '.git', 'remoteUrl'), url);
|
87
|
+
|
69
88
|
(0, _index.log)('Repository cloned!');
|
70
89
|
};
|
90
|
+
|
71
91
|
let getRemoteURL = () => {
|
72
92
|
let remoteUrl = _fs.default.readFileSync(_path.default.join(projectPath, type === 'hg' ? '.hg' : '.git', 'remoteUrl')).toString();
|
93
|
+
|
73
94
|
return remoteUrl.trim();
|
74
95
|
};
|
96
|
+
|
75
97
|
if (_fs.default.existsSync(projectPath)) {
|
76
98
|
let remoteUrl = getRemoteURL();
|
99
|
+
|
77
100
|
if (remoteUrl === url) {
|
78
101
|
if (type === 'git') {
|
79
102
|
spawnSyncWithErrorLog(type, ['pull', remoteName, branch], {
|
@@ -82,11 +105,13 @@ if (_fs.default.existsSync(projectPath)) {
|
|
82
105
|
});
|
83
106
|
} else {
|
84
107
|
let revisionOrBranch;
|
108
|
+
|
85
109
|
if (revision) {
|
86
110
|
revisionOrBranch = `-r${revision}`;
|
87
111
|
} else {
|
88
112
|
revisionOrBranch = `-b${branch}`;
|
89
113
|
}
|
114
|
+
|
90
115
|
spawnSyncWithErrorLog(type, ['pull', revisionOrBranch, '-u', url], {
|
91
116
|
cwd: projectPath,
|
92
117
|
stdio: 'inherit'
|
package/lib/utils/request.js
CHANGED
@@ -1,12 +1,19 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
const https = require('https');
|
4
|
+
|
4
5
|
const http = require('http');
|
6
|
+
|
5
7
|
const url = require('url');
|
8
|
+
|
6
9
|
const querystring = require('querystring');
|
10
|
+
|
7
11
|
let isObject = data => data && data.toString && data.toString() === '[object Object]';
|
12
|
+
|
8
13
|
let isArray = data => data && Array.isArray(data);
|
14
|
+
|
9
15
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
16
|
+
|
10
17
|
let callback = resolve => res => {
|
11
18
|
res.setEncoding('utf8');
|
12
19
|
let str = '';
|
@@ -23,6 +30,7 @@ let callback = resolve => res => {
|
|
23
30
|
process.stdout.write(err);
|
24
31
|
});
|
25
32
|
};
|
33
|
+
|
26
34
|
let request = options => new Promise((resolve, reject) => {
|
27
35
|
let {
|
28
36
|
protocol,
|
@@ -44,11 +52,13 @@ let request = options => new Promise((resolve, reject) => {
|
|
44
52
|
headers: headers
|
45
53
|
};
|
46
54
|
let req;
|
55
|
+
|
47
56
|
if (protocol === 'https:') {
|
48
57
|
req = https.request(newOptions, callback(resolve));
|
49
58
|
} else if (protocol === 'http:') {
|
50
59
|
req = http.request(newOptions, callback(resolve));
|
51
60
|
}
|
61
|
+
|
52
62
|
if (method.toUpperCase() === 'POST') {
|
53
63
|
if (isObject(payload) || isArray(payload)) {
|
54
64
|
payload = JSON.stringify(payload);
|
@@ -58,6 +68,7 @@ let request = options => new Promise((resolve, reject) => {
|
|
58
68
|
req.write(formdata);
|
59
69
|
}
|
60
70
|
}
|
71
|
+
|
61
72
|
req.on('error', err => {
|
62
73
|
//eslint-disable-next-line
|
63
74
|
console.log(err);
|
@@ -65,4 +76,5 @@ let request = options => new Promise((resolve, reject) => {
|
|
65
76
|
});
|
66
77
|
req.end();
|
67
78
|
});
|
79
|
+
|
68
80
|
module.exports = request;
|
package/lib/utils/rtl.js
CHANGED
@@ -1,24 +1,35 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _postcss = _interopRequireDefault(require("postcss"));
|
4
|
+
|
4
5
|
var _path = _interopRequireDefault(require("path"));
|
6
|
+
|
5
7
|
var _fs = _interopRequireDefault(require("fs"));
|
8
|
+
|
6
9
|
var _folderIterator = _interopRequireDefault(require("./folderIterator"));
|
10
|
+
|
7
11
|
var _postcssRtl = _interopRequireDefault(require("@zohodesk/postcss-rtl"));
|
8
|
-
|
12
|
+
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
|
+
|
9
15
|
let cwd = process.cwd();
|
16
|
+
|
10
17
|
let src = _path.default.join(cwd, process.argv[2]);
|
18
|
+
|
11
19
|
let dist = _path.default.join(cwd, process.argv[3]);
|
20
|
+
|
12
21
|
let canWacth = '-w' === process.argv[4];
|
13
|
-
// import { useExitCleanup } from './useExitCleanup';
|
14
22
|
|
23
|
+
// import { useExitCleanup } from './useExitCleanup';
|
15
24
|
function watchHandler(fromPath, toPath) {
|
16
25
|
let css = _fs.default.readFileSync(fromPath);
|
26
|
+
|
17
27
|
(0, _postcss.default)([(0, _postcssRtl.default)({
|
18
28
|
addPrefixToSelector: function addPrefixToSelector(selector, prefix) {
|
19
29
|
if (prefix === '[dir]') {
|
20
30
|
return selector;
|
21
31
|
}
|
32
|
+
|
22
33
|
return `${prefix} ${selector}`; // Make selectors like [dir=rtl] > .selector
|
23
34
|
}
|
24
35
|
})]).process(css, {
|
@@ -26,21 +37,22 @@ function watchHandler(fromPath, toPath) {
|
|
26
37
|
to: toPath
|
27
38
|
}).then(result => {
|
28
39
|
_fs.default.writeFile(toPath, result.css, () => true);
|
40
|
+
|
29
41
|
if (result.map) {
|
30
42
|
_fs.default.writeFile(`${toPath}.map`, result.map, () => true);
|
31
43
|
}
|
32
44
|
});
|
33
45
|
}
|
46
|
+
|
34
47
|
(0, _folderIterator.default)(src, dist, ['.css'], false, (fromPath, toPath) => {
|
35
48
|
if (canWacth && fromPath) {
|
36
49
|
_fs.default.watchFile(fromPath, () => {
|
37
50
|
watchHandler(fromPath, toPath);
|
38
51
|
});
|
39
52
|
}
|
40
|
-
watchHandler(fromPath, toPath);
|
41
|
-
});
|
42
53
|
|
43
|
-
|
54
|
+
watchHandler(fromPath, toPath);
|
55
|
+
}); // if (canWacth) {
|
44
56
|
// useExitCleanup(() => {
|
45
57
|
// fs.unwatchFile(src, watchHandler);
|
46
58
|
// });
|
@@ -1,23 +1,31 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _getOptions = _interopRequireDefault(require("./getOptions"));
|
4
|
+
|
4
5
|
var _folderIterator = _interopRequireDefault(require("./folderIterator"));
|
5
|
-
|
6
|
+
|
7
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
|
+
|
6
9
|
const postcss = require('postcss');
|
10
|
+
|
7
11
|
const path = require('path');
|
12
|
+
|
8
13
|
const fs = require('fs');
|
14
|
+
|
9
15
|
const SelectorReplacePlugin = require('../postcss-plugins/SelectorReplace');
|
16
|
+
|
10
17
|
const cwd = process.cwd();
|
11
18
|
const src = path.join(cwd, process.argv[2]);
|
12
19
|
const dist = path.join(cwd, process.argv[3]);
|
13
20
|
const options = (0, _getOptions.default)();
|
21
|
+
|
14
22
|
function watchHandler(fromPath, toPath) {
|
15
|
-
const css = fs.readFileSync(fromPath, 'utf-8');
|
16
|
-
|
23
|
+
const css = fs.readFileSync(fromPath, 'utf-8'); // console.log(css);
|
24
|
+
|
17
25
|
const {
|
18
26
|
css: cssOptions
|
19
|
-
} = options;
|
20
|
-
|
27
|
+
} = options; // console.log(cssOptions, appOptions);
|
28
|
+
|
21
29
|
const {
|
22
30
|
selectorReplace
|
23
31
|
} = cssOptions;
|
@@ -26,15 +34,13 @@ function watchHandler(fromPath, toPath) {
|
|
26
34
|
to: toPath
|
27
35
|
}).then(result => {
|
28
36
|
fs.writeFileSync(toPath, result.css);
|
29
|
-
});
|
30
|
-
// console.log(variableOptions);
|
37
|
+
}); // console.log(variableOptions);
|
31
38
|
}
|
39
|
+
|
32
40
|
(0, _folderIterator.default)(src, dist, ['.css'], false, (fromPath, toPath) => {
|
33
41
|
// console.log(fromPath, toPath);
|
34
42
|
watchHandler(fromPath, toPath);
|
35
|
-
});
|
36
|
-
|
37
|
-
// if (canWacth) {
|
43
|
+
}); // if (canWacth) {
|
38
44
|
// useExitCleanup(() => {
|
39
45
|
// fs.unwatchFile(src, watchHandler);
|
40
46
|
// });
|