GithubHelp home page GithubHelp logo

glweems / node-command-line-starter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kreuzerk/node-command-line-starter

0.0 1.0 0.0 1.01 MB

Starter project that provides you with all the necessary setup to quickly create your node-command-line utility. Focus on your util and don't loose time with the project setup.

License: MIT License

JavaScript 20.98% TypeScript 79.02%

node-command-line-starter's Introduction

node-command-line-starter

Progammers are lazy. As soon as we have to do the same task over and over again we start on automizing it. Automization is often done in the form of a command line utility.

node-command-line-starter image

This starter provides you with all the necessary setup to quickly create your node-command-line utility. Focus on your util and don't loose time with the project setup.

The starter provides you with a setup to perform fully automated releases with Travis. Publish new versions quickly and automated to your npm repositiory. If this is new to you, you may want to read my blog-post about The way to fully automated releases in open source projects

What's included?

Language

This starter allows you to write your command line util in TypeScript. ๐Ÿ’ช

Testing

  • Jest - JavaScript Testing Framework
  • Jest configurations to mock third party libaries
  • Sample tests

Command line utils

  • Commander - Complete solution for node.js command-line interfaces.
  • Chalk - Terminal string styling
  • Boxen - Create boxes in terminal

Dev utilities

  • Prettier - Code formater
  • Commitizen Util that helps to create conventional commit messages
  • Commitlint Lint your commit messages to ensure you use conventional commits
  • Husky and Lint-staged to run prettier on each commit on staged files. Husky is also used to run commitlint on a commit.

Build tools

  • Codecov - Integration to upload your coverage report to codecov
  • Travis - Sample travis file with all the necessary build steps
  • SemanticRelease - All the setup to use semantic release. Publish your command line utility to npm by using conventional commits

Folder structure

|__ mocks Folder that contains the mocks for third party libraries

|__ bin contains your file with the commander instructions - this is the entry to your command line tool

|__ src contains your implementation and the logic - is called by the file in your bin folder

Getting started

Development

  1. Fork this repo
  2. Adjust the URLs and names in package.json
  3. Adjust the files in bin, src and mocks
  4. Adjust the bin command in package.json

Setup CI (Travis)

  1. Go to https://travis-ci.org/ and sign up with your Github account. Accept the Authorizaiton of GitHub. Activate Travis for your repository.
  2. The starter allready contains a .travis.yml file that will be interpreted up by travis.

Setup npm account

Sign up on https://www.npmjs.com/.

Setup using semantic-release-cli

npm install -g semantic-release-cli

cd your-module
semantic-release-cli setup

Enter the required informations. The CLI will do the setup and add the necessary tokens to your Travie repository settings.

Visualize coverage

To visualize coverage just sign up on https://codecov.io/. Go to Settings and copy the token. Add this token as CODECOV_TOKEN to your travis repository settings.

Merge your feature branch into master

Use conventional commit messages for your commits. A merge on master will then analyze the commits, automatically bump the version, create the release assets and then publish the package.

Play around with the example

If you are curious about how this example is used, just try it out. Open up a terminal and run:

npx node-command-line-starter pizza beer

which will output the following:

  _   _  ___  _   _ _ __    ___  _ __ __| | ___ _ __
 | | | |/ _ \| | | | '__|  / _ \| '__/ _` |/ _ \ '__|
 | |_| | (_) | |_| | |    | (_) | | | (_| |  __/ |
  \__, |\___/ \__,_|_|     \___/|_|  \__,_|\___|_|
  |___/

   โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
   โ”‚                                             โ”‚
   โ”‚   You ordered the following food:  pizza    โ”‚
   โ”‚   You ordered the following drink:  beer    โ”‚
   โ”‚                                             โ”‚
   โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

additionally the starter example also allows you to use a -w option followed by a filename. In case you do so, your order is written to the file you specified.

node-command-line-starter's People

Contributors

kreuzerk avatar dependabot[bot] avatar semantic-release-bot avatar kuncevic avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.