{"id":13588611,"url":"https://github.com/zce/caz","last_synced_at":"2025-05-13T19:03:16.755Z","repository":{"id":39587696,"uuid":"69054457","full_name":"zce/caz","owner":"zce","description":"A simple yet powerful template-based Scaffolding tools.","archived":false,"fork":false,"pushed_at":"2025-03-26T17:00:37.000Z","size":731,"stargazers_count":2470,"open_issues_count":16,"forks_count":793,"subscribers_count":150,"default_branch":"main","last_synced_at":"2025-04-27T23:59:29.351Z","etag":null,"topics":["boilerplate","caz","generator","productivity","scaffold","scaffolding","starter-kit","template","zce"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zce.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"zce"}},"created_at":"2016-09-23T19:24:33.000Z","updated_at":"2025-04-27T00:54:01.000Z","dependencies_parsed_at":"2023-02-18T21:46:04.423Z","dependency_job_id":"a65f2690-771b-45a9-b749-76f5e4406477","html_url":"https://github.com/zce/caz","commit_stats":{"total_commits":410,"total_committers":4,"mean_commits":102.5,"dds":0.348780487804878,"last_synced_commit":"18dc1beab675bd9b437f146c12637a5d92ad9344"},"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zce%2Fcaz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zce%2Fcaz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zce%2Fcaz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zce%2Fcaz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zce","download_url":"https://codeload.github.com/zce/caz/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254010793,"owners_count":21998993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boilerplate","caz","generator","productivity","scaffold","scaffolding","starter-kit","template","zce"],"created_at":"2024-08-01T15:06:49.190Z","updated_at":"2025-05-13T19:03:16.738Z","avatar_url":"https://github.com/zce.png","language":"TypeScript","readme":"\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/zce/caz\"\u003e\u003cimg src=\"docs/caz.png\" alt=\"CAZ\"\u003e\u003c/a\u003e\n  \u003cp\u003eA simple yet powerful template-based Scaffolding tools for my personal productivity.\u003c/p\u003e\n  \u003cp\u003e\n    \u003ca href=\"https://github.com/zce/caz/actions\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/zce/caz/main.yml\" alt=\"Build Status\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://codecov.io/gh/zce/caz\"\u003e\u003cimg src=\"https://img.shields.io/codecov/c/github/zce/caz\" alt=\"Coverage Status\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/zce/caz/blob/master/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/zce/caz\" alt=\"License\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://npm.im/caz\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/caz\" alt=\"NPM Version\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://npm.im/caz\"\u003e\u003cimg src=\"https://img.shields.io/node/v/caz\" alt=\"Node Version\"\u003e\u003c/a\u003e\n    \u003cbr\u003e\n    \u003ca href=\"https://standardjs.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/code_style-standard-brightgreen\" alt=\"Code Style\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://npm.im/caz\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/caz\" alt=\"NPM Downloads\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://packagephobia.com/result?p=caz\"\u003e\u003cimg src=\"https://packagephobia.com/badge?p=caz\" alt=\"Install Size\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/zce/caz\"\u003e\u003cimg src=\"https://img.shields.io/github/repo-size/zce/caz\" alt=\"Repo Size\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/zce/caz\"\u003e\u003cimg src=\"https://img.shields.io/librariesio/github/zce/caz\" alt=\"Dependencies Status\"\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\u003cbr\u003e\n\n**English** | [简体中文](README.zh-CN.md)\n\n## Introduction\n\nCAZ (**C**reate **A**pp **Z**en)\n\nIt's a a simple template-based Scaffolding tools for my personal productivity, inspired by [Yeoman](https://yeoman.io) \u0026amp; [Vue CLI 2](https://npm.im/vue-cli) \u0026amp; etc.\n\n- pronounced: [[kæz]](http://dict.youdao.com/dictvoice?audio=caz) 📷 ✌\n- written: CAZ / caz\n\n_For more introduction, please refer to the [How it works](#how-it-works)._\n\n### Features\n\n- Easy to use\n- Light-weight\n- Still powerful\n- High efficiency\n- Zero dependencies\n- Template-based\n- Configurable\n- Extensible\n- TypeScript\n- Use modern API\n\n\u003e I'll give you specific reasons later.\n\n## Table of Contents\n\n- [Introduction](#introduction)\n  - [Features](#features)\n- [Getting Started](#getting-started)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n  - [Quick Start](#quick-start)\n- [Recipes](#recipes)\n  - [GitHub Repo Templates](#github-repo-templates)\n  - [Local Templates](#local-templates)\n  - [Remote ZIP Templates](#remote-zip-templates)\n  - [Offline Mode](#offline-mode)\n  - [Prompts Override](#prompts-override)\n  - [Debug Mode](#debug-mode)\n  - [List Available Templates](#list-available-templates)\n- [Official Templates](#official-templates)\n- [Advanced](#advanced)\n  - [Configuration](#configuration)\n  - [Create Your Template](#create-your-template)\n  - [Create Your Scaffold](#create-your-scaffold)\n- [References](#references)\n- [Motivation](#motivation)\n- [About](#about)\n  - [How It Works](#how-it-works)\n  - [Built With](#built-with)\n- [Roadmap](#roadmap)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Getting Started\n\n### Prerequisites\n\n- [Node.js](https://nodejs.org) (\u003e= 16.x required, \u003e= 18.x preferred)\n- [npm](https://www.npmjs.com) (\u003e= 7.x) or [pnpm](https://pnpm.io) (\u003e= 6.x) or [yarn](https://yarnpkg.com) (\u003e= 1.22)\n- [Git](https://git-scm.com) (\u003e= 2.0)\n\n### Installation\n\n```shell\n# install it globally\n$ npm install -g caz\n\n# or yarn\n$ yarn global add caz\n```\n\n### Quick Start\n\nCreate new project from a template.\n\n```shell\n$ caz \u003ctemplate\u003e [project] [-f|--force] [-o|--offline]\n\n# caz with an official template\n$ caz \u003ctemplate\u003e [project]\n\n# caz with a github repo\n$ caz \u003cowner\u003e/\u003crepo\u003e [project]\n```\n\nIf you only use it occasionally, I recommend that you use `npx` to run `caz` directly.\n\n```shell\n$ npx caz \u003ctemplate\u003e [project] [-f|--force] [-o|--offline]\n```\n\n#### Options\n\n- `-f, --force`: Overwrite if the target exists\n- `-o, --offline`: Try to use an offline template\n\n## Recipes\n\n### GitHub Repo Templates\n\n```shell\n$ caz nm my-project\n```\n\nThe above command pulls the template from [caz-templates/nm](https://github.com/caz-templates/nm), then prompts for some information according to the configuration of this template, and generate the project at `./my-project`.\n\n```shell\n$ caz nm#typescript my-project\n```\n\nBy running this command, CAZ will pulls the template from `typescript` branch of [caz-templates/nm](https://github.com/caz-templates/nm).\n\n#### Use Custom templates\n\n```shell\n$ caz zce/nm my-project\n```\n\nThe above command pulls the template from [zce/nm](https://github.com/zce/nm). This means that you can also pull templates from your public GitHub repository.\n\n**Public repository is necessary.**\n\n### Local Templates\n\nInstead of a GitHub repo, you can also use a template on your local file system.\n\ne.g.\n\n```shell\n$ caz ~/local/template my-project\n```\n\nThe above command use the template from `~/local/template`.\n\n### Remote ZIP Templates\n\nInstead of a GitHub repo, you can also use a template with a zip file uri.\n\ne.g.\n\n```shell\n$ caz https://cdn.zce.me/boilerplate.zip my-project\n```\n\nThe above command will download \u0026 extract template from `https://cdn.zce.me/boilerplate.zip`.\n\n### Offline Mode\n\n```shell\n$ caz nm my-project --offline\n```\n\nBy running this command, CAZ will try to find a cached version of `nm` template or download from GitHub if it's not yet cached.\n\n### Prompts Override\n\nCAZ allows you to specify prompt response answers through cli parameters.\n\n```shell\n$ caz minima my-project --name my-proj\n```\n\nBy running this command, you don't have to answer the next `name` prompts.\n\n### Debug Mode\n\n```shell\n$ caz nm my-project --debug\n```\n\n`--debug` parameter will open the debug mode.\n\nIn debug mode, once an exception occurs, the exception details will be automatically output. This is very helpful in finding errors in the template.\n\n### List Available Templates\n\nShow all available templates:\n\n```shell\n$ caz list [owner] [-j|--json] [-s|--short]\n```\n\n#### Arguments\n\n- `[owner]`: GitHub orgs or user slug, default: `'caz-templates'`\n\n#### Options\n\n- `-j, --json`: Output with json format\n- `-s, --short`: Output with short format\n\n## Official Templates\n\nCurrent available templates list:\n\n- [template](https://github.com/caz-templates/template) - for creating [caz](https://github.com/zce/caz) templates.\n- [nm](https://github.com/caz-templates/nm) - for creating [node](https://nodejs.org) modules.\n- [vercel](https://github.com/caz-templates/vercel) - for creating [vercel](https://vercel.com) apps.\n- [react](https://github.com/caz-templates/react) - for creating modern [react](https://reactjs.org) apps.\n- [vue](https://github.com/caz-templates/vue) - for creating modern [vue.js](https://vuejs.org) apps.\n- [vite](https://github.com/caz-templates/vite) - for creating vue.js apps powered by [vite](https://github.com/vitejs/vite).\n- [electron](https://github.com/caz-templates/electron) - :construction: for creating [electron](https://electronjs.org) apps.\n- [mp](https://github.com/caz-templates/mp) - :construction: for creating wechat [mini-programs](https://developers.weixin.qq.com/miniprogram/dev/framework).\n- [jekyll](https://github.com/caz-templates/jekyll) - :construction: for creating [jekyll](https://jekyllrb.com) site.\n- [x-pages](https://github.com/caz-templates/x-pages) - for creating [x-pages](https://github.com/zce/x-pages) static site.\n\nMaybe more: https://github.com/caz-templates\n\n\u003e You can also run `$ caz list` to see all available official templates in real time.\n\n**All templates are currently hosted on GitHub, Chinese users can [use the mirror](#mirror-for-chinese) on coding.net.**\n\n## Advanced\n\n### Configuration\n\nCAZ will read the configuration file in `~/.cazrc`, default config:\n\n```ini\n; template download registry\n; {owner} \u0026 {name} \u0026 {branch} will eventually be replaced by the corresponding value.\nregistry = https://github.com/{owner}/{name}/archive/{branch}.zip\n; template offlicial organization name\nofficial = caz-templates\n; default template branch name\nbranch = master\n```\n\nThis means that you can customize the configuration by modifying the configuration file.\n\nFor example, in your `~/.cazrc`:\n\n```ini\nregistry = https://gitlab.com/{owner}/{name}/archive/{branch}.zip\nofficial = faker\nbranch = main\n```\n\nThen run the following command:\n\n```shell\n$ caz nm my-project\n```\n\nThe above command will download \u0026 extract template from `https://gitlab.com/faker/nm/archive/main.zip`.\n\n#### Mirror for Chinese\n\nDue to network limitations, the template download may time out, you can consider using the mirror repository I configured on [coding.net](https://coding.net).\n\n`~/.cazrc`:\n\n```ini\nregistry = https://zce.coding.net/p/{owner}/d/{name}/git/archive/{branch}\nofficial = caz\n```\n\n#### Socks Proxy\n\nCAZ supports socks proxy config.\n\n`~/.cazrc`:\n\n```ini\nproxy = socks5://127.0.0.1:1080\n```\n\nor environment variable:\n\n```shell\n$ ALL_PROXY=socks5://127.0.0.1:1080 caz nm my-project\n```\n\n### Create Your Template\n\n```shell\n$ caz template my-template\n```\n\nThe above command will pulls the template from [caz-templates/template](https://github.com/caz-templates/template), and help you create your own CAZ template.\n\nTo create and distribute your own template, please refer to the [How to create template](docs/create-template.md).\n\n\u003e Maybe fork an official template is also a good decision.\n\n### Create Your Scaffold\n\n```shell\n# install it locally\n$ npm install caz\n\n# or yarn\n$ yarn add caz\n```\n\nwith ESM and async/await:\n\n```javascript\nimport caz from 'caz'\n\ntry {\n  const template = 'nm'\n  // project path (relative cwd or full path)\n  const project = 'my-project'\n  const options = { force: false, offline: false }\n  // scaffolding by caz...\n  await caz(template, project, options)\n  // success created my-project by nm template\n} catch (e) {\n  // error handling\n  console.error(e)\n}\n```\n\nor with CommonJS and Promise:\n\n```javascript\nconst { default: caz } = require('caz')\n\nconst template = 'nm'\n// project path (relative cwd or full path)\nconst project = 'my-project'\nconst options = { force: false, offline: false }\n// scaffolding by caz...\ncaz(template, project, options)\n  .then(() =\u003e {\n    // success created my-project by nm template\n  })\n  .catch(e =\u003e {\n    // error handling\n    console.error(e)\n  })\n```\n\nThis means that you can develop your own scaffolding module based on it.\n\nTo create and distribute your own scaffolding tools, please refer to the [How to create scaffolding tools based on CAZ](docs/create-scaffold.md).\n\n## References\n\n\u003c!-- API Docs --\u003e\n\n### caz(template, project?, options?)\n\nCreate new project from a template\n\n#### template\n\n- Type: `string`\n- Details: template name, it can also be a template folder path\n\n#### project\n\n- Type: `string`\n- Details: project name, it can also be a project folder path\n- Default: `'.'`\n\n#### options\n\n- Type: `object`\n- Details: options \u0026 prompts override\n- Default: `{}`\n\n##### force\n\n- Type: `boolean`\n- Details: overwrite if the target exists\n- Default: `false`\n\n##### offline\n\n- Type: `boolean`\n- Details: try to use an offline template\n- Default: `false`\n\n##### [key: string]\n\n- Type: `any`\n- Details: cli options to override prompts\n\n## Motivation\n\n👉 🛠 ⚙\n\nJoking: I want to make wheels ;P\n\nThe real reason is that I think I need a scaffolding tool that is more suitable for my personal productivity. The existing tools have more or less certain limitations because of their different starting points.\n\nNothing else.\n\n## Concepts\n\n### How It Works\n\n![Scaffolding flow](https://user-images.githubusercontent.com/6166576/88473012-d4ecb180-cf4b-11ea-968a-5508c6f84502.png)\n\n\u003e P.S. The picture is from the Internet, but I have forgotten the specific source, sorry to the author.\n\n#### Main Workflow\n\nThe [core code](src/index.ts) is based on the middleware mechanism provided by [zce/mwa](https://github.com/zce/mwa).\n\nThe following middleware will be executed sequentially.\n\n1. [confirm](src/confirm.ts) - Confirm destination by [prompts](https://github.com/terkelg/prompts).\n2. [resolve](src/resolve.ts) - Resolve template from remote or local filesystem.\n3. [load](src/load.ts) - Install template dependencies, load template config by `require`.\n4. [inquire](src/inquire.ts) - Inquire template prompts by [prompts](https://github.com/terkelg/prompts).\n5. [setup](src/setup.ts) - Only apply template setup hook function.\n6. [prepare](src/prepare.ts) - Filter out unnecessary files and prepare all files to be generated.\n7. [rename](src/rename.ts) - Rename each file if the filename contains interpolations.\n8. [render](src/render.ts) - Render the contents of each file if template.\n9. [emit](src/emit.ts) - Emit files to destination.\n10. [install](src/install.ts) - Execute `npm | yarn | pnpm install` command if necessary.\n11. [init](src/init.ts) - Execute `git init \u0026\u0026 git add \u0026\u0026 git commit` command if necessary.\n12. [complete](src/complete.ts) - Only apply template complete hook function.\n\n### Built With\n\n- [adm-zip](https://github.com/cthackers/adm-zip) - A Javascript implementation of zip for nodejs. Allows user to create or extract zip files both in memory or to/from disk\n- [cac](https://github.com/cacjs/cac) - Simple yet powerful framework for building command-line apps.\n- [env-paths](https://github.com/sindresorhus/env-paths) - Get paths for storing things like data, config, cache, etc\n- [fast-glob](https://github.com/mrmlnc/fast-glob) - It's a very fast and efficient glob library for Node.js\n- [ini](https://github.com/npm/ini) - An ini encoder/decoder for node\n- [lodash](https://github.com/lodash/lodash) - Lodash modular utilities.\n- [node-fetch](https://github.com/node-fetch/node-fetch) - A light-weight module that brings Fetch API to node.js\n- [ora](https://github.com/sindresorhus/ora) - Elegant terminal spinner\n- [prompts](https://github.com/terkelg/promptss) - Lightweight, beautiful and user-friendly prompts\n- [semver](https://github.com/npm/node-semver) - The semantic version parser used by npm.\n- [validate-npm-package-name](https://github.com/npm/validate-npm-package-name) - Give me a string and I'll tell you if it's a valid npm package name\n\n## Roadmap\n\nThe following are the features I want to achieve or are under development:\n\n- [ ] config command\n- [ ] cache command\n- [ ] all lifecycle hooks\n- [ ] console output (colorful \u0026 verbose)\n- [ ] more and more official templates\n\nSee the [open issues](https://github.com/zce/caz/issues) for a list of proposed features (and known issues).\n\n## Contributing\n\n1. **Fork** it on GitHub!\n2. **Clone** the fork to your own machine.\n3. **Checkout** your feature branch: `git checkout -b my-awesome-feature`\n4. **Commit** your changes to your own branch: `git commit -am 'Add some feature'`\n5. **Push** your work back up to your fork: `git push -u origin my-awesome-feature`\n6. Submit a **Pull Request** so that we can review your changes.\n\n\u003e **NOTE**: Be sure to merge the latest from \"upstream\" before making a pull request!\n\n## License\n\nDistributed under the MIT License. See [LICENSE](LICENSE) for more information. \u0026copy; [汪磊](https://zce.me)\n\n\u003c!-- Acknowledgements --\u003e\n","funding_links":["https://github.com/sponsors/zce"],"categories":["TypeScript","boilerplate"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzce%2Fcaz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzce%2Fcaz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzce%2Fcaz/lists"}