cleanup(angular): remove deprecated schema options from app generator (#9821)
This commit is contained in:
parent
6d9ec39c75
commit
56957cc292
@ -204,40 +204,10 @@
|
||||
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"mf": {
|
||||
"description": "Generate a Module Federation configuration for the application",
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"x-deprecated": "Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version."
|
||||
},
|
||||
"mfType": {
|
||||
"type": "string",
|
||||
"enum": ["host", "remote"],
|
||||
"description": "Type of application to generate the Module Federation configuration for.",
|
||||
"default": "remote",
|
||||
"x-deprecated": "Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version."
|
||||
},
|
||||
"federationType": {
|
||||
"type": "string",
|
||||
"enum": ["static", "dynamic"],
|
||||
"description": "Use either Static or Dynamic Module Federation pattern for the application.",
|
||||
"default": "static",
|
||||
"x-deprecated": "Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version."
|
||||
},
|
||||
"port": {
|
||||
"type": "number",
|
||||
"description": "The port at which the remote application should be served."
|
||||
},
|
||||
"remotes": {
|
||||
"type": "array",
|
||||
"description": "A list of remote application names that the host application should consume.",
|
||||
"x-deprecated": "Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version."
|
||||
},
|
||||
"host": {
|
||||
"type": "string",
|
||||
"description": "The name of the host application that the remote application will be consumed by.",
|
||||
"x-deprecated": "Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version."
|
||||
},
|
||||
"setParserOptionsProject": {
|
||||
"type": "boolean",
|
||||
"description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
|
||||
|
||||
@ -1,29 +1,5 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`app --mf should add a remote application and add it to a specified host applications webpack config that contains a remote application already 1`] = `
|
||||
"const { withModuleFederation } = require('@nrwl/angular/module-federation');
|
||||
const config = require('./module-federation.config');
|
||||
module.exports = withModuleFederation(config);"
|
||||
`;
|
||||
|
||||
exports[`app --mf should add a remote application and add it to a specified host applications webpack config when no other remote has been added to it 1`] = `
|
||||
"const { withModuleFederation } = require('@nrwl/angular/module-federation');
|
||||
const config = require('./module-federation.config');
|
||||
module.exports = withModuleFederation(config);"
|
||||
`;
|
||||
|
||||
exports[`app --mf should generate a Module Federation correctly for a each app 1`] = `
|
||||
"const { withModuleFederation } = require('@nrwl/angular/module-federation');
|
||||
const config = require('./module-federation.config');
|
||||
module.exports = withModuleFederation(config);"
|
||||
`;
|
||||
|
||||
exports[`app --mf should generate a Module Federation correctly for a each app 2`] = `
|
||||
"const { withModuleFederation } = require('@nrwl/angular/module-federation');
|
||||
const config = require('./module-federation.config');
|
||||
module.exports = withModuleFederation(config);"
|
||||
`;
|
||||
|
||||
exports[`app --standalone should generate a standalone app correctly with routing 1`] = `
|
||||
"import { enableProdMode, importProvidersFrom } from '@angular/core';
|
||||
import { bootstrapApplication } from '@angular/platform-browser';
|
||||
|
||||
@ -5,7 +5,6 @@ import {
|
||||
NxJsonConfiguration,
|
||||
parseJson,
|
||||
readJson,
|
||||
readProjectConfiguration,
|
||||
readWorkspaceConfiguration,
|
||||
updateJson,
|
||||
} from '@nrwl/devkit';
|
||||
@ -929,99 +928,6 @@ describe('app', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('--mf', () => {
|
||||
test.each(['host', 'remote'])(
|
||||
'should generate a Module Federation correctly for a each app',
|
||||
async (type: 'host' | 'remote') => {
|
||||
await generateApp(appTree, 'my-app', { mf: true, mfType: type });
|
||||
|
||||
expect(appTree.exists(`apps/my-app/webpack.config.js`)).toBeTruthy();
|
||||
expect(
|
||||
appTree.exists(`apps/my-app/webpack.prod.config.js`)
|
||||
).toBeTruthy();
|
||||
expect(
|
||||
appTree.read(`apps/my-app/webpack.config.js`, 'utf-8')
|
||||
).toMatchSnapshot();
|
||||
}
|
||||
);
|
||||
|
||||
test.each(['host', 'remote'])(
|
||||
'should update the builder to use webpack-browser',
|
||||
async (type: 'host' | 'remote') => {
|
||||
await generateApp(appTree, 'my-app', { mf: true, mfType: type });
|
||||
|
||||
const projectConfig = readProjectConfiguration(appTree, 'my-app');
|
||||
|
||||
expect(projectConfig.targets.build.executor).toEqual(
|
||||
'@nrwl/angular:webpack-browser'
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
it('should add a remote application and add it to a specified host applications webpack config when no other remote has been added to it', async () => {
|
||||
// ARRANGE
|
||||
await generateApp(appTree, 'app1', {
|
||||
mf: true,
|
||||
mfType: 'host',
|
||||
});
|
||||
|
||||
// ACT
|
||||
await generateApp(appTree, 'remote1', {
|
||||
mf: true,
|
||||
mfType: 'remote',
|
||||
host: 'app1',
|
||||
});
|
||||
|
||||
// ASSERT
|
||||
const hostWebpackConfig = appTree.read(
|
||||
'apps/app1/webpack.config.js',
|
||||
'utf-8'
|
||||
);
|
||||
expect(hostWebpackConfig).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should add a remote application and add it to a specified host applications webpack config that contains a remote application already', async () => {
|
||||
// ARRANGE
|
||||
await generateApp(appTree, 'app1', {
|
||||
mf: true,
|
||||
mfType: 'host',
|
||||
});
|
||||
|
||||
await generateApp(appTree, 'remote1', {
|
||||
mf: true,
|
||||
mfType: 'remote',
|
||||
host: 'app1',
|
||||
port: 4201,
|
||||
});
|
||||
|
||||
// ACT
|
||||
await generateApp(appTree, 'remote2', {
|
||||
mf: true,
|
||||
mfType: 'remote',
|
||||
host: 'app1',
|
||||
port: 4202,
|
||||
});
|
||||
|
||||
// ASSERT
|
||||
const hostWebpackConfig = appTree.read(
|
||||
'apps/app1/webpack.config.js',
|
||||
'utf-8'
|
||||
);
|
||||
expect(hostWebpackConfig).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should add a port to a non-mf app', async () => {
|
||||
// ACT
|
||||
await generateApp(appTree, 'app1', {
|
||||
port: 4205,
|
||||
});
|
||||
|
||||
// ASSERT
|
||||
const projectConfig = readProjectConfiguration(appTree, 'app1');
|
||||
expect(projectConfig.targets.serve.options.port).toBe(4205);
|
||||
});
|
||||
});
|
||||
|
||||
describe('--add-tailwind', () => {
|
||||
it('should not add a tailwind.config.js and relevant packages when "--add-tailwind" is not specified', async () => {
|
||||
// ACT
|
||||
|
||||
@ -12,7 +12,6 @@ import { setupTailwindGenerator } from '../setup-tailwind/setup-tailwind';
|
||||
import {
|
||||
addE2e,
|
||||
addLinting,
|
||||
addMf,
|
||||
addProxyConfig,
|
||||
addRouterRootConfiguration,
|
||||
addUnitTestRunner,
|
||||
@ -135,10 +134,6 @@ export async function applicationGenerator(
|
||||
convertToStandaloneApp(host, options);
|
||||
}
|
||||
|
||||
if (options.mf) {
|
||||
await addMf(host, options);
|
||||
}
|
||||
|
||||
if (!options.skipFormat) {
|
||||
await formatFiles(host);
|
||||
}
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
import type { Tree } from '@nrwl/devkit';
|
||||
import type { NormalizedSchema } from './normalized-schema';
|
||||
|
||||
import { setupMf } from '../../setup-mf/setup-mf';
|
||||
|
||||
export async function addMf(host: Tree, options: NormalizedSchema) {
|
||||
await setupMf(host, {
|
||||
appName: options.name,
|
||||
mfType: options.mfType,
|
||||
port: options.port,
|
||||
remotes: options.remotes,
|
||||
host: options.host,
|
||||
routing: options.routing,
|
||||
skipFormat: true,
|
||||
skipPackageJson: options.skipPackageJson,
|
||||
e2eProjectName: options.e2eProjectName,
|
||||
federationType: options.federationType,
|
||||
prefix: options.prefix,
|
||||
});
|
||||
}
|
||||
@ -1,6 +1,5 @@
|
||||
export * from './add-e2e';
|
||||
export * from './add-linting';
|
||||
export * from './add-mf';
|
||||
export * from './add-protractor';
|
||||
export * from './add-proxy-config';
|
||||
export * from './add-unit-test-runner';
|
||||
|
||||
@ -23,30 +23,10 @@ export interface Schema {
|
||||
backendProject?: string;
|
||||
strict?: boolean;
|
||||
standaloneConfig?: boolean;
|
||||
/**
|
||||
* @deprecated Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version.
|
||||
*/
|
||||
mf?: boolean;
|
||||
/**
|
||||
* @deprecated Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version.
|
||||
*/
|
||||
mfType?: 'host' | 'remote';
|
||||
/**
|
||||
* @deprecated Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version.
|
||||
*/
|
||||
remotes?: string[];
|
||||
port?: number;
|
||||
/**
|
||||
* @deprecated Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version.
|
||||
*/
|
||||
host?: string;
|
||||
setParserOptionsProject?: boolean;
|
||||
skipPackageJson?: boolean;
|
||||
skipPostInstall?: boolean;
|
||||
/**
|
||||
* @deprecated Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version.
|
||||
*/
|
||||
federationType?: 'static' | 'dynamic';
|
||||
skipDefaultProject?: boolean;
|
||||
standalone?: boolean;
|
||||
}
|
||||
|
||||
@ -133,40 +133,10 @@
|
||||
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"mf": {
|
||||
"description": "Generate a Module Federation configuration for the application",
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"x-deprecated": "Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version."
|
||||
},
|
||||
"mfType": {
|
||||
"type": "string",
|
||||
"enum": ["host", "remote"],
|
||||
"description": "Type of application to generate the Module Federation configuration for.",
|
||||
"default": "remote",
|
||||
"x-deprecated": "Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version."
|
||||
},
|
||||
"federationType": {
|
||||
"type": "string",
|
||||
"enum": ["static", "dynamic"],
|
||||
"description": "Use either Static or Dynamic Module Federation pattern for the application.",
|
||||
"default": "static",
|
||||
"x-deprecated": "Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version."
|
||||
},
|
||||
"port": {
|
||||
"type": "number",
|
||||
"description": "The port at which the remote application should be served."
|
||||
},
|
||||
"remotes": {
|
||||
"type": "array",
|
||||
"description": "A list of remote application names that the host application should consume.",
|
||||
"x-deprecated": "Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version."
|
||||
},
|
||||
"host": {
|
||||
"type": "string",
|
||||
"description": "The name of the host application that the remote application will be consumed by.",
|
||||
"x-deprecated": "Use the `host` or `remote` generators instead. Support for generating Module Federation applications using the application generator will be removed in an upcoming version."
|
||||
},
|
||||
"setParserOptionsProject": {
|
||||
"type": "boolean",
|
||||
"description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user