Skip to content

Instantly share code, notes, and snippets.

options.skipVo ? noop() : schematic("vo", voOptions),
// DON'T DO THIS
options.skipVo ? noop() : schematic("vo", {
project: options.project,
path: options.path,
name: options.vo,
spec: options.spec,
obj: options.obj
}),
// DO THIS
// within template chain
...,
options.uiFramework === UI_FRAMEWORK_OPTION.MATERIAL ?
externalSchematic('@angular/material', 'material-shell', {
project: options.project
}) : noop(),
...
{
"$schema": "./node_modules/@angular-devkit/schematics/collection-schema.json",
"schematics": {
// Adds Angular Material to an application without changing any templates
"ng-add": {
"description": "Adds Angular Material to the application without affecting any templates",
"factory": "./install",
"schema": "./install/schema.json",
"aliases": ["material-shell"] # <-- name/alias of Schematic
},
{
"$schema": "http://json-schema.org/schema",
"id": "SchematicsMaterialInstall",
"title": "Material Install Options Schema",
"type": "object",
"properties": {
"skipPackageJson": {
"type": "boolean",
"default": false,
"description": "Do not add materials dependencies to package.json (e.g., --skipPackageJson)"
const rule = chain([
rule1,
rule2,
rule3
]);
return rule(host, context);
function myCustomRule(options: any): Rule {
return (host: Tree) => {
return host;
}
}
function waitingRule(options: any): Rule {
return (host: Tree) => {
const observer = new Observable<Tree>((observer) => {
fetch('someUrl.com/') // any async operation
.then(res => res.json())
.then(data => {
observer.next(host);
observer.complete();
})
.catch(function (err: any) {
apiVersion: v1
kind: ConfigMap # it is a config map
data: # key value pairs
NODE_ENV: "production"
SOME_VALUE: "my config value"
metadata:
name: basic-config # name to reference
env:
- name: NODE_ENV
valueFrom:
configMapKeyRef:
name: basic-config # name of the configmap
key: NODE_ENV # key within the configmap
- name: SOME_VALUE
valueFrom:
configMapKeyRef:
name: basic-config