Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate an 'angular.json' file

Tags:

angular-cli

My current application was in Angular 4 without Angular CLI. So I never had a angular.json file or Angular-cli.json file. Now we want to generate that Angular CLI or angular.json file. Because this file is not available it is not taking any of the ng commands like ng serve or ng g c testing.

How can I generate the file without using the ng new command, because ng new will create a new project which I don't want. I want to support my existing project.

Few notes on my project:

  1. We are launching multiple applications from one folder
  2. We are launching each application from the ASPX page without using index.html.

Please see the screenshot attached of the error and the folder structure of my project

Enter image description here

Enter image description here

like image 909
Akash Surana Avatar asked Oct 16 '25 19:10

Akash Surana


1 Answers

Create a new file with name '.angular-cli.json' and add this file in your main directory.

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "my-app"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "styles.css"
      ],
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
    {
      "project": "src/tsconfig.app.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "src/tsconfig.spec.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "e2e/tsconfig.e2e.json",
      "exclude": "**/node_modules/**"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "css",
    "component": {}
  }
}
like image 80
Hasee Amarathunga Avatar answered Oct 19 '25 11:10

Hasee Amarathunga



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!