2017 © Pedro PelΓ‘ez
 

project ng2-template

CLI generator for ankor webpack angular 2 start kit

image

anton/ng2-template

CLI generator for ankor webpack angular 2 start kit

  • Monday, April 17, 2017
  • by ancor.dev
  • Repository
  • 1 Watchers
  • 1 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Angular 2 CLI Templates

Creation main project elements with unit tests, (*1)

Installation

ln -s $(realpath ng-templator.php) ~/bin/ngt
chmod +x ~/bin/ngt

Notice: ~/bin should be added to $PATH., (*2)

Generating of blanks


Component

$ ngt component my-component

Makes structure:, (*3)

.
└───my-component
    β”œβ”€β”€β”€index.ts
    β”œβ”€β”€β”€my-component.component.pug
    β”œβ”€β”€β”€my-component.component.less
    β”œβ”€β”€β”€my-component.component.ts
    β”œβ”€β”€β”€my-component.component.spec.ts

Parameters: - -tp\--tag-prefix my - (Note! without dash) makes prefix my- for component tag selector.
Default value is app- - -s\--style less - generate styles in .less format instead of .scss, (*4)

Small Component

$ ngt small-component my-component

Makes component with inline styles and template, (*5)

Makes structure:, (*6)

.
β”œβ”€β”€β”€my-component.component.ts
β”œβ”€β”€β”€my-component.component.spec.ts

Parameters: - -tp\--tag-prefix my - (Note! without dash) makes prefix my- for component tag selector.
Default value is app- - -s\--style less - generate styles in .less format instead of .scss, (*7)

Module

$ ngt module my-module

Makes structure:, (*8)

.
└───my-module
    β”œβ”€β”€β”€index.ts
    β”œβ”€β”€β”€my-routes.module.ts

Parameters: - -wc\--with-component - additionally makes main component for the module.
File structure:, (*9)

    .
    └───my-module
        β”œβ”€β”€β”€index.ts
        β”œβ”€β”€β”€my-routes.module.ts
        β”œβ”€β”€β”€my-component.component.pug
        β”œβ”€β”€β”€my-component.component.less
        β”œβ”€β”€β”€my-component.component.ts
        β”œβ”€β”€β”€my-component.component.spec.ts

Component parameters `-tp`, `-s` also available when you creates component with a module.  

Directive

$ ngt directive super-highlight

Makes structure:, (*10)

.
β”œβ”€β”€β”€super-highlight.directive.ts
β”œβ”€β”€β”€super-highlight.directive.spec.ts

Parameters: - -sp\--selector-prefix my (value without dash) makes prefix my for directive selector.
Result will be mySuperHighlight
Default value is app, (*11)

Pipe

$ ngt pipe pretty

Makes structure:, (*12)

.
β”œβ”€β”€β”€pretty.pipe.ts
β”œβ”€β”€β”€pretty.pipe.spec.ts

Service

$ ngt service auth

Makes structure:, (*13)

.
β”œβ”€β”€β”€auth.service.ts
β”œβ”€β”€β”€auth.service.spec.ts

Api Service

$ ngt api user

Makes structure:, (*14)

.
β”œβ”€β”€β”€user-api.service.ts
β”œβ”€β”€β”€user-api.service.spec.ts

Model

$ ngt model user

Makes structure:, (*15)

.
β”œβ”€β”€β”€user.model.ts
β”œβ”€β”€β”€user.model.spec.ts

Parameters: - -f\--fields makes fields for the model.
Available modifiers: - s - string (also default if not specified) - b - boolean - n - number - a - any - MyClass - custom type definition, (*16)

Every model has id:n field by default.
If you don't want to use id just specify field -id in fields. Example: -f '-id'. Notice: Specify -id as first column will not works., (*17)

Example: name;surname;email:s;age:n;isAdmin:b;currency:Currency;createdAt:a Result will be - user.model.ts
Declarations:
public id: number; public name: string; public surname: string; public email: string; public age: number; public isAdmin: boolean; public currency: Currency; public createdAt: any; Initializations: this.id = +data.id || null; this.name = data.name || null; this.surname = data.surname || null; this.email = data.email || null; this.age = +data.age || null; this.isAdmin = data.isAdmin !== undefined && data.isAdmin !== null ? Boolean(data.isAdmin) : null; this.currency = data.currency || null; this.createdAt = data.createdAt || null; Data in .spec.ts: id: 1, name: 'Test string 1', surname: 'Test string 2', email: 'Test string 3', age: 2, isAdmin: true, currency: 'No generator. Using some string 1', createdAt: 'Any as string 1',, (*18)

The Versions

17/04 2017

dev-master

9999999-dev

CLI generator for ankor webpack angular 2 start kit

  Sources   Download

The Requires

 

by Anton Korniychuk

23/11 2016

v0.1.0.0

0.1.0.0

CLI generator for ankor webpack angular 2 start kit

  Sources   Download

The Requires

 

by Anton Korniychuk

26/09 2016

v1.0.0

1.0.0.0

  Sources   Download

The Requires

 

by Anton Korniychuk