npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ttjl/template-cli

v0.0.6

Published

Create a new project from Git repository templates

Downloads

623

Readme

create-myapp

从 Git 仓库模板创建项目的脚手架工具。

特性

  • 🚀 快速创建 - 从 Git 仓库快速克隆项目模板
  • 🎨 交互式配置 - 友好的命令行交互界面
  • 📝 模板引擎 - 支持 Handlebars 语法,包含条件、循环等功能
  • 🔧 灵活配置 - 支持自定义变量和多种输入类型
  • 📦 多模板管理 - 内置或自定义模板列表

安装

# 全局安装
npm install -g create-myapp

# 或使用 pnpm
pnpm add -g create-myapp

# 或直接使用 npx (无需安装)
npx create-myapp

使用

交互式创建

create-myapp

指定项目名称

create-myapp my-project

使用指定模板

create-myapp my-project --template vite-typescript

使用自定义 Git 仓库

create-myapp my-project --repo https://github.com/user/template.git

使用特定分支或标签

create-myapp my-project --repo https://github.com/user/template.git --branch dev
create-myapp my-project --repo https://github.com/user/template.git --tag v1.0.0

传入变量值

create-myapp my-project --var author=张三 --var typescript=true

完整选项

create-myapp [project-name] [options]

选项:
  -t, --template <name>      模板名称
  -r, --repo <url>           Git 仓库 URL
  -b, --branch <name>        Git 分支
  -T, --tag <tag>            Git 标签
  --target-dir <path>        目标目录
  --var <variables>          变量值 (格式: key=value)
  -h, --help                 显示帮助信息

模板配置

模板仓库需要包含 template.config.json 文件来定义模板配置:

{
  "name": "vue-template",
  "description": "Vue 3 项目模板",
  "variables": [
    {
      "name": "projectName",
      "description": "项目名称",
      "default": "my-app"
    },
    {
      "name": "author",
      "description": "作者",
      "default": ""
    },
    {
      "name": "typescript",
      "description": "使用 TypeScript",
      "type": "confirm",
      "default": true
    },
    {
      "name": "features",
      "description": "选择功能",
      "type": "multiselect",
      "options": ["router", "pinia", "vitest"],
      "default": ["router"]
    }
  ]
}

变量类型

  • text - 文本输入(默认)
  • confirm - 确认(是/否)
  • select - 单选
  • multiselect - 多选

模板语法

模板文件支持 Handlebars 语法:

package.json 示例

{
  "name": "{{kebab-case projectName}}",
  "version": "1.0.0",
  "author": "{{author}}",
  {{#if typescript}}
  "type": "module",
  {{/if}}
  "scripts": {
    {{#if typescript}}
    "build": "tsc && vite build"
    {{else}}
    "build": "vite build"
    {{/if}}
  }
}

内置 Helpers

  • {{kebab-case value}} - 转换为 kebab-case
  • {{camelCase value}} - 转换为 camelCase
  • {{upper value}} - 转大写
  • {{lower value}} - 转小写
  • {{#if condition}}...{{/if}} - 条件判断
  • {{#each array}}...{{/each}} - 循环

开发

# 克隆仓库
git clone <repo-url>
cd create-myapp

# 安装依赖
pnpm install

# 构建
pnpm build

# 本地测试
node dist/index.js test-project

# 或使用 link
pnpm link --global
create-myapp test-project

发布

# 更新版本
pnpm version patch/minor/major

# 发布到 npm
pnpm publish

License

MIT