Skip to content

donymvarkey/create-mexn-app

Repository files navigation

create-mexn-app

npm version GitHub Actions Known Vulnerabilities npm license NPM Last Update

NodeJS Express.js MongoDB CircleCI

create-mexn-app create-mexn-app

A CLI tool to scaffold a new Node.js+Express+MongoDB project from a Git template. It simplifies project initialization, customizes package.json, and sets up a fresh Git repository. Inspired from create-react-app

Features

  • Clone a Node.js project boilerplate from a Git repository.
  • Update package.json with project-specific details (e.g., name, version, description).
  • Automatically initialize a new Git repository.
  • Include Prettier and ESLint configurations for industry-standard code quality.
  • Select your preferred templates from CommonJS, ESModules or Typescript

Installation

Install globally using npm or yarn:

$ npm install -g create-mexn-app

Or run directly with npx:

$ npx create-mexn-app project-name

Usage

Command Syntax

$ create-mexn-app [project-name]

Options

Option Description
-v, --version Displays the current version of the CLI tool.
-h , --help Displays help information about the CLI tool.

Examples

Create a new project in a directory:

$ create-mexn-app my-new-project

Use the current directory as the project root:

$ create-mexn-app .

View CLI version and Help

$ create-mexn-app -v
$ create-mexn-app -h

Features Breakdown

  1. Clone template from remote repository

    The CLI tool clones the provided template repository into the specified project directory. It uses degit for reliable Git operations.

  2. Update package.json

    The tool customizes the package.json file of the cloned template:

    • Updates the name, version, and description fields.
  3. Fresh Git Initialization

    After cloning:

    • Removes the existing .git folder from the template.
    • Initializes a new Git repository.
    • Creates an initial commit for the scaffolded code.
  4. Prettier and ESLint Setup

    The tool ensures your project starts with:

    • Prettier for code formatting.
    • ESLint for identifying syntax and style issues.
    • husky precommit hook.

Requirements

  • Node.js 18.0.0 or higher.
  • Git installed on your machine.

Development

Setup for Local Development

  1. Clone this repository:

    $ git clone https://github.com/donymvarkey/create-mexn-app.git
  2. Install dependencies:

    $ npm install
  3. Link the CLI tool locally:

    $ npm link
  4. Test the CLI:

    $ create-mexn-app --help

Directory Structure

create-mexn-app/
├── dist/ # Contains the build of the create-mexn-app
├── src/
│ ├── constants/
| | ├── index.ts # Constants used in the project
│ ├── utils/
│ │ ├── directoryOps.ts # Directory related operations
│ │ ├── displayAsciArt.ts # Methods to display the ASCII art for the cli
│ │ ├── gitOps.ts # Git related operations
│ │ ├── packageOps.ts # Package.json handling
│ │ └── utils.ts # Other utility functions
│ ├── cli.ts # Entry point for the CLI
│ ├── version.ts # Version handling for the cli
│ └── utils.ts # Reusable utility functions
├── .gitignore # Gitignore file
├── tsconfig.json # typescript config
├── package-lock.json # lock file
├── package.json # Project metadata
└── README.md # Documentation

Available Scripts

  1. Lint Code:
     $ npm run lint
  2. Build:
    $ npm run build
  3. Run Locally:
    $ npm start

License

This project is licensed under the MIT License.

About

A CLI utility to scaffold a node-express-mongodb app

Resources

License

Stars

Watchers

Forks

Packages

No packages published