feat(schematics): add a nice app.component.html
This commit is contained in:
parent
78a1552c66
commit
bfcaaeafb7
@ -32,7 +32,7 @@ describe('Nrwl Workspace', () => {
|
|||||||
'apps/myapp/e2e/app.po.ts');
|
'apps/myapp/e2e/app.po.ts');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should build app', () => {
|
fit('should build app', () => {
|
||||||
ngNew('--collection=@nrwl/schematics');
|
ngNew('--collection=@nrwl/schematics');
|
||||||
copyMissingPackages();
|
copyMissingPackages();
|
||||||
newApp('myapp');
|
newApp('myapp');
|
||||||
|
|||||||
@ -0,0 +1,16 @@
|
|||||||
|
<div style="text-align:center">
|
||||||
|
<h1>
|
||||||
|
Welcome to an Angular CLI app build with Nrwl Nx!
|
||||||
|
</h1>
|
||||||
|
<img width="300" src="assets/nx-logo.png">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2>Nx</h2>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
<h2>Quick Start & Documentation</h2>
|
||||||
|
|
||||||
|
<a href="https://nrwl.io/nx">Watch a 5-minute video on how to get started with Nx.</a>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
@ -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 {Schema} from './schema';
|
||||||
import * as stringUtils from '@schematics/angular/strings';
|
import * as stringUtils from '@schematics/angular/strings';
|
||||||
import {addImportToModule, insert, toFileName} from '@nrwl/schematics';
|
import {addImportToModule, insert, toFileName} from '@nrwl/schematics';
|
||||||
@ -70,6 +70,7 @@ export default function(schema: Schema): Rule {
|
|||||||
const templateSource =
|
const templateSource =
|
||||||
apply(url('./files'), [template({utils: stringUtils, dot: '.', tmpl: '', ...options as object})]);
|
apply(url('./files'), [template({utils: stringUtils, dot: '.', tmpl: '', ...options as object})]);
|
||||||
|
|
||||||
|
const selector = `${options.prefix}-root`;
|
||||||
return chain([
|
return chain([
|
||||||
branchAndMerge(chain([mergeWith(templateSource)])), externalSchematic('@schematics/angular', 'module', {
|
branchAndMerge(chain([mergeWith(templateSource)])), externalSchematic('@schematics/angular', 'module', {
|
||||||
name: 'app',
|
name: 'app',
|
||||||
@ -81,7 +82,7 @@ export default function(schema: Schema): Rule {
|
|||||||
}),
|
}),
|
||||||
externalSchematic('@schematics/angular', 'component', {
|
externalSchematic('@schematics/angular', 'component', {
|
||||||
name: 'app',
|
name: 'app',
|
||||||
selector: `${options.prefix}-root`,
|
selector: selector,
|
||||||
sourceDir: fullPath(options),
|
sourceDir: fullPath(options),
|
||||||
flat: true,
|
flat: true,
|
||||||
inlineStyle: options.inlineStyle,
|
inlineStyle: options.inlineStyle,
|
||||||
@ -91,6 +92,16 @@ export default function(schema: Schema): Rule {
|
|||||||
viewEncapsulation: options.viewEncapsulation,
|
viewEncapsulation: options.viewEncapsulation,
|
||||||
changeDetection: options.changeDetection
|
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)
|
addBootstrap(fullPath(options)), addNxModule(fullPath(options)), addAppToAngularCliJson(options)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user