首页 > 解决方案 > 如何更改heroku的node.js buildpack以运行构建以外的脚本

问题描述

我有一个应用程序 foobar,它的文件结构是这样的:

我的 package.json 看起来像这样:

"scripts": {
    "start": "node server",
    "start-local": "nodemon server NODE_ENV=local",
    "start-dev": "nodemon server NODE_ENV=dev ",
    "start-stage": "nodemon server NODE_ENV=stage",
    "build": "cd Client/ && npm install && npm run build",
    "build-stage": "cd Client/ && npm install && npm run build-stage",
    "build-dev": "cd Client/ && npm install && npm run build-dev"
  },

Client 中的 package.json 如下所示:

"scripts": {
    "ng": "ng",
    "start-dev": "ng serve --open --configuration development",
    "build": "ng build",
    "build-stage": "ng build --configuration=staging",
    "build-dev": "ng build --watch --configuration development",
    "test": "ng test"
  },

我目前已将应用程序部署在 heroku 上。我有两个应用程序:foobar-stage 和 foobar。我正在使用 node.js 构建包。我在客户端和 api 的不同 env 文件中为(dev、stage & prod)设置了不同的配置值。foob​​ar 应用程序在 heroku 上部署良好,但 foobar-stage 应用程序,尽管我将 NODE_ENV 更改为 stage 运行构建命令。

如何告诉 heroku 为 foobar-stage 运行 build-stage 命令?

标签: angularherokudeploymentmean-stackstaging

解决方案


推荐阅读