从外部函数文件夹

时间:2018-05-31 10:38:45

标签: firebase google-cloud-functions package.json firebase-cli

我有一个这样的工作区,其中'app'通常是firebase init上的'functions'文件夹

server
--- app
------ controllers
------ middleware
------ db.js
------ index.js //where I export the firebase endpoint
------ router.js
------ serve.js //the express app
--- dist
--- node_modules
--- firebase.json
--- package.json

我从根目录运行firebase serve以便在本地提供函数时没有问题,但是firebase deploy要求我将package.json文件和./dist文件夹放在{{1}中}}

有没有办法从root部署,而不在应用程序中放置package.json和app文件夹?

我的package.json文件:

./dist

我的firebase.json文件

{
  "main": "./dist/index.js",
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "prepare": "rm -rf dist && babel ./app/ -d ./dist && mkdir dist/private && cp app/private/conf.json dist/private/conf.json",
    "lint": "eslint app",
    "serve": "firebase serve --only dist",
    "shell": "firebase experimental:functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only dist",
    "logs": "firebase functions:log"
  },
  "dependencies": {
    "cors": "^2.8.4",
    "cross-fetch": "^2.1.0",
    "firebase-admin": "^5.12.1",
    "firebase-functions": "^1.0.3",
    "moment": "^2.22.1",
    "uuid": "^3.2.1"
  },
  "devDependencies": {
    "babel-cli": "^6.26.0",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-preset-env": "^1.6.1",
    "babel-runtime": "^6.26.0",
    "eslint": "^4.12.0",
    "eslint-plugin-promise": "^3.6.0"
  },
  "private": true
}

0 个答案:

没有答案