Skip to content

Instantly share code, notes, and snippets.

View brandonroberts's full-sized avatar

Brandon Roberts brandonroberts

View GitHub Profile
@brandonroberts
brandonroberts / jest.config.js
Created July 22, 2021 17:17
Jest Config w/o helpers
module.exports = {
projects: [
'<rootDir>/apps/products',
'<rootDir>/apps/cart',
'<rootDir>/libs/shared/product/ui',
'<rootDir>/libs/products/home-page',
'<rootDir>/libs/cart/cart-page',
'<rootDir>/libs/shared/cart/state',
'<rootDir>/libs/shared/product/state',
'<rootDir>/libs/shared/header',
@brandonroberts
brandonroberts / angular.json
Last active July 12, 2021 13:27
Angular v11 serve
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"ngapp": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
@brandonroberts
brandonroberts / schema.ts
Created May 24, 2021 14:46
Schematic Interface
export interface Schema {
// The name of the service.
name: string;
// The path to create the service.
path?: string;
// The name of the project.
project?: string;
}
@brandonroberts
brandonroberts / schema.json
Created May 24, 2021 14:46
Schematic Schema v2
{
"$schema": "http://json-schema.org/schema",
"id": "SchematicsMySchematic",
"title": "My Schematic Schema",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Service name",
"$default": {
@brandonroberts
brandonroberts / index.ts
Created May 24, 2021 14:45
Schematic Convert Generator
export const mySchematic = convertNxGenerator(mySchematicGenerator);
@brandonroberts
brandonroberts / schema.json
Created May 24, 2021 14:43
Schematic schema
{
"$schema": "http://json-schema.org/schema",
"id": "SchematicsMySchematic",
"title": "My Schematic Schema",
"type": "object",
"properties": {
},
"required": []
}
{
"compilerOptions": {
"baseUrl": ".",
"lib": [
"es2018",
"dom"
],
"declaration": true,
"module": "commonjs",
"moduleResolution": "node",
@brandonroberts
brandonroberts / package.json
Created May 24, 2021 14:41
Schematic package.json
{
"name": "my-lib",
"version": "0.0.1",
"scripts": {
"prebuild": "../../node_modules/.bin/rimraf dist/my-lib && mkdir -p ../../dist/my-lib/schematics && cp -R schematics/ ../../dist/my-lib/schematics/",
"build": "../../node_modules/.bin/tsc -p tsconfig.schematics.json",
"postbuild": "../../node_modules/.bin/rimraf --glob ../../dist/my-lib/schematics/**/*.ts"
},
"peerDependencies": {
"@angular/common": "^12.0.0",
@brandonroberts
brandonroberts / collection.json
Last active May 24, 2021 14:44
Schematic Schema v1
{
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
"schematics": {
"my-schematic": {
"description": "Generate a service in the project.",
"factory": "./my-schematic/index#mySchematic",
"schema": "./my-schematic/schema.json"
}
}
}
@brandonroberts
brandonroberts / index.ts
Created May 24, 2021 13:14
Schematic Simple Generator
import { Tree, convertNxGenerator } from '@nrwl/devkit';
export function mySchematicGenerator(_tree: Tree, opts: any) {
console.log('options', opts);
}