├── .editorconfig ├── .github ├── contributing.md ├── husky │ ├── commit-msg │ └── pre-commit └── workflows │ └── main.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── README.zh-CN.md ├── docs ├── caz.png ├── create-scaffold.md ├── create-scaffold.zh-CN.md ├── create-template.md ├── create-template.zh-CN.md ├── flow.png └── logo.svg ├── package.json ├── src ├── cli.spec.ts ├── cli.ts ├── complete.spec.ts ├── complete.ts ├── confirm.spec.ts ├── confirm.ts ├── core │ ├── config.spec.ts │ ├── config.ts │ ├── exec.spec.ts │ ├── exec.ts │ ├── file.spec.ts │ ├── file.ts │ ├── http.spec.ts │ ├── http.ts │ ├── index.spec.ts │ ├── index.ts │ ├── ware.spec.ts │ └── ware.ts ├── emit.spec.ts ├── emit.ts ├── index.spec.ts ├── index.ts ├── init.spec.ts ├── init.ts ├── inquire.spec.ts ├── inquire.ts ├── install.spec.ts ├── install.ts ├── list │ ├── fetch.spec.ts │ ├── fetch.ts │ ├── index.spec.ts │ └── index.ts ├── load.spec.ts ├── load.ts ├── prepare.spec.ts ├── prepare.ts ├── rename.spec.ts ├── rename.ts ├── render.spec.ts ├── render.ts ├── resolve.spec.ts ├── resolve.ts ├── setup.spec.ts ├── setup.ts └── types.ts ├── test ├── fixtures │ ├── .cazrc │ ├── .gitconfig │ ├── .npmrc │ ├── archive.zip │ ├── caz.png │ ├── error.zip │ ├── error │ │ ├── index.js │ │ └── package.json │ ├── features │ │ ├── index.js │ │ ├── package.json │ │ └── template │ │ │ ├── README.md │ │ │ ├── bin │ │ │ └── {name}.js │ │ │ ├── caz.png │ │ │ ├── lib │ │ │ └── index.js │ │ │ ├── package.json │ │ │ └── src │ │ │ └── index.ts │ ├── minima.zip │ └── minima │ │ ├── package.json │ │ └── template │ │ └── caz.txt └── helpers.ts ├── tsconfig.json └── types.d.ts /.editorconfig: -------------------------------------------------------------------------------- 1 | # For more information about the properties used in 2 | # this file, please see the EditorConfig documentation: 3 | # https://editorconfig.org/ 4 | 5 | root = true 6 | 7 | [*] 8 | charset = utf-8 9 | end_of_line = lf 10 | indent_size = 2 11 | indent_style = space 12 | insert_final_newline = true 13 | trim_trailing_whitespace = true 14 | 15 | [*.md] 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /.github/contributing.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | 1. **Fork** it on GitHub! 4 | 2. **Clone** the fork to your own machine. 5 | 3. **Checkout** your feature branch: `git checkout -b my-awesome-feature` 6 | 4. **Commit** your changes to your own branch: `git commit -am 'Add some feature'` 7 | 5. **Push** your work back up to your fork: `git push -u origin my-awesome-feature` 8 | 6. Submit a **Pull Request** so that we can review your changes. 9 | 10 | > **NOTE**: Be sure to merge the latest from "upstream" before making a pull request! 11 | 12 | ## Prerequisites 13 | 14 | - [Node.js](https://nodejs.org) (>= 18.x) 15 | - [npm](https://www.npmjs.com) (>= 7.x) 16 | - [pnpm](https://pnpm.io) (>= 6.x) 17 | - [yarn](https://yarnpkg.com) (>= 1.22) 18 | - [Git](https://git-scm.com) (>= 2.20) 19 | 20 | ## Development 21 | 22 | ```shell 23 | $ git clone https://github.com/zce/caz.git 24 | $ cd caz 25 | $ npm install 26 | $ npm run build 27 | $ npm link 28 | ``` 29 | 30 | dev cli entry 31 | 32 | ```javascript 33 | const fs = require('fs') 34 | const path = require('path') 35 | 36 | // tsconfig filename 37 | const project = path.join(__dirname, '../tsconfig.json') 38 | 39 | // check if we're running in dev mode 40 | const devMode = fs.existsSync(project) 41 | // or want to "force" running the compiled version with --compiled-build 42 | const wantsCompiled = process.argv.indexOf('--compiled-build') >= 0 43 | 44 | if (!devMode || wantsCompiled) { 45 | // import cli from the compiled 46 | // run the CLI with the current process arguments 47 | require('../lib/cli') 48 | } else { 49 | // hook into ts-node so we can run typescript on the fly 50 | require('ts-node').register({ project, files: true }) 51 | 52 | // import cli from the source 53 | // run the CLI with the current process arguments 54 | require('../src/cli') 55 | } 56 | ``` 57 | -------------------------------------------------------------------------------- /.github/husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx --no-install commitlint --edit $1 5 | -------------------------------------------------------------------------------- /.github/husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx --no-install lint-staged 5 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | test: 7 | strategy: 8 | matrix: 9 | os: [ubuntu-latest, windows-latest] 10 | node: [16, 18, 20] 11 | runs-on: ${{ matrix.os }} 12 | steps: 13 | - uses: actions/checkout@v3 14 | - uses: actions/setup-node@v3 15 | with: 16 | node-version: ${{ matrix.node }} 17 | - run: npm i pnpm yarn -g 18 | - run: git config --global user.name "GitHub Actions" 19 | - run: git config --global user.email "bots@github.com" 20 | - run: npm install 21 | - run: npm i @vitest/coverage-v8 22 | - run: npx ts-standard 23 | - run: npx vitest run --coverage 24 | - run: npx codecov 25 | 26 | publish: 27 | if: startsWith(github.ref, 'refs/tags') 28 | needs: test 29 | runs-on: ubuntu-latest 30 | steps: 31 | - uses: actions/checkout@v3 32 | - uses: actions/setup-node@v3 33 | with: 34 | registry-url: https://registry.npmjs.org 35 | - run: npm install 36 | - run: npm run build 37 | - run: npm publish 38 | env: 39 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | node_modules 4 | 5 | /dist 6 | 7 | /coverage 8 | /test/.temp 9 | 10 | package-lock.json 11 | pnpm-lock.yaml 12 | yarn.lock 13 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [1.1.0] - 2022-04-19 4 | 5 | - feat: add socks proxy support 6 | 7 | ## [1.0.0] - 2022-03-24 8 | 9 | - zero dependencies by tsup 10 | - node v14.14.0 required 11 | - auto install template dependencies 12 | - support native esm 13 | - upgrade all dependencies 14 | - refactor test 15 | - chore: minify output dist 16 | - docs: chinese docs 17 | - fix: dts output 18 | 19 | ## [0.8.2] - 2022-01-20 20 | 21 | - fix: output types.d.ts 22 | 23 | ## [0.8.1] - 2021-09-22 24 | 25 | - fix: temp pin adm-zip 0.5.5 (cthackers/adm-zip#389) 26 | 27 | ## [0.8.0] - 2021-08-14 28 | 29 | - feat: support path-based branch name (#62) 30 | - fix: mini template replace regex 31 | 32 | ## [0.7.0] - 2021-07-26 33 | 34 | - feat: ensure local template dir exists (#55) 35 | - chore: upgrade node version requirements 36 | 37 | ## [0.6.0] - 2021-04-02 38 | 39 | - feat: debug mode for output error details 40 | - feat: allow cli options override prompts 41 | 42 | ## [0.5.1] - 2021-03-21 43 | 44 | - fix: update npm scripts 45 | 46 | ## [0.5.0] - 2021-03-21 47 | 48 | - ci: update ci config 49 | 50 | ## [0.4.0] - 2021-03-20 51 | 52 | - ci: remove travis ci 53 | - chore: remove meaningless comments 54 | - chore: remove useless dependencies 55 | 56 | ## [0.3.0] - 2021-03-17 57 | 58 | - feat: using adm-zip instead extract-zip 59 | 60 | ## [0.2.1] - 2021-01-29 61 | 62 | - fix: remove license initial value 63 | 64 | ## [0.2.0] - 2021-01-29 65 | 66 | - feat: license prompt default value 67 | - chore: update license year 68 | - chore: update deps 69 | 70 | ## [0.1.5] - 2020-12-10 71 | 72 | - chore: downgrade node-fetch to 2.x (#142) 73 | 74 | ## [0.1.4] - 2020-12-04 75 | 76 | - chore: update deps 77 | - docs: update docs 78 | 79 | ## [0.1.3] - 2020-08-16 80 | 81 | - feat: using self built api instead github api 82 | 83 | ## [0.1.2] - 2020-08-14 84 | 85 | - feat: setup after inquire 86 | - fix: extract zip strip 87 | 88 | ## [0.1.1] - 2020-08-09 89 | 90 | - fix: skip binary files when rendering templates (#5) 91 | - chore: update dependency ora to v5.0.0 92 | 93 | ## [0.1.0] - 2020-08-02 94 | 95 | - chore: initial release 96 | 97 | ## [0.0.0] - 2020-07-14 98 | 99 | - feat: initial commit 100 | 101 | 102 | 103 | [1.1.0]: https://github.com/zce/caz/compare/v1.0.0...v1.1.0 104 | [1.0.0]: https://github.com/zce/caz/compare/v0.8.2...v1.0.0 105 | [0.8.2]: https://github.com/zce/caz/compare/v0.8.1...v0.8.2 106 | [0.8.1]: https://github.com/zce/caz/compare/v0.8.0...v0.8.1 107 | [0.8.0]: https://github.com/zce/caz/compare/v0.7.0...v0.8.0 108 | [0.7.0]: https://github.com/zce/caz/compare/v0.6.0...v0.7.0 109 | [0.6.0]: https://github.com/zce/caz/compare/v0.5.1...v0.6.0 110 | [0.5.1]: https://github.com/zce/caz/compare/v0.5.0...v0.5.1 111 | [0.5.0]: https://github.com/zce/caz/compare/v0.4.0...v0.5.0 112 | [0.4.0]: https://github.com/zce/caz/compare/v0.3.0...v0.4.0 113 | [0.3.0]: https://github.com/zce/caz/compare/v0.2.1...v0.3.0 114 | [0.2.1]: https://github.com/zce/caz/compare/v0.2.0...v0.2.1 115 | [0.2.0]: https://github.com/zce/caz/compare/v0.1.5...v0.2.0 116 | [0.1.5]: https://github.com/zce/caz/compare/v0.1.4...v0.1.5 117 | [0.1.4]: https://github.com/zce/caz/compare/v0.1.3...v0.1.4 118 | [0.1.3]: https://github.com/zce/caz/compare/v0.1.2...v0.1.3 119 | [0.1.2]: https://github.com/zce/caz/compare/v0.1.1...v0.1.2 120 | [0.1.1]: https://github.com/zce/caz/compare/v0.1.0...v0.1.1 121 | [0.1.0]: https://github.com/zce/caz/compare/v0.0.0-alpha.2...v0.1.0 122 | [0.0.0]: https://github.com/zce/caz/releases/tag/v0.0.0-alpha.2 123 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023 zce (https://zce.me) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | CAZ 3 |

