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
- 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
Install globally using npm
or yarn
:
$ npm install -g create-mexn-app
Or run directly with npx
:
$ npx create-mexn-app project-name
Command Syntax
$ create-mexn-app [project-name]
Option | Description |
---|---|
-v, --version | Displays the current version of the CLI tool. |
-h , --help | Displays help information about the CLI tool. |
Create a new project in a directory:
$ create-mexn-app my-new-project
Use the current directory as the project root:
$ create-mexn-app .
$ create-mexn-app -v
$ create-mexn-app -h
-
The CLI tool clones the provided template repository into the specified project directory. It uses
degit
for reliable Git operations. -
The tool customizes the package.json file of the cloned template:
- Updates the name, version, and description fields.
-
After cloning:
- Removes the existing .git folder from the template.
- Initializes a new Git repository.
- Creates an initial commit for the scaffolded code.
-
The tool ensures your project starts with:
- Prettier for code formatting.
- ESLint for identifying syntax and style issues.
- husky precommit hook.
- Node.js 18.0.0 or higher.
- Git installed on your machine.
-
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
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
- Lint Code:
$ npm run lint
- Build:
$ npm run build
- Run Locally:
$ npm start
This project is licensed under the MIT License.