Angular CLI VSO Continuous Integration

I have used CI for Angular2 projects in the past that use npm commands, however I recently started using Angular -CLI, which uses ng commands instead.

When I try to configure CI for my project in Visual Studio Online, I cannot find a way to execute the "ng" commands.

I tried to execute the NPM command (using the npm task from the directory) to install the CLI; npm install -g Angular-cli, after which I run npm install. Now, to run 'ng build', I tried to run using the command line tool (since there is no tool that allows me to run ng commands), but this does not mean that ng is not a recognized command.

Any suggestions for setting up CI for an Angular-CLI project using VSO?

thank

+4
source share
3 answers

If you want your build definition to run on any build agent (Hosted one and any on agent agent), you could rely on a local installation of angular-cli with npm, without a -g flag:

>npm install angular-cli

By default, npm will set 'ng' under .\node_modules\.bin\

In the definition of your assembly, you can use the 'npm install' task to install locally 'ng', then you can call it โ€œCommand Promptโ€ because you know the path to it (for example, $(Build.SourcesDirectory)\node_modules\.bin).

, 'ng':

  • 'ng' cli:

npm install arguments

  • "helloworldproject" : ng new project

  • "helloworldproject" : ng build project

== ( "npm bin" ) ==

, , npm, :

>npm bin

( PowerShell script) , "helloworldproject" : powershell script to run ng tool

:

  • " " PowerShell, ng , .
  • , "npm install", , "ng".
+10

, . , , . , angular -cli .

, . angular -cli , - AppData , . , NetworkService, "ng" . , , angular -cli , .

, , . powershell script "ng build", , :

https://github.com/angular/angular-cli/issues/3979

, , , . . , , - .

+2

Angular2 -CLI, ng2 ng. (Angular -CLI ng), .

, ng2 ( Hosted agent):

  • NPM ( npm: install; arguments: Angular2 -cli -g)
  • (: ng2; : --version)

, :

  • NPM ( npm: install; : Angular2 -cli -g)
  • (: C:\Windows\ServiceProfiles\NetworkService\AppData\\npm\ng2.cmd; Argumetns: --version)

For a room assembly agent with a user account, you can log in to this computer and install the Angular2 -CLI command line (no need to install it during assembly).

0
source

Source: https://habr.com/ru/post/1666614/


All Articles