diff --git a/package.json b/package.json index e3f0f5fb2..ed0ba7b1b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nestjs/schematics", - "version": "6.1.2-next", + "version": "6.1.3-next", "description": "Nest - modern, fast, powerful node.js web framework (@schematics)", "main": "index.js", "publishConfig": { diff --git a/src/lib/client-app/angular/angular.factory.ts b/src/lib/client-app/angular/angular.factory.ts index 8577a4142..186ecd454 100644 --- a/src/lib/client-app/angular/angular.factory.ts +++ b/src/lib/client-app/angular/angular.factory.ts @@ -71,7 +71,7 @@ function createAngularApplication(options: AngularOptions): Rule { } return externalSchematic('@schematics/angular', 'ng-new', { name: options.directory, - version: '7.0.0', + version: '^7.0.0', }); } diff --git a/src/lib/client-app/angular/files/loaders/abstract.loader.ts b/src/lib/client-app/angular/files/loaders/abstract.loader.ts index 1a3e110b1..82741f1fb 100644 --- a/src/lib/client-app/angular/files/loaders/abstract.loader.ts +++ b/src/lib/client-app/angular/files/loaders/abstract.loader.ts @@ -13,8 +13,4 @@ export abstract class AbstractLoader { public getIndexFilePath(clientPath: string): string { return join(clientPath, 'index.html'); } - - public getClientDirPath(options: AngularModuleOptions): string { - return join(process.cwd(), '..', options.rootPath); - } } diff --git a/src/lib/client-app/angular/files/loaders/express.loader.ts b/src/lib/client-app/angular/files/loaders/express.loader.ts index b2579760f..eaa04c2f3 100644 --- a/src/lib/client-app/angular/files/loaders/express.loader.ts +++ b/src/lib/client-app/angular/files/loaders/express.loader.ts @@ -14,10 +14,12 @@ export class ExpressLoader extends AbstractLoader { const express = loadPackage('express', 'AngularModule', () => require('express'), ); - const clientPath = this.getClientDirPath(options); + const clientPath = options.rootPath; const indexFilePath = this.getIndexFilePath(clientPath); app.use(express.static(clientPath, options.serveStaticOptions)); - app.get(options.renderPath, (req, res) => res.sendFile(indexFilePath)); + app.get(options.renderPath, (req: any, res: any) => + res.sendFile(indexFilePath), + ); } } diff --git a/src/lib/client-app/angular/files/loaders/fastify.loader.ts b/src/lib/client-app/angular/files/loaders/fastify.loader.ts index a3474c9e3..b2a51b78d 100644 --- a/src/lib/client-app/angular/files/loaders/fastify.loader.ts +++ b/src/lib/client-app/angular/files/loaders/fastify.loader.ts @@ -17,7 +17,7 @@ export class FastifyLoader extends AbstractLoader { ); const { setHeaders, redirect, ...send } = options.serveStaticOptions || ({} as any); - const clientPath = this.getClientDirPath(options); + const clientPath = options.rootPath; const indexFilePath = this.getIndexFilePath(clientPath); app.register(fastifyStatic, { @@ -26,7 +26,7 @@ export class FastifyLoader extends AbstractLoader { redirect, send, }); - app.get(options.renderPath, (req, res) => { + app.get(options.renderPath, (req: any, res: any) => { const stream = fs.createReadStream(indexFilePath); res.type('text/html').send(stream); });