GithubHelp home page GithubHelp logo

nitin9736 / develop-your-first-cli-workshop Goto Github PK

View Code? Open in Web Editor NEW

This project forked from neha/develop-your-first-cli-workshop

1.0 0.0 0.0 37 KB

develop-your-first-CLI-workshop

JavaScript 100.00%

develop-your-first-cli-workshop's Introduction

๐Ÿ’ฅ Develop your First CLI - Workshop ๐Ÿ’ฅ

This repo is the step-by-step guide to develop the CLI in Nodejs. This repo is the part of the GDG (Google Developer Groups), New Delhi/Gurgaon.

๐Ÿ“† Event Details

April

  • Event Name: Code-lab : Web Developers Day 3 by Google Developer Group, New Delhi
  • Date: 28th April 2019
  • Location: 91Springboard, Gurgaon
  • Event Link: GDG Event Page

May

  • Event Name: Code-lab : Develop your First CLI, Bangalore
  • Date: 12th May 2019
  • Location: Microsoft, Bangalore
  • Event Link: JSLovers

Introduction

My name is Neha Sharma. I am working as technical lead. I am the organizer of JSLovers community. I am tech and non-tech speaker. Apart form coding I enjoy doing calligraphy.

You can reach me :

โ— Pre-requists โ—

  • โœ… Knowledge of Javascript
  • โœ… Knowledge of nodejs
  • โœ… Comfortble working with CLI and IDE
  • โœ… Github account
  • โœ… NPM account

๐Ÿ“ Agenda

  1. What is nodejs & CLI [Theory]
  2. Project walkthrough [Theory]
  3. Folder structure [Theory]
  4. Installing package.json [Code]
  5. Create your data [Code]
  6. Code time [Code]
  7. Publish the npm [Code]

Content

  1. Walkthrough of Nodejs, CLI , and Project
  2. Setup your machine - nodejs, folder structure, package.json
  3. Create your data
  4. Install require package and print your first message
  5. Write the code
  6. Publish the NPM

๐Ÿ”” How to use this repo?

This repo is step-by-step guide. You can clone the repo or follow along.Every folder is marked below with what is expected in it.

0๏ธโƒฃ Walkthrough [Theory]

Introduction to nodejs and CLI.

Folder : session-1/intro.md

1๏ธโƒฃ Setup your machine [Codelab]

Folder : session-1

  • Install nodejs

  • Create a folder - "myprofile"

  • Create package.json

      npm init
    

2๏ธโƒฃ Create your Data [Codelab]

Folder : session-2

Go to folder session-2/myprofile/data. If you want to update the content you can edit it in data.js

3๏ธโƒฃ Code Time [Codelab]

Folder : session-3

Go to folder session-3/myprofile. In this we will identify the commands and add it to the commands folder.

To sync with data.js we have following commands (user input) :

  • about me
  • contact me
  • experience
  • summary

To print the choices on the terminal we will use the npm package inquirer.

4๏ธโƒฃ Beautification

Folder : session-4

This section is totally optional. To make the CLI' content more colorful and presentable. We will use two more packages:

  • chalk : Will let us provide the colors to the texts.
  • cfonts : Will let us write a big fancy welcome message.
  • inquirer : Common interactive command line user interfaces.
  • commander : Common interactive command line user interfaces.

5๏ธโƒฃ Publish NPM [Codelab]

How to make it Executable?

  1. Add #!/usr/bin/env node on the top of index.js. Read about it here : https://en.wikipedia.org/wiki/Shebang_%28Unix%29

  2. In package.json, add section of bin

    "bin": {
        "myprofile": "./index.js"
    }
    
  3. Run the following command

     npm link
    
  4. Now go to the terminal and write

     myprofile
    

Publish to NPM

  1. Create an account in npmjs.com

  2. On terminal run the following command & enter the username and password.

    npm login
    
  3. To publish

    npm publish
    

    You can check your package after publishing : https://www.npmjs.com/~{username}/{package-name}

How to run it?

  1. Go to the desire folder. eg :

    cd session-2/myprofile
    
  2. Install the dependency

    npm install
    
  3. From the root of the myprofile run the following command to start the application

    node index.js
    

If you are only interested in the end code then clone the session-4 folder.

โ™ฅ๏ธ Collabrations

Collabrations are the awesome way to create small things better, and big. If you see anything which can be improved ? If you see something can be added here? Before telling to anyone else, raise the PR :) . If you are new to the collabrations and have no idea how to do it. Do not worry, reach to me [email protected]

develop-your-first-cli-workshop's People

Contributors

neha avatar

Stargazers

Roman 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.