web: add rollup config for proxy outpost
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
03e0eecb1d
commit
b58875d4c7
|
@ -4,7 +4,7 @@ FROM --platform=${BUILDPLATFORM} docker.io/node:16 as web-builder
|
||||||
COPY ./web /static/
|
COPY ./web /static/
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
RUN cd /static && npm i && npm run build
|
RUN cd /static && npm i && npm run build-proxy
|
||||||
|
|
||||||
# Stage 2: Build
|
# Stage 2: Build
|
||||||
FROM docker.io/golang:1.17.3-bullseye AS builder
|
FROM docker.io/golang:1.17.3-bullseye AS builder
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"extract": "lingui extract",
|
"extract": "lingui extract",
|
||||||
"build": "lingui compile && rollup -c ./rollup.config.js",
|
"build": "lingui compile && rollup -c ./rollup.config.js",
|
||||||
|
"build-proxy": "lingui compile && rollup -c ./rollup.proxy.js",
|
||||||
"watch": "lingui compile && rollup -c -w",
|
"watch": "lingui compile && rollup -c -w",
|
||||||
"lint": "eslint . --max-warnings 0 --fix",
|
"lint": "eslint . --max-warnings 0 --fix",
|
||||||
"lit-analyse": "lit-analyzer src",
|
"lit-analyse": "lit-analyzer src",
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { terser } from "rollup-plugin-terser";
|
||||||
|
|
||||||
const extensions = [".js", ".jsx", ".ts", ".tsx"];
|
const extensions = [".js", ".jsx", ".ts", ".tsx"];
|
||||||
|
|
||||||
const resources = [
|
export const resources = [
|
||||||
{ src: "node_modules/rapidoc/dist/rapidoc-min.js", dest: "dist/" },
|
{ src: "node_modules/rapidoc/dist/rapidoc-min.js", dest: "dist/" },
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -44,12 +44,12 @@ const resources = [
|
||||||
];
|
];
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
const isProdBuild = process.env.NODE_ENV === "production";
|
export const isProdBuild = process.env.NODE_ENV === "production";
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
const apiBasePath = process.env.AK_API_BASE_PATH || "";
|
export const apiBasePath = process.env.AK_API_BASE_PATH || "";
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||||
function manualChunks(id) {
|
export function manualChunks(id) {
|
||||||
if (id.endsWith(".md")) {
|
if (id.endsWith(".md")) {
|
||||||
return "docs";
|
return "docs";
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ function manualChunks(id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const PLUGINS = [
|
export const PLUGINS = [
|
||||||
cssimport(),
|
cssimport(),
|
||||||
markdown(),
|
markdown(),
|
||||||
nodeResolve({ extensions, browser: true }),
|
nodeResolve({ extensions, browser: true }),
|
||||||
|
@ -88,9 +88,8 @@ const PLUGINS = [
|
||||||
isProdBuild && terser(),
|
isProdBuild && terser(),
|
||||||
].filter((p) => p);
|
].filter((p) => p);
|
||||||
|
|
||||||
export default [
|
// Polyfills (imported first)
|
||||||
// Polyfills (imported first)
|
export const POLY = {
|
||||||
{
|
|
||||||
input: "./poly.ts",
|
input: "./poly.ts",
|
||||||
output: [
|
output: [
|
||||||
{
|
{
|
||||||
|
@ -112,7 +111,10 @@ export default [
|
||||||
watch: {
|
watch: {
|
||||||
clearScreen: false,
|
clearScreen: false,
|
||||||
},
|
},
|
||||||
},
|
};
|
||||||
|
|
||||||
|
export default [
|
||||||
|
POLY,
|
||||||
// Flow interface
|
// Flow interface
|
||||||
{
|
{
|
||||||
input: "./src/interfaces/FlowInterface.ts",
|
input: "./src/interfaces/FlowInterface.ts",
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
import { POLY } from "./rollup.config";
|
||||||
|
|
||||||
|
export default [POLY];
|
Reference in New Issue