Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Beyond ng new
Search
Ciro Nunes
June 22, 2018
Programming
230
2
Share
Beyond ng new
Use lesser known features of the Angular CLI to unlock the ultimate productivity
Ciro Nunes
June 22, 2018
More Decks by Ciro Nunes
See All by Ciro Nunes
Rust Front-end with Yew
cironunes
0
76
Type safe CSS with Reason
cironunes
0
140
What I've learned building automated docs for Ansarada's design system
cironunes
0
90
Animate your Angular apps
cironunes
0
450
Sweet Angular, good forms never felt so good
cironunes
0
97
Sweet Angular, good forms never felt so good
cironunes
0
310
Progressive Angular apps
cironunes
3
930
Angular: Um framework. Mobile & desktop.
cironunes
1
600
Firebase & Angular
cironunes
0
300
Other Decks in Programming
See All in Programming
AI-DLC Deep Dive
yuukiyo
9
5.1k
UIの境界線をデザインする | React Tokyo #15 メイントーク
sasagar
2
410
Terraform言語の静的解析 / static analysis of Terraform language
wata727
1
120
Don't Prompt Harder, Structure Better
kitasuke
0
800
PHPer、Cloudflare に引っ越す
suguruooki
1
120
AIベース静的検査器の偽陽性率を抑える工夫3選
orgachem
PRO
4
380
【26新卒研修資料】TDD実装演習
dip_tech
PRO
0
140
YJITとZJITにはイカなる違いがあるのか?
nakiym
0
400
ついに来た!本格的なマルチクラウド時代の Google Cloud
maroon1st
0
330
書き換えて学ぶTemporal #fukts
pirosikick
1
310
GitHubCopilotCLIをはじめよう.pdf
htkym
0
300
実用!Hono RPC2026
yodaka
2
280
Featured
See All Featured
Designing for humans not robots
tammielis
254
26k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.2k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
530
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
140
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
53k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Abbi's Birthday
coloredviolet
2
7.4k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.3k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
780
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Transcript
beyond ngnew Go http://cnun.es/beyond-ngnew
Ciro Nunes Brought to you by @cironunesdev cironunes.com
Ciro Nunes Brought to you by @cironunesdev cironunes.com
Ciro Nunes Brought to you by @cironunesdev cironunes.com
None
The CLI
I ❤ CLI
Agenda Basics 1 Unlock the ultimate productivity 2 Tips &
tricks 3
Agenda Basics 1 Unlock the ultimate productivity 2 Tips &
tricks 3
" Start # projects
ng new gdg-devfest --routing --prefix gdg Start new projects Include
routing module and prefix all components with gdg-
--dry-run (-d) Pro tip! Do not modify the file system
$ Add capabilities
ng add @angular/material Add libraries
ng add @angular/material Add libraries Install the official material packages
and schematics to generate material components
ng add @angular/material Add libraries Install the official material packages
and schematics to generate material components ng g @angular/material:dashboard --name my-dash
ng add @angular/material Add libraries Install the official material packages
and schematics to generate material components ng g @angular/material:dashboard --name my-dash Generate the dashboard component using @angular/material schematics
ng add @angular/pwa Add PWA features
ng add @angular/pwa Add PWA features Get 100/100 PWA score
in lighthouse
% Keep your & dependencies ☝ up-to-date
ng update --all --next -d Update packages (
ng update --all --next -d Update packages ( All packages
to latest versions including betas and RCS
) Scaffold anything
ng generate (g) guard (g) appShell component (c) directive (d)
service (c) … Scaffold anything! )
ng generate universal --client-project ang-conf Server-side rendering
ng generate universal --client-project ang-conf Scaffold server-side Angular with Universal
Server-side rendering
ng generate library tooltip Scaffold libraries &
ng generate library tooltip Scaffold libraries & Scaffold libraries using
ng-packgr
Create libraries for your components Pro tip! It’s a good
way to check if their APIs are well designed
ng xi18n i18n
ng xi18n i18n Extract text marked with the i18n pipe
into a translation file
ng eject Gain more control
ng eject Gain more control When you need more customisation
or just want to learn more
OnCe you eject you can ’ t go back!
Memorise the shortcuts, type less! Usually you just have to
type the first letter of a command
ng n new ng g generate ng s serve Shortcuts
Ask for help
ng help or just ng Need help?
None
ng g universal --help Need help per command?
ng g universal --help Need help per command? Help info
for the universal schematic
Learn from the docs!
ng doc term in the API -s everywhere Search
None
Play around, have fun
Agenda Basics 1 Unlock the ultimate productivity 2 Tips &
tricks 3
Share Learn Create
Schematics
Apply transformations to your project
Just like the CLI does
None
Rules
Rules Trees
Rules Takes a tree and returns a tree Trees
Rules Takes a tree and returns a tree Trees Existing
files + stage area
Modifies trees instead of the filesystem directly
Dry runs Reusability Extensibility That allows for
Creating schematics
npm i -g @angular-devkit/schematics-cli Install it
schematics blank --name=my-component Generate a blank schematic
Rules
z import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics'; export
function myComponent(options: any): Rule { return (tree: Tree, _context: SchematicContext) => { return tree; }; }
z import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics'; export
function myComponent(options: any): Rule { return (tree: Tree, _context: SchematicContext) => { return tree; }; }
z import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics'; export
function myComponent(options: any): Rule { return (tree: Tree, _context: SchematicContext) => { tree.create(options.name || 'hello', 'world'); return tree; }; } Create and modify files
z import { Rule, SchematicContext, Tree, chain, externalSchematic } from
'@angular-devkit/schematics'; export function myComponent(options: any): Rule { return (tree: Tree, _context: SchematicContext) => { tree.create(options.name || 'hello', 'world'); return chain(tree, externalSchematic(...)); }; } Chain external schematics
Collections
z { "$schema": “.../@angular-devkit/schematics/ collection-schema.json", "schematics": { "my-component": { "description":
"A blank schematic.", "factory": "./my-component/index#myComponent" } } } Schematics collection collection.json
npm run build Build and test it schematics .:my-component --name=test
--dry-run=false
node --inspect-brk $(which schematics) .:myComponent --name=test Debug it
ng new myapp Use it with the CLI npm link
$PATH_TO_my-component ng g my-component:my-component someName
* Remember to publish on NPM ⚓ when you’re happy
with the results!
Learn more, for free! https://leanpub.com/angular-schematics/read_full
Agenda Basics 1 Unlock the ultimate productivity 2 Tips &
tricks 3
Now the , of the -
None
Monorepo structure enterprise ready! .
None
None
/ Practice the commands, use dry runs 0 Use, create
and share schematics 1 Use the help command and the docs Takeaways 2 Embrace the ecosystem
Stay curious, explore the opportunities, use your creativity!
Thank you! I hope you enjoyed it @cironunesdev