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
2
220
Beyond ng new
Use lesser known features of the Angular CLI to unlock the ultimate productivity
Ciro Nunes
June 22, 2018
Tweet
Share
More Decks by Ciro Nunes
See All by Ciro Nunes
Rust Front-end with Yew
cironunes
0
61
Type safe CSS with Reason
cironunes
0
140
What I've learned building automated docs for Ansarada's design system
cironunes
0
83
Animate your Angular apps
cironunes
0
440
Sweet Angular, good forms never felt so good
cironunes
0
88
Sweet Angular, good forms never felt so good
cironunes
0
300
Progressive Angular apps
cironunes
3
920
Angular: Um framework. Mobile & desktop.
cironunes
1
600
Firebase & Angular
cironunes
0
300
Other Decks in Programming
See All in Programming
Rails Girls Tokyo 18th GMO Pepabo Sponsor Talk
yutokyokutyo
0
170
go directiveを最新にしすぎないで欲しい話──あるいは、Go 1.26からgo mod initで作られるgo directiveの値が変わる話 / Go 1.26 リリースパーティ
arthur1
2
270
日本だけで解禁されているアプリ起動の方法
ryunakayama
0
360
AI主導でFastAPIのWebサービスを作るときに 人間が構造化すべき境界線
okajun35
0
280
JPUG勉強会 OSSデータベースの内部構造を理解しよう
oga5
2
220
ぼくの開発環境2026
yuzneri
1
290
24時間止められないシステムを守る-医療ITにおけるランサムウェア対策の実際
koukimiura
2
170
AIフル活用時代だからこそ学んでおきたい働き方の心得
shinoyu
0
150
生成AIを活用したソフトウェア開発ライフサイクル変革の現在値
hiroyukimori
PRO
0
140
PostgreSQL を使った快適な go test 環境を求めて
otakakot
0
310
AI時代でも変わらない技術コミュニティの力~10年続く“ゆるい”つながりが生み出す価値
n_takehata
2
440
Ruby x Terminal
a_matsuda
4
280
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
How to Think Like a Performance Engineer
csswizardry
28
2.5k
Facilitating Awesome Meetings
lara
57
6.8k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
960
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
450
Ethics towards AI in product and experience design
skipperchong
2
210
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
340
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
0
2.4k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
What's in a price? How to price your products and services
michaelherold
247
13k
Mobile First: as difficult as doing things right
swwweet
225
10k
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