# nutiljs

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

Latest version **0.4.2** (published 2018-04-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install nutiljs
pnpm add nutiljs
yarn add nutiljs
bun add nutiljs
```

Provides the command `nutil`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.2 |
| Published | 2018-04-05 |
| First published | 2018-04-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 26.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Francisco Couceiro |
| Maintainers | fcouceiro |
| Keywords | generator, cli |

## Links

- npm: https://www.npmjs.com/package/nutiljs
- Repository: https://github.com/fcouceiro/nutiljs
- Homepage: https://github.com/fcouceiro/nutiljs#readme
- Issues: https://github.com/fcouceiro/nutiljs/issues
- npm.io page: https://npm.io/package/nutiljs

## Dependencies (8)

- [q](https://npm.io/package/q.md) ^1.5.1
- [shelljs](https://npm.io/package/shelljs.md) ^0.8.1
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [commander](https://npm.io/package/commander.md) ^2.15.1
- [inflection](https://npm.io/package/inflection.md) ^1.12.0
- [stream-sink](https://npm.io/package/stream-sink.md) ^2.2.1
- [replacestream](https://npm.io/package/replacestream.md) ^4.0.3
- [pipe-streams-to-promise](https://npm.io/package/pipe-streams-to-promise.md) ^0.2.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 0.4.2 (latest) — 2018-04-05

## README

<img width="484" alt="logoxhdpi" src="https://user-images.githubusercontent.com/3154879/38369604-0bb512de-38e0-11e8-9e26-00bb2c465b37.png">

# 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 nutiljs`

or 
* `npm i -g nutiljs`

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

### Locally:
* `yarn add nutiljs`

or 
* `npm i nutiljs`

Use a package runner like [npx](https://www.npmjs.com/package/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](https://github.com/fcouceiro/nutil/tree/master/placeholders/controllers):

    nutil --controller (-c) <controllerName>

  

Create a service based on [provided placeholder](https://github.com/fcouceiro/nutil/tree/master/placeholders/services):

    nutil --service (-s) <serviceName>

  

Create a model based on [provided placeholder](https://github.com/fcouceiro/nutil/tree/master/placeholders/models):

    nutil --model (-m) <modelName>

  

Create a resource based on [provided placeholder](https://github.com/fcouceiro/nutil/tree/master/placeholders/resources):

    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](https://www.npmjs.com/package/inflection).

## 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](#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](https://www.npmjs.com/package/joi) for model validation).

---
_Source: https://npm.io/package/nutiljs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
