@mlbstack/create
v0.2.0
Published
Official MLB Stack project scaffolder. Creates a project aligned with the MLB golden path: Next.js or Vite + TypeScript + Tailwind CSS + shadcn/ui + ESLint.
Downloads
76
Maintainers
Readme
@mlbstack/create
Official MLB project scaffolder. It creates a project aligned with the MLB golden path so a new developer does not have to research how to configure Next.js, Tailwind CSS, shadcn/ui or ESLint.
npm create @mlbstack@latestYou choose a framework (Next.js or Vite) and receive a project that already uses the technologies the MLB standardizes on.
Stack
The official templates always include:
- TypeScript
- Tailwind CSS
- shadcn/ui
- ESLint
The CLI never asks about these — they are part of the golden path and reduce the number of decisions a developer has to make.
Uso
npm create @mlbstack@latestYou can also run it with npx:
npx @mlbstack/create@latestExemplos
npm create @mlbstack@latest my-app
npm create @mlbstack@latest my-app -- --template next
npm create @mlbstack@latest my-app -- --template vite
npm create @mlbstack@latest my-app -- --template next --package-manager pnpm
npm create @mlbstack@latest my-app -- --template next --no-install
npm create @mlbstack@latest my-app -- --template vite --skip-git
npm create @mlbstack@latest my-app -- --yesTemplates
| id | name | stack |
| ------ | ----------------- | ---------------------------------------------------------------- |
| next | MLB Stack Next.js | Next.js + React + TypeScript + Tailwind CSS + shadcn/ui + ESLint |
| vite | MLB Stack Vite | Vite + React + TypeScript + Tailwind CSS + shadcn/ui + ESLint |
CLI options
| Option | Description | Default |
| ------------------- | ---------------------------------------- | ----------- |
| [project-name] | Name of the project to create. | prompted |
| -t, --template | Template to use (next, vite). | prompted |
| --framework | Framework to use (next, vite). | inferred |
| --package-manager | Package manager (npm, pnpm, yarn). | detected |
| --no-install | Skip installing dependencies. | install |
| --skip-git | Skip initializing a Git repository. | git init |
| -y, --yes | Use defaults without prompting. | interactive |
| -v, --version | Print the CLI version. | — |
| -h, --help | Show help. | — |
--yes defaults
When --yes is used, the CLI does not prompt and applies these defaults:
- Project name: the
[project-name]argument, ormy-app. - Framework: the
--template/--frameworkflag, ornext. - Package manager: the
--package-managerflag, or detected from lockfiles, otherwisenpm. - Install dependencies: yes (disable with
--no-install). - Initialize Git: yes (disable with
--skip-git).
Filesystem safety
The CLI validates the project name, resolves an absolute path and checks the target directory before generating. It never silently overwrites existing files.
- If the directory is missing or empty, generation proceeds.
- If the directory is not empty, the CLI fails safely in non-interactive mode:
Directory "my-app" is not empty. - In interactive mode it asks for confirmation before continuing.
Desenvolvimento
Clone the repository and install dependencies:
npm install
npm run build
npm test
npm run lint
npm run typecheck| Command | Description |
| ---------------------- | ---------------------------------- |
| npm run build | Build the CLI into dist/. |
| npm run typecheck | Run TypeScript type checking. |
| npm run lint | Run ESLint. |
| npm test | Run the Vitest test suite. |
| npm run test:watch | Run tests in watch mode. |
| npm run format | Format the codebase with Prettier. |
| npm run format:check | Check formatting with Prettier. |
Testing templates locally
Structure checks run for every template in the regular test suite. To run a full smoke test that installs dependencies and builds a generated project (requires network access and more time):
MLB_SMOKE=1 npm testAdicionando templates
- Create a directory under
templates/(e.g.templates/expo). - Register it in
src/templates/registry.tswith anid,name,framework,description,pathandstack. - Create a generator wrapper under
src/generators/and register it insrc/generators/index.ts.
Because the registry drives template discovery, there is no scattered list of template ids to maintain.
Publicação
Bump the version in package.json, then publish:
npm publishThe package ships dist/ and templates/ only (see the files field).
Set the publishConfig.access to public for an unscoped-visible scoped
package (already configured).
Architecture
src/
├── cli.ts entrypoint (shebang, commander wiring)
├── commands/create.ts create flow orchestration
├── prompts/ interactive prompts
├── generators/ per-framework generators (next, vite)
├── templates/registry.ts central template registry
├── core/ template model, generator, package manager, git
└── utils/ validation, filesystem, logger, errors
templates/ template directories (next, vite)
tests/ unit + smoke testsThe design intentionally separates the CLI from prompts, the registry,
generators, filesystem and package managers so future templates (expo,
nest, library, ...) and shared @mlbstack/* configuration packages can be added
without restructuring the project.
License
MIT
