Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2893908
D7354.id24877.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D7354.id24877.diff
View Options
diff --git a/keyserver/Dockerfile b/keyserver/Dockerfile
--- a/keyserver/Dockerfile
+++ b/keyserver/Dockerfile
@@ -150,7 +150,13 @@
# We do this first so Docker doesn't rebuild when only keyserver files change
#-------------------------------------------------------------------------------
+# These are needed for babel-build-comm-config
+COPY --chown=comm keyserver/src keyserver/src
+COPY --chown=comm keyserver/bash/source-nvm.sh keyserver/bash/source-nvm.sh
+COPY --chown=comm keyserver/babel.config.cjs keyserver/babel.config.cjs
+
COPY --chown=comm lib lib/
+
COPY --chown=comm landing landing/
RUN yarn workspace landing prod
diff --git a/keyserver/package.json b/keyserver/package.json
--- a/keyserver/package.json
+++ b/keyserver/package.json
@@ -7,6 +7,7 @@
"main": "dist/keyserver",
"scripts": {
"clean": "rm -rf dist/ && rm -rf node_modules/ && mkdir dist",
+ "babel-build-comm-config": ". bash/source-nvm.sh && yarn --silent babel src/lib/utils/comm-config.js --out-dir dist/lib/utils/ --config-file ./babel.config.cjs",
"babel-build": ". bash/source-nvm.sh && yarn --silent babel src/ --out-dir dist/ --config-file ./babel.config.cjs --verbose --ignore 'src/landing/flow-typed','src/landing/node_modules','src/landing/package.json','src/lib/flow-typed','src/lib/node_modules','src/lib/package.json','src/web/flow-typed','src/web/node_modules','src/web/package.json','src/web/dist','src/web/webpack.config.js','src/web/account-bar.react.js','src/web/app.react.js','src/web/calendar','src/web/chat','src/web/flow','src/web/loading-indicator.react.js','src/web/modals','src/web/root.js','src/web/router-history.js','src/web/script.js','src/web/selectors/chat-selectors.js','src/web/selectors/entry-selectors.js','src/web/splash','src/web/vector-utils.js','src/web/vectors.react.js'",
"rsync": "rsync -rLpmuv --exclude '*/package.json' --exclude '*/node_modules/*' --include '*.json' --include '*.cjs' --include '*.node' --exclude '*.*' src/ dist/",
"prod-build": "yarn babel-build && yarn rsync && yarn update-geoip",
diff --git a/landing/package.json b/landing/package.json
--- a/landing/package.json
+++ b/landing/package.json
@@ -6,8 +6,8 @@
"license": "BSD-3-Clause",
"scripts": {
"clean": "rm -rf dist/ && rm -rf node_modules/",
- "dev": "yarn concurrently --names=\"NODESSR,BROWSER\" -c \"bgBlue.bold,bgMagenta.bold\" \"yarn webpack --config webpack.config.cjs --config-name=server --watch\" \"yarn webpack-dev-server --config webpack.config.cjs --config-name=browser\"",
- "prod": "yarn webpack --config webpack.config.cjs --env prod --progress"
+ "dev": "yarn workspace keyserver babel-build-comm-config && yarn concurrently --names=\"NODESSR,BROWSER\" -c \"bgBlue.bold,bgMagenta.bold\" \"yarn webpack --config webpack.config.cjs --config-name=server --watch\" \"yarn webpack-dev-server --config webpack.config.cjs --config-name=browser\"",
+ "prod": "yarn workspace keyserver babel-build-comm-config && yarn webpack --config webpack.config.cjs --env prod --progress"
},
"devDependencies": {
"@babel/core": "^7.13.14",
diff --git a/lib/utils/comm-config.js b/lib/utils/comm-config.js
--- a/lib/utils/comm-config.js
+++ b/lib/utils/comm-config.js
@@ -1,6 +1,7 @@
// @flow
import fs from 'fs';
+import path from 'path';
import { promisify } from 'util';
const readFile = promisify(fs.readFile);
@@ -49,13 +50,19 @@
);
}
}
- const path = getPathForConfigName(configName);
+
+ let filePath = getPathForConfigName(configName);
+ const cwd = path.resolve();
+ if (!cwd.endsWith('/keyserver')) {
+ filePath = `../keyserver/${filePath}`;
+ }
+
try {
- const pathString = await readFile(path, 'utf8');
+ const pathString = await readFile(filePath, 'utf8');
return JSON.parse(pathString);
} catch (e) {
if (e.code !== 'ENOENT') {
- console.log(`Failed to read JSON from ${path}`, e);
+ console.log(`Failed to read JSON from ${filePath}`, e);
}
return null;
}
diff --git a/web/package.json b/web/package.json
--- a/web/package.json
+++ b/web/package.json
@@ -6,8 +6,8 @@
"license": "BSD-3-Clause",
"scripts": {
"clean": "rm -rf dist/ && rm -rf node_modules/",
- "dev": "yarn concurrently --names=\"NODESSR,BROWSER,WORKERS\" -c \"bgBlue.bold,bgMagenta.bold,bgCyan.bold\" \"yarn webpack --config webpack.config.cjs --config-name=server --watch\" \"yarn webpack-dev-server --config webpack.config.cjs --config-name=browser\" \"yarn webpack --config webpack.config.cjs --config-name=webworkers --watch\"",
- "prod": "yarn webpack --config webpack.config.cjs --env prod --progress",
+ "dev": "yarn workspace keyserver babel-build-comm-config && yarn concurrently --names=\"NODESSR,BROWSER,WORKERS\" -c \"bgBlue.bold,bgMagenta.bold,bgCyan.bold\" \"yarn webpack --config webpack.config.cjs --config-name=server --watch\" \"yarn webpack-dev-server --config webpack.config.cjs --config-name=browser\" \"yarn webpack --config webpack.config.cjs --config-name=webworkers --watch\"",
+ "prod": "yarn workspace keyserver babel-build-comm-config && yarn webpack --config webpack.config.cjs --env prod --progress",
"test": "jest"
},
"devDependencies": {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 5, 2:07 PM (21 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2244035
Default Alt Text
D7354.id24877.diff (5 KB)
Attached To
Mode
D7354: [keyserver][lib][web] Make it possible to call getCommConfig from Webpack config
Attached
Detach File
Event Timeline
Log In to Comment