This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| json.scripts = { | |
| ...json.scripts, | |
| 'build:prod': 'ng build --prod', | |
| 'test:ci': 'ng test --no-watch --code-coverage' | |
| }; | |
| json.husky = { | |
| 'hooks': { | |
| 'pre-commit': 'pretty-quick --staged --pattern \"apps/**/**/*.{ts,scss,html}\"' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function updatePackageJson(name: string): Rule { | |
| return (tree: Tree): Tree => { | |
| const path = `/${name}/package.json`; | |
| const file = tree.read(path); | |
| const json = JSON.parse(file!.toString()); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const rule = chain([ | |
| generateRepo(name), | |
| merged | |
| ]); | |
| return rule(tree, _context) as Rule; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const templateSource = apply(url('./files'), [ | |
| template({..._options, ...strings}), | |
| ]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Rule, SchematicContext, Tree, externalSchematic } from '@angular-devkit/schematics'; | |
| export function angularSchematic(_options: any): Rule { | |
| const name = _options.name | |
| return (_: Tree, _context: SchematicContext) => { | |
| return externalSchematic('@schematics/angular', 'ng-new', { | |
| name, | |
| version: '11.0.1', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "http://json-schema.org/schema", | |
| "id": "angularSchematic", | |
| "title": "ng new options schema", | |
| "type": "object", | |
| "description": "Initialise a new project", | |
| "properties": { | |
| "name": { | |
| "type": "string", | |
| "description": "The name of the project", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <button *appHasPermissions="[admin, guest]" class="btn btn-primary">Click</button> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Directive, Input, TemplateRef, ViewContainerRef, Renderer2 } from '@angular/core'; | |
| import { PermissionOptions } from './model/permissionOptions.interface'; | |
| import { PermissionService } from './permission.service'; | |
| @Directive({ | |
| selector: '[appHasPermissions]' | |
| }) | |
| export class HasPermissionsDirective { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Injectable } from '@angular/core'; | |
| import { Subject, Observable } from 'rxjs'; | |
| import { PermissionOptions } from './model/permissionOptions.interface'; | |
| @Injectable({ | |
| providedIn: 'root' | |
| }) | |
| export class PermissionService { | |
| userPermissions : string[] = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <button *ngIf="userPermissionService.userPrmissions.includes('admin')"> </button> |
NewerOlder