Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#547: Added ncc to minimize the app, and updated a security issu… #4

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ venv**
/log
/.idea
/.history
/.serverless
/.serverless

# Build of the minified app
/dist

/lib
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# assistant-service

[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-green.svg)](https://www.gnu.org/licenses/gpl-3.0)

Global Digital Library's Google assistant service

## Installation
Expand All @@ -15,8 +17,10 @@ Global Digital Library's Google assistant service
- `npm install`

##### Plugins

The application uses some serverless plugins which may affect the use of additional plugins (so you are aware). Current plugins used are:
* [serverless-plugin-warmup](https://github.com/FidelLimited/serverless-plugin-warmup)

- [serverless-plugin-warmup](https://github.com/FidelLimited/serverless-plugin-warmup)

### Run locally

Expand All @@ -33,8 +37,8 @@ Test are run by using the command:
To be able to test the API on an assistant like Google Home, Google home mini or an assistant on your phone you first need to create a project on [Google actions](https://developers.google.com/actions/).
Then you can integrate with [Dialogflow](https://console.dialogflow.com/) where you set up the following:

* A `fulfilment` (webhook url) which must be a `https`-address (you can use [ngrok](https://ngrok.com/))
* A list of `intents` (should correlate with the ones defined in `app.js`)
* A set of `entities` (we use `read` and `topic`)
- A `fulfilment` (webhook url) which must be a `https`-address (you can use [ngrok](https://ngrok.com/))
- A list of `intents` (should correlate with the ones defined in `app.js`)
- A set of `entities` (we use `read` and `topic`)

In the folder `config/intents` and `config/entities` lies the configuration setup for `intents` and `entities` in the project which can be uploaded on [Dialogflow](https://console.dialogflow.com/).
61 changes: 24 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
"serverless-plugin-warmup": "^4.3.2-rc.1"
},
"scripts": {
"dev": "serverless offline start",
"test": "jest"
"dev": "npm run build && serverless offline start",
"test": "jest",
"build": "ncc build functions/app.js -o dist"
},
"author": "[email protected]",
"license": "GPL v3"
Expand Down
6 changes: 3 additions & 3 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ package:
individually: true
exclude:
- ./**
- '!node_modules/**'
- "!node_modules/**"

functions:
assistant:
handler: functions/app.handler
handler: dist/index.handler
description: "Google assistant API for reading books"
events:
- http:
Expand All @@ -44,7 +44,7 @@ functions:
- functions/**/*.js
- functions/*.js
exclude:
- '**__tests__/**'
- "**__tests__/**"

custom:
warmup:
Expand Down