1
0
mirror of synced 2026-01-20 21:06:36 -05:00
Files
airbyte/airbyte-webapp/packages/vite-plugins/doc-middleware.ts
Tim Roes 828b32a3a2 🪟 🔧 Migrate from react-scripts to Vite (#21421)
* Migrate to Vite

* Continue work on vite migration

* More environment fixes

* Add CSP headers to dev server

* Remove react-scripts

* Shim process.env

* Cleanup

* Create ESLint failure for CI test

* create vite-plugins package

* Update nodeJS

* Make eslint warnings fail build

* Remove trailing empty line in nvmrc

* Match package.json with nvmrc

* Fix eslint test breakage

* Revert node upgrade

* Remove setupProxy script

* Change default API endpoints to be http
2023-01-23 21:10:23 +01:00

28 lines
1.0 KiB
TypeScript

import type { Connect, Plugin } from "vite";
import express from "express";
export function docMiddleware(): Plugin {
return {
name: "airbyte/doc-middleware",
configureServer(server) {
// Serve the docs used in the sidebar. During building Gradle will copy those into the docker image
// Relavant gradle task :airbyte-webapp:copyDocs
server.middlewares.use(
"/docs/integrations",
express.static(`${__dirname}/../../../docs/integrations`) as Connect.NextHandleFunction
);
// workaround for adblockers to serve google ads docs in development
server.middlewares.use(
"/docs/integrations/sources/gglad.md",
express.static(`${__dirname}/../../../docs/integrations/sources/google-ads.md`) as Connect.NextHandleFunction
);
// Server assets that can be used during. Related gradle task: :airbyte-webapp:copyDocAssets
server.middlewares.use(
"/docs/.gitbook",
express.static(`${__dirname}/../../../docs/.gitbook`) as Connect.NextHandleFunction
);
},
};
}