diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 09c6b82..7e1cf16 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @cloudbeds/mfd-fe-global-owners +* @cloudbeds/mfd-fe-global-owners diff --git a/README.md b/README.md index 51931a8..2d7a82d 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,6 @@ To enable verbose logging add folowing in webpack config: | `downloadTypesWhenIdleIntervalInSeconds` | `number`, `-1` | `60` | Synchronize types continusouly - compile types after every compilation, download when idle with a specified delay value in seconds.

`-1` - disables continuous synchronization (compile and download will happen only on startup). | | `remoteEntryUrls` | `RemoteEntryUrls` | `{}` | Base URLs for types. These should target compiled bundles that also contain the types. E.g. with `{ mfeApp: 'https://assets.mydomain.com/mfe-app' }` the types will be downloaded from `'https://assets.mydomain.com/mfe-app/@types/index.d.ts'`. More details available in [this section](#templated-remote-urls) | | `remoteManifestUrls` | `RemoteManifestUrls` | `{}` | URLs to remote manifest files. A manifest contains a URL to a remote entry that is substituted in runtime.

More details available in [this section](#templated-remote-urls) | -| `cloudbedsRemoteManifestsBaseUrl` | `string` | `'/remotes/dev-ga'` | Base URL for remote `remote-entries.json` manifest file that is specific to Cloudbeds microapps

_Examples:_
`http://localhost:4480/remotes/dev` (or `/dev-docker`)
`https://cb-front.cloudbeds-dev.com/remotes/[env]`.

`remoteManifestUrls` is ignored when this setting has a value other than `undefined`. | | `moduleFederationPluginName` | `string` | `ModuleFederationPlugin` | The name of the Module Federation plugin. Change this to `NextFederationPlugin` if you are using this plugin with [@module-federation/nextjs-mf](https://www.npmjs.com/package/@module-federation/nextjs-mf) | @@ -187,7 +186,6 @@ There are several ways one can resolve this placeholder: * `remoteEntryUrls` option * `remoteManifestUrls` or `remoteManifestUrl` option - * `cloudbedsRemoteManifestsBaseUrl` option (Cloudbeds specific) The `remoteEntryUrls` option is a simple key-value map of remote names and their bundle's base URL. diff --git a/src/constants.ts b/src/constants.ts index 89b3c7a..e6105da 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -8,12 +8,3 @@ export const DEFAULT_DIR_GLOBAL_TYPES = 'src/@types'; export const DEFAULT_DIR_DOWNLOADED_TYPES = 'src/@types/remotes'; export const DEFAULT_DOWNLOAD_TYPES_INTERVAL_IN_SECONDS = 60; - -export enum CloudbedsCloudfrontDomain { - Dev = 'https://cb-front.cloudbeds-dev.com', - Stage = 'https://cb-front.cloudbeds-stage.com', - Prod = 'https://front.cloudbeds.com', -} - -export const CLOUDBEDS_REMOTES_MANIFEST_FILE_NAME = 'remote-entries.json'; -export const CLOUDBEDS_DEPLOYMENT_ENV_WITH_DISABLED_REMOTE_TYPES_DOWNLOAD = 'devbox'; diff --git a/src/downloadTypes/getRemoteManifestUrls.ts b/src/downloadTypes/getRemoteManifestUrls.ts index 869d760..a452a2c 100644 --- a/src/downloadTypes/getRemoteManifestUrls.ts +++ b/src/downloadTypes/getRemoteManifestUrls.ts @@ -1,37 +1,8 @@ -import { - CloudbedsCloudfrontDomain, - CLOUDBEDS_REMOTES_MANIFEST_FILE_NAME, -} from '../constants'; -import { isValidUrl } from '../helpers'; import { ModuleFederationTypesPluginOptions, RemoteManifestUrls, } from '../models'; export function getRemoteManifestUrls(options?: ModuleFederationTypesPluginOptions): RemoteManifestUrls | undefined { - if (options?.cloudbedsRemoteManifestsBaseUrl !== undefined) { - let artifactsBaseUrl = ''; - let manifestBaseUrl = options.cloudbedsRemoteManifestsBaseUrl; - - if (!isValidUrl(manifestBaseUrl)) { - if (['stage', 'stage-ga'].includes(manifestBaseUrl)) { - artifactsBaseUrl = `${CloudbedsCloudfrontDomain.Stage}/builds`; - manifestBaseUrl = `${CloudbedsCloudfrontDomain.Stage}/remotes/stage-ga/{version}`; - } else if (['prod', 'prod-ga'].includes(manifestBaseUrl)) { - artifactsBaseUrl = `${CloudbedsCloudfrontDomain.Prod}/builds`; - manifestBaseUrl = `${CloudbedsCloudfrontDomain.Prod}/remotes/prod-ga/{version}`; - } else { - artifactsBaseUrl = `${CloudbedsCloudfrontDomain.Dev}/branches`; - manifestBaseUrl = `${CloudbedsCloudfrontDomain.Dev}/remotes/dev-ga`; - } - } - - return { - ...(artifactsBaseUrl ? { artifactsBaseUrl } : null), - registry: `${manifestBaseUrl}/${CLOUDBEDS_REMOTES_MANIFEST_FILE_NAME}`, - ...options?.remoteManifestUrls, - }; - } - if (options?.remoteManifestUrl) { return { ...options?.remoteManifestUrls, diff --git a/src/models/ModuleFederationTypesPluginOptions.ts b/src/models/ModuleFederationTypesPluginOptions.ts index 823375b..7679282 100644 --- a/src/models/ModuleFederationTypesPluginOptions.ts +++ b/src/models/ModuleFederationTypesPluginOptions.ts @@ -13,9 +13,4 @@ export type ModuleFederationTypesPluginOptions = { remoteEntryUrls?: RemoteEntryUrls, remoteManifestUrls?: RemoteManifestUrls, remoteManifestUrl?: string, - - cloudbedsRemoteManifestsBaseUrl?: string | '' - | 'dev' | 'dev-ga' - | 'stage' | 'stage-ga' - | 'prod' | 'prod-ga', } diff --git a/src/plugin.ts b/src/plugin.ts index e2bd513..9e3b9e7 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -5,7 +5,6 @@ import { } from 'webpack'; import { - CLOUDBEDS_DEPLOYMENT_ENV_WITH_DISABLED_REMOTE_TYPES_DOWNLOAD, DEFAULT_DIR_DIST, DEFAULT_DIR_DOWNLOADED_TYPES, DEFAULT_DIR_EMITTED_TYPES, @@ -42,7 +41,7 @@ export class ModuleFederationTypesPlugin implements WebpackPluginInstance { const remoteManifestUrls = getRemoteManifestUrls(this.options); const isCompilationDisabled = !!this.options?.disableTypeCompilation; const isDownloadDisabled = this.options?.disableDownladingRemoteTypes - ?? process.env.DEPLOYMENT_ENV === CLOUDBEDS_DEPLOYMENT_ENV_WITH_DISABLED_REMOTE_TYPES_DOWNLOAD; + ?? process.env.DEPLOYMENT_ENV === 'devbox'; // Disable plugin when some URLs are not valid if (!isEveryUrlValid(Object.values({ ...remoteEntryUrls }))) {