update documentation on using application with Firebase

This commit is contained in:
Ondřej Synáček 2020-11-15 21:39:25 +01:00
parent c55774eb39
commit 0cca2a96bf
3 changed files with 18 additions and 2 deletions

View File

@ -17,7 +17,7 @@
"start": "npm run build && node lib/index.js", "start": "npm run build && node lib/index.js",
"start:dev": "concurrently \"npm run build:dev\" \"NODE_ENV=development PORT=3000 nodemon lib/index.js\"", "start:dev": "concurrently \"npm run build:dev\" \"NODE_ENV=development PORT=3000 nodemon lib/index.js\"",
"start:dev:inspect": "npm run build:dev && NODE_ENV=development PORT=3000 nodemon --inspect lib/index.js", "start:dev:inspect": "npm run build:dev && NODE_ENV=development PORT=3000 nodemon --inspect lib/index.js",
"start:dev:firebase": "npm run build:firebase:hosting:dev && NODE_ENV=development firebase emulators:start", "start:dev:firebase": "concurrently \"npm run build:firebase:hosting:dev\" \"NODE_ENV=development firebase emulators:start\"",
"test": "jest" "test": "jest"
}, },
"keywords": [ "keywords": [

View File

@ -12,6 +12,14 @@ The page that is served by the app uses a service worker and can be used offline
The site can run and download ICS file without JavaScript just fine. When JS is enabled, the server only downloads HTML file, parsing and creation of iCal file is performed inside the browser. The results will be same for both JS-enabed / disabled approach as the parser code is actually shared between browser and server. The site can run and download ICS file without JavaScript just fine. When JS is enabled, the server only downloads HTML file, parsing and creation of iCal file is performed inside the browser. The results will be same for both JS-enabed / disabled approach as the parser code is actually shared between browser and server.
## Installing
Run `npm install`. App should be compatible with `Node v10`.
### Installing with Firebase
Additionally to `npm install` in root directory, make sure you navigate to `functions/` directory and run `npm install there`. You need to set up Firebase service and install Firebase CLI in order to deploy and develop for Firebase service.
## Development ## Development
It can run in environment with NodeJS 10 installed. It does not use Facebook API for retrieving information, instead it relies on crawling and scraping event URL. This means that it can stop working or the results might not be reliable so use this at your own risk. It can run in environment with NodeJS 10 installed. It does not use Facebook API for retrieving information, instead it relies on crawling and scraping event URL. This means that it can stop working or the results might not be reliable so use this at your own risk.
@ -20,6 +28,10 @@ Run development server: `npm run start:dev`.
Run development server with debugger `npm run start:dev:inspect`. Run development server with debugger `npm run start:dev:inspect`.
### Development with Firebase
Run `npm run start:dev:firebase` from project root. This will run webpack development server for frontend and also launch Firebase emulator. Unfortunately you will not get live reload on frontend because it is actually served using Firebase hosting emulator, so you will need to refresh the browser manually.
### Static assets ### Static assets
The frontend / assets are built by webpack and put into `dist/` folder. These assets are then served statically. The frontend / assets are built by webpack and put into `dist/` folder. These assets are then served statically.
@ -32,6 +44,10 @@ The app is stateless and does not need any persistent storage.
The app is automatically set up to create logs in `logs/` directory each day but it's up to your environment if the file system is persisted. The app is automatically set up to create logs in `logs/` directory each day but it's up to your environment if the file system is persisted.
### Deployement with Firebase
Run `npm run deploy:firebase` to deploy everything. Notice: the project contains symbolic link between `lib/` and `functions/` directories so Firebase functions can actually use the application code, otherwise it would not get uploaded. Do not remove this symbolic link.
### HTTPS ### HTTPS
App contains middleware that will redirect all traffic to HTTPS if the requests contain header `X-FORWARDED-PROTO`. For this to work, the middleware has to be enabled by setting environment variable `ENFORCE_HTTPS` to value `1`. App contains middleware that will redirect all traffic to HTTPS if the requests contain header `X-FORWARDED-PROTO`. For this to work, the middleware has to be enabled by setting environment variable `ENFORCE_HTTPS` to value `1`.

View File

@ -30,7 +30,7 @@ const getFirebaseUrl = () => {
module.exports = { module.exports = {
entry: path.join(__dirname, 'lib', 'static', 'index.js'), entry: path.join(__dirname, 'lib', 'static', 'index.js'),
watch: isDevelopment && !isFirebaseEnv, watch: isDevelopment,
output: { output: {
filename: '[name].[hash].js', filename: '[name].[hash].js',
path: destination, path: destination,