feat(frontend): generate NxModule only when generating NgRx

This commit is contained in:
Victor Savkin 2019-02-16 19:15:16 -05:00
parent ddf7afb219
commit 36b8ff9c94
2 changed files with 0 additions and 30 deletions

View File

@ -236,17 +236,6 @@ describe('app', () => {
});
});
it('should import NgModule', async () => {
const tree = await runSchematic(
'app',
{ name: 'myApp', directory: 'myDir' },
appTree
);
expect(
getFileContent(tree, 'apps/my-dir/my-app/src/app/app.module.ts')
).toContain('NxModule.forRoot()');
});
describe('routing', () => {
it('should include RouterTestingModule', async () => {
const tree = await runSchematic(

View File

@ -44,24 +44,6 @@ interface NormalizedSchema extends Schema {
parsedTags: string[];
}
function addNxModule(options: NormalizedSchema): Rule {
return (host: Tree) => {
const modulePath = `${options.appProjectRoot}/src/app/app.module.ts`;
const moduleSource = host.read(modulePath)!.toString('utf-8');
const sourceFile = ts.createSourceFile(
modulePath,
moduleSource,
ts.ScriptTarget.Latest,
true
);
insert(host, modulePath, [
insertImport(sourceFile, modulePath, 'NxModule', '@nrwl/nx'),
...addImportToModule(sourceFile, modulePath, 'NxModule.forRoot()')
]);
return host;
};
}
function addRouterRootConfiguration(options: NormalizedSchema): Rule {
return (host: Tree) => {
const modulePath = `${options.appProjectRoot}/src/app/app.module.ts`;
@ -379,7 +361,6 @@ export default function(schema: Schema): Rule {
updateProject(options),
updateComponentTemplate(options),
addNxModule(options),
options.routing ? addRouterRootConfiguration(options) : noop(),
options.unitTestRunner === 'jest'
? schematic('jest-project', {