diff --git a/README.md b/README.md
index 8944c883..b1521b38 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-
+
# Angular Universal Plugin
@@ -31,7 +31,7 @@ Create a `netlify.toml` in the root of your project. Your file should include th
```toml
[build]
command = "ng build --configuration production && ng run {projectName}:serverless:production"
- publish = "dist/browser"
+ publish = "dist/{projectName}/browser"
[[plugins]]
package = "@netlify/plugin-angular-universal"
diff --git a/package.json b/package.json
index 2efe9f86..45b9a2a4 100644
--- a/package.json
+++ b/package.json
@@ -5,6 +5,7 @@
"main": "src/index.js",
"files": [
"src/**/*.js",
+ "src/**/*.json",
"manifest.yml"
],
"scripts": {
diff --git a/src/config.js b/src/config.js
new file mode 100644
index 00000000..8d07ca32
--- /dev/null
+++ b/src/config.js
@@ -0,0 +1,7 @@
+const path = require('path')
+
+const TEMPLATES_DIR = path.join(__dirname, 'templates')
+
+module.exports = {
+ TEMPLATES_DIR,
+}
diff --git a/src/helpers/addAngularServerlessFiles.js b/src/helpers/addAngularServerlessFiles.js
index 1fb11219..748df3b7 100644
--- a/src/helpers/addAngularServerlessFiles.js
+++ b/src/helpers/addAngularServerlessFiles.js
@@ -2,11 +2,11 @@ const path = require('path')
const { copySync, writeFileSync } = require('fs-extra')
+const { TEMPLATES_DIR } = require('../config')
+
const { getServerlessTs } = require('./getDynamicTemplates')
const addAngularServerlessFiles = ({ projectName, siteRoot }) => {
- const TEMPLATES_DIR = path.join('src', 'templates')
-
// Write file with injected project name
writeFileSync(
path.join(siteRoot, 'serverless.ts'),
diff --git a/src/helpers/getDynamicTemplates.js b/src/helpers/getDynamicTemplates.js
index 5ffa5cb7..e794e151 100644
--- a/src/helpers/getDynamicTemplates.js
+++ b/src/helpers/getDynamicTemplates.js
@@ -37,6 +37,7 @@ const getAngularBuilder = ({ functionServerPath }) => javascript`
`
const getServerlessTs = ({ projectName, siteRoot }) => javascript`
+ // @ts no-check
///
import 'zone.js/dist/zone-node'
@@ -45,8 +46,11 @@ const getServerlessTs = ({ projectName, siteRoot }) => javascript`
import { CommonEngine, RenderOptions } from '@nguniversal/common/engine';
import { REQUEST, RESPONSE } from '@nguniversal/express-engine/tokens';
+ // @ts-ignore
import MockExpressRequest from 'mock-express-request';
+ // @ts-ignore
import MockExpressResponse from 'mock-express-response';
+ // @ts-ignore
import qs from 'qs';
import { AppServerModule } from './src/main.server'
@@ -73,14 +77,14 @@ const getServerlessTs = ({ projectName, siteRoot }) => javascript`
}
// backwards compat for old CLI releases
- function getRawQuery(event): string {
+ function getRawQuery(event: any): string {
if (event.rawQuery) {
return event.rawQuery;
}
return qs.stringify(event.multiValueQueryStringParameters, { arrayFormat: 'repeat' })
}
- function getRawUrl(event): string {
+ function getRawUrl(event: any): string {
if (event.rawUrl) {
return event.rawUrl;
}
@@ -92,7 +96,7 @@ const getServerlessTs = ({ projectName, siteRoot }) => javascript`
return (event.headers['x-forwarded-proto'] || 'http') + "://" + event.headers.host + event.path + query;
}
- export async function render(event, context): Promise {
+ export async function render(event: any, context: any): Promise {
const { method, path, headers, multiValueHeaders } = event;
let query = getRawQuery(event);
if (!!query) {