Skip to content

Commit

Permalink
bugfix(): fix invalid paths
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Mar 25, 2019
1 parent 1ba57e4 commit 414b860
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/client-app/angular/angular.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
});
}

Expand Down
4 changes: 0 additions & 4 deletions src/lib/client-app/angular/files/loaders/abstract.loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
6 changes: 4 additions & 2 deletions src/lib/client-app/angular/files/loaders/express.loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
);
}
}
4 changes: 2 additions & 2 deletions src/lib/client-app/angular/files/loaders/fastify.loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand All @@ -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);
});
Expand Down

0 comments on commit 414b860

Please sign in to comment.