如何告诉ng deploy运行不同的npm构建脚本

时间:2019-09-23 11:37:47

标签: angular firebase angularfire2 firebase-hosting

我正在使用@angular/fire在Firebase Hosting上部署我的应用程序。另外,每次构建应用程序时我都会预渲染我的应用程序,因此我制作了以下npm脚本:

"scripts": {
  ...
  "build:client-and-server-bundles": "ng build --prod && ng run portfolio:server:production",
  "build:prerender": "npm run build:client-and-server-bundles && node prerender.js",
}

所以我的问题是,当我运行ng deploy时,我该如何告诉angular应该只运行build:prerender然后上传到firebase?

编辑1

这些是当前脚本:

  "scripts": {
    "ng": "ng",
    "deploy": "npm run build:prerender",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "serve": "node serve-script",
    "compile:server": "webpack --config webpack.server.config.js --progress --colors",
    "serve:ssr": "node dist/server",
    "build:ssr": "npm run build:client-and-server-bundles && npm run compile:server",
    "build:client-and-server-bundles": "ng build --prod && ng run portfolio:server:production",
    "build:prerender": "npm run build:client-and-server-bundles && node prerender.js",
    "serve:prerender": "http-server dist/browser -c-1"
  },

0 个答案:

没有答案