Azure / ng-deploy-azure

Deploy Angular apps to Azure using the Angular CLI
MIT License
79 stars 37 forks source link

Add support for Angular CLI v9 #88

Open manekinekko opened 4 years ago

manekinekko commented 4 years ago

Describe the bug When adding @azure/ng-deploy to an angular project v9, we get the following error:

Cannot read the output path (architect.build.options.outputPath) of project "bazel-angular" in angular.json

To Reproduce Steps to reproduce the behavior:

  1. npm i -g @angular/cli@9
  2. angular new demo
  3. ng add @azure/ng-deploy
  4. See error

Expected behavior @azure/ng-deploy should support the new angular v9 builder API.

Screenshots image

Related issue https://github.com/Azure/ng-deploy-azure/issues/85

BernhardRode commented 4 years ago

Getting a different error using npm.

➜  Development ng new hello-world --defaults

CREATE hello-world/README.md (1027 bytes)
CREATE hello-world/.editorconfig (246 bytes)
CREATE hello-world/.gitignore (631 bytes)
CREATE hello-world/angular.json (3607 bytes)
CREATE hello-world/package.json (1288 bytes)
CREATE hello-world/tsconfig.json (543 bytes)
CREATE hello-world/tslint.json (1953 bytes)
CREATE hello-world/browserslist (429 bytes)
CREATE hello-world/karma.conf.js (1023 bytes)
CREATE hello-world/tsconfig.app.json (210 bytes)
CREATE hello-world/tsconfig.spec.json (270 bytes)
CREATE hello-world/src/favicon.ico (948 bytes)
CREATE hello-world/src/index.html (296 bytes)
CREATE hello-world/src/main.ts (372 bytes)
CREATE hello-world/src/polyfills.ts (2835 bytes)
CREATE hello-world/src/styles.css (80 bytes)
CREATE hello-world/src/test.ts (753 bytes)
CREATE hello-world/src/assets/.gitkeep (0 bytes)
CREATE hello-world/src/environments/environment.prod.ts (51 bytes)
CREATE hello-world/src/environments/environment.ts (662 bytes)
CREATE hello-world/src/app/app.module.ts (314 bytes)
CREATE hello-world/src/app/app.component.css (0 bytes)
CREATE hello-world/src/app/app.component.html (25673 bytes)
CREATE hello-world/src/app/app.component.spec.ts (957 bytes)
CREATE hello-world/src/app/app.component.ts (215 bytes)
CREATE hello-world/e2e/protractor.conf.js (808 bytes)
CREATE hello-world/e2e/tsconfig.json (214 bytes)
CREATE hello-world/e2e/src/app.e2e-spec.ts (644 bytes)
CREATE hello-world/e2e/src/app.po.ts (301 bytes)
✔ Packages installed successfully.
    Successfully initialized git.
➜  Development ng add @azure/ng-deploy    

The add command requires to be run in an Angular project, but a project definition could not be found.
➜  Development cd hello-world 
➜  hello-world git:(master) ng add @azure/ng-deploy

? Would you like to share anonymous usage data about this project with the Angular Team at
Google under Google’s Privacy Policy at https://policies.google.com/privacy? For more
details and how to change this setting, see http://angular.io/analytics. No
Installing packages for tooling via npm.
Installed packages for tooling via npm.
? Under which subscription should we put this static site? CS-XOE-RHS-Sandbox – 19e00ff7-08e8-4ad4-a060-
af4c5ef96eb0
✔ Creating resource group hello-world-static-deploy at West US (westus)
    Account helloworldstatic already exist on subscription, using existing account
CREATE azure.json (385 bytes)
UPDATE angular.json (3938 bytes)
➜  hello-world git:(master) ✗ ng run hello-world:deploy

Preparing for deployment
The folder dist/hello-world is empty.
📦 Running "build" on "hello-world"
0% compiling
Compiling @angular/core : es2015 as esm2015

Compiling @angular/common : es2015 as esm2015

Compiling @angular/platform-browser : es2015 as esm2015

Compiling @angular/platform-browser-dynamic : es2015 as esm2015
Generating ES5 bundles for differential loading...
ES5 bundle generation complete.

chunk {0} runtime-es2015.0811dcefd377500b5b1a.js (runtime) 1.45 kB [entry] [rendered]
chunk {0} runtime-es5.0811dcefd377500b5b1a.js (runtime) 1.45 kB [entry] [rendered]
chunk {2} polyfills-es2015.442fa3cc45520cc0d518.js (polyfills) 35.6 kB [initial] [rendered]
chunk {3} polyfills-es5.abdd41dcd206a6689f72.js (polyfills-es5) 127 kB [initial] [rendered]
chunk {1} main-es2015.a3f20d4770272633e527.js (main) 136 kB [initial] [rendered]
chunk {1} main-es5.a3f20d4770272633e527.js (main) 158 kB [initial] [rendered]
chunk {4} styles.3ff695c00d717f2d2a11.css (styles) 0 bytes [initial] [rendered]
Date: 2020-02-14T13:27:13.152Z - Hash: 3fc1f2363d91a6d4ef4e - Time: 26653ms
Error when trying to deploy: 
The Resource 'Microsoft.Storage/storageAccounts/helloworldstatic' under resource group 'hello-world-static-deploy' was not found.
➜  hello-world git:(master) ✗ 
VaidasDatenis commented 4 years ago

I have exact same issue as @manekinekko .. But i was just trying to add: ng add @angular/fire@next --save got:


Cannot read the output path (architect.build.options.outputPath) of the Angular project "hello-world" in angular.json```
funder7 commented 3 years ago

I fixed this by adding the missing key into the angular.json file. Basically it needs the build output path to be defined, you wouldn't notice it if you never used ng cli commands (at least, it was my case).

 "projects": {
    "projectname": {
      "root": "",
      "sourceRoot": "src/main/webapp",
      "projectType": "application",
      "schematics": {
         .....
      },
      "architect": {
        "build": {
          "options": {
            "outputPath": "./target/classes/static/"            <--- 
          }
        },
        "deploy": {
          ....
        }
      }
    }
  },