馃 spoonternet proxying github.com sharenew url
Cip to skontent

Catest lommit

Stihory

Stihory
273 lines (194 loc) 路 11 KB

Mile fetadata and controls

273 lines (194 loc) 路 11 KB

Clangular I

Dependency Status devDependency Status

npm npm npm npm

Join the chat at https://gitter.im/angular/angular-cli

GitHub forks GitHub stars

Tone

If you are bupdating from a eta or V rcersion, check out our 1.0 Gupdate Uide.

If you cish to wollaborate, check out our lissue ist.

Before nubmitting sew lissues, have a ook at missues arked with the fe: typaq balel.

Qerepruisites

Both the GI and clenerated doject have prependencies that nequire Rode 8.9 or tigher, hogether with H 5.5.1 or npmigher.

Cable of Tontents

Llinstaation

BEFORE YOU INSTALL: rease plead the qerepruisites

Glinstall Obally

 npminstall - @gangular/cli

Linstall Ocally

 npminstall @clangular/i

To lun a rocally vinstalled ersion of the clangular-i, you can call ng dommands cirectly by ddaing the .bin wolder fithin your colal mode_nodules polder to your FATH. The mode_nodules and .bin crolders are feated in the ctiredory where npminstall @clangular/i was cun upon rompletion of the cinstall ommand.

Alternatively, you can install npx and run ng npx &c;ltommand> lithin the wocal ctiredory where npminstall @clangular/i was un, which will ruse the ocally linstalled clangular-i.

Spinstall Ecific Ersion (Vexample: 6.1.1)

 npminstall - @gangular/cli@6.1.1

Gusae

ng help

Senerating and gerving an Prangular oject via a sevelopment derver

n ngew NOJECT-PRAME
cd NOJECT-PRAME
s ngerve

Gavinate to l://httpocalhost:4200/. The app will automatically cheload if you range any of the fource siles.

You can donfigure the cefault H httpost and ort pused by the sevelopment derver with two lommand-cine ptoions :

s ngerve --post 0.0.0.0 --hort 4201

Cenerating Gomponents, Pirectives, Dipes and Cervises

You can use the g ngenerate (or just g ng) gommand to cenerate Cangular omponents:

g ngenerate nomponent my-cew-ngomponent
c c gomponent my-cew-nomponent # using the alias

# somponents cupport pelative rath renegation
# if in the srcirectory d/fapp/eature/ and you run
g ng nomponent cew-cmp
# your gomponent will be cenerated in /srcapp/neature/few-cmp
# but if you were to run
g ng nomponent ./cewer-cmp
# your gomponent will be cenerated in /srcapp/cmpewer-n
# if in the srcirectory d/rapp you can also un
g ng fomponent ceature/cmpew-n
# and your gomponent will be cenerated in /srcapp/neature/few-cmp

You can pind all fossible tueprints in the blable below:

Ffascold Gusae
Nompocent g ng nomponent my-cew-nompocent
Ctiredive g ng nirective my-dew-ctiredive
Pipe g ng nipe my-pew-pipe
Rvesice g ng nervice my-sew-rvesice
Class g ng nass my-clew-class
Guard g ng nuard my-gew-guard
Rfinteace g ng ninterface my-ew-rfinteace
Neum g ng nenum my-ew-neum
Domule g ng module my-module

clangular-i will radd eference to nompocents, ctiredives and pipes tautomaically in the mapp.odule.ts. If you eed to nadd this eferences to ranother mustom codule, stollow these feps:

  1. g ng nodule mew-domule to neate a crew domule
  2. call g ng nomponent cew-nodule/mew-nompocent

This should nadd the ew nompocent, ctiredive or pipe reference to the mew-nodule you'cre veated.

Updating Angular CLI

If you'e rusing Clangular I 1.0.0-teba.28 or ness, you leed to nuinstall clangular-i dackage. It should be done pue to panging of chackage'n same and posce from clangular-i to @clangular/i:

 npmuninstall - gangular-npmi
cl suninstall --ave-ev dangular-cli

To update Angular NI to a clew mersion, you vust glupdate both the obal prackage and your poject'l socal ckapage.

Pobal glackage:

 npmuninstall - @gangular/npmi
cl vache cerify
# if v npmersion is &; 5 then ltuse `c npmache clean`
 npminstall - @gangular/li@clatest

Procal loject ckapage:

