Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/cli/dev proxy/join #2612

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/wise-pears-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@equinor/fusion-framework-cli': patch
---

### Changes

- Stopped using node:path join in app-proxy-plugin since it caused issues on windows
11 changes: 5 additions & 6 deletions packages/cli/src/lib/plugins/app-proxy/app-proxy-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { AppManifest } from '@equinor/fusion-framework-app';
import { ClientRequest, IncomingMessage, ServerResponse } from 'node:http';

import { ApiAppConfig } from '../../../schemas.js';
import { join } from 'node:path';

/**
* Preserve token for executing proxy assets
Expand Down Expand Up @@ -151,27 +150,27 @@ export const appProxyPlugin = (options: AppProxyPluginOptions): Plugin => {
if (!app) return;

// serve app config if request matches the current app and version
const configPath = join(
const configPath = [
proxyPath,
app.configPath ?? `apps/${app.key}/builds/${app.version}/config`,
);
].join('/');
server.middlewares.use(configPath, async (_req, res) => {
res.setHeader('content-type', 'application/json');
res.end(JSON.stringify(await app.generateConfig()));
});

// serve app manifest if request matches the current app
const manifestPath = join(proxyPath, app.manifestPath ?? `apps/${app.key}`);
const manifestPath = [proxyPath, app.manifestPath ?? `apps/${app.key}`].join('/');
server.middlewares.use(manifestPath, async (_req, res) => {
res.setHeader('content-type', 'application/json');
res.end(JSON.stringify(await app.generateManifest()));
});

// serve local bundles if request matches the current app and version
const bundlePath = join(
const bundlePath = [
proxyPath,
app.bundlePath ?? `bundles/apps/${app.key}/${app.version}`,
);
].join('/');
server.middlewares.use(async (req, _res, next) => {
if (req.url?.match(bundlePath)) {
// remove proxy path from url
Expand Down