Skip to content
This repository was archived by the owner on Jun 24, 2021. It is now read-only.

Backend rework#27

Merged
chamkank merged 16 commits into
masterfrom
backend-rework
Aug 3, 2018
Merged

Backend rework#27
chamkank merged 16 commits into
masterfrom
backend-rework

Conversation

@chamkank

@chamkank chamkank commented Jul 22, 2018

Copy link
Copy Markdown
Contributor

👷 Changes

  • Changes made to export functions to GCF directly using the Firebase CLI
  • Local emulation is working!
    • make functions to host HTTP functions locally
    • make shell to host the functions in an interactive shell
  • make deploy-dev or make deploy-prod to upload functions directly from command line (no more repo mirroring required)

Will be adding unit testing soon™ in the next PR.

chamkank added 10 commits July 18, 2018 23:12
Mostly taken from serverless/package.json
We will define functions seperately in functions/src/. Each file in src will be responsible for importing their own dependencies.

Also note that each file can export more than one function so we can group related functions into the same files (ex: email.js)
@bobheadxi

Copy link
Copy Markdown
Contributor

Looks awesome so far! Are we removing the serverless directory entirely then? (functions is a much nicer name 😋 )

@bobheadxi bobheadxi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

however:

bobbook:nwhacks2019 robertlin$ make functions
(cd ./functions ; yarn serve)
yarn run v1.7.0
$ firebase serve --only functions

Error: No project active, but project aliases are available.

Run firebase use <alias> with one of these options:

  development (nwhacks-2019-dev)
  production (nwhacks-2019)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
make: *** [functions] Error 1

🤔

Comment thread functions/.eslintrc.json
"no-regex-spaces": "off",

// Removed rule "disallow the use of debugger" from recommended eslint rules
"no-debugger": "off",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this really need a comment for each rule?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

firebase init seemed to think so, I'm gonna leave them there because some of them do seem useful.

Comment thread functions/.eslintrc.json Outdated
"plugins": [
"promise"
],
"extends": "eslint:recommended",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any thoughts on extending AirBNB-base (for more consistency with the front-end)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, will do

Comment thread Makefile
# Runs interactive shell for cloud functions
.PHONY: shell
shell:
(cd ./functions ; yarn start)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💪

Comment thread functions/package.json
"start": "yarn pick:dev && yarn run shell",
"deploy:dev": "yarn pick:dev && firebase deploy --only functions",
"deploy:prod": "yarn pick:prod && firebase deploy --only functions",
"logs": "firebase functions:log"

@bobheadxi bobheadxi Aug 2, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

travis is looking for a test script here, can probably copy the one that used to be in serverless or add a simple one-liner that exits with 0 to appease travis for now

@bobheadxi bobheadxi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff - lots of changes here, let's get this PR landed ASAP 🗡 🐦 🍽

@chamkank chamkank merged commit f05fb86 into master Aug 3, 2018
@chamkank chamkank deleted the backend-rework branch August 3, 2018 06:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants