Skip to content

Instantly share code, notes, and snippets.

{
"$schema": "http://json-schema.org/schema",
"id": "simpleSchema",
"title": "Creates a simple schematic.",
"type": "object",
"properties": {
"project": {
"type": "string",
"description": "The name of the project.",
"$default": {
{
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
"schematics": {
"simple-schematic": {
"description": "A basic schematic.",
"factory": "./simple-schematic/index#simpleSchematic",
"schema": "./simple-schematic/schema.json"
}
}
}
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": "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)"
{
"$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
},
const rule = chain([
rule1,
rule2,
rule3
]);
return rule(host, context);