Skip to content
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
4 changes: 4 additions & 0 deletions packages/microfrontends/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ Split apart large applications and develop faster with microfrontends. This pack

See the [full documentation](https://vercel.com/docs/microfrontends) and [examples](https://vercel.com/templates/microfrontends) to learn more.

## Changelog

See the [changelog](./packages/microfrontends/CHANGELOG.md) for a list of changes.

## Getting Started

Follow the [quickstart](https://vercel.com/docs/microfrontends/quickstart) documentation to get started.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { getPossibleConfigurationFilenames } from './get-config-file-name';

describe('getPossibleConfigurationFilenames', () => {
it.each([
{
customConfigFilename: 'microfrontends.json',
expected: ['microfrontends.json', 'microfrontends.jsonc'],
},
{
customConfigFilename: 'microfrontends-dev.json',
expected: [
'microfrontends-dev.json',
'microfrontends.json',
'microfrontends.jsonc',
],
},
{
customConfigFilename: 'microfrontends-dev.jsonc',
expected: [
'microfrontends-dev.jsonc',
'microfrontends.json',
'microfrontends.jsonc',
],
},
{
customConfigFilename: '/path/to/microfrontends-dev.jsonc',
expected: [
'/path/to/microfrontends-dev.jsonc',
'microfrontends.json',
'microfrontends.jsonc',
],
},
{
customConfigFilename: 'mfe-dev.jsonc',
expected: [
'mfe-dev.jsonc',
'microfrontends.json',
'microfrontends.jsonc',
],
},
])(
'returns the filenames or throws an error if the filename is invalid',
({ customConfigFilename, expected }) => {
const result = getPossibleConfigurationFilenames({
customConfigFilename,
});
expect(result).toEqual(expected);
},
);
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// ordered by most likely to be the correct one
const DEFAULT_CONFIGURATION_FILENAMES = [
'microfrontends.jsonc',
'microfrontends.json',
'microfrontends.jsonc',
] as const;

export function getPossibleConfigurationFilenames({
Expand All @@ -15,7 +16,9 @@ export function getPossibleConfigurationFilenames({
!customConfigFilename.endsWith('.jsonc')
) {
throw new Error(
`The VC_MICROFRONTENDS_CONFIG_FILE_NAME environment variable must end with '.json' or '.jsonc'. Received: ${customConfigFilename}`,
`Found VC_MICROFRONTENDS_CONFIG_FILE_NAME but the name is invalid. Received: ${customConfigFilename}.` +
` The file name must end with '.json' or '.jsonc'.` +
` It's also possible for the env var to include the path, eg microfrontends-dev.json or /path/to/microfrontends-dev.json.`,
);
}
return Array.from(
Expand Down
6 changes: 6 additions & 0 deletions packages/microfrontends/src/next/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,11 @@ export interface WithMicrofrontendsOptions {
* enabled when necessary.
*/
supportPagesRouter?: boolean;
/**
* @deprecated Use VC_MICROFRONTENDS_CONFIG_FILE_NAME instead. This option is
* deprecated and will be removed in a future release. The env var enables the
* vercel build to also read the custom config file / path.
* @see https://vercel.com/docs/microfrontends/configuration#file-naming
*/
configPath?: string;
}
6 changes: 6 additions & 0 deletions packages/microfrontends/src/sveltekit/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ export interface WithMicrofrontendsOptions {
* Explicitly set the name of the application instead of using the name from the package.json.
*/
appName?: string;
/**
* @deprecated Use VC_MICROFRONTENDS_CONFIG_FILE_NAME instead. This option is
* deprecated and will be removed in a future release. The env var enables the
* vercel build to also read the custom config file / path.
* @see https://vercel.com/docs/microfrontends/configuration#file-naming
*/
configPath?: string;
}

Expand Down