{"id":13561564,"url":"https://github.com/zce/caz-prev","last_synced_at":"2025-04-03T17:31:11.278Z","repository":{"id":37026264,"uuid":"280898827","full_name":"zce/caz-prev","owner":"zce","description":"A simple yet powerful template-based Scaffolding tools.","archived":true,"fork":false,"pushed_at":"2024-05-06T19:16:38.000Z","size":420,"stargazers_count":85,"open_issues_count":14,"forks_count":25,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-04T13:37:40.863Z","etag":null,"topics":["boilerplate","caz","productivity","scaffold","scaffolding","zce"],"latest_commit_sha":null,"homepage":"https://github.com/zce/caz","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},"funding":{"github":"zce"}},"created_at":"2020-07-19T15:51:57.000Z","updated_at":"2024-05-07T03:23:29.000Z","dependencies_parsed_at":"2023-12-30T01:52:48.329Z","dependency_job_id":"99128515-faf0-41e6-8ed4-152efcaa4484","html_url":"https://github.com/zce/caz-prev","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zce%2Fcaz-prev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zce%2Fcaz-prev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zce%2Fcaz-prev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zce%2Fcaz-prev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zce","download_url":"https://codeload.github.com/zce/caz-prev/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247046880,"owners_count":20874735,"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","productivity","scaffold","scaffolding","zce"],"created_at":"2024-08-01T13:00:58.369Z","updated_at":"2025-04-03T17:31:06.268Z","avatar_url":"https://github.com/zce.png","language":"TypeScript","funding_links":["https://github.com/sponsors/zce"],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/zce/caz\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/6166576/88473000-af5fa800-cf4b-11ea-8ce4-59f1b1f09efe.png\" alt=\"CAZ\"\u003e\u003c/a\u003e\n  \u003cp align=\"center\"\u003eA simple yet powerful template-based Scaffolding tools for my personal productivity.\u003c/p\u003e\n  \u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/zce/caz/actions\"\u003e\u003cimg src=\"https://img.shields.io/github/workflow/status/zce/caz/CI\" 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    \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    \u003cbr\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://david-dm.org/zce/caz\"\u003e\u003cimg src=\"https://img.shields.io/david/zce/caz\" alt=\"Dependencies Status\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://david-dm.org/zce/caz?type=dev\"\u003e\u003cimg src=\"https://img.shields.io/david/dev/zce/caz\" alt=\"DevDependencies Status\"\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\u003cbr\u003e\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- Less 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  - [List Available Templates](#list-available-templates)\n  - [Official Templates](#official-templates)\n- [Advanced](#advanced)\n  - [Create Your Template](#create-your-template)\n  - [Configuration](#configuration)\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= 10.12, 14.15 preferred)\n- [npm](https://www.npmjs.com) (\u003e= 6.x) or [yarn](https://yarnpkg.com) (\u003e= 1.20)\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\n### Debug Mode\n\n```shell\n$ caz nm my-project --debug\n```\n\n`--debug` parameter will open the debug mode, In 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- [react](https://github.com/caz-templates/react) - :construction: for creating modern [react](https://reactjs.org) app.\n- [vue](https://github.com/caz-templates/vue) - for creating modern [vue.js](https://vuejs.org) app.\n- [vite](https://github.com/caz-templates/vite) - for creating vue.js app powered by [vite](https://github.com/vitejs/vite).\n- [electron](https://github.com/caz-templates/electron) - :construction: for creating [electron](https://electronjs.org) app.\n- [jekyll](https://github.com/caz-templates/jekyll) - :construction: for creating [jekyll](https://jekyllrb.com) site.\n- [mp](https://github.com/caz-templates/mp) - :construction: for creating wechat [mini-programs](https://developers.weixin.qq.com/miniprogram/dev/framework).\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## Advanced\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### 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 = dev\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/dev.zip`.\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\n;(async () =\u003e {\n  try {\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```\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\u003c!-- _For more examples, please refer to the [example/usage.ts](example/usage.ts)._ --\u003e\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\n\n#### project\n\n- Type: `string`\n- Details: project name\n- Default: `'.'`\n\n#### options\n\n- Type: `object`\n- Details: options \u0026 prompts override\n- Default: `{}`\n\n##### force\n\nType: `boolean`\nDetails: overwrite if the target exists\nDefault: `false`\n\n##### offline\n\nType: `boolean`\nDetails: try to use an offline template\nDefault: `false`\n\n##### [key: string]\n\nType: `any`\nDetails: 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.\n\nNothing else.\n\n\u003c!-- TODO: Concepts / Recipes / Documentation --\u003e\n\n## About\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/init/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/init/confirm.ts) - Confirm destination by [prompts](https://github.com/terkelg/prompts).\n2. [resolve](src/init/resolve.ts) - Resolve template from remote or local.\n3. [load](src/init/load.ts) - Load template config by require.\n4. [inquire](src/init/inquire.ts) - Inquire template prompts by [prompts](https://github.com/terkelg/prompts).\n5. [setup](src/init/setup.ts) - Apply template setup hook.\n6. [prepare](src/init/prepare.ts) - Prepare all template files.\n7. [rename](src/init/rename.ts) - Rename file if necessary.\n8. [render](src/init/render.ts) - Render file if template.\n9. [emit](src/init/emit.ts) - Emit files to destination.\n10. [install](src/init/install.ts) - Execute `npm | yarn | pnpm install` command.\n11. [init](src/init/init.ts) - Execute `git init \u0026\u0026 git add \u0026\u0026 git commit` command.\n12. [complete](src/init/complete.ts) - Apply template complete hook.\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzce%2Fcaz-prev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzce%2Fcaz-prev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzce%2Fcaz-prev/lists"}