A simple yet powerful template-based Scaffolding tools for my personal productivity.

4 |

5 | Build Status 6 | Coverage Status 7 | License 8 | NPM Version 9 | Node Version 10 |
11 | Code Style 12 | NPM Downloads 13 | Install Size 14 | Repo Size 15 | Dependencies Status 16 |

17 |
18 | 19 |
20 | 21 | **English** | [简体中文](README.zh-CN.md) 22 | 23 | ## Introduction 24 | 25 | CAZ (**C**reate **A**pp **Z**en) 26 | 27 | It's a a simple template-based Scaffolding tools for my personal productivity, inspired by [Yeoman](https://yeoman.io) & [Vue CLI 2](https://npm.im/vue-cli) & etc. 28 | 29 | - pronounced: [[kæz]](http://dict.youdao.com/dictvoice?audio=caz) 📷 ✌ 30 | - written: CAZ / caz 31 | 32 | _For more introduction, please refer to the [How it works](#how-it-works)._ 33 | 34 | ### Features 35 | 36 | - Easy to use 37 | - Light-weight 38 | - Still powerful 39 | - High efficiency 40 | - Zero dependencies 41 | - Template-based 42 | - Configurable 43 | - Extensible 44 | - TypeScript 45 | - Use modern API 46 | 47 | > I'll give you specific reasons later. 48 | 49 | ## Table of Contents 50 | 51 | - [Introduction](#introduction) 52 | - [Features](#features) 53 | - [Getting Started](#getting-started) 54 | - [Prerequisites](#prerequisites) 55 | - [Installation](#installation) 56 | - [Quick Start](#quick-start) 57 | - [Recipes](#recipes) 58 | - [GitHub Repo Templates](#github-repo-templates) 59 | - [Local Templates](#local-templates) 60 | - [Remote ZIP Templates](#remote-zip-templates) 61 | - [Offline Mode](#offline-mode) 62 | - [Prompts Override](#prompts-override) 63 | - [Debug Mode](#debug-mode) 64 | - [List Available Templates](#list-available-templates) 65 | - [Official Templates](#official-templates) 66 | - [Advanced](#advanced) 67 | - [Configuration](#configuration) 68 | - [Create Your Template](#create-your-template) 69 | - [Create Your Scaffold](#create-your-scaffold) 70 | - [References](#references) 71 | - [Motivation](#motivation) 72 | - [About](#about) 73 | - [How It Works](#how-it-works) 74 | - [Built With](#built-with) 75 | - [Roadmap](#roadmap) 76 | - [Contributing](#contributing) 77 | - [License](#license) 78 | 79 | ## Getting Started 80 | 81 | ### Prerequisites 82 | 83 | - [Node.js](https://nodejs.org) (>= 16.x required, >= 18.x preferred) 84 | - [npm](https://www.npmjs.com) (>= 7.x) or [pnpm](https://pnpm.io) (>= 6.x) or [yarn](https://yarnpkg.com) (>= 1.22) 85 | - [Git](https://git-scm.com) (>= 2.0) 86 | 87 | ### Installation 88 | 89 | ```shell 90 | # install it globally 91 | $ npm install -g caz 92 | 93 | # or yarn 94 | $ yarn global add caz 95 | ``` 96 | 97 | ### Quick Start 98 | 99 | Create new project from a template. 100 | 101 | ```shell 102 | $ caz