Start MockService Instance

I am trying to build an Angular project, that has 4 different build types

  1. prod (production, requests go to production Backend)
  2. test (unittests, requests go to Debug Backend)
  3. debug (like prod, but with debug functionality and the backend can be set)
  4. demo (like debug, but the with MockServices in the background instead of Backend)

I know have a problem. How do I start the MockServices in the Background? How do I make sure the ports of the front end are set to the MockServices instead of the production backend.

How do I design the package.json. I attached the example project.`

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "cli": {
    "analytics": "851e2529-ac16-4728-9d03-f0539ad6cc6a"
  },
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "angular-example": {
      "projectType": "application",
      "schematics": {
        "@schematics/angular:application": {
          "strict": true
        }
      },
      "root": "",
      "sourceRoot": "src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/angular-example",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
              "src/styles.css"
            ],
            "scripts": []
          },
          "configurations": {
            "prod": {
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "500kb",
                  "maximumError": "1mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "2kb",
                  "maximumError": "4kb"
                }
              ],
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "outputHashing": "all"
            },
            "dev": {
              "buildOptimizer": false,
              "optimization": false,
              "vendorChunk": true,
              "extractLicenses": false,
              "sourceMap": true,
              "namedChunks": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.dev.ts"
                }
              ]
            },
            "demo": {
              "buildOptimizer": false,
              "optimization": false,
              "vendorChunk": true,
              "extractLicenses": false,
              "sourceMap": true,
              "namedChunks": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.demo.ts"
                }
              ]
            },
            "test": {
              "buildOptimizer": false,
              "optimization": false,
              "vendorChunk": true,
              "extractLicenses": false,
              "sourceMap": true,
              "namedChunks": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.test.ts"
                }
              ]
            }
          },
          "defaultConfiguration": "dev"
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "configurations": {
            "prod": {
              "browserTarget": "angular-example:build:prod"
            },
            "dev": {
              "browserTarget": "angular-example:build:dev"
            },
            "demo": {
              "browserTarget": "angular-example:build:demo"
            },
            "test": {
              "browserTarget": "angular-example:build:test"
            }
          },
          "defaultConfiguration": "dev"
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "angular-example:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.spec.json",
            "karmaConfig": "karma.conf.js",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
              "src/styles.css"
            ],
            "scripts": []
          }
        }
      }
    }
  },
  "defaultProject": "beispiel"
}
{
  "name": "Beispiel",
  "version": "0.0.1",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "demo": "mockserver -p 3001 -m ./src/test && ng demo",
    "debug": "mockserver -m ./src/test/Beispiel.service.mock.ts && ng debug",
    "build": "ng build",
    "watch": "ng build --watch --configuration dev",
    "uTest": "ng test",
    "mock:server": "json-server --watch src/test/beispielEntries.json",
    "postinstall": "ngcc"
  },
  "private": true,
  "angularCompilerOptions": {
    "enableIvy": false,
    "allowEmptyCodegenFiles": true
  },
  "dependencies": {
    "@angular/animations": "~13.0.0",
    "@angular/cdk": "^13.0.0",
    "@angular/common": "~13.0.0",
    "@angular/compiler": "~13.0.0",
    "@angular/core": "~13.0.0",
    "@angular/forms": "~13.0.0",
    "@angular/material": "^13.0.0",
    "@angular/platform-browser": "~13.0.0",
    "@angular/platform-browser-dynamic": "~13.0.0",
    "@angular/router": "~13.0.0",
    "@material-ui/core": "^4.12.3",
    "@types/node": "^12.20.37",
    "material-table": "^1.63.0",
    "mockserver": "^3.1.1",
    "rxjs": "~6.6.7",
    "rxjs-compat": "~6.6.7",
    "rxjs-websockets": "~9.0.0",
    "tslib": "~2.3.0",
    "tslint": "~6.1.3",
    "typescript": "~4.4.2",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^13.0.1",
    "@angular/cli": "~13.0.1",
    "@angular/compiler-cli": "~13.0.0",
    "@types/mocha": "^9.0.0",
    "bootstrap": "^3.3.6",
    "chai": "*",
    "chai-spies": "*",
    "json-server": "0.17.0",
    "karma": "~6.3.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "~1.7.0",
    "mocha": "^9.1.3",
    "mocha-loader": "~5.1.5",
    "mocha-webpack": "~1.1.0",
    "ng-mocks": "~12.5.0"
  }
}