Skip to content

Drozerah/cli-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLI Starter

A Command Line Interface starter boilerplate

This material comes with the minimum settings and files that are required to start the creation of a new CLI utility with a Node.js and NPM environment.

Structure

├───bin/
│   └───cli.js
├───.gitignore
├───licence
├───package-lock.json
├───package.json
└───README.md

Install

# GET the latest version
$ git clone https://github.com/Drozerah/cli-starter.git

# Rapid install
$ git clone https://github.com/Drozerah/cli-starter.git my-project-name && cd my-project-name && npm install && code . && exit

Then install globally:

$ npm install -g

Once you are done with this step, you need to:

$ npm link

This command will register your CLI project locally so you are now able to run the command below anywhere into the terminal:

$ cli-starter

This command will prompt a message into the terminal meaning that everything is fine with the installation of cli-starter module:

cli starter

CLI command name:

Because all projects are differents, you'll certainly need to change the name of the command that runs your own CLI:

package.json

{
//...
    "bin": {
-       "cli-starter": "bin/cli.js"
+       "myCommand": "bin/cli.js"
    }
//...
}

Development:

$ npm run dev

This command will execute the cli-starter\bin\cli.js JavaScript file, it can also be used during the development phase of your project...

Notes:

In order to prevent accidental publication of you project, the "private" key is set to true by default - to publish your project to the NPM registry you must turn the value to false

package.json

{
//...
-    "private": true
+    "private": false
//...
}

npm command

If you want or have to unregister your project, you'll need to unbind the symlink created from your project's directory to your global node modules, keep in mind to:

$ npm unlink

This command will also disable the cli-starter command into the terminal.


Versioning

  • we use SemVer for versioning

Author

  • Thomas G. aka Drozerah - GitHub

License

  • ISC © Thomas G. aka Drozerah

Releases

No releases published

Packages

No packages published