aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/scripts
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2018-05-25 15:50:51 +0200
committerSonarTech <sonartech@sonarsource.com>2018-06-12 20:20:58 +0200
commit9c920745177dc467e7efd00715454c7eeb5cd2ca (patch)
treedd21034b84bd9e6b8f5387d6d4fb41cd00965e21 /server/sonar-web/scripts
parentbdde08fff517a28f6f639e724b810a3679fdc452 (diff)
downloadsonarqube-9c920745177dc467e7efd00715454c7eeb5cd2ca.tar.gz
sonarqube-9c920745177dc467e7efd00715454c7eeb5cd2ca.zip
Add parameter 'l10nCompiled' in start script to force usage of compiled l10n bundle
Diffstat (limited to 'server/sonar-web/scripts')
-rw-r--r--server/sonar-web/scripts/start.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/server/sonar-web/scripts/start.js b/server/sonar-web/scripts/start.js
index 839fcf48eb9..ce3726d43e9 100644
--- a/server/sonar-web/scripts/start.js
+++ b/server/sonar-web/scripts/start.js
@@ -37,8 +37,10 @@ const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
const host = process.env.HOST || 'localhost';
const proxy = process.env.PROXY || 'http://localhost:9000';
-const compiler = setupCompiler(host, port, protocol);
+// Force start script to proxy l10n request to the server (can be useful when working with plugins/extensions)
+const l10nCompiledFlag = process.argv.findIndex(val => val === 'l10nCompiled') >= 0;
+const compiler = setupCompiler(host, port, protocol);
runDevServer(compiler, host, port, protocol);
function setupCompiler(host, port, protocol) {
@@ -82,11 +84,13 @@ function runDevServer(compiler, host, port, protocol) {
const devServer = new WebpackDevServer(compiler, {
before(app) {
app.use(errorOverlayMiddleware());
- app.get('/api/l10n/index', (req, res) => {
- getMessages()
- .then(messages => res.json({ effectiveLocale: 'en', messages }))
- .catch(() => res.status(500));
- });
+ if (!l10nCompiledFlag) {
+ app.get('/api/l10n/index', (req, res) => {
+ getMessages()
+ .then(messages => res.json({ effectiveLocale: 'en', messages }))
+ .catch(() => res.status(500));
+ });
+ }
},
compress: true,
clientLogLevel: 'none',