@zohodesk/react-cli 0.0.1-beta.17 → 0.0.1-beta.171
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 +859 -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 +99 -84
- package/lib/configs/webpack.docs.config.js +65 -57
- package/lib/configs/webpack.impact.config.js +109 -0
- package/lib/configs/webpack.prod.config.js +147 -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 +368 -0
- package/lib/postcss-plugins/variableModifier.js +243 -0
- package/lib/schemas/index.js +541 -65
- 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,238 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var _path = require('path');
|
4
|
-
|
5
|
-
var _path2 = _interopRequireDefault(_path);
|
6
|
-
|
7
|
-
var _express = require('express');
|
8
|
-
|
9
|
-
var _express2 = _interopRequireDefault(_express);
|
10
|
-
|
11
|
-
var _child_process = require('child_process');
|
12
|
-
|
13
|
-
var _utils = require('../utils');
|
14
|
-
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
|
-
|
17
|
-
var options = (0, _utils.getOptions)();
|
18
|
-
var server = options.ssr.server;
|
19
|
-
var host = server.host,
|
20
|
-
port = server.port,
|
21
|
-
repoUrl = server.repoUrl,
|
22
|
-
branch = server.branch,
|
23
|
-
clientAppPath = server.clientAppPath;
|
24
|
-
|
25
|
-
|
26
|
-
var appPath = process.cwd();
|
27
|
-
var serverUrl = (0, _utils.getServerURL)(server, 'htt' + 'p');
|
28
|
-
|
29
|
-
var app = (0, _express2.default)();
|
30
|
-
|
31
|
-
var commitHash = '';
|
32
|
-
var serverProcess = void 0;
|
33
|
-
|
34
|
-
var stream = (0, _utils.createEventStream)(5000, function () {
|
35
|
-
return {
|
36
|
-
branch: branch,
|
37
|
-
commitHash: commitHash,
|
38
|
-
isStart: serverProcess ? true : false
|
39
|
-
};
|
40
|
-
});
|
41
|
-
|
42
|
-
app.use(function (req, res, next) {
|
43
|
-
res.setHeader('Access-Control-Allow-Origin', '*');
|
44
|
-
res.setHeader('Access-Control-Allow-Methods', 'GET,POST,PUT,DELETE,OPTIONS');
|
45
|
-
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With');
|
46
|
-
next();
|
47
|
-
});
|
48
|
-
|
49
|
-
app.use(_express2.default.json());
|
50
|
-
|
51
|
-
app.get('/node/getInfo', function (req, res) {
|
52
|
-
res.send(JSON.stringify({ repoUrl: repoUrl, host: host, port: port, branch: branch }));
|
53
|
-
});
|
54
|
-
|
55
|
-
app.get('/node/heartbeat', stream.handler);
|
56
|
-
|
57
|
-
app.get('/node/clone', function (req, res) {
|
58
|
-
var output = (0, _child_process.spawnSync)('rm', ['-R', branch], {
|
59
|
-
encoding: 'utf8'
|
60
|
-
});
|
61
|
-
|
62
|
-
output = (0, _child_process.spawnSync)('git', ['clone', repoUrl, '-b', branch, branch], {
|
63
|
-
encoding: 'utf8'
|
64
|
-
});
|
65
|
-
output = (0, _child_process.spawnSync)('npm', ['install'], {
|
66
|
-
encoding: 'utf8',
|
67
|
-
shell: true,
|
68
|
-
cwd: _path2.default.join(appPath, branch, clientAppPath)
|
69
|
-
});
|
70
|
-
|
71
|
-
var test = (0, _child_process.spawnSync)('npm', ['run', 'build:component:server'], {
|
72
|
-
encoding: 'utf8',
|
73
|
-
shell: true,
|
74
|
-
cwd: _path2.default.join(appPath, branch, clientAppPath)
|
75
|
-
});
|
76
|
-
|
77
|
-
(0, _utils.log)(test.stdout);
|
78
|
-
res.send(output.stdout);
|
79
|
-
});
|
80
|
-
|
81
|
-
app.get('/node/isStart', function (req, res) {
|
82
|
-
if (serverProcess) {
|
83
|
-
res.send('true');
|
84
|
-
} else {
|
85
|
-
res.send('false');
|
86
|
-
}
|
87
|
-
});
|
88
|
-
|
89
|
-
app.get('/node/start', function (req, res) {
|
90
|
-
if (!serverProcess) {
|
91
|
-
(0, _utils.log)(_path2.default.join(appPath, branch, clientAppPath));
|
92
|
-
var test = (0, _child_process.spawnSync)('npm', ['run', 'build:component:server'], {
|
93
|
-
encoding: 'utf8',
|
94
|
-
shell: true,
|
95
|
-
cwd: _path2.default.join(appPath, branch, clientAppPath)
|
96
|
-
});
|
97
|
-
(0, _utils.log)(test.stdout);
|
98
|
-
serverProcess = (0, _child_process.spawnSync)('npm', ['run', 'serverrender', '--server:port=' + port], {
|
99
|
-
encoding: 'utf8',
|
100
|
-
shell: true,
|
101
|
-
cwd: _path2.default.join(appPath, branch, clientAppPath)
|
102
|
-
});
|
103
|
-
serverProcess.on('error', function (err) {
|
104
|
-
(0, _utils.log)('Oh noez, teh errurz: ' + err);
|
105
|
-
res.send('Server Error');
|
106
|
-
serverProcess = null;
|
107
|
-
});
|
108
|
-
var flag = true;
|
109
|
-
serverProcess.stdout.on('data', function (data) {
|
110
|
-
(0, _utils.log)('stdout: ' + data.toString());
|
111
|
-
if (flag) {
|
112
|
-
res.send('Server start');
|
113
|
-
flag = false;
|
114
|
-
}
|
115
|
-
});
|
116
|
-
} else {
|
117
|
-
res.send('Already started');
|
118
|
-
}
|
119
|
-
});
|
120
|
-
app.get('/node/stop', function (req, res) {
|
121
|
-
if (serverProcess) {
|
122
|
-
serverProcess.stdin.pause();
|
123
|
-
if (serverProcess.kill('SIGTERM')) {
|
124
|
-
res.send('Stopped');
|
125
|
-
serverProcess = null;
|
126
|
-
} else {
|
127
|
-
res.send('Not able to stop');
|
128
|
-
}
|
129
|
-
} else {
|
130
|
-
res.send('Already Stopped');
|
131
|
-
}
|
132
|
-
});
|
133
|
-
app.post('/node/deploy', function (req, res) {
|
134
|
-
if (serverProcess) {
|
135
|
-
serverProcess.stdin.pause();
|
136
|
-
if (serverProcess.kill('SIGTERM')) {
|
137
|
-
serverProcess = null;
|
138
|
-
var test = (0, _child_process.spawnSync)('git', ['pull'], {
|
139
|
-
encoding: 'utf8',
|
140
|
-
shell: true,
|
141
|
-
cwd: _path2.default.join(appPath, branch, clientAppPath)
|
142
|
-
});
|
143
|
-
(0, _utils.log)('pull:', test.stdout);
|
144
|
-
var deployObj = req.body;
|
145
|
-
test = (0, _child_process.spawnSync)('git', ['reset', '--hard', deployObj.repoInfo.hash], {
|
146
|
-
encoding: 'utf8',
|
147
|
-
shell: true,
|
148
|
-
cwd: _path2.default.join(appPath, branch, clientAppPath)
|
149
|
-
});
|
150
|
-
(0, _utils.log)('reset commit hash', test.stdout);
|
151
|
-
commitHash = deployObj.repoInfo.hash;
|
152
|
-
// test = spawnSync('npm', ['install'], {
|
153
|
-
// encoding: 'utf8',
|
154
|
-
// shell: true,
|
155
|
-
// cwd: path.join(appPath, branch, clientAppPath)
|
156
|
-
// });
|
157
|
-
// console.log('install', test.stdout);
|
158
|
-
test = (0, _child_process.spawnSync)('npm', ['run', 'build:component:server'], {
|
159
|
-
encoding: 'utf8',
|
160
|
-
shell: true,
|
161
|
-
cwd: _path2.default.join(appPath, branch, clientAppPath)
|
162
|
-
});
|
163
|
-
(0, _utils.log)('server build', test.stdout);
|
164
|
-
serverProcess = (0, _child_process.spawnSync)('npm', ['run', 'serverrender', '--server:port=' + port, '--', JSON.stringify(JSON.stringify(deployObj))], {
|
165
|
-
encoding: 'utf8',
|
166
|
-
shell: true,
|
167
|
-
cwd: _path2.default.join(appPath, branch, clientAppPath)
|
168
|
-
});
|
169
|
-
serverProcess.on('error', function (err) {
|
170
|
-
(0, _utils.log)('Oh noez, teh errurz: ' + err);
|
171
|
-
res.send('Server Error');
|
172
|
-
serverProcess = null;
|
173
|
-
});
|
174
|
-
var flag = true;
|
175
|
-
serverProcess.stdout.on('data', function (data) {
|
176
|
-
(0, _utils.log)('stdout: ' + data.toString());
|
177
|
-
if (flag) {
|
178
|
-
res.send('Server start');
|
179
|
-
flag = false;
|
180
|
-
}
|
181
|
-
});
|
182
|
-
} else {
|
183
|
-
res.send('Not able to stop');
|
184
|
-
}
|
185
|
-
} else {
|
186
|
-
var _test = (0, _child_process.spawnSync)('git', ['pull'], {
|
187
|
-
encoding: 'utf8',
|
188
|
-
shell: true,
|
189
|
-
cwd: _path2.default.join(appPath, branch, clientAppPath)
|
190
|
-
});
|
191
|
-
(0, _utils.log)('pull:', _test.stdout);
|
192
|
-
var _deployObj = req.body;
|
193
|
-
_test = (0, _child_process.spawnSync)('git', ['reset', '--hard', _deployObj.repoInfo.hash], {
|
194
|
-
encoding: 'utf8',
|
195
|
-
shell: true,
|
196
|
-
cwd: _path2.default.join(appPath, branch, clientAppPath)
|
197
|
-
});
|
198
|
-
(0, _utils.log)('reset commit hash', _test.stdout);
|
199
|
-
commitHash = _deployObj.repoInfo.hash;
|
200
|
-
// test = spawnSync('npm', ['install'], {
|
201
|
-
// encoding: 'utf8',
|
202
|
-
// shell: true,
|
203
|
-
// cwd: path.join(appPath, branch, clientAppPath)
|
204
|
-
// });
|
205
|
-
// console.log('install', test.stdout);
|
206
|
-
_test = (0, _child_process.spawnSync)('npm', ['run', 'build:component:server'], {
|
207
|
-
encoding: 'utf8',
|
208
|
-
shell: true,
|
209
|
-
cwd: _path2.default.join(appPath, branch, clientAppPath)
|
210
|
-
});
|
211
|
-
(0, _utils.log)('server build', _test.stdout);
|
212
|
-
serverProcess = (0, _child_process.spawnSync)('npm', ['run', 'serverrender', '--server:port=' + port, '--', JSON.stringify(JSON.stringify(_deployObj))], {
|
213
|
-
encoding: 'utf8',
|
214
|
-
shell: true,
|
215
|
-
cwd: _path2.default.join(appPath, branch, clientAppPath)
|
216
|
-
});
|
217
|
-
serverProcess.on('error', function (err) {
|
218
|
-
(0, _utils.log)('Oh noez, teh errurz: ' + err);
|
219
|
-
res.send('Server Error');
|
220
|
-
serverProcess = null;
|
221
|
-
});
|
222
|
-
var _flag = true;
|
223
|
-
serverProcess.stdout.on('data', function (data) {
|
224
|
-
(0, _utils.log)('stdout: ' + data.toString());
|
225
|
-
if (_flag) {
|
226
|
-
res.send('Server start');
|
227
|
-
_flag = false;
|
228
|
-
}
|
229
|
-
});
|
230
|
-
}
|
231
|
-
});
|
232
|
-
|
233
|
-
app.listen(port + 1, function (err) {
|
234
|
-
if (err) {
|
235
|
-
throw err;
|
236
|
-
}
|
237
|
-
(0, _utils.log)('Listening at ' + serverUrl + '/node/');
|
238
|
-
});
|
@@ -1,256 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) 2015-present, Facebook, Inc.
|
3
|
-
*
|
4
|
-
* This source code is licensed under the MIT license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*/
|
7
|
-
|
8
|
-
'use strict';
|
9
|
-
|
10
|
-
// This alternative WebpackDevServer combines the functionality of:
|
11
|
-
// https://github.com/webpack/webpack-dev-server/blob/webpack-1/client/index.js
|
12
|
-
// https://github.com/webpack/webpack/blob/webpack-1/hot/dev-server.js
|
13
|
-
|
14
|
-
// It only supports their simplest configuration (hot updates on same server).
|
15
|
-
// It makes some opinionated choices on top, like adding a syntax error overlay
|
16
|
-
// that looks similar to our console output. The error overlay is inspired by:
|
17
|
-
// https://github.com/glenjamin/webpack-hot-middleware
|
18
|
-
|
19
|
-
var SockJS = require('sockjs-client');
|
20
|
-
var stripAnsi = require('strip-ansi');
|
21
|
-
var url = require('url');
|
22
|
-
var launchEditorEndpoint = require('./launchEditorEndpoint');
|
23
|
-
var formatWebpackMessages = require('./formatWebpackMessages');
|
24
|
-
var ErrorOverlay = require('react-error-overlay');
|
25
|
-
|
26
|
-
ErrorOverlay.setEditorHandler(function editorHandler(errorLocation) {
|
27
|
-
// Keep this sync with errorOverlayMiddleware.js
|
28
|
-
fetch(launchEditorEndpoint + '?fileName=' + window.encodeURIComponent(errorLocation.fileName) + '&lineNumber=' + window.encodeURIComponent(errorLocation.lineNumber || 1) + '&colNumber=' + window.encodeURIComponent(errorLocation.colNumber || 1));
|
29
|
-
});
|
30
|
-
|
31
|
-
// We need to keep track of if there has been a runtime error.
|
32
|
-
// Essentially, we cannot guarantee application state was not corrupted by the
|
33
|
-
// runtime error. To prevent confusing behavior, we forcibly reload the entire
|
34
|
-
// application. This is handled below when we are notified of a compile (code
|
35
|
-
// change).
|
36
|
-
// See https://github.com/facebook/create-react-app/issues/3096
|
37
|
-
var hadRuntimeError = false;
|
38
|
-
ErrorOverlay.startReportingRuntimeErrors({
|
39
|
-
onError: function onError() {
|
40
|
-
hadRuntimeError = true;
|
41
|
-
},
|
42
|
-
filename: '/static/js/bundle.js'
|
43
|
-
});
|
44
|
-
|
45
|
-
if (module.hot && typeof module.hot.dispose === 'function') {
|
46
|
-
module.hot.dispose(function () {
|
47
|
-
// TODO: why do we need this?
|
48
|
-
ErrorOverlay.stopReportingRuntimeErrors();
|
49
|
-
});
|
50
|
-
}
|
51
|
-
|
52
|
-
// Connect to WebpackDevServer via a socket.
|
53
|
-
var connection = new SockJS(url.format({
|
54
|
-
protocol: window.location.protocol,
|
55
|
-
hostname: window.location.hostname,
|
56
|
-
port: window.location.port,
|
57
|
-
// Hardcoded in WebpackDevServer
|
58
|
-
pathname: '/sockjs-node'
|
59
|
-
}));
|
60
|
-
|
61
|
-
// Unlike WebpackDevServer client, we won't try to reconnect
|
62
|
-
// to avoid spamming the console. Disconnect usually happens
|
63
|
-
// when developer stops the server.
|
64
|
-
connection.onclose = function () {
|
65
|
-
if (typeof console !== 'undefined' && typeof console.info === 'function') {
|
66
|
-
console.info('The development server has disconnected.\nRefresh the page if necessary.');
|
67
|
-
}
|
68
|
-
};
|
69
|
-
|
70
|
-
// Remember some state related to hot module replacement.
|
71
|
-
var isFirstCompilation = true;
|
72
|
-
var mostRecentCompilationHash = null;
|
73
|
-
var hasCompileErrors = false;
|
74
|
-
|
75
|
-
function clearOutdatedErrors() {
|
76
|
-
// Clean up outdated compile errors, if any.
|
77
|
-
if (typeof console !== 'undefined' && typeof console.clear === 'function') {
|
78
|
-
if (hasCompileErrors) {
|
79
|
-
console.clear();
|
80
|
-
}
|
81
|
-
}
|
82
|
-
}
|
83
|
-
|
84
|
-
// Successful compilation.
|
85
|
-
function handleSuccess() {
|
86
|
-
clearOutdatedErrors();
|
87
|
-
|
88
|
-
var isHotUpdate = !isFirstCompilation;
|
89
|
-
isFirstCompilation = false;
|
90
|
-
hasCompileErrors = false;
|
91
|
-
|
92
|
-
// Attempt to apply hot updates or reload.
|
93
|
-
if (isHotUpdate) {
|
94
|
-
tryApplyUpdates(function onHotUpdateSuccess() {
|
95
|
-
// Only dismiss it when we're sure it's a hot update.
|
96
|
-
// Otherwise it would flicker right before the reload.
|
97
|
-
ErrorOverlay.dismissBuildError();
|
98
|
-
});
|
99
|
-
}
|
100
|
-
}
|
101
|
-
|
102
|
-
// Compilation with warnings (e.g. ESLint).
|
103
|
-
function handleWarnings(warnings) {
|
104
|
-
clearOutdatedErrors();
|
105
|
-
|
106
|
-
var isHotUpdate = !isFirstCompilation;
|
107
|
-
isFirstCompilation = false;
|
108
|
-
hasCompileErrors = false;
|
109
|
-
|
110
|
-
function printWarnings() {
|
111
|
-
// Print warnings to the console.
|
112
|
-
var formatted = formatWebpackMessages({
|
113
|
-
warnings: warnings,
|
114
|
-
errors: []
|
115
|
-
});
|
116
|
-
|
117
|
-
if (typeof console !== 'undefined' && typeof console.warn === 'function') {
|
118
|
-
for (var i = 0; i < formatted.warnings.length; i++) {
|
119
|
-
if (i === 5) {
|
120
|
-
console.warn('There were more warnings in other files.\n' + 'You can find a complete log in the terminal.');
|
121
|
-
break;
|
122
|
-
}
|
123
|
-
console.warn(stripAnsi(formatted.warnings[i]));
|
124
|
-
}
|
125
|
-
}
|
126
|
-
}
|
127
|
-
|
128
|
-
// Attempt to apply hot updates or reload.
|
129
|
-
if (isHotUpdate) {
|
130
|
-
tryApplyUpdates(function onSuccessfulHotUpdate() {
|
131
|
-
// Only print warnings if we aren't refreshing the page.
|
132
|
-
// Otherwise they'll disappear right away anyway.
|
133
|
-
printWarnings();
|
134
|
-
// Only dismiss it when we're sure it's a hot update.
|
135
|
-
// Otherwise it would flicker right before the reload.
|
136
|
-
ErrorOverlay.dismissBuildError();
|
137
|
-
});
|
138
|
-
} else {
|
139
|
-
// Print initial warnings immediately.
|
140
|
-
printWarnings();
|
141
|
-
}
|
142
|
-
}
|
143
|
-
|
144
|
-
// Compilation with errors (e.g. syntax error or missing modules).
|
145
|
-
function handleErrors(errors) {
|
146
|
-
clearOutdatedErrors();
|
147
|
-
|
148
|
-
isFirstCompilation = false;
|
149
|
-
hasCompileErrors = true;
|
150
|
-
|
151
|
-
// "Massage" webpack messages.
|
152
|
-
var formatted = formatWebpackMessages({
|
153
|
-
errors: errors,
|
154
|
-
warnings: []
|
155
|
-
});
|
156
|
-
|
157
|
-
// Only show the first error.
|
158
|
-
ErrorOverlay.reportBuildError(formatted.errors[0]);
|
159
|
-
|
160
|
-
// Also log them to the console.
|
161
|
-
if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
162
|
-
for (var i = 0; i < formatted.errors.length; i++) {
|
163
|
-
console.error(stripAnsi(formatted.errors[i]));
|
164
|
-
}
|
165
|
-
}
|
166
|
-
|
167
|
-
// Do not attempt to reload now.
|
168
|
-
// We will reload on next success instead.
|
169
|
-
}
|
170
|
-
|
171
|
-
// There is a newer version of the code available.
|
172
|
-
function handleAvailableHash(hash) {
|
173
|
-
// Update last known compilation hash.
|
174
|
-
mostRecentCompilationHash = hash;
|
175
|
-
}
|
176
|
-
|
177
|
-
// Handle messages from the server.
|
178
|
-
connection.onmessage = function (e) {
|
179
|
-
var message = JSON.parse(e.data);
|
180
|
-
switch (message.type) {
|
181
|
-
case 'hash':
|
182
|
-
handleAvailableHash(message.data);
|
183
|
-
break;
|
184
|
-
case 'still-ok':
|
185
|
-
case 'ok':
|
186
|
-
handleSuccess();
|
187
|
-
break;
|
188
|
-
case 'content-changed':
|
189
|
-
// Triggered when a file from `contentBase` changed.
|
190
|
-
window.location.reload();
|
191
|
-
break;
|
192
|
-
case 'warnings':
|
193
|
-
handleWarnings(message.data);
|
194
|
-
break;
|
195
|
-
case 'errors':
|
196
|
-
handleErrors(message.data);
|
197
|
-
break;
|
198
|
-
default:
|
199
|
-
// Do nothing.
|
200
|
-
}
|
201
|
-
};
|
202
|
-
|
203
|
-
// Is there a newer version of this code available?
|
204
|
-
function isUpdateAvailable() {
|
205
|
-
/* globals __webpack_hash__ */
|
206
|
-
// __webpack_hash__ is the hash of the current compilation.
|
207
|
-
// It's a global variable injected by Webpack.
|
208
|
-
return mostRecentCompilationHash !== __webpack_hash__;
|
209
|
-
}
|
210
|
-
|
211
|
-
// Webpack disallows updates in other states.
|
212
|
-
function canApplyUpdates() {
|
213
|
-
return module.hot.status() === 'idle';
|
214
|
-
}
|
215
|
-
|
216
|
-
// Attempt to update code on the fly, fall back to a hard reload.
|
217
|
-
function tryApplyUpdates(onHotUpdateSuccess) {
|
218
|
-
if (!module.hot) {
|
219
|
-
// HotModuleReplacementPlugin is not in Webpack configuration.
|
220
|
-
window.location.reload();
|
221
|
-
return;
|
222
|
-
}
|
223
|
-
|
224
|
-
if (!isUpdateAvailable() || !canApplyUpdates()) {
|
225
|
-
return;
|
226
|
-
}
|
227
|
-
|
228
|
-
function handleApplyUpdates(err, updatedModules) {
|
229
|
-
if (err || !updatedModules || hadRuntimeError) {
|
230
|
-
window.location.reload();
|
231
|
-
return;
|
232
|
-
}
|
233
|
-
|
234
|
-
if (typeof onHotUpdateSuccess === 'function') {
|
235
|
-
// Maybe we want to do something.
|
236
|
-
onHotUpdateSuccess();
|
237
|
-
}
|
238
|
-
|
239
|
-
if (isUpdateAvailable()) {
|
240
|
-
// While we were updating, there was a new update! Do it again.
|
241
|
-
tryApplyUpdates();
|
242
|
-
}
|
243
|
-
}
|
244
|
-
|
245
|
-
// https://webpack.github.io/docs/hot-module-replacement.html#check
|
246
|
-
var result = module.hot.check( /* autoApply */true, handleApplyUpdates);
|
247
|
-
|
248
|
-
// // Webpack 2 returns a Promise instead of invoking a callback
|
249
|
-
if (result && result.then) {
|
250
|
-
result.then(function (updatedModules) {
|
251
|
-
handleApplyUpdates(null, updatedModules);
|
252
|
-
}, function (err) {
|
253
|
-
handleApplyUpdates(err, null);
|
254
|
-
});
|
255
|
-
}
|
256
|
-
}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var _querystring = require('querystring');
|
4
|
-
|
5
|
-
var _querystring2 = _interopRequireDefault(_querystring);
|
6
|
-
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
|
-
|
9
|
-
var options = _querystring2.default.parse(__resourceQuery.slice(1)); /* eslint-disable no-undef */
|
10
|
-
|
11
|
-
|
12
|
-
if (!__DEVELOPMENT__) {
|
13
|
-
global.setPublicPath = function (webpackRequireFun) {
|
14
|
-
webpackRequireFun.p = '' + global.staticDomain[options.js];
|
15
|
-
};
|
16
|
-
}
|
package/lib/utils/setConfig.js
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var _child_process = require('child_process');
|
4
|
-
|
5
|
-
var args = process.argv.slice(2);
|
6
|
-
|
7
|
-
args.forEach(function (arg) {
|
8
|
-
if (arg.startsWith('-')) {
|
9
|
-
//eslint-disable-next-line
|
10
|
-
arg = arg.substring(2);
|
11
|
-
}
|
12
|
-
|
13
|
-
(0, _child_process.execSync)('npm config set ' + arg);
|
14
|
-
});
|