Build config: add FE_BUILD_DIR to configure the output path

build-json
Alex Gleason 2021-09-03 14:42:31 -05:00
rodzic 54d7d9c6db
commit 7861270355
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
3 zmienionych plików z 16 dodań i 8 usunięć

Wyświetl plik

@ -88,9 +88,9 @@ pages:
stage: deploy
script:
- yarn build
- mv static public
variables:
NODE_ENV: production
FE_BUILD_DIR: public
artifacts:
paths:
- public

Wyświetl plik

@ -9,6 +9,7 @@ const { trim } = require('lodash');
const {
BACKEND_URL,
FE_BASE_PATH,
FE_BUILD_DIR,
} = process.env;
const sanitizeURL = url => {
@ -19,9 +20,12 @@ const sanitizeURL = url => {
}
};
// Run Soapbox FE from a subdirectory.
const getFeBasePath = () => {
return `/${trim(FE_BASE_PATH, '/')}`;
const sanitizeBasename = path => {
return `/${trim(path, '/')}`;
};
const sanitizePath = path => {
return trim(path, '/');
};
// JSON.parse/stringify is to emulate what @preval is doing and avoid any
@ -30,5 +34,6 @@ const sanitize = obj => JSON.parse(JSON.stringify(obj));
module.exports = sanitize({
BACKEND_URL: sanitizeURL(BACKEND_URL),
FE_BASE_PATH: getFeBasePath(),
FE_BASE_PATH: sanitizeBasename(FE_BASE_PATH),
FE_BUILD_DIR: sanitizePath(FE_BUILD_DIR) || 'static',
});

Wyświetl plik

@ -1,12 +1,15 @@
const { join } = require('path');
const { env } = require('process');
const { FE_BASE_PATH } = require(join(__dirname, '..', 'app', 'soapbox', 'build_config'));
const {
FE_BASE_PATH,
FE_BUILD_DIR,
} = require(join(__dirname, '..', 'app', 'soapbox', 'build_config'));
const settings = {
source_path: 'app',
public_root_path: 'static',
test_root_path: 'static-test',
public_root_path: FE_BUILD_DIR,
test_root_path: `${FE_BUILD_DIR}-test`,
cache_path: 'tmp/cache/webpacker',
resolved_paths: [],
static_assets_extensions: [ '.jpg', '.jpeg', '.png', '.tiff', '.ico', '.svg', '.gif', '.eot', '.otf', '.ttf', '.woff', '.woff2', '.mp3', '.ogg', '.oga' ],