diff --git a/e2e/schematics/application.test.ts b/e2e/schematics/application.test.ts index aa8771d07b..62e79c5a36 100644 --- a/e2e/schematics/application.test.ts +++ b/e2e/schematics/application.test.ts @@ -32,7 +32,7 @@ describe('Nrwl Workspace', () => { 'apps/myapp/e2e/app.po.ts'); }); - it('should build app', () => { + fit('should build app', () => { ngNew('--collection=@nrwl/schematics'); copyMissingPackages(); newApp('myapp'); diff --git a/packages/schematics/src/app/component-files/app.component.html__tmpl__ b/packages/schematics/src/app/component-files/app.component.html__tmpl__ new file mode 100644 index 0000000000..899a3940bd --- /dev/null +++ b/packages/schematics/src/app/component-files/app.component.html__tmpl__ @@ -0,0 +1,16 @@ +
+

+ Welcome to an Angular CLI app build with Nrwl Nx! +

+ +
+ +

Nx

+ +An open source toolkit for enterprise Angular applications. + +Nx is designed to help you create and build enterprise grade Angular applications. It provides an opinionated approach to application project structure and patterns. + +

Quick Start & Documentation

+ +Watch a 5-minute video on how to get started with Nx. diff --git a/packages/schematics/src/app/files/apps/__name__/__sourceDir__/assets/nx-logo.png b/packages/schematics/src/app/files/apps/__name__/__sourceDir__/assets/nx-logo.png new file mode 100644 index 0000000000..bed0370902 Binary files /dev/null and b/packages/schematics/src/app/files/apps/__name__/__sourceDir__/assets/nx-logo.png differ diff --git a/packages/schematics/src/app/index.ts b/packages/schematics/src/app/index.ts index 4b04c59555..b056ac6c51 100644 --- a/packages/schematics/src/app/index.ts +++ b/packages/schematics/src/app/index.ts @@ -1,4 +1,4 @@ -import {apply, branchAndMerge, chain, externalSchematic, mergeWith, move, Rule, template, Tree, url} from '@angular-devkit/schematics'; +import {apply, branchAndMerge, chain, externalSchematic, mergeWith, move, Rule, template, Tree, url, MergeStrategy, filter, noop} from '@angular-devkit/schematics'; import {Schema} from './schema'; import * as stringUtils from '@schematics/angular/strings'; import {addImportToModule, insert, toFileName} from '@nrwl/schematics'; @@ -70,6 +70,7 @@ export default function(schema: Schema): Rule { const templateSource = apply(url('./files'), [template({utils: stringUtils, dot: '.', tmpl: '', ...options as object})]); + const selector = `${options.prefix}-root`; return chain([ branchAndMerge(chain([mergeWith(templateSource)])), externalSchematic('@schematics/angular', 'module', { name: 'app', @@ -81,7 +82,7 @@ export default function(schema: Schema): Rule { }), externalSchematic('@schematics/angular', 'component', { name: 'app', - selector: `${options.prefix}-root`, + selector: selector, sourceDir: fullPath(options), flat: true, inlineStyle: options.inlineStyle, @@ -91,6 +92,16 @@ export default function(schema: Schema): Rule { viewEncapsulation: options.viewEncapsulation, changeDetection: options.changeDetection }), + + mergeWith( + apply( + url('./component-files'), + [ + options.inlineTemplate ? filter(path => !path.endsWith('.html')) : noop(), + template({...options, tmpl: ''}), + move(path.join(fullPath(options), 'app')), + ]), + MergeStrategy.Overwrite), addBootstrap(fullPath(options)), addNxModule(fullPath(options)), addAppToAngularCliJson(options) ]); }