Where is the file angular-cli.json in the new @angular/cli version?
Asked Answered
B

4

43

I'm new in angular2 and i have tried to create a project with cli, but when I try to change the css adding it in angular-cli.json, I have detected that this file is not created...

Can I create manually or this file has been changed for another one?

Thanks!!

Bellamy answered 22/2, 2017 at 15:7 Comment(0)
D
25

The angular-cli.json should be located in the root folder of the project. This is using the latest version "@angular/cli": "1.0.0-beta.32.3".

As for creating it if it is missing or maybe accidentally deleted, you could try that since the original version is pretty generic. Here is what it should look like right after project creation:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "version": "1.0.0-beta.32.3",
    "name": "testproj"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.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": [
    {
      "files": "src/**/*.ts",
      "project": "src/tsconfig.json"
    },
    {
      "files": "e2e/**/*.ts",
      "project": "e2e/tsconfig.json"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "css",
    "component": {}
  }
}

You could also try generating a new project with the cli with ng new PROJECT_NAME and see if it contains the angular-cli.json file.

Disbranch answered 22/2, 2017 at 15:20 Comment(0)
R
121

Angular 6 and later

angular-cli.json file has been renamed/replaced with angular.json in version 6 of Angular.

It's a different file format and not just a rename :

https://github.com/angular/angular-cli/wiki/angular-workspace

Rennie answered 4/5, 2018 at 22:50 Comment(4)
The documentation for this file and its formatting is here: https://github.com/angular/angular-cli/wiki/angular-workspace. This is for Angular CLI 6Pretoria
@Weikardzaena thanks for adding this. It's a file format change too and not just a rename as my answer probably implied.Rennie
I know this is an old thread but if we have upgraded to 6 then is it safe to delete the angular-cli.json file being that the newer angular.json file is present ?Hatcher
Yes you can delete the old one safely.Rennie
F
36

The file was changed to be a hidden file now on unix/linux systems. It is now .angular-cli.json.

Flavone answered 22/2, 2017 at 19:33 Comment(0)
D
25

The angular-cli.json should be located in the root folder of the project. This is using the latest version "@angular/cli": "1.0.0-beta.32.3".

As for creating it if it is missing or maybe accidentally deleted, you could try that since the original version is pretty generic. Here is what it should look like right after project creation:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "version": "1.0.0-beta.32.3",
    "name": "testproj"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.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": [
    {
      "files": "src/**/*.ts",
      "project": "src/tsconfig.json"
    },
    {
      "files": "e2e/**/*.ts",
      "project": "e2e/tsconfig.json"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "css",
    "component": {}
  }
}

You could also try generating a new project with the cli with ng new PROJECT_NAME and see if it contains the angular-cli.json file.

Disbranch answered 22/2, 2017 at 15:20 Comment(0)
E
1

If you are looking for the global CLI config, I found it here on Windows:

%USERPROFILE%\angular-config.json

Example config change

ng config -g cli.defaultCollection @angular-eslint/schematics

Change is saved here

C:\users\USERNAME-GOES-HERE\angular-config.json

{
  "version": 1,
  "cli": {
    "defaultCollection": "@angular-eslint/schematics",
    "packageManager": "yarn",
    "warnings": {
      "versionMismatch": false
    }
  }
}
Eyetooth answered 29/4, 2022 at 15:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.