Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into feature/perf-suite
Browse files Browse the repository at this point in the history
  • Loading branch information
10xLaCroixDrinker authored Apr 19, 2024
2 parents e9c8c81 + 15b7c02 commit c1d1700
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ARG VERSION=lts
# builds as we do not have to run apk installs for alpine.
FROM node:$VERSION as builder
WORKDIR /opt/build
RUN npm install -g npm@9.6.7 --registry=https://registry.npmjs.org
RUN npm install -g npm@9.9.3 --registry=https://registry.npmjs.org
COPY --chown=node:node ./ /opt/build
# npm ci does not run postinstall with root account
RUN NODE_ENV=development npm ci --build-from-source
Expand Down
7 changes: 4 additions & 3 deletions __tests__/server/utils/watchLocalModules.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
} from 'holocron/moduleRegistry';
import watchLocalModules from '../../../src/server/utils/watchLocalModules';
import { getIp } from '../../../src/server/utils/getIP';
import addBaseUrlToModuleMap from '../../../src/server/utils/addBaseUrlToModuleMap';

const ip = getIp();

Expand Down Expand Up @@ -112,7 +113,7 @@ describe('watchLocalModules', () => {
await changeListener(modulePath);
expect(loadModule).toHaveBeenCalledWith(
moduleName,
moduleMapSample.modules[moduleName],
addBaseUrlToModuleMap(moduleMapSample).modules[moduleName],
require('../../../src/server/utils/onModuleLoad').default
);
expect(getModules().get(moduleName)).toBe(updatedModule);
Expand Down Expand Up @@ -153,7 +154,7 @@ describe('watchLocalModules', () => {
await changeListener(modulePath);
expect(loadModule).toHaveBeenCalledWith(
moduleName,
moduleMapSample.modules[moduleName],
addBaseUrlToModuleMap(moduleMapSample).modules[moduleName],
require('../../../src/server/utils/onModuleLoad').default
);
expect(getModules().get(moduleName)).toBe(originalModule);
Expand Down Expand Up @@ -234,7 +235,7 @@ describe('watchLocalModules', () => {
await changeListener(modulePath);
expect(loadModule).toHaveBeenCalledWith(
moduleName,
updatedModuleMapSample.modules[moduleName],
addBaseUrlToModuleMap(updatedModuleMapSample).modules[moduleName],
require('../../../src/server/utils/onModuleLoad').default
);
expect(getModules().get(moduleName)).toBe(updatedModule);
Expand Down
4 changes: 3 additions & 1 deletion src/server/utils/watchLocalModules.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
} from 'holocron/moduleRegistry';
import { getIp } from './getIP';
import onModuleLoad from './onModuleLoad';
import addBaseUrlToModuleMap from './addBaseUrlToModuleMap';

export default function watchLocalModules() {
const staticsDirectoryPath = path.resolve(__dirname, '../../../static');
Expand All @@ -43,12 +44,13 @@ export default function watchLocalModules() {

const moduleMap = JSON.parse(fs.readFileSync(moduleMapPath, 'utf8'));

const moduleData = moduleMap.modules[moduleNameChangeDetectedIn];
const moduleData = addBaseUrlToModuleMap(moduleMap).modules[moduleNameChangeDetectedIn];
const oneAppDevCdnAddress = `http://${getIp()}:${process.env.HTTP_ONE_APP_DEV_CDN_PORT || 3001}`;

moduleData.browser.url = moduleData.browser.url.replace('[one-app-dev-cdn-url]', oneAppDevCdnAddress);
moduleData.legacyBrowser.url = moduleData.legacyBrowser.url.replace('[one-app-dev-cdn-url]', oneAppDevCdnAddress);
moduleData.node.url = moduleData.node.url.replace('[one-app-dev-cdn-url]', oneAppDevCdnAddress);
moduleData.baseUrl = moduleData.baseUrl.replace('[one-app-dev-cdn-url]', oneAppDevCdnAddress);

const module = addHigherOrderComponent(await loadModule(
moduleNameChangeDetectedIn,
Expand Down

0 comments on commit c1d1700

Please sign in to comment.