This is a monorepo containing two packages:
unmint/
├── packages/
│ ├── create-unmint/ # CLI tool published to npm
│ └── template/ # Documentation template
├── .github/
│ └── workflows/
│ └── release.yml # Automated release workflow
├── package.json # Root workspace config
└── pnpm-workspace.yaml
- Node.js 20+
- npm (or pnpm)
# Clone the repo
git clone https://github.com/gregce/unmint.git
cd unmint
# Install CLI dependencies
cd packages/create-unmint
npm install
# Build the CLI
npm run build
# Link for local testing
npm linkAfter linking, you can test the CLI anywhere:
# Create a test project
cd /tmp
create-unmint my-test-docs --yes
# Or with interactive prompts
create-unmint my-test-docscd packages/template
npm install
npm run devOpen http://localhost:3000 to see the docs.
packages/create-unmint/src/index.ts - Commander.js CLI with two modes:
- Default:
npx create-unmint my-docs→ runs init - Update:
npx create-unmint --update→ runs update
| File | Purpose |
|---|---|
src/index.ts |
CLI entry point and argument parsing |
src/commands/init.ts |
Creates new projects |
src/commands/update.ts |
Updates existing projects (skeleton) |
src/prompts.ts |
Interactive prompts (inquirer) |
src/scaffold.ts |
File copying and transformation |
npm run buildThis runs:
tsupto compile TypeScript →dist/index.js- Copies
packages/template/→packages/create-unmint/template/
The template is bundled with the CLI package for offline use.
- Go to GitHub Actions → Release → Run workflow
- Enter version:
patch→ bumps 1.0.0 → 1.0.1minor→ bumps 1.0.0 → 1.1.0major→ bumps 1.0.0 → 2.0.0- Or specific version like
1.2.3
- Click Run workflow
The workflow automatically:
- Bumps version in
package.json - Builds the CLI
- Commits the version bump to main
- Creates a git tag
- Publishes to npm
- Creates a GitHub release with auto-generated notes
cd packages/create-unmint
# Bump version
npm version patch # or minor, major, or specific version
# Build
npm run build
# Publish
npm publish --access public
# Push changes
git push origin main --tagsIn GitHub repo settings → Secrets → Actions:
| Secret | Description |
|---|---|
NPM_TOKEN |
npm access token with publish permissions |
To create an npm token:
npm login
npm token createUsers are prompted for:
- Project name
- Description
- Accent color (6 presets + custom hex)
- GitHub URL (optional)
- Site URL
- Initialize git (yes/no)
- Install dependencies (yes/no)
When scaffolding, these files are transformed:
| File | Transformation |
|---|---|
package.json |
Sets name, description, version |
lib/theme-config.ts |
Updates site name, description, URLs |
app/globals.css |
Applies custom accent color |
content/docs/index.mdx |
Updates welcome page title |
README.md |
Generates project-specific readme |
Projects created with the CLI have .unmint/version.json:
{
"version": "1.0.0",
"installedAt": "2025-01-21T00:00:00.000Z",
"generator": "create-unmint"
}This enables future update functionality.
The update command (--update) has a skeleton implementation. Full implementation would:
- Fetch latest template from npm/GitHub
- Compare files against user's project
- Show diff for modified files
- Apply safe updates (framework files)
- Skip protected files (user content, theme config)
- Create backups before updating
lib/theme-config.tscontent/docs/*public/*.env*
app/api/*app/components/docs/mdx/*- Core framework files
# Check if linked
npm ls -g create-unmint
# Re-link
cd packages/create-unmint
npm unlink
npm link# Clean and rebuild
cd packages/create-unmint
rm -rf dist template
npm run buildThe CLI looks for the template in two locations:
./template(bundled in npm package)../../template(development monorepo)
If neither exists, run npm run build to copy the template.