1.0.12 • Published 6 months ago
create-mexn-app v1.0.12
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
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
Clone template from remote repository
The CLI tool clones the provided template repository into the specified project directory. It usesdegit
for reliable Git operations.Update package.json
The tool customizes the package.json file of the cloned template:- Updates the name, version, and description fields.
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.
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 16.0.0 or higher.
- Git installed on your machine.
Development
Setup for Local Development
Clone this repository:
$ git clone https://github.com/donymvarkey/create-mexn-app.git
Install dependencies:
$ npm install
Link the CLI tool locally:
$ npm link
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
- Lint Code:
$ npm run lint
- Build:
$ npm run build
- Run Locally:
$ npm start
License
This project is licensed under the MIT License.