@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
@@ -1,46 +1,42 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
|
-
var _path = require(
|
3
|
+
var _path = _interopRequireDefault(require("path"));
|
4
4
|
|
5
|
-
var
|
5
|
+
var _fs = _interopRequireDefault(require("fs"));
|
6
6
|
|
7
|
-
var
|
7
|
+
var _express = _interopRequireDefault(require("express"));
|
8
8
|
|
9
|
-
var
|
10
|
-
|
11
|
-
var _express = require('express');
|
12
|
-
|
13
|
-
var _express2 = _interopRequireDefault(_express);
|
14
|
-
|
15
|
-
var _utils = require('../utils');
|
9
|
+
var _utils = require("../utils");
|
16
10
|
|
17
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
18
12
|
|
19
|
-
|
20
|
-
|
21
|
-
|
13
|
+
let options = (0, _utils.getOptions)();
|
14
|
+
let {
|
15
|
+
cluster: {
|
16
|
+
server
|
17
|
+
}
|
18
|
+
} = options;
|
19
|
+
let app = (0, _express.default)();
|
20
|
+
let appPath = process.cwd();
|
22
21
|
|
23
|
-
|
24
|
-
var appPath = process.cwd();
|
22
|
+
let clusterConfigPath = _path.default.join(appPath, 'clusterConfig.js');
|
25
23
|
|
26
|
-
|
27
|
-
var config = void 0;
|
24
|
+
let config;
|
28
25
|
|
29
|
-
if (
|
26
|
+
if (_fs.default.existsSync(clusterConfigPath)) {
|
30
27
|
config = require(clusterConfigPath);
|
31
28
|
} else {
|
32
|
-
throw new Error(
|
29
|
+
throw new Error(`clusterConfig.js doen't exist under following path - ${clusterConfigPath}`);
|
33
30
|
}
|
34
31
|
|
35
|
-
app.get('/clusterhub/nodes',
|
32
|
+
app.get('/clusterhub/nodes', (req, res) => {
|
36
33
|
res.send(JSON.stringify(config.cluster));
|
37
34
|
});
|
38
|
-
|
39
|
-
app.
|
40
|
-
|
41
|
-
app.listen(server.port, function (err) {
|
35
|
+
app.use('/clusterhub', _express.default.static(_path.default.join(__dirname, '..', '..', 'templates', 'clusterhub')));
|
36
|
+
app.listen(server.port, err => {
|
42
37
|
if (err) {
|
43
38
|
throw err;
|
44
39
|
}
|
45
|
-
|
40
|
+
|
41
|
+
(0, _utils.log)(`Listening at ${(0, _utils.getServerURL)(server, 'ht' + 'tp')}/clusterhub/`);
|
46
42
|
});
|
@@ -0,0 +1,102 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getPaths = getPaths;
|
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 _utils = require("../utils");
|
15
|
+
|
16
|
+
var _getCliPath = require("./getCliPath");
|
17
|
+
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
|
+
|
20
|
+
const options = (0, _utils.getOptions)(); // const args = process.argv.slice(3);
|
21
|
+
// NOTE: need to discuss about in below codes,
|
22
|
+
// when we run webpack the usable options that comes for npm run not working as automatical
|
23
|
+
// we are use this option always --disable_watch=true reason for now no need for
|
24
|
+
|
25
|
+
const {
|
26
|
+
app: {
|
27
|
+
outputFolder
|
28
|
+
}
|
29
|
+
} = options;
|
30
|
+
const {
|
31
|
+
cssSelectorZipPath
|
32
|
+
} = options.impactService;
|
33
|
+
const zipname = cssSelectorZipPath ? _path.default.parse(cssSelectorZipPath).name : null;
|
34
|
+
|
35
|
+
const outputFolderLocation = _path.default.join(process.cwd(), outputFolder);
|
36
|
+
|
37
|
+
function execSyncDefalut(command) {
|
38
|
+
console.log(' command running ==>', command);
|
39
|
+
return (0, _child_process.execSync)(command, {
|
40
|
+
stdio: 'inherit'
|
41
|
+
});
|
42
|
+
}
|
43
|
+
|
44
|
+
const isQuiet = 'q';
|
45
|
+
const webpack = (0, _getCliPath.getCliPath)('webpack'); // console.log('webpack === > ', webpack, fs.existsSync(webpack));
|
46
|
+
|
47
|
+
if (_fs.default.existsSync(outputFolderLocation)) {
|
48
|
+
execSyncDefalut(`rm -rf ${outputFolder}`);
|
49
|
+
console.log(`previous ${outputFolder} removed`);
|
50
|
+
}
|
51
|
+
|
52
|
+
if (_fs.default.existsSync(_path.default.join(process.cwd(), 'build.zip'))) {
|
53
|
+
execSyncDefalut('rm build.zip');
|
54
|
+
console.log('previous build.zip removed');
|
55
|
+
} // execSyncDefalut(`${webpack } --version`);
|
56
|
+
// execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')}`);
|
57
|
+
|
58
|
+
|
59
|
+
console.log('webpack compilation starts...');
|
60
|
+
const startTime = Date.now(); // const result = spawnSync(
|
61
|
+
// webpack,
|
62
|
+
// ['--config', require.resolve('../configs/webpack.dev.config.js')].concat(
|
63
|
+
// args
|
64
|
+
// ),
|
65
|
+
// { stdio: 'inherit' }
|
66
|
+
// );
|
67
|
+
// --disable_watch=true
|
68
|
+
|
69
|
+
const result = execSyncDefalut(`${webpack} --config ${require.resolve('../configs/webpack.dev.config.js')} ${process.argv.slice(2).map(o => o.replace(/(.*?)=(.*)/, '$1="$2"')).join(' ')} `);
|
70
|
+
result && console.log(result);
|
71
|
+
|
72
|
+
if (result && result.stderr) {
|
73
|
+
throw result.stderr;
|
74
|
+
}
|
75
|
+
|
76
|
+
console.log(`compailation done in ${Date.now() - startTime}ms`);
|
77
|
+
|
78
|
+
if (zipname) {
|
79
|
+
execSyncDefalut(`zip -r${isQuiet} build.zip ${outputFolder}/*`);
|
80
|
+
console.log('build.zip file created');
|
81
|
+
const result = execSyncDefalut(`zip -r${isQuiet} ${cssSelectorZipPath} ${zipname}/*`);
|
82
|
+
execSyncDefalut(`rm -rf ${zipname}`);
|
83
|
+
|
84
|
+
if (result && result.stderr) {
|
85
|
+
console.log('zip file not created', cssSelectorZipPath);
|
86
|
+
console.error(result.stderr);
|
87
|
+
} else {
|
88
|
+
console.log('zip file created', cssSelectorZipPath);
|
89
|
+
}
|
90
|
+
} // npm run start --app:domain=tsi --impact:cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
|
91
|
+
// npm run start --app_domain=tsi --impact_cssbountry="{$@&&@$}" --disable-watch --dev-cache --cssselector_zip=css-source-map.zip
|
92
|
+
|
93
|
+
|
94
|
+
console.log(`compailation done in ${Date.now() - startTime}ms`);
|
95
|
+
|
96
|
+
function getPaths() {
|
97
|
+
return {
|
98
|
+
zipname,
|
99
|
+
cssSelectorZipPath,
|
100
|
+
outputFolderLocation
|
101
|
+
};
|
102
|
+
}
|
@@ -1,9 +1,7 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
|
-
var _docsServerCore = require(
|
4
|
-
|
5
|
-
var _docsServerCore2 = _interopRequireDefault(_docsServerCore);
|
3
|
+
var _docsServerCore = _interopRequireDefault(require("./docsServerCore"));
|
6
4
|
|
7
5
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
6
|
|
9
|
-
(0,
|
7
|
+
(0, _docsServerCore.default)();
|
@@ -1,126 +1,141 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
+
exports.default = void 0;
|
6
7
|
|
7
|
-
var
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
8
9
|
|
9
|
-
var
|
10
|
+
var _https = _interopRequireDefault(require("https"));
|
10
11
|
|
11
|
-
var
|
12
|
+
var _webpack = _interopRequireDefault(require("webpack"));
|
12
13
|
|
13
|
-
var
|
14
|
+
var _express = _interopRequireDefault(require("express"));
|
14
15
|
|
15
|
-
var
|
16
|
+
var _child_process = require("child_process");
|
16
17
|
|
17
|
-
var
|
18
|
+
var _webpackDevMiddleware = _interopRequireDefault(require("webpack-dev-middleware"));
|
18
19
|
|
19
|
-
var
|
20
|
+
var _HMRMiddleware = _interopRequireDefault(require("../middlewares/HMRMiddleware"));
|
20
21
|
|
21
|
-
var
|
22
|
+
var _utils = require("../utils");
|
22
23
|
|
23
|
-
var
|
24
|
+
var _webpackDocs = _interopRequireDefault(require("../configs/webpack.docs.config"));
|
24
25
|
|
25
|
-
var
|
26
|
-
|
27
|
-
var _child_process = require('child_process');
|
28
|
-
|
29
|
-
var _webpackDevMiddleware = require('webpack-dev-middleware');
|
30
|
-
|
31
|
-
var _webpackDevMiddleware2 = _interopRequireDefault(_webpackDevMiddleware);
|
32
|
-
|
33
|
-
var _utils = require('../utils');
|
34
|
-
|
35
|
-
var _webpackDocs = require('../configs/webpack.docs.config');
|
36
|
-
|
37
|
-
var _webpackDocs2 = _interopRequireDefault(_webpackDocs);
|
26
|
+
var _httpsOptions = require("./httpsOptions");
|
38
27
|
|
39
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
40
29
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
30
|
+
// import fs from 'fs';
|
31
|
+
var _default = isSSTest => {
|
32
|
+
let options = (0, _utils.getOptions)();
|
33
|
+
let {
|
34
|
+
docs: {
|
35
|
+
server
|
36
|
+
}
|
37
|
+
} = options;
|
38
|
+
let {
|
39
|
+
port,
|
40
|
+
branch,
|
41
|
+
host,
|
42
|
+
domain,
|
43
|
+
iphost
|
44
|
+
} = server;
|
45
|
+
let appPath = process.cwd();
|
46
|
+
const app = (0, _express.default)();
|
47
|
+
app.use(_express.default.json());
|
48
|
+
app.use(_express.default.urlencoded({
|
54
49
|
extended: true
|
55
50
|
}));
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
var wdm = (0, _webpackDevMiddleware2.default)(compiler, {
|
51
|
+
let docsConfig = (0, _webpackDocs.default)(isSSTest);
|
52
|
+
let compiler = (0, _webpack.default)(docsConfig);
|
53
|
+
let wdm = (0, _webpackDevMiddleware.default)(compiler, {
|
60
54
|
logLevel: 'error',
|
61
|
-
publicPath:
|
62
|
-
headers: {
|
55
|
+
publicPath: docsConfig.output.publicPath,
|
56
|
+
headers: {
|
57
|
+
'Access-Control-Allow-Origin': '*'
|
58
|
+
}
|
63
59
|
});
|
64
|
-
|
65
60
|
app.use(wdm);
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
app.use('/docs',
|
70
|
-
|
71
|
-
app.use('/docs/*',
|
72
|
-
res.sendFile(
|
61
|
+
app.use((0, _HMRMiddleware.default)(compiler, {
|
62
|
+
path: '/sockjs-node/info'
|
63
|
+
}));
|
64
|
+
app.use('/docs/external/', _express.default.static(_path.default.join(appPath, 'docs', 'external')));
|
65
|
+
app.use('/docs', _express.default.static(_path.default.join(__dirname, '..', '..', 'templates', 'docs')));
|
66
|
+
app.use('/docs/*', (req, res) => {
|
67
|
+
res.sendFile(_path.default.join(__dirname, '..', '..', 'templates', 'docs', 'index.html'));
|
73
68
|
});
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
componentName =
|
78
|
-
|
79
|
-
|
69
|
+
app.use('/author/get', (req, res) => {
|
70
|
+
let {
|
71
|
+
query: {
|
72
|
+
componentName = ''
|
73
|
+
}
|
74
|
+
} = req;
|
75
|
+
res.json({
|
76
|
+
stdout: (0, _child_process.execSync)(`git blame ${componentName}`).toString()
|
77
|
+
});
|
80
78
|
});
|
81
|
-
|
82
|
-
|
83
|
-
|
79
|
+
app.use('/cli/version', (req, res) => {
|
80
|
+
res.json({
|
81
|
+
version: require('../../package.json').version
|
82
|
+
});
|
84
83
|
});
|
85
84
|
|
86
85
|
if (branch) {
|
87
|
-
app.post('/repo/merge',
|
88
|
-
|
86
|
+
app.post('/repo/merge', (req, res) => {
|
87
|
+
let {
|
88
|
+
ref
|
89
|
+
} = req.body;
|
89
90
|
|
90
91
|
if (ref && ref.endsWith(branch)) {
|
91
92
|
(0, _child_process.spawnSync)('git', ['pull', 'origin', branch], {
|
92
93
|
stdio: 'inherit'
|
93
94
|
});
|
94
95
|
}
|
96
|
+
|
95
97
|
res.send('done');
|
96
98
|
});
|
97
99
|
}
|
98
100
|
|
99
|
-
|
100
|
-
key: _fs2.default.readFileSync(_path2.default.join(__dirname, '../../cert/key.pem')),
|
101
|
-
cert: _fs2.default.readFileSync(_path2.default.join(__dirname, '../../cert/cert.pem')),
|
102
|
-
passphrase: 'zddqa1585f82'
|
103
|
-
}, app);
|
101
|
+
const httpsServer = _https.default.createServer(_httpsOptions.httpsOptions, app);
|
104
102
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
});
|
103
|
+
if (!isSSTest) {
|
104
|
+
httpsServer.listen(port, err => {
|
105
|
+
if (err) {
|
106
|
+
throw err;
|
107
|
+
}
|
111
108
|
|
112
|
-
|
109
|
+
(0, _utils.log)(`Listening at ${(0, _utils.getServerURL)(server, 'htt' + 'ps')}/docs/`);
|
110
|
+
});
|
111
|
+
}
|
113
112
|
|
114
|
-
|
113
|
+
let httpPort = Number(port) + 1;
|
114
|
+
let http = app.listen(httpPort, err => {
|
115
115
|
if (err) {
|
116
116
|
throw err;
|
117
117
|
}
|
118
|
-
(0, _utils.log)('Listening at ' + (0, _utils.getServerURL)(server, 'htt' + 'p') + '/docs/');
|
119
|
-
});
|
120
118
|
|
119
|
+
if (isSSTest) {
|
120
|
+
(0, _utils.log)(`Listening at ${(0, _utils.getServerURL)(Object.assign(server, {
|
121
|
+
host: iphost,
|
122
|
+
port: port
|
123
|
+
}), 'htt' + 'p')}/docs/`);
|
124
|
+
} else {
|
125
|
+
(0, _utils.log)(`Listening at ${(0, _utils.getServerURL)({
|
126
|
+
host,
|
127
|
+
domain,
|
128
|
+
port
|
129
|
+
}, 'htt' + 'p')}/docs/`);
|
130
|
+
}
|
131
|
+
});
|
121
132
|
return {
|
122
|
-
|
133
|
+
compiler,
|
134
|
+
app,
|
135
|
+
http,
|
123
136
|
https: httpsServer,
|
124
|
-
wdm
|
137
|
+
wdm
|
125
138
|
};
|
126
|
-
};
|
139
|
+
};
|
140
|
+
|
141
|
+
exports.default = _default;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getCliPath = getCliPath;
|
7
|
+
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
9
|
+
|
10
|
+
var _os = require("os");
|
11
|
+
|
12
|
+
var _fs = require("fs");
|
13
|
+
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
+
|
16
|
+
const appPath = process.cwd();
|
17
|
+
const isNodeModuleUnderAppFolder = __dirname.indexOf(appPath) !== -1;
|
18
|
+
const isWindows = (0, _os.platform)().toLowerCase() === 'win32';
|
19
|
+
|
20
|
+
const _getCliPath = !isNodeModuleUnderAppFolder ? libName => _path.default.join(__dirname, '..', '..', 'node_modules', '.bin', libName) : libName => libName;
|
21
|
+
|
22
|
+
const suffixExt = isWindows ? '.cmd' : '';
|
23
|
+
|
24
|
+
function getCliPath(libName) {
|
25
|
+
const cliPath = _getCliPath(libName + suffixExt);
|
26
|
+
|
27
|
+
return (0, _fs.existsSync)(cliPath) ? cliPath : libName + suffixExt;
|
28
|
+
}
|
@@ -1,31 +1,29 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
|
3
|
-
var _path = require(
|
3
|
+
var _path = _interopRequireDefault(require("path"));
|
4
4
|
|
5
|
-
var
|
5
|
+
var _express = _interopRequireDefault(require("express"));
|
6
6
|
|
7
|
-
var
|
8
|
-
|
9
|
-
var _express2 = _interopRequireDefault(_express);
|
10
|
-
|
11
|
-
var _utils = require('../utils');
|
7
|
+
var _utils = require("../utils");
|
12
8
|
|
13
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
10
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
app.
|
11
|
+
let options = (0, _utils.getOptions)();
|
12
|
+
let {
|
13
|
+
help: {
|
14
|
+
server
|
15
|
+
}
|
16
|
+
} = options;
|
17
|
+
let serverUrl = (0, _utils.getServerURL)(server, 'htt' + 'p');
|
18
|
+
let {
|
19
|
+
port
|
20
|
+
} = server;
|
21
|
+
let app = (0, _express.default)();
|
22
|
+
app.use('/help', _express.default.static(_path.default.join(__dirname, '..', '..', 'templates', 'help')));
|
23
|
+
app.listen(port, err => {
|
27
24
|
if (err) {
|
28
25
|
throw err;
|
29
26
|
}
|
30
|
-
|
27
|
+
|
28
|
+
(0, _utils.log)(`Listening at ${serverUrl}/help/`);
|
31
29
|
});
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.httpsOptions = 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
|
+
const httpsOptions = {
|
15
|
+
key: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/Tsicsezwild-22-23.key')),
|
16
|
+
cert: _fs.default.readFileSync(_path.default.join(__dirname, '../../cert/Tsicsezwild-22-23.crt'))
|
17
|
+
};
|
18
|
+
exports.httpsOptions = httpsOptions;
|