@ngsl/schematics

0.0.13 • Public • Published

@ngsl/schematics (BETA)

An useful library for scaffold an Angular project with an enterprise architecture using Angular Schematics

Installation

Run npm install @ngsl/schematics --save-dev

To use @ngsl/schematics as the default collection in your Angular CLI project, add it to your angular.json or type on your command line:

ng config cli.defaultCollection @ngsl/schematics

Usage

Once the ng new command has been executed you can run:

Project:

  • Command ng g @ngsl/schematics:project alias: p
  • Creates the basic project structures, such as files, folders, etc
  • Be careful running this command, it will replace all the files and some work might be erased

Feature Module:

  • Command ng g @ngsl/schematics:feature-module <name> alias: fm
  • Creates a feature module with custom routes and a pages folder

Optional params

NAME TYPE DEFAULT DESCRIPTION
wrapper boolean true By default the schematic will create a wrapper, i.e. a component that will wrap the children components declared within

Shared Module:

  • Command ng g @ngsl/schematics:shared-module <name> alias: sm
  • Creates a shared module, i. e.modules like Ui, meaning that it's components will be declared and exported

Interfaces/Enums

  • Command ng g @ngsl/schematics:(ngsl-interface|ngsl-enum) <name> alias: ngsl-i/ngsl-e
  • Creates an interface

Optional params

NAME TYPE DEFAULT DESCRIPTION
group string auxiliary Creates an interface inside a grouped folder with the given name, if not provided the file will be created inside an auxiliary folder

Domain Enum

  • Command ng g @ngsl/schematics:(domain-enum) <name> alias: denum
  • Creates a domain enum

Component

  • Command ng g @ngsl/schematics:ngsl-component <name> alias: ngsl-c
  • Creates a component and place it inside the index.ts file which contains all the module declarations

Page

  • Command ng g @ngsl/schematics:page <name> alias: pg
  • Creates a page and place it inside the index.ts file which contains all the module declarations

Controller

  • Command ng g @ngsl/schematics:controller <name> alias: ct
  • Creates and API service and a Facade for the given entity name

Facade

  • Command ng g @ngsl/schematics:facade <name> alias: f
  • Creates a Facade for the given name

Class

  • Command ng g @ngsl/schematics:ngsl-class <name> alias: ngsl-cl
  • Creates a class and place it inside the index.ts

Model

  • Command ng g @ngsl/schematics:model <name> alias: m
  • Creates a model and imports it inside the index.ts

Optional params

NAME TYPE DEFAULT DESCRIPTION
useInterface boolean false Will add an interface with the given name
singleInterface boolean false Will not generate a class but a single interface

Observable service

  • Command ng g @ngsl/schematics:observable-service <name> alias: os
  • Creates an observable service and imports it inside the index.ts

Package Sidebar

Install

npm i @ngsl/schematics

Weekly Downloads

44

Version

0.0.13

License

MIT

Unpacked Size

179 kB

Total Files

232

Last publish

Collaborators

  • djguzmanc