本文整理汇总了TypeScript中@angular-devkit/architect/src/architect.Architect类的典型用法代码示例。如果您正苦于以下问题:TypeScript Architect类的具体用法?TypeScript Architect怎么用?TypeScript Architect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Architect类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: describe
describe('AppShell Builder', () => {
const target = { project: 'app', target: 'app-shell' };
let architect: Architect;
beforeEach(async () => {
await host.initialize().toPromise();
architect = (await createArchitect(host.root())).architect;
});
afterEach(async () => host.restore().toPromise());
const appShellRouteFiles = {
'src/app/app-shell/app-shell.component.html': `
<p>
app-shell works!
</p>
`,
'src/app/app-shell/app-shell.component.ts': `
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-app-shell',
templateUrl: './app-shell.component.html',
})
export class AppShellComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
`,
'src/app/app.module.ts': `
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { environment } from '../environments/environment';
import { RouterModule } from '@angular/router';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule.withServerTransition({ appId: 'serverApp' }),
AppRoutingModule,
RouterModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
`,
'src/app/app.server.module.ts': `
import { NgModule } from '@angular/core';
import { ServerModule } from '@angular/platform-server';
import { AppModule } from './app.module';
import { AppComponent } from './app.component';
import { Routes, RouterModule } from '@angular/router';
import { AppShellComponent } from './app-shell/app-shell.component';
const routes: Routes = [ { path: 'shell', component: AppShellComponent }];
@NgModule({
imports: [
AppModule,
ServerModule,
RouterModule.forRoot(routes),
],
bootstrap: [AppComponent],
declarations: [AppShellComponent],
})
export class AppServerModule {}
`,
'src/main.ts': `
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
document.addEventListener('DOMContentLoaded', () => {
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));
});
`,
'src/app/app-routing.module.ts': `
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
const routes: Routes = [];
@NgModule({
//.........这里部分代码省略.........
开发者ID:angular,项目名称:angular-cli,代码行数:101,代码来源:app-shell_spec_large.ts
示例2: it
it('works with route', async () => {
host.writeMultipleFiles(appShellRouteFiles);
const overrides = { route: 'shell' };
const run = await architect.scheduleTarget(target, overrides);
const output = await run.result;
await run.stop();
expect(output.success).toBe(true);
const fileName = 'dist/index.html';
const content = virtualFs.fileBufferToString(host.scopedSync().read(normalize(fileName)));
expect(content).toContain('app-shell works!');
});
开发者ID:angular,项目名称:angular-cli,代码行数:13,代码来源:app-shell_spec_large.ts
注:本文中的@angular-devkit/architect/src/architect.Architect类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论