@zohodesk/react-cli 0.0.1-beta.16 → 0.0.1-beta.160
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 +1 -0
- package/.eslintrc.js +46 -3
- package/CHANGELOG.md +5 -0
- package/README.md +650 -0
- package/bin/cli.js +134 -27
- package/cert/cert.pem +37 -129
- package/cert/key.pem +27 -27
- package/cert/passphrase.pem +1 -0
- package/files/eslintrc.js +62 -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 +33 -24
- package/lib/common/getPublicPathConfig.js +40 -0
- package/lib/common/index.js +27 -13
- package/lib/common/splitChunks.js +64 -26
- package/lib/common/sslcertUpdater.js +59 -0
- package/lib/common/templateParameters.js +25 -0
- package/lib/configs/jest.config.js +18 -28
- package/lib/configs/webpack.component.umd.config.js +31 -37
- package/lib/configs/webpack.css.umd.config.js +44 -44
- package/lib/configs/webpack.dev.config.js +113 -57
- package/lib/configs/webpack.docs.config.js +104 -98
- package/lib/configs/webpack.impact.config.js +116 -0
- package/lib/configs/webpack.prod.config.js +154 -86
- package/lib/hooks/docsProptypeHook.js +32 -38
- package/lib/jest/commitedFilesResult.js +144 -71
- package/lib/jest/coverageCollector.js +62 -29
- package/lib/jest/jsonMaker.js +54 -0
- package/lib/jest/preProcessors/cssPreprocessor.js +16 -18
- package/lib/jest/preProcessors/jsPreprocessor.js +5 -6
- package/lib/jest/preProcessors/otherFilesPreprocessor.js +5 -6
- package/lib/jest/result.js +91 -41
- package/lib/jest/run.js +74 -27
- package/lib/jest/setup.js +103 -102
- package/lib/loaderUtils/getCSSLoaders.js +77 -0
- package/lib/loaderUtils/getDevJsLoaders.js +30 -23
- package/lib/loaderUtils/index.js +14 -7
- package/lib/loaders/docsLoader.js +15 -15
- package/lib/loaders/docsPropsLoader.js +14 -17
- package/lib/loaders/fileBountryLoader.js +17 -0
- package/lib/loaders/fileLoader.js +47 -38
- package/lib/loaders/scriptInstrumentLoader.js +21 -20
- package/lib/loaders/selectorMappingLoader.js +75 -0
- package/lib/loaders/workerLoader.js +136 -0
- package/lib/middlewares/HMRMiddleware.js +59 -41
- package/lib/middlewares/SSTMiddleware.js +21 -0
- package/lib/pluginUtils/getDevPlugins.js +173 -26
- package/lib/pluginUtils/getDocsPlugins.js +32 -17
- package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
- package/lib/pluginUtils/getLibraryPlugins.js +8 -10
- package/lib/pluginUtils/getProdPlugins.js +238 -37
- 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 +77 -0
- package/lib/plugins/CleanupStatsPlugin.js +28 -0
- package/lib/plugins/EFCPlugin.js +211 -0
- package/lib/plugins/EFCPlugin.md +6 -0
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +141 -0
- 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 +98 -97
- package/lib/plugins/OptimizeJSPlugin.js +24 -41
- package/lib/plugins/PublicPathCallbackPlugin.js +63 -0
- package/lib/plugins/PublicPathChangePlugin.js +187 -174
- package/lib/plugins/ReportGeneratePlugin.js +181 -0
- package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
- package/lib/plugins/ResourceHintsPlugin.js +53 -35
- package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +80 -0
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +82 -0
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
- package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +26 -0
- package/lib/plugins/ScriptInstrumentPlugin.js +22 -37
- package/lib/plugins/ServiceWorkerPlugin.js +107 -0
- package/lib/plugins/ShadowDOMSupportPlugin.js +270 -0
- package/lib/plugins/SourceMapHookPlugin.js +25 -31
- package/lib/plugins/TPHashMappingPlugin.js +67 -0
- package/lib/plugins/UglifyCSSPlugin.js +23 -30
- package/lib/plugins/UnusedFilesFindPlugin.js +150 -97
- package/lib/plugins/index.js +118 -55
- package/lib/plugins/libraryImpactPlugin.js +190 -0
- package/lib/plugins/webpackwatchrunplugin.js +26 -0
- package/lib/postcss-plugins/ExcludeRTLPlugin.js +23 -0
- package/lib/postcss-plugins/RTLSplitPlugin.js +138 -0
- package/lib/schemas/index.js +463 -52
- package/lib/servers/clusterHubServer.js +22 -26
- package/lib/servers/docsServer.js +3 -5
- package/lib/servers/docsServerCore.js +93 -85
- package/lib/servers/helpServer.js +19 -21
- package/lib/servers/httpsOptions.js +19 -0
- package/lib/servers/impactServer.js +99 -92
- package/lib/servers/mockserver.js +44 -0
- package/lib/servers/nowatchserver.js +275 -0
- package/lib/servers/scrServer.js +147 -0
- package/lib/servers/server.js +118 -124
- package/lib/servers/ssServer.js +107 -65
- package/lib/sh/reportPublish.sh +16 -10
- package/lib/templates/CoverageScriptTemplate.js +45 -18
- package/lib/templates/WMSTemplate.js +17 -18
- package/lib/templates/linterConstant.js +10 -0
- package/lib/utils/babelPresets.js +12 -5
- package/lib/utils/buildstats.html +148 -0
- package/lib/utils/clean.js +12 -11
- package/lib/utils/copy.js +13 -127
- package/lib/utils/copyTimezones.js +21 -0
- package/lib/utils/createEventStream.js +24 -19
- package/lib/utils/cssClassNameGenerate.js +70 -0
- package/lib/utils/cssURLReplacer.js +67 -54
- package/lib/utils/dependencyPostPublish.js +42 -0
- package/lib/utils/fileUtils.js +125 -0
- package/lib/utils/folderIterator.js +47 -0
- package/lib/utils/getComponents.js +126 -0
- package/lib/utils/getCurrentBranch.js +11 -17
- package/lib/utils/getDependenciesImpactList.js +151 -0
- package/lib/utils/getHash.js +26 -0
- package/lib/utils/getIp.js +20 -0
- package/lib/utils/getOptions.js +55 -30
- package/lib/utils/getServerURL.js +25 -8
- package/lib/utils/index.js +259 -82
- package/lib/utils/init.js +2 -2
- package/lib/utils/initPreCommitHook.js +40 -31
- package/lib/utils/jsonHelper.js +97 -0
- package/lib/utils/libraryImpactConfig.js +63 -0
- 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 +142 -0
- package/lib/utils/mailSender.js +16 -25
- package/lib/utils/pullOrigin.js +28 -0
- package/lib/utils/reinstallDependencies.js +133 -0
- package/lib/utils/removeAttributes.js +25 -23
- package/lib/utils/repoClone.js +56 -63
- package/lib/utils/request.js +64 -77
- package/lib/utils/resultSchema.json +73 -0
- package/lib/utils/rtl.js +42 -0
- package/lib/utils/setEnvVariables.js +5 -6
- package/lib/utils/ssTestHack.js +48 -0
- package/lib/utils/switchBranch.js +28 -0
- package/lib/utils/urlConcat.js +22 -0
- package/package.json +92 -64
- package/templates/app/.eslintrc.js +140 -0
- package/templates/app/README.md +12 -12
- package/templates/app/app/index.html +24 -8
- 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 -13
- package/templates/app/package.json +37 -17
- package/templates/app/src/actions/SampleActions/index.js +37 -0
- package/templates/app/src/actions/index.js +65 -0
- package/templates/app/src/appUrls.js +19 -0
- package/templates/app/src/components/Alert/Alert.js +134 -0
- package/templates/app/src/components/Alert/Alert.module.css +79 -0
- package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -0
- package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -0
- package/templates/app/src/components/Sample/Sample.module.css +11 -0
- package/templates/app/src/components/Sample/SampleList.js +61 -0
- package/templates/app/src/components/Slider/Slider.css +41 -0
- package/templates/app/src/components/Slider/Slider.js +55 -0
- package/templates/app/src/containers/AlertContainer/index.js +15 -0
- package/templates/app/src/containers/AppContainer/index.js +96 -0
- package/templates/app/src/containers/AppContainer/index.module.css +27 -0
- package/templates/app/src/containers/CustomMatch/index.js +65 -0
- package/templates/app/src/containers/DevTools/index.js +10 -0
- package/templates/app/src/containers/Header/index.js +67 -0
- package/templates/app/src/containers/Header/index.module.css +43 -0
- package/templates/app/src/containers/Redirect/index.js +63 -0
- package/templates/app/src/containers/Redirector/index.js +47 -0
- package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -0
- package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -0
- package/templates/app/src/historyChange.js +5 -0
- package/templates/app/src/index.html +10 -0
- package/templates/app/src/index.js +24 -0
- package/templates/app/src/middleware/PromiseMiddleware.js +59 -0
- package/templates/app/src/reducers/alertData.js +11 -0
- package/templates/app/src/reducers/index.js +6 -0
- package/templates/app/src/reducers/samples.js +19 -0
- package/templates/app/src/store/configureStore.dev.js +51 -0
- package/templates/app/src/store/configureStore.js +5 -0
- package/templates/app/src/store/configureStore.prod.js +26 -0
- package/templates/app/src/util/Common.js +5 -0
- package/templates/app/src/util/RequestAPI.js +132 -0
- package/templates/appold/README.md +12 -0
- package/templates/appold/app/index.html +8 -0
- package/templates/appold/app/properties/ApplicationResources_en_US.properties +1 -0
- package/templates/appold/app/properties/i18nkeys.json +3 -0
- package/templates/appold/docs/all.html +69 -0
- package/templates/appold/mockapi/index.js +13 -0
- package/templates/{app → appold}/mockapi/tickets.json +0 -0
- package/templates/appold/package.json +17 -0
- package/templates/appold/src/components/Text/Text.css +0 -0
- package/templates/appold/src/components/Text/Text.js +23 -0
- package/templates/appold/src/components/Text/__tests__/Text.spec.js +30 -0
- package/templates/appold/src/components/Text/docs/Text__default.docs.js +16 -0
- package/templates/appold/src/components/docs.js +1 -0
- package/templates/appold/src/components/index.js +5 -0
- package/templates/appold/src/index.js +13 -0
- package/templates/docs/all.html +1 -1
- package/templates/docs/component.html +110 -69
- package/templates/docs/components.html +221 -0
- package/templates/docs/css/component.css +12 -14
- package/templates/docs/css/componentTest.css +7 -0
- package/templates/docs/css/style.css +150 -206
- package/templates/docs/impactReportTemplate.html +154 -0
- package/templates/docs/index.html +1482 -1336
- package/templates/library/src/index.js +0 -0
@@ -0,0 +1,133 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.reinstallDependencies = exports.reinstallDependencies1 = exports.collectPackageDiff = void 0;
|
7
|
+
|
8
|
+
var _fs = _interopRequireDefault(require("fs"));
|
9
|
+
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
11
|
+
|
12
|
+
var _child_process = require("child_process");
|
13
|
+
|
14
|
+
var _gitRootDir = _interopRequireDefault(require("git-root-dir"));
|
15
|
+
|
16
|
+
var _index = require("./index");
|
17
|
+
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
|
+
|
20
|
+
let packageJsons = {};
|
21
|
+
|
22
|
+
let packageDiffChecker = (pre, current) => {
|
23
|
+
let {
|
24
|
+
dependencies = {},
|
25
|
+
devDependencies = {}
|
26
|
+
} = current;
|
27
|
+
let diffs = {};
|
28
|
+
Object.keys(dependencies).forEach(pack => {
|
29
|
+
let version = dependencies[pack];
|
30
|
+
|
31
|
+
if (version !== pre.dependencies && pre.dependencies[pack]) {
|
32
|
+
diffs[pack] = version;
|
33
|
+
}
|
34
|
+
});
|
35
|
+
Object.keys(devDependencies).forEach(pack => {
|
36
|
+
let version = devDependencies[pack];
|
37
|
+
|
38
|
+
if (version !== pre.devDependencies && pre.devDependencies[pack]) {
|
39
|
+
diffs[pack] = version;
|
40
|
+
}
|
41
|
+
});
|
42
|
+
return diffs;
|
43
|
+
};
|
44
|
+
|
45
|
+
let collectPackageDiff = pathToSubProjects => new Promise(resolve => {
|
46
|
+
(0, _gitRootDir.default)(process.cwd()).then(rootDir => {
|
47
|
+
let projects = _fs.default.readdirSync(_path.default.join(rootDir, pathToSubProjects));
|
48
|
+
|
49
|
+
projects.forEach(project => {
|
50
|
+
let packageJson = _path.default.join(_path.default.join(rootDir, pathToSubProjects), project, 'package.json');
|
51
|
+
|
52
|
+
if (_fs.default.existsSync(packageJson)) {
|
53
|
+
packageJsons[project] = require(packageJson);
|
54
|
+
}
|
55
|
+
});
|
56
|
+
resolve();
|
57
|
+
});
|
58
|
+
});
|
59
|
+
|
60
|
+
exports.collectPackageDiff = collectPackageDiff;
|
61
|
+
|
62
|
+
let reinstallDependencies1 = pathToSubProjects => {
|
63
|
+
(0, _gitRootDir.default)(process.cwd()).then(rootDir => {
|
64
|
+
let projects = _fs.default.readdirSync(_path.default.join(rootDir, pathToSubProjects));
|
65
|
+
|
66
|
+
projects.forEach(project => {
|
67
|
+
let prePackageJson = packageJsons[project];
|
68
|
+
let currentPackageJson;
|
69
|
+
|
70
|
+
if (prePackageJson) {
|
71
|
+
currentPackageJson = _path.default.join(_path.default.join(rootDir, pathToSubProjects), project, 'package.json');
|
72
|
+
|
73
|
+
if (_fs.default.existsSync(currentPackageJson)) {
|
74
|
+
currentPackageJson = require(currentPackageJson);
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
let projPath = _path.default.join(_path.default.join(rootDir, pathToSubProjects), project);
|
79
|
+
|
80
|
+
let diffs = packageDiffChecker(prePackageJson, currentPackageJson);
|
81
|
+
|
82
|
+
if (Object.keys(diffs).length) {
|
83
|
+
(0, _index.log)(diffs, `package diffs between branches for ${project} project`);
|
84
|
+
(0, _child_process.spawnSync)('rm', ['-rf', 'package-lock.json'], {
|
85
|
+
cwd: projPath,
|
86
|
+
stdio: 'inherit'
|
87
|
+
});
|
88
|
+
let packages = Object.keys(diffs);
|
89
|
+
let dummy = [];
|
90
|
+
|
91
|
+
for (let name of packages) {
|
92
|
+
let version = diffs[name];
|
93
|
+
dummy.push(`${name}@${version}`);
|
94
|
+
}
|
95
|
+
|
96
|
+
(0, _index.log)(`npm ${['install'].concat(dummy).join(' ')}`);
|
97
|
+
(0, _child_process.spawnSync)('npm', ['install'].concat(dummy), {
|
98
|
+
cwd: projPath,
|
99
|
+
stdio: 'inherit'
|
100
|
+
});
|
101
|
+
} else {
|
102
|
+
(0, _child_process.spawnSync)('rm', ['-rf', 'node_modules', 'package-lock.json'], {
|
103
|
+
cwd: projPath,
|
104
|
+
stdio: 'inherit'
|
105
|
+
});
|
106
|
+
(0, _child_process.spawnSync)('npm', ['install'], {
|
107
|
+
cwd: projPath,
|
108
|
+
stdio: 'inherit'
|
109
|
+
});
|
110
|
+
}
|
111
|
+
});
|
112
|
+
});
|
113
|
+
};
|
114
|
+
|
115
|
+
exports.reinstallDependencies1 = reinstallDependencies1;
|
116
|
+
|
117
|
+
let reinstallDependencies = pathToSubProjects => new Promise(resolve => {
|
118
|
+
(0, _gitRootDir.default)(process.cwd()).then(rootDir => {
|
119
|
+
let projects = _fs.default.readdirSync(_path.default.join(rootDir, pathToSubProjects));
|
120
|
+
|
121
|
+
projects.forEach(project => {
|
122
|
+
let projPath = _path.default.join(_path.default.join(rootDir, pathToSubProjects), project);
|
123
|
+
|
124
|
+
(0, _child_process.spawnSync)('npm', ['install'], {
|
125
|
+
cwd: projPath,
|
126
|
+
stdio: 'inherit'
|
127
|
+
});
|
128
|
+
resolve();
|
129
|
+
});
|
130
|
+
});
|
131
|
+
});
|
132
|
+
|
133
|
+
exports.reinstallDependencies = reinstallDependencies;
|
@@ -1,32 +1,34 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
|
-
var _getOptions = require(
|
4
|
-
|
5
|
-
var _getOptions2 = _interopRequireDefault(_getOptions);
|
3
|
+
var _getOptions = _interopRequireDefault(require("./getOptions"));
|
6
4
|
|
7
5
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
6
|
|
9
|
-
|
7
|
+
let options = (0, _getOptions.default)();
|
8
|
+
let {
|
9
|
+
app: {
|
10
|
+
attrbuteNames
|
11
|
+
}
|
12
|
+
} = options;
|
10
13
|
|
11
|
-
|
14
|
+
module.exports = () => ({
|
15
|
+
visitor: {
|
16
|
+
Program(path, state) {
|
17
|
+
let properties = state.opts.properties || [];
|
12
18
|
|
19
|
+
if (properties.length === 0) {
|
20
|
+
properties = properties.concat(attrbuteNames);
|
21
|
+
}
|
13
22
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
var properties = state.opts.properties || [];
|
19
|
-
if (properties.length === 0) {
|
20
|
-
properties = properties.concat(attrbuteNames);
|
21
|
-
}
|
22
|
-
path.traverse({
|
23
|
-
JSXIdentifier: function JSXIdentifier(path2) {
|
24
|
-
if (properties.indexOf(path2.node.name.toLowerCase()) > -1) {
|
25
|
-
path2.parentPath.remove();
|
26
|
-
}
|
23
|
+
path.traverse({
|
24
|
+
JSXIdentifier(path2) {
|
25
|
+
if (properties.indexOf(path2.node.name.toLowerCase()) > -1) {
|
26
|
+
path2.parentPath.remove();
|
27
27
|
}
|
28
|
-
}
|
29
|
-
|
28
|
+
}
|
29
|
+
|
30
|
+
});
|
30
31
|
}
|
31
|
-
|
32
|
-
}
|
32
|
+
|
33
|
+
}
|
34
|
+
});
|
package/lib/utils/repoClone.js
CHANGED
@@ -1,121 +1,115 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
|
-
var
|
3
|
+
var _os = require("os");
|
4
4
|
|
5
|
-
var
|
5
|
+
var _path = _interopRequireDefault(require("path"));
|
6
6
|
|
7
|
-
var
|
7
|
+
var _fs = _interopRequireDefault(require("fs"));
|
8
8
|
|
9
|
-
var
|
9
|
+
var _child_process = require("child_process");
|
10
10
|
|
11
|
-
var
|
12
|
-
|
13
|
-
var _fs2 = _interopRequireDefault(_fs);
|
14
|
-
|
15
|
-
var _child_process = require('child_process');
|
16
|
-
|
17
|
-
var _index = require('./index');
|
11
|
+
var _index = require("./index");
|
18
12
|
|
19
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20
14
|
|
21
|
-
|
15
|
+
function spawnSyncWithErrorLog(...args) {
|
16
|
+
let result = (0, _child_process.spawnSync)(...args);
|
22
17
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
revision = _options$clone.revision,
|
28
|
-
projectName = _options$clone.projectName,
|
29
|
-
cacheDir = _options$clone.cacheDir,
|
30
|
-
remoteName = _options$clone.remoteName,
|
31
|
-
shouldDelete = _options$clone.shouldDelete;
|
18
|
+
if (result.stderr) {
|
19
|
+
console.error(result.stderr);
|
20
|
+
}
|
21
|
+
}
|
32
22
|
|
23
|
+
let options = (0, _index.getOptions)();
|
24
|
+
let {
|
25
|
+
clone: {
|
26
|
+
type,
|
27
|
+
url,
|
28
|
+
branch,
|
29
|
+
revision,
|
30
|
+
projectName,
|
31
|
+
cacheDir,
|
32
|
+
remoteName,
|
33
|
+
shouldDelete
|
34
|
+
}
|
35
|
+
} = options;
|
33
36
|
|
34
37
|
if (type && (type === 'git' || type === 'hg')) {
|
35
|
-
(0, _index.log)(
|
38
|
+
(0, _index.log)(`Going to clone ${type} repository`);
|
36
39
|
} else {
|
37
40
|
throw new Error('You must give valid type to clone a repository');
|
38
41
|
}
|
39
42
|
|
40
43
|
if (!cacheDir) {
|
41
|
-
cacheDir =
|
44
|
+
cacheDir = _path.default.join((0, _os.homedir)(), '.react-cli');
|
42
45
|
} else {
|
43
|
-
cacheDir =
|
46
|
+
cacheDir = _path.default.join(process.cwd(), cacheDir);
|
44
47
|
}
|
45
48
|
|
46
49
|
if (!projectName) {
|
47
|
-
|
48
|
-
|
50
|
+
let {
|
51
|
+
name
|
52
|
+
} = _path.default.parse(url);
|
49
53
|
|
50
54
|
projectName = name;
|
51
55
|
}
|
52
56
|
|
53
|
-
|
57
|
+
let projectPath = _path.default.join(cacheDir, projectName);
|
54
58
|
|
55
|
-
|
56
|
-
if (!
|
57
|
-
|
59
|
+
let cloneRepo = () => {
|
60
|
+
if (!_fs.default.existsSync(cacheDir)) {
|
61
|
+
_fs.default.mkdirSync(cacheDir);
|
58
62
|
}
|
59
|
-
|
63
|
+
|
64
|
+
let revisionOrBranch;
|
60
65
|
|
61
66
|
if (type === 'git') {
|
62
|
-
revisionOrBranch =
|
67
|
+
revisionOrBranch = `-b${branch}`;
|
63
68
|
} else {
|
64
69
|
if (revision) {
|
65
|
-
revisionOrBranch =
|
70
|
+
revisionOrBranch = `-r${revision}`;
|
66
71
|
} else {
|
67
|
-
revisionOrBranch =
|
72
|
+
revisionOrBranch = `-b${branch}`;
|
68
73
|
}
|
69
74
|
}
|
70
|
-
|
71
|
-
(0,
|
75
|
+
|
76
|
+
(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
|
77
|
+
|
78
|
+
spawnSyncWithErrorLog(type, ['clone', url, revisionOrBranch, projectName], {
|
72
79
|
cwd: cacheDir,
|
73
80
|
stdio: 'inherit'
|
74
81
|
});
|
75
82
|
|
76
|
-
|
77
|
-
_fs2.default.writeFileSync(_path2.default.join(projectPath, '.hg', 'remoteUrl'), url);
|
78
|
-
}
|
83
|
+
_fs.default.writeFileSync(_path.default.join(projectPath, type === 'hg' ? '.hg' : '.git', 'remoteUrl'), url);
|
79
84
|
|
80
85
|
(0, _index.log)('Repository cloned!');
|
81
86
|
};
|
82
87
|
|
83
|
-
|
84
|
-
|
85
|
-
var results = (0, _child_process.spawnSync)('git', ['config --get remote.' + remoteName + '.url'], {
|
86
|
-
cwd: projectPath,
|
87
|
-
stdio: 'inherit'
|
88
|
-
});
|
89
|
-
|
90
|
-
var _results$output$filte = results.output.filter(function (d) {
|
91
|
-
return d;
|
92
|
-
}),
|
93
|
-
_results$output$filte2 = _slicedToArray(_results$output$filte, 1),
|
94
|
-
_remoteUrl = _results$output$filte2[0];
|
88
|
+
let getRemoteURL = () => {
|
89
|
+
let remoteUrl = _fs.default.readFileSync(_path.default.join(projectPath, type === 'hg' ? '.hg' : '.git', 'remoteUrl')).toString();
|
95
90
|
|
96
|
-
return _remoteUrl.replace(/(\r\n|\n|\r)/gm, '').trim();
|
97
|
-
}
|
98
|
-
var remoteUrl = _fs2.default.readFileSync(_path2.default.join(projectPath, '.hg', 'remoteUrl')).toString();
|
99
91
|
return remoteUrl.trim();
|
100
92
|
};
|
101
93
|
|
102
|
-
if (
|
103
|
-
|
94
|
+
if (_fs.default.existsSync(projectPath)) {
|
95
|
+
let remoteUrl = getRemoteURL();
|
104
96
|
|
105
97
|
if (remoteUrl === url) {
|
106
98
|
if (type === 'git') {
|
107
|
-
(
|
99
|
+
spawnSyncWithErrorLog(type, ['pull', remoteName, branch], {
|
108
100
|
cwd: projectPath,
|
109
101
|
stdio: 'inherit'
|
110
102
|
});
|
111
103
|
} else {
|
112
|
-
|
104
|
+
let revisionOrBranch;
|
105
|
+
|
113
106
|
if (revision) {
|
114
|
-
revisionOrBranch =
|
107
|
+
revisionOrBranch = `-r${revision}`;
|
115
108
|
} else {
|
116
|
-
revisionOrBranch =
|
109
|
+
revisionOrBranch = `-b${branch}`;
|
117
110
|
}
|
118
|
-
|
111
|
+
|
112
|
+
spawnSyncWithErrorLog(type, ['pull', revisionOrBranch, '-u', url], {
|
119
113
|
cwd: projectPath,
|
120
114
|
stdio: 'inherit'
|
121
115
|
});
|
@@ -125,7 +119,6 @@ if (_fs2.default.existsSync(projectPath)) {
|
|
125
119
|
cwd: cacheDir,
|
126
120
|
stdio: 'inherit'
|
127
121
|
});
|
128
|
-
|
129
122
|
(0, _index.log)('Existing repository deleted!');
|
130
123
|
cloneRepo();
|
131
124
|
}
|
package/lib/utils/request.js
CHANGED
@@ -1,93 +1,80 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
|
-
|
4
|
-
var http = require('http');
|
5
|
-
var url = require('url');
|
6
|
-
var querystring = require('querystring');
|
3
|
+
const https = require('https');
|
7
4
|
|
8
|
-
|
9
|
-
return data && data.toString && data.toString() === '[object Object]';
|
10
|
-
};
|
5
|
+
const http = require('http');
|
11
6
|
|
12
|
-
|
13
|
-
return data && Array.isArray(data);
|
14
|
-
};
|
7
|
+
const url = require('url');
|
15
8
|
|
16
|
-
|
9
|
+
const querystring = require('querystring');
|
17
10
|
|
18
|
-
|
19
|
-
return function (res) {
|
20
|
-
res.setEncoding('utf8');
|
21
|
-
var str = '';
|
11
|
+
let isObject = data => data && data.toString && data.toString() === '[object Object]';
|
22
12
|
|
23
|
-
|
24
|
-
str += chunk;
|
25
|
-
});
|
13
|
+
let isArray = data => data && Array.isArray(data);
|
26
14
|
|
27
|
-
|
28
|
-
resolve({
|
29
|
-
body: str,
|
30
|
-
response: res
|
31
|
-
});
|
32
|
-
});
|
15
|
+
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
33
16
|
|
34
|
-
|
35
|
-
|
17
|
+
let callback = resolve => res => {
|
18
|
+
res.setEncoding('utf8');
|
19
|
+
let str = '';
|
20
|
+
res.on('data', chunk => {
|
21
|
+
str += chunk;
|
22
|
+
});
|
23
|
+
res.on('end', () => {
|
24
|
+
resolve({
|
25
|
+
body: str,
|
26
|
+
response: res
|
36
27
|
});
|
37
|
-
};
|
28
|
+
});
|
29
|
+
res.on('error', err => {
|
30
|
+
process.stdout.write(err);
|
31
|
+
});
|
38
32
|
};
|
39
33
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
payload = JSON.stringify(payload);
|
76
|
-
req.write(payload);
|
77
|
-
} else if (isObject(formdata)) {
|
78
|
-
formdata = querystring.stringify(formdata);
|
79
|
-
req.write(formdata);
|
80
|
-
}
|
34
|
+
let request = options => new Promise((resolve, reject) => {
|
35
|
+
let {
|
36
|
+
protocol,
|
37
|
+
hostname,
|
38
|
+
path,
|
39
|
+
port
|
40
|
+
} = url.parse(options.url);
|
41
|
+
let {
|
42
|
+
method = 'GET',
|
43
|
+
headers = {},
|
44
|
+
payload = null,
|
45
|
+
formdata = null
|
46
|
+
} = options;
|
47
|
+
let newOptions = {
|
48
|
+
host: hostname,
|
49
|
+
port: port,
|
50
|
+
path: path,
|
51
|
+
method: method,
|
52
|
+
headers: headers
|
53
|
+
};
|
54
|
+
let req;
|
55
|
+
|
56
|
+
if (protocol === 'https:') {
|
57
|
+
req = https.request(newOptions, callback(resolve));
|
58
|
+
} else if (protocol === 'http:') {
|
59
|
+
req = http.request(newOptions, callback(resolve));
|
60
|
+
}
|
61
|
+
|
62
|
+
if (method.toUpperCase() === 'POST') {
|
63
|
+
if (isObject(payload) || isArray(payload)) {
|
64
|
+
payload = JSON.stringify(payload);
|
65
|
+
req.write(payload);
|
66
|
+
} else if (isObject(formdata)) {
|
67
|
+
formdata = querystring.stringify(formdata);
|
68
|
+
req.write(formdata);
|
81
69
|
}
|
70
|
+
}
|
82
71
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
});
|
88
|
-
|
89
|
-
req.end();
|
72
|
+
req.on('error', err => {
|
73
|
+
//eslint-disable-next-line
|
74
|
+
console.log(err);
|
75
|
+
reject();
|
90
76
|
});
|
91
|
-
|
77
|
+
req.end();
|
78
|
+
});
|
92
79
|
|
93
80
|
module.exports = request;
|
@@ -0,0 +1,73 @@
|
|
1
|
+
{
|
2
|
+
"jobDetails": {
|
3
|
+
"isTriggeredFromGit": true,
|
4
|
+
"isCIPassed": true,
|
5
|
+
"developerName": "GITLAB_USER_NAME",
|
6
|
+
"jobID": "CI_PIPELINE_ID",
|
7
|
+
"branchName": "CI_COMMIT_REF_NAME",
|
8
|
+
"commitMessage": "CI_COMMIT_MESSAGE",
|
9
|
+
"jobURL": "CI_JOB_URL",
|
10
|
+
"isByManual": "CI_JOB_MANUAL",
|
11
|
+
"commitID": "CI_COMMIT_SHA",
|
12
|
+
"executionTime": "Date.now()-Date.now()",
|
13
|
+
"hostName": "kathir-zt252"
|
14
|
+
},
|
15
|
+
"tests": {
|
16
|
+
"unitCase": {
|
17
|
+
"startTime": "123455",
|
18
|
+
"endTime": "123446",
|
19
|
+
"isExecuted": true,
|
20
|
+
"numberOfSuccess": "",
|
21
|
+
"numberOfFails": "",
|
22
|
+
"numberOfCases": "",
|
23
|
+
"numberOfSuites": "",
|
24
|
+
"fileDetail": {
|
25
|
+
"fileName": "sample.spec.js",
|
26
|
+
"caseDetail": {
|
27
|
+
"failedCaseLists": [],
|
28
|
+
"passedCaseList": []
|
29
|
+
}
|
30
|
+
},
|
31
|
+
"coverageDetail": {
|
32
|
+
"codeCoveragePercentage": "",
|
33
|
+
"fileCoveragePercentage": ""
|
34
|
+
}
|
35
|
+
},
|
36
|
+
"modifiedFileUnitCase": {
|
37
|
+
"hasChanges": "true",
|
38
|
+
"startTime": "123455",
|
39
|
+
"endTime": "123446",
|
40
|
+
"isExecuted": true,
|
41
|
+
"isPassed": true,
|
42
|
+
"numberOfSuccess": "",
|
43
|
+
"numberOfFails": "",
|
44
|
+
"numberOfCases": "",
|
45
|
+
"numberOfSuites": "",
|
46
|
+
"fileDetail": {
|
47
|
+
"fileName": "sample.spec.js",
|
48
|
+
"caseDetail": {
|
49
|
+
"failedCaseLists": [],
|
50
|
+
"passedCaseList": []
|
51
|
+
}
|
52
|
+
},
|
53
|
+
"coverageDetail": {
|
54
|
+
"codeCoveragePercentage": "",
|
55
|
+
"fileCoveragePercentage": ""
|
56
|
+
}
|
57
|
+
},
|
58
|
+
"screenshotTest": {
|
59
|
+
"message": "some",
|
60
|
+
"startTime": "123455",
|
61
|
+
"endTime": "123446",
|
62
|
+
"isThisExecuted": true,
|
63
|
+
"compareBranch": "master",
|
64
|
+
"isPassed": true,
|
65
|
+
"result": {
|
66
|
+
"numberOfComponents": 200,
|
67
|
+
"numberOfDiffFiles": 20,
|
68
|
+
"improperDocsList": [],
|
69
|
+
"erroredComponents": []
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
package/lib/utils/rtl.js
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _postcss = _interopRequireDefault(require("postcss"));
|
4
|
+
|
5
|
+
var _path = _interopRequireDefault(require("path"));
|
6
|
+
|
7
|
+
var _fs = _interopRequireDefault(require("fs"));
|
8
|
+
|
9
|
+
var _folderIterator = _interopRequireDefault(require("./folderIterator"));
|
10
|
+
|
11
|
+
var _postcssRtl = _interopRequireDefault(require("@zohodesk/postcss-rtl"));
|
12
|
+
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
|
+
|
15
|
+
let cwd = process.cwd();
|
16
|
+
|
17
|
+
let src = _path.default.join(cwd, process.argv[2]);
|
18
|
+
|
19
|
+
let dist = _path.default.join(cwd, process.argv[3]);
|
20
|
+
|
21
|
+
(0, _folderIterator.default)(src, dist, ['.css'], false, (fromPath, toPath) => {
|
22
|
+
let css = _fs.default.readFileSync(fromPath);
|
23
|
+
|
24
|
+
(0, _postcss.default)([(0, _postcssRtl.default)({
|
25
|
+
addPrefixToSelector: function addPrefixToSelector(selector, prefix) {
|
26
|
+
if (prefix === '[dir]') {
|
27
|
+
return selector;
|
28
|
+
}
|
29
|
+
|
30
|
+
return `${prefix} ${selector}`; // Make selectors like [dir=rtl] > .selector
|
31
|
+
}
|
32
|
+
})]).process(css, {
|
33
|
+
from: fromPath,
|
34
|
+
to: toPath
|
35
|
+
}).then(result => {
|
36
|
+
_fs.default.writeFile(toPath, result.css, () => true);
|
37
|
+
|
38
|
+
if (result.map) {
|
39
|
+
_fs.default.writeFile(`${toPath}.map`, result.map, () => true);
|
40
|
+
}
|
41
|
+
});
|
42
|
+
});
|
@@ -1,14 +1,13 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
|
-
var _child_process = require(
|
3
|
+
var _child_process = require("child_process");
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
args.forEach(function (arg) {
|
5
|
+
let args = process.argv.slice(2);
|
6
|
+
args.forEach(arg => {
|
8
7
|
if (arg.startsWith('-')) {
|
9
8
|
//eslint-disable-next-line
|
10
9
|
arg = arg.substring(2);
|
11
10
|
}
|
12
11
|
|
13
|
-
(0, _child_process.execSync)(
|
12
|
+
(0, _child_process.execSync)(`npm config set ${arg}`);
|
14
13
|
});
|