From 44366ba489e60ff44cac316aba8fc5a6b6e9772e Mon Sep 17 00:00:00 2001 From: Steven Prybylynskyi Date: Tue, 9 Jan 2024 10:53:57 +0100 Subject: [PATCH] fix(download-types): default webpack config --- README.md | 12 ++++++++---- src/bin/__tests__/download-federated-types.test.ts | 2 +- src/bin/make-federated-types.ts | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4b76e3e..30e4af2 100644 --- a/README.md +++ b/README.md @@ -61,11 +61,15 @@ Or it can be added to `package.json`: ### CLI options #### download-federated-types -| Option | Default value | Description | -|-------------------------------|-------------------|---------------------------| -| `--webpack-config` | `webpack/prod.ts` | Path to webpack.config.js | +| Option | Default value | Description | +|-------------------------------|---------------------|---------------------------| +| `--webpack-config` | `webpack.config.js` | Path to webpack.config.js | -If the config is written in TypeScript, the script should be called with `npx ts-node`. +If the config is written in TypeScript, the script should be called with `ts-node`. _Example:_ + +``` +ts-node node_modules/bin/download-federated-types --webpack-config webpack/prod.ts +``` #### make-federated-types | Option | Default value | Description | diff --git a/src/bin/__tests__/download-federated-types.test.ts b/src/bin/__tests__/download-federated-types.test.ts index 576791a..3ec82ca 100644 --- a/src/bin/__tests__/download-federated-types.test.ts +++ b/src/bin/__tests__/download-federated-types.test.ts @@ -79,7 +79,7 @@ describe('download-federated-types', () => { require('../download-federated-types'); }); - expect(mockGetOptionsFromWebpackConfig).toHaveBeenCalledWith('webpack/prod.ts'); + expect(mockGetOptionsFromWebpackConfig).toHaveBeenCalledWith('webpack.config.js'); expect(mockConsoleError).toHaveBeenCalledWith('One or more remote URLs are invalid:', remoteEntryUrls); expect(process.exit).toHaveBeenCalledWith(1); }); diff --git a/src/bin/make-federated-types.ts b/src/bin/make-federated-types.ts index ec74897..a994103 100644 --- a/src/bin/make-federated-types.ts +++ b/src/bin/make-federated-types.ts @@ -36,7 +36,7 @@ const argv = parseArgs(process.argv.slice(2), { } as Partial, }); -const webpackConfigPath = argv['webpack-config'] || 'webpack/prod.ts'; +const webpackConfigPath = argv['webpack-config'] || 'webpack.config.js'; const federationConfig = webpackConfigPath ? getOptionsFromWebpackConfig(webpackConfigPath).mfPluginOptions as unknown as FederationConfig : getFederationConfig(argv['federation-config']);