@zohodesk/react-cli 0.0.1-beta.17 → 0.0.1-beta.170
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 +49 -10
- package/.prettierrc +6 -0
- package/CHANGELOG.md +5 -0
- package/README.md +855 -0
- package/bin/cli.js +215 -46
- package/cert/Tsicsezwild-22-23.crt +37 -0
- package/cert/Tsicsezwild-22-23.key +27 -0
- package/docs/CustomChunks.md +26 -0
- package/docs/DevStart.md +18 -0
- package/docs/HoverActive.md +12 -0
- package/docs/InstallNode.md +28 -0
- package/docs/TODOS.md +10 -0
- package/docs/ValueReplacer.md +60 -0
- package/docs/warnings_while_install.txt +35 -0
- package/files/eslintrc.js +62 -0
- package/files/prettierrc.js +3 -0
- package/lib/babel/cmjs-plugins-presets.js +24 -0
- package/lib/babel/es-plugins-presets.js +34 -0
- package/lib/common/getEntries.js +33 -46
- package/lib/common/getPublicPathConfig.js +40 -0
- package/lib/common/index.js +24 -19
- package/lib/common/splitChunks.js +110 -25
- package/lib/common/sslcertUpdater.js +59 -0
- package/lib/common/templateParameters.js +25 -0
- package/lib/common/testPattern.js +69 -0
- package/lib/common/valueReplacer.js +55 -0
- package/lib/configs/jest.config.js +31 -27
- package/lib/configs/libAlias.js +31 -0
- package/lib/configs/webpack.component.umd.config.js +46 -53
- package/lib/configs/webpack.css.umd.config.js +47 -46
- package/lib/configs/webpack.dev.config.js +98 -84
- package/lib/configs/webpack.docs.config.js +64 -57
- package/lib/configs/webpack.impact.config.js +108 -0
- package/lib/configs/webpack.prod.config.js +146 -104
- package/lib/hooks/docsProptypeHook.js +32 -38
- package/lib/jest/commitedFilesResult.js +144 -71
- package/lib/jest/coverageCollector.js +68 -35
- 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 +92 -42
- package/lib/jest/run.js +75 -28
- package/lib/jest/setup.js +103 -102
- package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
- package/lib/loaderUtils/getCSSLoaders.js +113 -0
- package/lib/loaderUtils/getDevJsLoaders.js +35 -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 +23 -20
- package/lib/loaders/selectorMappingLoader.js +75 -0
- package/lib/loaders/workerLoader.js +136 -0
- package/lib/middlewares/HMRMiddleware.js +90 -72
- package/lib/middlewares/SSTMiddleware.js +21 -0
- package/lib/pluginUtils/getDevPlugins.js +177 -30
- package/lib/pluginUtils/getDocsPlugins.js +36 -15
- package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
- package/lib/pluginUtils/getLibraryPlugins.js +8 -10
- package/lib/pluginUtils/getProdPlugins.js +244 -37
- package/lib/pluginUtils/getServerPlugins.js +8 -11
- package/lib/pluginUtils/getUMDCSSPlugins.js +14 -18
- package/lib/pluginUtils/getUMDComponentPlugins.js +14 -9
- 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 +241 -0
- package/lib/plugins/EFCPlugin.md +6 -0
- package/lib/plugins/EFCTemplatePlugin.js +151 -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 +95 -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 +86 -0
- package/lib/plugins/ModuleStatsPlugin.js +98 -97
- package/lib/plugins/OptimizeJSPlugin.js +41 -0
- package/lib/plugins/PublicPathCallbackPlugin.js +63 -0
- package/lib/plugins/PublicPathChangePlugin.js +226 -0
- package/lib/plugins/ReportGeneratePlugin.js +181 -0
- package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
- package/lib/plugins/ResourceHintsPlugin.js +67 -0
- 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 -59
- package/lib/plugins/TPHashMappingPlugin.js +67 -0
- package/lib/plugins/UglifyCSSPlugin.js +39 -0
- package/lib/plugins/UnusedFilesFindPlugin.js +150 -97
- package/lib/plugins/index.js +127 -37
- package/lib/plugins/libraryImpactPlugin.js +190 -0
- package/lib/plugins/webpackwatchrunplugin.js +26 -0
- package/lib/postcss-plugins/ExcludePlugin.js +23 -0
- package/lib/postcss-plugins/RTLSplitPlugin.js +138 -0
- package/lib/postcss-plugins/ValueReplacer.js +46 -0
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
- package/lib/postcss-plugins/__test__/test1Input.css +39 -0
- package/lib/postcss-plugins/__test__/test1Output.css +39 -0
- package/lib/postcss-plugins/hoverActivePlugin.js +365 -0
- package/lib/postcss-plugins/variableModifier.js +243 -0
- package/lib/schemas/index.js +534 -66
- package/lib/servers/clusterHubServer.js +22 -26
- package/lib/servers/devBuild.js +102 -0
- package/lib/servers/docsServer.js +3 -5
- package/lib/servers/docsServerCore.js +94 -79
- package/lib/servers/getCliPath.js +28 -0
- package/lib/servers/helpServer.js +19 -21
- package/lib/servers/httpsOptions.js +18 -0
- package/lib/servers/impactServer.js +123 -115
- package/lib/servers/mockserver.js +44 -0
- package/lib/servers/nowatchserver.js +200 -0
- package/lib/servers/scrServer.js +147 -0
- package/lib/servers/server.js +134 -132
- package/lib/servers/ssServer.js +106 -70
- 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 -4
- package/lib/utils/buildstats.html +148 -0
- package/lib/utils/clean.js +12 -11
- package/lib/utils/copy.js +16 -109
- package/lib/utils/copyTimezones.js +21 -0
- package/lib/utils/createEventStream.js +24 -19
- package/lib/utils/cssClassNameGenerate.js +77 -0
- package/lib/utils/cssURLReplacer.js +136 -0
- 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 +113 -28
- package/lib/utils/getServerURL.js +25 -8
- package/lib/utils/index.js +283 -68
- package/lib/utils/init.js +2 -2
- package/lib/utils/initPreCommitHook.js +47 -27
- package/lib/utils/jsonHelper.js +106 -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 +59 -63
- package/lib/utils/request.js +64 -77
- package/lib/utils/resultSchema.json +73 -0
- package/lib/utils/rtl.js +59 -0
- package/lib/utils/setEnvVariables.js +13 -0
- package/lib/utils/ssTestHack.js +48 -0
- package/lib/utils/switchBranch.js +28 -0
- package/lib/utils/urlConcat.js +22 -0
- package/lib/utils/useExitCleanup.js +55 -0
- package/npm8.md +9 -0
- package/package.json +96 -64
- package/postpublish.js +6 -0
- 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
- package/.npmignore +0 -3
- package/cert/cert.pem +0 -129
- package/cert/key.pem +0 -27
- package/lib/common/getInsertAt.js +0 -36
- package/lib/common/getInsertIntoFunction.js +0 -13
- package/lib/configs/webpack.server.config.js +0 -93
- package/lib/plugins/ChunkManifestReplacePlugin.js +0 -94
- package/lib/plugins/RuntimePublicPathPlugin.js +0 -46
- package/lib/rmcntrlm.sh +0 -14
- package/lib/servers/nodeServer.js +0 -238
- package/lib/templates/HMRTemplate.js +0 -256
- package/lib/templates/publicPathTemplate.js +0 -16
- package/lib/utils/setConfig.js +0 -14
- package/node_modules/history/CHANGES.md +0 -395
- package/node_modules/history/DOMUtils.js +0 -3
- package/node_modules/history/ExecutionEnvironment.js +0 -3
- package/node_modules/history/LICENSE +0 -21
- package/node_modules/history/LocationUtils.js +0 -3
- package/node_modules/history/PathUtils.js +0 -3
- package/node_modules/history/README.md +0 -282
- package/node_modules/history/cjs/history.js +0 -933
- package/node_modules/history/cjs/history.min.js +0 -1
- package/node_modules/history/createBrowserHistory.js +0 -3
- package/node_modules/history/createHashHistory.js +0 -3
- package/node_modules/history/createMemoryHistory.js +0 -3
- package/node_modules/history/createTransitionManager.js +0 -3
- package/node_modules/history/es/DOMUtils.js +0 -7
- package/node_modules/history/es/ExecutionEnvironment.js +0 -7
- package/node_modules/history/es/LocationUtils.js +0 -7
- package/node_modules/history/es/PathUtils.js +0 -7
- package/node_modules/history/es/createBrowserHistory.js +0 -7
- package/node_modules/history/es/createHashHistory.js +0 -7
- package/node_modules/history/es/createMemoryHistory.js +0 -7
- package/node_modules/history/es/createTransitionManager.js +0 -7
- package/node_modules/history/es/warnAboutDeprecatedESMImport.js +0 -35
- package/node_modules/history/esm/history.js +0 -904
- package/node_modules/history/index.js +0 -7
- package/node_modules/history/package.json +0 -134
- package/node_modules/history/umd/history.js +0 -1059
- package/node_modules/history/umd/history.min.js +0 -1
- package/node_modules/history/warnAboutDeprecatedCJSRequire.js +0 -35
- package/templates/app/.npmignore +0 -9
- package/templates/library/.npmignore +0 -9
package/lib/utils/repoClone.js
CHANGED
@@ -1,121 +1,118 @@
|
|
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
|
+
shallowClone,
|
32
|
+
cacheDir,
|
33
|
+
remoteName,
|
34
|
+
shouldDelete
|
35
|
+
}
|
36
|
+
} = options;
|
33
37
|
|
34
38
|
if (type && (type === 'git' || type === 'hg')) {
|
35
|
-
(0, _index.log)(
|
39
|
+
(0, _index.log)(`Going to clone ${type} repository`);
|
36
40
|
} else {
|
37
41
|
throw new Error('You must give valid type to clone a repository');
|
38
42
|
}
|
39
43
|
|
40
44
|
if (!cacheDir) {
|
41
|
-
cacheDir =
|
45
|
+
cacheDir = _path.default.join((0, _os.homedir)(), '.react-cli');
|
42
46
|
} else {
|
43
|
-
cacheDir =
|
47
|
+
cacheDir = _path.default.join(process.cwd(), cacheDir);
|
44
48
|
}
|
45
49
|
|
46
50
|
if (!projectName) {
|
47
|
-
|
48
|
-
|
51
|
+
let {
|
52
|
+
name
|
53
|
+
} = _path.default.parse(url);
|
49
54
|
|
50
55
|
projectName = name;
|
51
56
|
}
|
52
57
|
|
53
|
-
|
58
|
+
let projectPath = _path.default.join(cacheDir, projectName);
|
54
59
|
|
55
|
-
|
56
|
-
if (!
|
57
|
-
|
60
|
+
let cloneRepo = () => {
|
61
|
+
if (!_fs.default.existsSync(cacheDir)) {
|
62
|
+
_fs.default.mkdirSync(cacheDir);
|
58
63
|
}
|
59
|
-
|
64
|
+
|
65
|
+
let revisionOrBranch;
|
60
66
|
|
61
67
|
if (type === 'git') {
|
62
|
-
revisionOrBranch =
|
68
|
+
revisionOrBranch = `-b${branch}`;
|
63
69
|
} else {
|
64
70
|
if (revision) {
|
65
|
-
revisionOrBranch =
|
71
|
+
revisionOrBranch = `-r${revision}`;
|
66
72
|
} else {
|
67
|
-
revisionOrBranch =
|
73
|
+
revisionOrBranch = `-b${branch}`;
|
68
74
|
}
|
69
75
|
}
|
70
|
-
|
71
|
-
(0,
|
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
|
+
|
79
|
+
let oargs = ['clone', url, revisionOrBranch, projectName];
|
80
|
+
type === 'git' && shallowClone && oargs.push('--depth=1');
|
81
|
+
spawnSyncWithErrorLog(type, oargs, {
|
72
82
|
cwd: cacheDir,
|
73
83
|
stdio: 'inherit'
|
74
84
|
});
|
75
85
|
|
76
|
-
|
77
|
-
_fs2.default.writeFileSync(_path2.default.join(projectPath, '.hg', 'remoteUrl'), url);
|
78
|
-
}
|
86
|
+
_fs.default.writeFileSync(_path.default.join(projectPath, type === 'hg' ? '.hg' : '.git', 'remoteUrl'), url);
|
79
87
|
|
80
88
|
(0, _index.log)('Repository cloned!');
|
81
89
|
};
|
82
90
|
|
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];
|
91
|
+
let getRemoteURL = () => {
|
92
|
+
let remoteUrl = _fs.default.readFileSync(_path.default.join(projectPath, type === 'hg' ? '.hg' : '.git', 'remoteUrl')).toString();
|
95
93
|
|
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
94
|
return remoteUrl.trim();
|
100
95
|
};
|
101
96
|
|
102
|
-
if (
|
103
|
-
|
97
|
+
if (_fs.default.existsSync(projectPath)) {
|
98
|
+
let remoteUrl = getRemoteURL();
|
104
99
|
|
105
100
|
if (remoteUrl === url) {
|
106
101
|
if (type === 'git') {
|
107
|
-
(
|
102
|
+
spawnSyncWithErrorLog(type, ['pull', remoteName, branch], {
|
108
103
|
cwd: projectPath,
|
109
104
|
stdio: 'inherit'
|
110
105
|
});
|
111
106
|
} else {
|
112
|
-
|
107
|
+
let revisionOrBranch;
|
108
|
+
|
113
109
|
if (revision) {
|
114
|
-
revisionOrBranch =
|
110
|
+
revisionOrBranch = `-r${revision}`;
|
115
111
|
} else {
|
116
|
-
revisionOrBranch =
|
112
|
+
revisionOrBranch = `-b${branch}`;
|
117
113
|
}
|
118
|
-
|
114
|
+
|
115
|
+
spawnSyncWithErrorLog(type, ['pull', revisionOrBranch, '-u', url], {
|
119
116
|
cwd: projectPath,
|
120
117
|
stdio: 'inherit'
|
121
118
|
});
|
@@ -125,7 +122,6 @@ if (_fs2.default.existsSync(projectPath)) {
|
|
125
122
|
cwd: cacheDir,
|
126
123
|
stdio: 'inherit'
|
127
124
|
});
|
128
|
-
|
129
125
|
(0, _index.log)('Existing repository deleted!');
|
130
126
|
cloneRepo();
|
131
127
|
}
|
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,59 @@
|
|
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
|
+
let canWacth = '-w' === process.argv[4];
|
22
|
+
|
23
|
+
// import { useExitCleanup } from './useExitCleanup';
|
24
|
+
function watchHandler(fromPath, toPath) {
|
25
|
+
let css = _fs.default.readFileSync(fromPath);
|
26
|
+
|
27
|
+
(0, _postcss.default)([(0, _postcssRtl.default)({
|
28
|
+
addPrefixToSelector: function addPrefixToSelector(selector, prefix) {
|
29
|
+
if (prefix === '[dir]') {
|
30
|
+
return selector;
|
31
|
+
}
|
32
|
+
|
33
|
+
return `${prefix} ${selector}`; // Make selectors like [dir=rtl] > .selector
|
34
|
+
}
|
35
|
+
})]).process(css, {
|
36
|
+
from: fromPath,
|
37
|
+
to: toPath
|
38
|
+
}).then(result => {
|
39
|
+
_fs.default.writeFile(toPath, result.css, () => true);
|
40
|
+
|
41
|
+
if (result.map) {
|
42
|
+
_fs.default.writeFile(`${toPath}.map`, result.map, () => true);
|
43
|
+
}
|
44
|
+
});
|
45
|
+
}
|
46
|
+
|
47
|
+
(0, _folderIterator.default)(src, dist, ['.css'], false, (fromPath, toPath) => {
|
48
|
+
if (canWacth && fromPath) {
|
49
|
+
_fs.default.watchFile(fromPath, () => {
|
50
|
+
watchHandler(fromPath, toPath);
|
51
|
+
});
|
52
|
+
}
|
53
|
+
|
54
|
+
watchHandler(fromPath, toPath);
|
55
|
+
}); // if (canWacth) {
|
56
|
+
// useExitCleanup(() => {
|
57
|
+
// fs.unwatchFile(src, watchHandler);
|
58
|
+
// });
|
59
|
+
// }
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _child_process = require("child_process");
|
4
|
+
|
5
|
+
let args = process.argv.slice(2);
|
6
|
+
args.forEach(arg => {
|
7
|
+
if (arg.startsWith('-')) {
|
8
|
+
//eslint-disable-next-line
|
9
|
+
arg = arg.substring(2);
|
10
|
+
}
|
11
|
+
|
12
|
+
(0, _child_process.execSync)(`npm config set ${arg}`);
|
13
|
+
});
|
@@ -0,0 +1,48 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _fs = _interopRequireDefault(require("fs"));
|
9
|
+
|
10
|
+
var _path = _interopRequireDefault(require("path"));
|
11
|
+
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
14
|
+
function iterateDir(srcPath, callback) {
|
15
|
+
function iterate(srcPath) {
|
16
|
+
if (_fs.default.existsSync(srcPath)) {
|
17
|
+
_fs.default.readdirSync(srcPath).forEach(fileOrDir => {
|
18
|
+
let fromPath = _path.default.join(srcPath, fileOrDir);
|
19
|
+
|
20
|
+
if (_fs.default.statSync(fromPath).isDirectory()) {
|
21
|
+
iterate(fromPath);
|
22
|
+
} else {
|
23
|
+
callback(fromPath);
|
24
|
+
}
|
25
|
+
});
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
iterate(srcPath);
|
30
|
+
}
|
31
|
+
|
32
|
+
var _default = () => {
|
33
|
+
let dependencyFolders = [_path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'components', 'lib'), _path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'dot', 'lib'), _path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'icons', 'lib'), _path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'svg', 'lib'), _path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'variables', 'lib')];
|
34
|
+
let pattern = /if.*\(false\)/g;
|
35
|
+
dependencyFolders.forEach(componentsFolder => {
|
36
|
+
iterateDir(componentsFolder, filepath => {
|
37
|
+
let src = _fs.default.readFileSync(filepath).toString();
|
38
|
+
|
39
|
+
if (pattern.test(src)) {
|
40
|
+
src = src.replace(pattern, 'if (true)');
|
41
|
+
|
42
|
+
_fs.default.writeFileSync(filepath, src);
|
43
|
+
}
|
44
|
+
});
|
45
|
+
});
|
46
|
+
};
|
47
|
+
|
48
|
+
exports.default = _default;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
|
8
|
+
var _child_process = require("child_process");
|
9
|
+
|
10
|
+
var _utils = require("../utils");
|
11
|
+
|
12
|
+
var _default = (type = 'git', branchName) => new Promise(resolve => {
|
13
|
+
if (type === 'git') {
|
14
|
+
(0, _utils.log)((0, _utils.getCurrentBranch)(type, process.cwd()), 'Before the branch switch');
|
15
|
+
(0, _child_process.spawnSync)('git', ['checkout', branchName, '--force'], {
|
16
|
+
encoding: 'utf8'
|
17
|
+
});
|
18
|
+
(0, _utils.log)((0, _utils.getCurrentBranch)(type, process.cwd()), 'After the branch switch');
|
19
|
+
(0, _utils.pullOrigin)(type, branchName).then(resolve);
|
20
|
+
} else if (type === 'hg') {
|
21
|
+
(0, _child_process.spawnSync)('hg', ['update', branchName], {
|
22
|
+
encoding: 'utf8'
|
23
|
+
});
|
24
|
+
(0, _utils.pullOrigin)(type, branchName).then(resolve);
|
25
|
+
}
|
26
|
+
});
|
27
|
+
|
28
|
+
exports.default = _default;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.urlConcat = urlConcat;
|
7
|
+
|
8
|
+
function urlConcat(p1 = '', p2 = '') {
|
9
|
+
if (p1[p1.length - 1] === '/') {
|
10
|
+
if (p2[0] === '/') {
|
11
|
+
return p1 + p2.slice(1);
|
12
|
+
}
|
13
|
+
|
14
|
+
return p1 + p2;
|
15
|
+
}
|
16
|
+
|
17
|
+
if (p2[0] === '/') {
|
18
|
+
return p1 + p2;
|
19
|
+
}
|
20
|
+
|
21
|
+
return `${p1}/${p2}`;
|
22
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useExitCleanup = useExitCleanup;
|
7
|
+
//so the program will not close instantly
|
8
|
+
let listeners = [];
|
9
|
+
let hasCalled = false;
|
10
|
+
|
11
|
+
function useExitCleanup(listener) {
|
12
|
+
if (!hasCalled) {
|
13
|
+
process.stdin.resume();
|
14
|
+
hasCalled = true;
|
15
|
+
}
|
16
|
+
|
17
|
+
listeners.push(listeners);
|
18
|
+
return () => {
|
19
|
+
listeners = listeners.filter(l => l !== listener);
|
20
|
+
};
|
21
|
+
}
|
22
|
+
|
23
|
+
function exitHandler(options, exitCode) {
|
24
|
+
if (options.cleanup) {
|
25
|
+
console.log('clean');
|
26
|
+
}
|
27
|
+
|
28
|
+
if (exitCode || exitCode === 0) {
|
29
|
+
console.log(exitCode);
|
30
|
+
}
|
31
|
+
|
32
|
+
if (options.exit) {
|
33
|
+
process.exit();
|
34
|
+
}
|
35
|
+
} //do something when app is closing
|
36
|
+
|
37
|
+
|
38
|
+
process.on('exit', exitHandler.bind(null, {
|
39
|
+
cleanup: true
|
40
|
+
})); //catches ctrl+c event
|
41
|
+
|
42
|
+
process.on('SIGINT', exitHandler.bind(null, {
|
43
|
+
exit: true
|
44
|
+
})); // catches "kill pid" (for example: nodemon restart)
|
45
|
+
|
46
|
+
process.on('SIGUSR1', exitHandler.bind(null, {
|
47
|
+
exit: true
|
48
|
+
}));
|
49
|
+
process.on('SIGUSR2', exitHandler.bind(null, {
|
50
|
+
exit: true
|
51
|
+
})); //catches uncaught exceptions
|
52
|
+
|
53
|
+
process.on('uncaughtException', exitHandler.bind(null, {
|
54
|
+
exit: true
|
55
|
+
}));
|
package/npm8.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# npm 8 change related things
|
2
|
+
|
3
|
+
1. in npm run script config options `:` not working (properly|correctly), So we need to use `_` in the place of `:`
|
4
|
+
For Example:
|
5
|
+
- `--app:port` wouldn't work we have to do like this `--app_port`
|
6
|
+
- `--clone:proj:name` wouldn't work we have to do like this `----clone_proj_name`
|
7
|
+
|
8
|
+
@zohodes/react-cli or fz-react-cli regardless of what cli you use.
|
9
|
+
So, we need to change all package.json script which is using this (`:`) we need to change as (`_`)
|