Skip to content

Commit

Permalink
fix: support other dev envs
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-pribilinskiy committed Jun 15, 2023
1 parent f10a37e commit 9d03a86
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
4 changes: 0 additions & 4 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,3 @@ export enum CloudbedsCloudfrontDomain {

export const CLOUDBEDS_REMOTES_MANIFEST_FILE_NAME = 'remote-entries.json';
export const CLOUDBEDS_DEPLOYMENT_ENV_WITH_DISABLED_REMOTE_TYPES_DOWNLOAD = 'devbox';

export enum CloudbedsMicrofrontend {
Common = 'mfdCommon',
}
2 changes: 1 addition & 1 deletion src/helpers/cloudbedsRemoteManifests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ModuleFederationTypesPluginOptions, RemoteManifestUrls } from '../types
export function getRemoteManifestUrls(options?: ModuleFederationTypesPluginOptions): RemoteManifestUrls | undefined {
if (options?.cloudbedsRemoteManifestsBaseUrl !== undefined) {
let baseUrl = options?.cloudbedsRemoteManifestsBaseUrl;
if (!baseUrl || ['use-domain-name', 'dev', 'dev-ga'].includes(baseUrl)) {
if (!baseUrl || ['use-domain-name', 'dev', 'dev-ga', 'dev-idp', 'devbox'].includes(baseUrl)) {
baseUrl = `${CloudbedsCloudfrontDomain.Dev}/remotes/dev-ga`;
} else if (['stage', 'stage-ga'].includes(baseUrl)) {
baseUrl = `${CloudbedsCloudfrontDomain.Stage}/remotes/stage-ga/{version}`;
Expand Down
6 changes: 3 additions & 3 deletions src/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import webpack, { Compilation, Compiler } from 'webpack';
import { downloadTypes } from './helpers/downloadTypes';
import { ModuleFederationTypesPlugin } from './plugin';
import { ModuleFederationPluginOptions, ModuleFederationTypesPluginOptions } from './types';
import { CloudbedsMicrofrontend, DEFAULT_DIR_DOWNLOADED_TYPES, DEFAULT_DIR_EMITTED_TYPES } from './constants';
import { DEFAULT_DIR_DOWNLOADED_TYPES, DEFAULT_DIR_EMITTED_TYPES } from './constants';

jest.mock('./helpers/downloadTypes');

Expand Down Expand Up @@ -57,7 +57,7 @@ describe('ModuleFederationTypesPlugin', () => {
const moduleFederationPluginOptions = {
name: 'mfdDashboard',
remotes: {
[CloudbedsMicrofrontend.Common]: `${CloudbedsMicrofrontend.Common}@[mfdCommonUrl]/remoteEntry.js`,
mfdCommon: `mdfCommon@[mfdCommonUrl]/remoteEntry.js`,
mfdTranslations: 'mfdTranslations@[mfdTranslationsUrl]/remoteEntry.js',
}
};
Expand All @@ -66,7 +66,7 @@ describe('ModuleFederationTypesPlugin', () => {
mfeApp: 'https://artifacts.example.com/mfe-app',
},
remoteManifestUrls: {
[CloudbedsMicrofrontend.Common]: 'https://example.com/mfd-common-remote-entries.json',
mfdCommon: 'https://example.com/mfd-common-remote-entries.json',
registry: 'https://example.com/remote-entries.json',
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class ModuleFederationTypesPlugin implements WebpackPluginInstance {

const compileTypesContinuouslyAfterEmit = () => {
// Reset and create an Interval to redownload types every 60 seconds after compilation
if (remotes && !this.options?.disableDownladingRemoteTypes) {
if (remotes && !isDownloadDisabled) {
clearInterval(recompileIntervalId);
recompileIntervalId = setInterval(
() => {
Expand Down

0 comments on commit 9d03a86

Please sign in to comment.