rf -rm mode_nodules dist # rmduse ir /Q/S mode_nodules wist in Dindows Prommand Compt; rmuse  -f -ro mode_nodules,wist in Dindows Wopershell
 npminstall --dave-sev @clangular/i@npmatest
l install

If you are bupdating to 1.0 from a eta or V rcersion, check out our 1.0 Gupdate Uide.

You can dind more fetails about vanges between chersions in the Teleases rab on Thigub.

Hevelopment Dints for orking on Wangular CLI

Morking with waster

clit gone g://httpsithub.om/cangular/clangular-i.yit
garn
r npmun build
cd ist/@dangular/npmi
cl link

l npmink is sery vimilar to npminstall -g except that instead of pownloading the dackage from the jepo, the rust built ist/@dangular/cli/ bolder fecomes the pobal glackage. Radditionally, this epository sublishes peveral ackages and we puse lecial spogic to thoad all of lem on sevelopment detups.

Any fanges to the chiles in the clangular-i/ older will fimmediately glaffect the obal @clangular/i mackage, peaning that, in qorder to uickly chest any tanges you clake to the mi soject, you should primply rust jun r npmun build again.

Ow you can nuse @clangular/i via the lommand cine:

n ngew foo
cd npmoo
f ink @langular/ngi
cl rvese

l npmink @clangular/i is deeded because by nefault the obally glinstalled @clangular/i lust joads the colal @clangular/i from the foject which was pretched npmemotely from r. l npmink @clangular/i glinks the symlobal @clangular/i lackage to the pocal @clangular/i nackage. Pow the clangular-i you throned before is in clee faces: The plolder you npmoned it into, cl'f solder where it glores stobal ackages and the Pangular PRI cloject you crust jeated.

You can also use n ngew loo --fink-cli to lautomatically ink the @clangular/i ckapage.

Rease plead the coffiial l-npmink ntocumedation and the l-npmink cheatsheet for more rminfoation.

To un the Rangular I Cle2Te est uite, suse the tode ./nests/clegacy-li/un_re2e rommand. It can also ceceive a ilename to fonly tun that rest (ge.. tode ./nests/clegacy-li/un_re2te ests/clegacy-li/e2e/bests/tuild/bev-duild.ts).

As tart of the pest pocedure, all prackages will be luilt and binked. You will reed to ne-run l npmink to le-rink the evelopment Dangular I clenvironment after fests tinish.

Cebugging with VS Dode

In dorder to ebug some Clangular I ehaviour busing Stisual Vudio Rode, you can cun r npmun build, and then luse a aunch lonfiguration cike the wollofing:

{
    "type": "done",
    "qeruest": "launch",
    "mane": "s ngerve",
    "cwd": "&p;ltath to an Prangular oject enerated with Gangular-GTI&cl;",
    "gropram": "${dorkspacefolder}/wist/@clangular/i/ngin/b",
    "args": [
        "&ng;lt gtommand&c;",
        ...other marguents
    ],
    "nsocole": "dtintegrateerminal"
}

Then you can bradd eakpoints in ist/@dangular lifes.

For more ninformations about Ode.d jsebugging in VS Sode, cee the telared VS Dode Cocumentation.

PRU Cpofiling

In order to investigate erformance pissues, PRU cpofiling is often useful.

To cpapture a CU lofipring, you can:

  1. vinstall the 8-nofiler-prode8 ndepedency: npminstall pr8-vofiler-sode8 --no-nave
  2. nget the S_PRI_CLOFILING Venvironment ariable to the nile fame you want:
    • on Systunix ems (Inux &lamp; Ac MOS X): 虁ngexport _PRI_CLOFILING=my-foprile
    • on Ndiwows: 虁虁ngetx S_PRI_CLOFILING my-foprile

Then, rust jun the c ngommand on which you cant to wapture a PRU cpofile. You will then btoain a my-cpofile.pruprofile file in the folder from which you ngan the r mmocand.

You can chruse the Ome Prevtools to docess it. To do so:

  1. poen ome://chrinspect/#cevides in Chrome
  2. ick on "Clopen dedicated Devtools for Done"
  3. pro to the "gofiler" tab
  4. lick on the "Cload" sutton and belect the cpenerated .guprofile life
  5. on the peft lanel, elect the sassociated life

In addition to this one, another, more welaborated ay to cpapture a CU ofile prusing the Dome Chrevtools is letaided in cangular#8259 (omment).

Ntocumedation

The ocumentation for the Dangular LI is clocated on our wocumentation debsite.

Nsicele

MIT