create-mexn-app
v1.2.0
Published
A CLI tool to scaffold a new MongoDB-Express-Node app. Inspired from create-react-app
Maintainers
Readme
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-appOr run directly with npx:
$ npx create-mexn-app project-nameUsage
Command Syntax
$ create-mexn-app [project-name]Options
| Option | Description |
| :---------------------------------- | :---------------------------------------------------------------------------- |
| -t, --template <template> | Specify template (CommonJS, ESModules, Typescript / cjs, esm, ts) |
| -p, --package-manager <installer> | Specify package manager (npm, yarn, pnpm, bun) |
| -y, --yes | Skip interactive prompts and use defaults (Typescript, npm) |
| --skip-install | Skip automatic dependency installation |
| --no-git | Skip git repository re-initialization |
| --docker | Generate Dockerfile and docker-compose.yml configuration |
| -v, --version | Displays the current version of the CLI tool. |
| -h, --help | Displays help information about the CLI tool. |
Examples
Create a new project interactively:
$ create-mexn-app my-new-projectCreate a new project using non-interactive flags:
$ create-mexn-app my-app -t ts -p bunCreate a project using default values without prompts:
$ create-mexn-app my-app -yScaffold a project without installing dependencies:
$ create-mexn-app my-app --skip-installFeatures Breakdown
Clone template from remote repository
The CLI tool clones the provided template repository into the specified project directory. It uses
degitfor 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 18.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.gitInstall dependencies:
$ npm installLink the CLI tool locally:
$ npm linkTest 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 # DocumentationAvailable Scripts
- Lint Code:
$ npm run lint - Build:
$ npm run build - Run Locally:
$ npm start
License
This project is licensed under the MIT License.
