generator-zweman

1.0.2 • Public • Published

Zweman NPM version

Yeoman Angular Generator with REST API

About

Zweman is a generator that accepts Models with API links and generates an Angular project with basic CRUD features.


Installation

First, install Yeoman and generator-zweman using npm (we assume you have pre-installed node.js).

npm install -g yo
npm install -g generator-zweman

Creating a project

Starting a new project

A new project must be created before creating models.

Starting a project will install the angular-cli if you don't have one and generate a new angular project.

yo zweman MyNewProject

Creating a model

This will create a new model with specified data types.

yo zweman:model ModelName var1:var_type var2:vartype

Each model must provide an API URL for the CRUD processes of that model.

Model Name

Model name must start with a capital letter. Model name must not contain spaces.

Data Types

  • number for numbers and floating points.
  • string for strings and texts.
  • boolean for boolean.
  • Date for DateTime.
  • Objects can also be used as a data type but the object must be created as a model first. (i.e. If you want a Book object that has an Author object as a data type, an Author object must be created first. )
yo zweman:model Author id:number name:string email:string
 
yo zweman:model Book id:number title:string author:Author publication_date:Date stock:boolean

API

You only need to provide one URL for all CRUD processes like http://192.168.0.112:4000/api/v1


Scaffolding the project

After creating all necessary models, you can scaffold the project.

Scaffolding will generate angular components and services or the respective models.

yo zweman:scaffold

Running the project

To run the project change directory to the project folder

cd MyNewProject 

and run this command

ng serve

Building a production distribution

To build your project for production run this command inside the project folder.

ng build --aot --prod

A new folder named dist will appear inside your project folder. That is the production build of your project.


License

MIT © zwenex

Readme

Keywords

Package Sidebar

Install

npm i generator-zweman

Weekly Downloads

2

Version

1.0.2

License

MIT

Last publish

Collaborators

  • ayoe