npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-generator-cli

v0.0.6

Published

A CLI for node to generate file for controllers, router and models

Downloads

15

Readme

node-generator-cli

A CLI for node to generate file for controllers, router and models.

Install

$ npm install -g node-generator-cli

Usage

The most basic command runs a wizard.

$ ng

Note: Names can be inputted in any format (slug-case, camelCase, PascalCase, UPPERCASE, lowercase etc.).

controller

Directly create a controller based on the current settings.

$ ng controller <name>

Arguments:

  • name: The name you want to use for the controller.

Options:

  • -d, --destination <destination>: Override the destination for controller.
  • -p, --template-path <template-path>: Override template path.
  • -t, --template <template>: Override template type. By default it uses the 'controller' folder from the template path. With this option you can use a different template folder.
  • -f, --force: Force creation of a controller. By default it's impossible to create a controller if the destination path doesn't exist. This option forces the creation of a controller and will generates the destination folders if they don't exist.

Examples:

$ ng controller address
$ ng component address -d ./controllers/
$ ng component address -d ./src/components/address/ -t base-address-controller -f

The generated file will be *filename.js

Router

Directly create a router based on the current settings.

$ ng router <name>

Arguments:

  • name: The name you want to use for the router.

Options:

  • -d, --destination <destination>: Override the destination for router.
  • -p, --template-path <template-path>: Override template path.
  • -t, --template <template>: Override template type. By default it uses the 'router' folder from the template path. With this option you can use a different template folder.
  • -f, --force: Force creation of a router. By default it's impossible to create a router if the destination path doesn't exist. This option forces the creation of a router and will generates the destination folders if they don't exist.

Examples:

$ ng router address
$ ng router address -d ./router/address
$ ng router address -d ./src/router/address/ -t base-route -f

The generated file will be *filename.js

model

Directly create a model based on the current settings.

$ ng model <name>

Arguments:

name: The name you want to use for the model. Options:

  • -d, --destination <destination>: Override the destination for model.
  • -p, --template-path <template-path>: Override template path.
  • -t, --template <template>: Override template type. By default it uses the 'model' folder from the template path. With this option you can use a different template folder.
  • -f, --force: Force creation of a model. By default it's impossible to create a model if the destination path doesn't exist. This option forces the creation of a model and will generates the destination folders if they don't exist.

Examples:

$ ng model address
$ ng model address -d ./models
$ ng model address -t address-model

The generated file will be *filename.js

settings

Set or display settings. Without any options it will display the settings. By default it will set the settings locally in a .vuegenerator file. You can also set global settings by using the global option -g --global.

$ ng settings

Options:

  • -m, --model-destination <destination>: Set default model destination.
  • -c, --controller-destination <destination>: Set default controller destination.
  • -r, --router-destination <destination>: Set default router destination.
  • -t, --template-path <template-path>: Set template path.
  • -l, --log: Log global or local settings depending on the global flag.
  • -g, --global: Set global settings.

Examples:

$ ng settings -l
$ ng settings -m ./model -c ./contoller -r ./router -t ./template
$ ng settings -g -c ./controllers

reset

Reset global settings to the defaults.

$ ng reset

show-templates

Open the default template directory. The default templates can be edited to fit your needs.

$ ng show-templates

copy-templates

Copy the default templates to another directory. This is handy when you want to customize the default templates. Don't forget to run ng init or set the template path with ng settings.

$ ng copy-templates