Skip to content

update: budgets section is corrupted on ng update #15462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Splaktar opened this issue Aug 27, 2019 · 2 comments · Fixed by #16062
Closed

update: budgets section is corrupted on ng update #15462

Splaktar opened this issue Aug 27, 2019 · 2 comments · Fixed by #16062

Comments

@Splaktar
Copy link
Contributor

Splaktar commented Aug 27, 2019

🐞 Bug report

Command

- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [x] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Not sure as this is the first time using ng update after adding budgets.

Description

angular.json file's budgets section is corrupted on ng update @angular/cli --next.

🔬 Minimal Reproduction

  1. Start with a project based on
    "@angular-devkit/build-angular": "~0.803.0",
    "@angular/cli": "8.3.0",
    and build config below.
  2. Run ng update @angular/cli --next --force
  3. Commit files
  4. Run ng update @angular/material

🔥 Exception or Error


An unhandled exception occurred: Workspace config file cannot be loaded: /Users/splaktar/Git/devintent/devintent/angular.json
Invalid JSON character: "{" at 37:32.
See "/private/var/folders/3w/d8jpfpm16xs1ktpq20zprl880000gn/T/ng-PJGl3A/angular-errors.log" for further details.

Contents of that log file

[error] Error: Workspace config file cannot be loaded: /Users/splaktar/Git/devintent/devintent/angular.json
Invalid JSON character: "{" at 37:32.
    at getWorkspace (/Users/splaktar/Git/devintent/devintent/node_modules/@angular/cli/utilities/config.js:58:15)

🌍 Your Environment

Before


Angular CLI: 8.3.0
Node: 12.3.0
OS: darwin x64
Angular: 8.2.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.0
@angular-devkit/build-angular     0.803.0
@angular-devkit/build-optimizer   0.803.0
@angular-devkit/build-webpack     0.803.0
@angular-devkit/core              8.3.0
@angular-devkit/schematics        8.3.0
@angular/cdk                      8.1.4
@angular/cli                      8.3.0
@angular/fire                     5.2.1
@angular/flex-layout              8.0.0-beta.26
@angular/material                 8.1.4
@angular/pwa                      0.803.0
@ngtools/webpack                  8.3.0
@schematics/angular               8.3.0
@schematics/update                0.803.0
rxjs                              6.5.2
typescript                        3.5.3
webpack                           4.39.2

After


Angular CLI: 9.0.0-next.0
Node: 12.3.0
OS: darwin x64
Angular: 9.0.0-next.3
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
... service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.0
@angular-devkit/build-angular     0.900.0-next.0
@angular-devkit/build-optimizer   0.900.0-next.0
@angular-devkit/build-webpack     0.900.0-next.0
@angular-devkit/core              8.3.0
@angular-devkit/schematics        8.3.0
@angular/cdk                      8.1.4
@angular/cli                      9.0.0-next.0
@angular/fire                     5.2.1
@angular/flex-layout              8.0.0-beta.26
@angular/language-service         8.2.3
@angular/material                 8.1.4
@angular/pwa                      0.803.0
@ngtools/webpack                  9.0.0-next.0
@schematics/angular               8.3.0
@schematics/update                0.900.0-next.0
rxjs                              6.5.2
typescript                        3.5.3
webpack                           4.39.2

Anything else relevant?
angular.json before:

          "configurations": {
            "production": {
              "budgets": [{
                "type": "bundle",
                "name": "main",
                "maximumWarning": "650kb",
                "maximumError": "1000kb"
              }],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "serviceWorker": true,
              "ngswConfigPath": "ngsw-config.json"
            }
          }

angular.json after ng update:

         "configurations": {
            "production": {
              "budgets": [{
                "type": "bundle",
                "name": "main",
                "maximumWarning": "650kb",
                "maximumError": "1000kb"
              },]                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb"
                }
,
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "serviceWorker": true,
              "ngswConfigPath": "ngsw-config.json"
            }
          }

angular.json after manually fixing:

          "configurations": {
            "production": {
              "budgets": [
                {
                  "type": "bundle",
                  "name": "main",
                  "maximumWarning": "650kb",
                  "maximumError": "1000kb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "serviceWorker": true,
              "ngswConfigPath": "ngsw-config.json"
            }
          }
@alan-agius4
Copy link
Collaborator

It seems that we are not handling object literal and array opening and closing tags are on the same line properly.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.