Makes sure code quality stays high by checking that code is linted & formatted in CI. ### Reason Frustration — so that [things like this](https://github.com/webrecorder/browsertrix-cloud/pull/1500#issuecomment-1920087667) don't happen in the future. I tried to merge `main` into a branch to get it up to date with main, and main isn't totally formatted or linted properly, and then formatting the codebase introduced a whole bunch of unrelated changes. Running a formatter or linter shouldn't cause unrelated code changes, and `main` should always be in a correct state in terms of linting and formatting. ### Testing - [x] Test run with failing lint checks errors: https://github.com/webrecorder/browsertrix-cloud/actions/runs/7733354321/job/21085236200 - [x] Test run with failing formatting check errors: https://github.com/webrecorder/browsertrix-cloud/actions/runs/7733501666/job/21085717519 - [x] Test run with both passing lint & formatting checks passes: https://github.com/webrecorder/browsertrix-cloud/actions/runs/7733529142/job/21085796727
47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
/* eslint-env node */
|
|
const path = require("path");
|
|
require(path.resolve(process.cwd(), "./webpack.config.js"));
|
|
|
|
// for testing: for prod, using the version specified in Helm values.yaml
|
|
const RWP_BASE_URL =
|
|
process.env.RWP_BASE_URL || "https://cdn.jsdelivr.net/npm/replaywebpage/";
|
|
|
|
if (!process.env.API_BASE_URL) {
|
|
throw new Error(
|
|
"To run a dev frontend server, please set the API_BASE_URL pointing to your backend api server in '.env.local'"
|
|
);
|
|
}
|
|
|
|
const devBackendUrl = new URL(process.env.API_BASE_URL);
|
|
|
|
module.exports = {
|
|
proxy: {
|
|
"/api": {
|
|
target: devBackendUrl.href,
|
|
headers: {
|
|
Host: devBackendUrl.host,
|
|
},
|
|
ws: true,
|
|
},
|
|
|
|
"/data": {
|
|
target: devBackendUrl.href,
|
|
headers: {
|
|
Host: devBackendUrl.host,
|
|
},
|
|
},
|
|
},
|
|
// Serve replay service worker file
|
|
onBeforeSetupMiddleware: (server) => {
|
|
server.app.get("/replay/sw.js", (req, res) => {
|
|
res.set("Content-Type", "application/javascript");
|
|
res.send(`importScripts("${RWP_BASE_URL}sw.js")`);
|
|
});
|
|
|
|
server.app.get("/replay/ui.js", (req, res) => {
|
|
res.set("Content-Type", "application/javascript");
|
|
res.redirect(307, RWP_BASE_URL + "ui.js");
|
|
});
|
|
},
|
|
};
|