@equinor/fusion-framework-cli 5.0.7-beta.0 → 5.0.7-proxy-uri.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,7 +20,7 @@
20
20
  };
21
21
  </script>
22
22
 
23
- <script type="module" crossorigin src="/assets/index-2f7c7343.js"></script>
23
+ <script type="module" crossorigin src="/assets/index-cec1b585.js"></script>
24
24
 
25
25
  <body>
26
26
  <div id="root"></div>
package/bin/serve.js CHANGED
@@ -19,12 +19,14 @@ import { createProxyMiddleware, responseInterceptor } from 'http-proxy-middlewar
19
19
  const resolveRelativePath = (path) => fileURLToPath(new URL(path, import.meta.url));
20
20
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
21
  export const server = (config) => __awaiter(void 0, void 0, void 0, function* () {
22
- var _a, _b;
22
+ var _a, _b, _c;
23
23
  const { manifest: appManifest } = config.appConfig;
24
24
  const app = express();
25
25
  app.disable('x-powered-by');
26
- const port = (_b = (_a = config.viteConfig.server) === null || _a === void 0 ? void 0 : _a.port) !== null && _b !== void 0 ? _b : 3000;
27
- const host = `http://localhost:${port}`;
26
+ const configHost = (_a = config.viteConfig.server) === null || _a === void 0 ? void 0 : _a.host;
27
+ // todo allow path
28
+ const host = new URL('/', typeof configHost === 'string' ? configHost : 'http://localhost');
29
+ host.port = String((_c = (_b = config.viteConfig.server) === null || _b === void 0 ? void 0 : _b.port) !== null && _c !== void 0 ? _c : 3000);
28
30
  const spinner = ora('Configuring dev-server').start();
29
31
  const vite = yield createServer(config.viteConfig);
30
32
  spinner.succeed('Configured dev-server');
@@ -36,13 +38,13 @@ export const server = (config) => __awaiter(void 0, void 0, void 0, function* ()
36
38
  target: 'https://pro-s-portal-ci.azurewebsites.net',
37
39
  changeOrigin: true,
38
40
  selfHandleResponse: true,
39
- onProxyRes: responseInterceptor((responseBuffer) => __awaiter(void 0, void 0, void 0, function* () {
41
+ onProxyRes: responseInterceptor((responseBuffer, _proxyRes, req) => __awaiter(void 0, void 0, void 0, function* () {
40
42
  const response = JSON.parse(responseBuffer.toString('utf8'));
41
43
  response.environmentName = 'DEVELOPMENT';
42
44
  response.services = response.services.filter((x) => x.key !== 'app');
43
45
  response.services.push({
44
46
  key: 'app',
45
- uri: host,
47
+ uri: new URL('/', req.headers.referer).href,
46
48
  });
47
49
  return JSON.stringify(response);
48
50
  })),
@@ -76,7 +78,7 @@ export const server = (config) => __awaiter(void 0, void 0, void 0, function* ()
76
78
  onProxyRes: responseInterceptor((responseBuffer, proxyRes, req, res) => __awaiter(void 0, void 0, void 0, function* () {
77
79
  const { appKey } = req.params;
78
80
  if (appManifest.key === appKey) {
79
- const response = Object.assign(Object.assign({}, appManifest), { entry: new URL(appManifest.main, host).href });
81
+ const response = Object.assign(Object.assign({}, appManifest), { entry: new URL(appManifest.main, req.headers.referer).href });
80
82
  if (Number(proxyRes.statusCode) === 404) {
81
83
  res.statusCode = 200;
82
84
  return JSON.stringify(response);
@@ -94,10 +96,10 @@ export const server = (config) => __awaiter(void 0, void 0, void 0, function* ()
94
96
  res.send(html);
95
97
  }));
96
98
  spinner.start('Starting dev-server');
97
- const instance = app.listen(port);
99
+ const instance = app.listen(host.port);
98
100
  vite.watcher.on('change', (x) => __awaiter(void 0, void 0, void 0, function* () {
99
- var _c, _d;
100
- if (x === ((_d = (_c = config.appConfig.dev) === null || _c === void 0 ? void 0 : _c.configSource) === null || _d === void 0 ? void 0 : _d.file)) {
101
+ var _d, _e;
102
+ if (x === ((_e = (_d = config.appConfig.dev) === null || _d === void 0 ? void 0 : _d.configSource) === null || _e === void 0 ? void 0 : _e.file)) {
101
103
  console.log('🛠', kleur.red('config changed, closing dev server'));
102
104
  yield vite.close();
103
105
  instance.close();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/fusion-framework-cli",
3
- "version": "5.0.7-beta.0",
3
+ "version": "5.0.7-proxy-uri.0",
4
4
  "keywords": [
5
5
  "Fusion",
6
6
  "Fusion Framework",
@@ -24,7 +24,7 @@
24
24
  "prepack": "yarn build"
25
25
  },
26
26
  "dependencies": {
27
- "@equinor/fusion-framework-app": "^6.0.7-beta.0",
27
+ "@equinor/fusion-framework-app": "^6.0.6",
28
28
  "@equinor/fusion-observable": "^7.0.1",
29
29
  "@vitejs/plugin-react": "^3.0.0",
30
30
  "commander": "^10.0.0",
@@ -37,8 +37,8 @@
37
37
  "vite-tsconfig-paths": "^4.0.5"
38
38
  },
39
39
  "devDependencies": {
40
- "@equinor/fusion-framework-module-context": "^2.0.7-beta.0",
41
- "@equinor/fusion-framework-react": "^4.0.4-beta.0",
40
+ "@equinor/fusion-framework-module-context": "^2.0.6",
41
+ "@equinor/fusion-framework-react": "^4.0.3",
42
42
  "@equinor/fusion-query": "^2.0.5",
43
43
  "@equinor/fusion-react-button": "^0.6.1",
44
44
  "@equinor/fusion-react-context-selector": "^0.3.0",
@@ -56,5 +56,5 @@
56
56
  "typescript": "^4.9.3",
57
57
  "vite-plugin-environment": "^1.1.3"
58
58
  },
59
- "gitHead": "8a1776230ab6b0176f41d875e91d1b18b5c2bc91"
59
+ "gitHead": "43c2f8bdc9584eeddba5b4a9c97a214ab4745db3"
60
60
  }