Have ideas to improve npm?Join in the discussion! »

    create-nodejs-project

    1.0.2 • Public • Published
    Create NodeJS Project Logo

    Node.js Project Initializer

    License version downloads

    coverage build

    An npm initializer to scaffold a node project and include basic tools like lint, testing, etc.

    npm init <initializer> can be used to set up a new or existing npm package.
    initializer in this case is an npm package named create-<initializer>, which will be installed by npx, and then have its main bin executed -- presumably creating or updating package.json and running any other initialization-related operations.
    — Source: docs.npmjs.com

    Requirements

    • npm >= 6.5
    • node >= 10.12.0

    Usage

    1. Install the package as global
    npm install -g create-nodejs-project
    
    1. Run the setup configuration
    npm setup
    

    You will be prompted for your Github information
    If you do not have the information at the moment, you can keep it empty.
    In order to create projects with Github integration, you will need to add the authentication information later. See Github Auth

    1. Create your project
    npm init nodejs-project path/to/new/project
    

    What it does

    1. Create the folder for the new project
    2. Guide you through a questionnaire to setup the project
    3. Initialize a git repository
    4. Copy the template files (src, eslintrc, gitignore, readme, etc)
    5. Create a Github repository
    6. Install eslint dependencies
    7. Install the selected testing dependencies
    8. Generate package.json with all the project details
    9. Commit and push the initial commit
    10. Generate the license file

    About this package

    Every time that I start a new project in Node.js, I hate to go to other project folder, copy files like eslintrc, editorconfig; install the same dependencies, create folder structure, etc.

    With this in mind, the motivation to build this package started as a DRY (Do not repeat yourself) thing.

    This package is intended to automated the initialization of new Node.js projects and with this have a new folder with everything ready to work, basically an scaffolding tool.

    Future features

    1. Unit testing
    2. Options to create the project with parameters instead of questionnaire
    3. A good error handler
    4. Color for the console messages
    5. Improve the template structure (the one that is generated in the new project) to include unit test
    6. Option to questionnaire with all the default values
    7. Logic to handle multiple authentication files and multiple Github accounts

    Configure Github Authentication

    If you are planning to allow this script to create your Github repositories, is required to generate a Github Token.

    1. Visit https://github.com/settings/tokens.
    2. Click Generate new token.
     Token Description: (your computer name)
     Scopes:
         [X] repo
             [X] repo:status
             [X] repo_deployment
             [X] public_repo
             [X] repo:invite
    
    1. Click Generate token.
    2. Copy the generated string to a safe place, such as a password safe.
    3. Open Terminal and add the Github token.
    # nano /YOUR-NODE_MODULES-PATH/create-nodejs-project/create-nodejs-settings.json
    
    ...
    ...
       "githubAuth": {
         "user": "YOUR_USER",
         "token": "YOUR_TOKEN"
       }
    ...
    ...
    

    Install

    npm i create-nodejs-project

    DownloadsWeekly Downloads

    20

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    172 kB

    Total Files

    45

    Last publish

    Collaborators

    • avatar