在基本的Firebase Functions项目中,将在functions文件夹中创建package.json文件。现在,我们将在项目中使用CircleCI。为了使此配置项正常工作,package.json必须位于存储库的顶部文件夹中,而不是此帖子中所见的任何其他子文件夹中:https : //discuss.circleci.com/t/cant-run- npm-install / 19012
现在,如果我将文件移至根目录并更正所有路径,则可以在项目上构建并使用lint,但是部署因错误而失败,即firebase没有项目的目录路径。似乎firebase-tools中有一个硬编码的方法,它阻止package.json移动到functions文件夹之外。
如果我复制package.json并将其放回functions文件夹,则一切工作正常,但这不是解决方案。
这是我想要的结构:
myproject
|
+- .firebaserc
+- firebase.json
+- package.json
+- tsconfig.json
+- tslint.json
|
+- functions/
|
+- src/
| |
| +- index.ts
|
+- lib/
|
+- index.js
+- index.js.map
Run Code Online (Sandbox Code Playgroud)
package.json
{
"name": "functions",
"scripts": {
"lint": "tslint --project tsconfig.json",
"build": "tsc",
"serve": "npm run build && firebase serve --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": …Run Code Online (Sandbox Code Playgroud)