Skip to content

Instantly share code, notes, and snippets.

View buildmotion's full-sized avatar

Matt Vaughn buildmotion

View GitHub Profile
@buildmotion
buildmotion / debugging-collections.json
Created November 24, 2018 01:39
debugging collection.json configuration
{
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
"schematics": {
"tree-debug": {
"description": "A schematic to demonstrate how to debug and view [Tree] details..",
"factory": "./tree-debug"
}
}
}
schematics
schematics [CollectionName:]SchematicName [options, ...]
By default, if the collection name is not specified, use the internal collection provided
by the Schematics CLI.
Options:
--debug Debug mode. This is true by default if the collection is a relative
path (in that case, turn off with --debug=false).
@buildmotion
buildmotion / launch.json
Last active November 22, 2018 05:36
A launch configuration to debug an Angular Schematic using node.
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/node_modules/@angular-devkit/schematics-cli/bin/schematics.js",
"args": [
"libOne": {
"root": "projects/buildmotion/lib-one",
"sourceRoot": "projects/buildmotion/lib-one/src",
"projectType": "library",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/buildmotion/lib-one/tsconfig.lib.json",
"projectType": {
"type": "string",
"description": "Project type.",
"enum": [
"application",
"library"
]
}
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class LibTwoService {
serviceName = 'LibTwoService';
constructor() { }
SayHello(message: string): string {
return `${message} from ${this.serviceName}`;
}
@buildmotion
buildmotion / workspace-demo-LibOneService2.ts
Created May 25, 2018 14:16
Workspace library dependencies.
import { Injectable } from '@angular/core';
import { LibTwoService } from '../../../lib-two/src/public_api';
@Injectable({
providedIn: 'root'
})
export class LibOneService {
constructor(
private serviceTwo: LibTwoService
) { }
SayHello(message: string): string {
@buildmotion
buildmotion / workspace-demo-launch-config.json
Created May 25, 2018 14:15
Workspace launch configuration.
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:4200",
"webRoot": "${workspaceFolder}"
}
@buildmotion
buildmotion / workspace-demo-LibOneService.ts
Created May 25, 2018 14:13
A new service library in Angular 6 Workspace.
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class LibOneService {
constructor() { }
SayHello(message: string): string {
return `${message}`;
}
}
@buildmotion
buildmotion / workspace-demo-app-component.ts
Created May 25, 2018 14:11
Demonstrates using a library from new Angular 6 Workspace in Component
import { Component } from '@angular/core';
import { LibOneService } from 'projects/lib-one/src/public_api';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app';
constructor(