@fcouceiro/nutil

A command-line tool for generating boilerplate (controllers, services, models and resources) based on placeholders provided by the user.

WARNING: This project has been renamed to nutiljs and is no longer scoped. Install using nutiljs instead.
Last updated 2 years ago by fcouceiro .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @fcouceiro/nutil 
SYNC missed versions from official npm registry.

nutil - Node Utility

A command-line tool for generating boilerplate (controllers, services, models and resources) based on placeholders provided by the user.

Installation

Globally:

  • yarn global add @fcouceiro/nutil

or

  • npm i -g @fcouceiro/nutil

You will then be able to run nutil from the command line.

Locally:

  • yarn add @fcouceiro/nutil

or

  • npm i @fcouceiro/nutil

Use a package runner like npx to run locally installed packages.

You will then be able to run npx nutil from the command line.

Usage

Create a controller based on the provided placeholder:

nutil --controller (-c) <controllerName>

Create a service based on provided placeholder:

nutil --service (-s) <serviceName>

Create a model based on provided placeholder:

nutil --model (-m) <modelName>

Create a resource based on provided placeholder:

nutil --resource (-r) <resourceName>

Multiple generations can take place with a single command, by concatenatig different options. Example: create both a controller and a service:

nutil -s <serviceName> -c <controllerName>

Note: Generated files will be created in the directory where you run nutil from (cwd)

How it works

There is a pre-defined set of placeholder keys, as represented in the following table:

Key Meaning
[name] Singular lower case
[NAME] Singular upper case
[Name] Singular pascal case
[names] Plural lower case
[NAMES] Plural upper case
[Names] Plural pascal case

When the user requests the generation of a certain type, the generator spawns a process that "search and replace" the corresponding type placeholders (both in file name and file content). It substitutes all found keys with the appropriate casing (e.g. [name] would be replaced by the controller name in singular lower case; [Names] in plural pascal case; etc).

Case representations are generated by the great inflection package.

Placeholders

All boilerplate is generated based on placeholders provided by the user. Feel free to use different placeholder keys in both file name and content, as described in How it works section.

Placeholders must be placed inside placeholders/ folder.

A few basic placeholders are included by default (using mongoose for model generation and Joi for model validation).

Current Tags

  • 0.4.1                                ...           latest (2 years ago)

10 Versions

  • 0.4.1 [deprecated]           ...           2 years ago
  • 0.4.0 [deprecated]           ...           2 years ago
  • 0.3.0 [deprecated]           ...           2 years ago
  • 0.2.1 [deprecated]           ...           2 years ago
  • 0.2.0 [deprecated]           ...           2 years ago
  • 0.1.5 [deprecated]           ...           2 years ago
  • 0.1.4 [deprecated]           ...           2 years ago
  • 0.1.3 [deprecated]           ...           2 years ago
  • 0.1.1 [deprecated]           ...           2 years ago
  • 0.1.0 [deprecated]           ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 12
Dependencies (8)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |