├── .editorconfig ├── .github ├── contributing.md ├── husky │ ├── commit-msg │ └── pre-commit └── workflows │ └── main.yml ├── .gitignore ├── .vscode └── settings.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── bin └── caz.js ├── docs ├── caz.png ├── create-scaffold.md ├── create-template.md ├── flow.png └── logo.svg ├── package.json ├── src ├── cli.ts ├── core │ ├── config.ts │ ├── exec.ts │ ├── file.ts │ ├── http.ts │ ├── index.ts │ └── ware.ts ├── index.ts ├── init │ ├── complete.ts │ ├── confirm.ts │ ├── emit.ts │ ├── index.ts │ ├── init.ts │ ├── inquire.ts │ ├── install.ts │ ├── load.ts │ ├── prepare.ts │ ├── rename.ts │ ├── render.ts │ ├── resolve.ts │ ├── setup.ts │ └── types.d.ts ├── list │ ├── fetch.ts │ └── index.ts └── types.d.ts ├── test ├── cli.spec.ts ├── core │ ├── config.spec.ts │ ├── exec.spec.ts │ ├── file.spec.ts │ ├── http.spec.ts │ ├── index.spec.ts │ └── ware.spec.ts ├── fixtures │ ├── .cazrc │ ├── .gitconfig │ ├── .npmrc │ ├── archive.zip │ ├── caz.png │ ├── error.zip │ ├── error │ │ └── index.js │ ├── features │ │ ├── index.js │ │ ├── package.json │ │ └── template │ │ │ ├── README.md │ │ │ ├── bin │ │ │ └── {name}.js │ │ │ ├── caz.png │ │ │ ├── lib │ │ │ └── index.js │ │ │ ├── package.json │ │ │ └── src │ │ │ └── index.ts │ └── minima │ │ └── template │ │ └── caz.txt ├── index.spec.ts ├── init │ ├── complete.spec.ts │ ├── confirm.spec.ts │ ├── emit.spec.ts │ ├── index.spec.ts │ ├── init.spec.ts │ ├── inquire.spec.ts │ ├── install.spec.ts │ ├── load.spec.ts │ ├── prepare.spec.ts │ ├── rename.spec.ts │ ├── render.spec.ts │ ├── resolve.spec.ts │ ├── setup.spec.ts │ └── util.ts └── list │ ├── fetch.spec.ts │ └── index.spec.ts ├── tsconfig.eslint.json └── tsconfig.json /.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) (>= 12.10) 15 | - [npm](https://www.npmjs.com) (>= 6.x) 16 | - [yarn](https://yarnpkg.com) (>= 1.20) 17 | - [Git](https://git-scm.com) (>= 2.20) 18 | 19 | ## Development 20 | 21 | ```shell 22 | $ git clone https://github.com/zce/caz.git 23 | $ cd caz 24 | $ npm install 25 | $ npm link 26 | ``` 27 | 28 | dev cli entry 29 | 30 | ```javascript 31 | const fs = require('fs') 32 | const path = require('path') 33 | 34 | // tsconfig filename 35 | const project = path.join(__dirname, '../tsconfig.json') 36 | 37 | // check if we're running in dev mode 38 | const devMode = fs.existsSync(project) 39 | // or want to "force" running the compiled version with --compiled-build 40 | const wantsCompiled = process.argv.indexOf('--compiled-build') >= 0 41 | 42 | if (!devMode || wantsCompiled) { 43 | // import cli from the compiled 44 | // run the CLI with the current process arguments 45 | require('../lib/cli') 46 | } else { 47 | // hook into ts-node so we can run typescript on the fly 48 | require('ts-node').register({ project, files: true }) 49 | 50 | // import cli from the source 51 | // run the CLI with the current process arguments 52 | require('../src/cli') 53 | } 54 | ``` -------------------------------------------------------------------------------- /.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 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | 9 | strategy: 10 | matrix: 11 | node-version: [12, 14, 15] 12 | 13 | steps: 14 | - uses: actions/checkout@v2 15 | - uses: actions/setup-node@v2 16 | with: 17 | node-version: ${{ matrix.node-version }} 18 | - run: npm install --ignore-scripts 19 | - run: npm run lint 20 | - run: npm run build 21 | - run: npm run test 22 | 23 | codecov: 24 | if: github.ref == 'refs/heads/master' 25 | needs: build 26 | runs-on: ubuntu-latest 27 | steps: 28 | - uses: actions/checkout@v2 29 | - uses: actions/setup-node@v2 30 | - run: npm install --ignore-scripts 31 | - run: npm run test 32 | - run: npx codecov 33 | 34 | publish: 35 | if: startsWith(github.ref, 'refs/tags') 36 | needs: build 37 | runs-on: ubuntu-latest 38 | steps: 39 | - uses: actions/checkout@v2 40 | - uses: actions/setup-node@v2 41 | with: 42 | registry-url: https://registry.npmjs.org 43 | - run: npm install --ignore-scripts 44 | - run: npm run build 45 | - run: npm publish --ignore-scripts 46 | env: 47 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | node_modules 4 | 5 | /lib 6 | 7 | /coverage 8 | /test/.temp 9 | 10 | package-lock.json 11 | yarn.lock 12 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules/typescript/lib" 3 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [0.6.0] - 2021-04-02 4 | 5 | - feat: debug mode for output error details 6 | - feat: allow cli options override prompts 7 | 8 | ## [0.5.1] - 2021-03-21 9 | 10 | - fix: update npm scripts 11 | 12 | ## [0.5.0] - 2021-03-21 13 | 14 | - ci: update ci config 15 | 16 | ## [0.4.0] - 2021-03-20 17 | 18 | - ci: remove travis ci 19 | - chore: remove meaningless comments 20 | - chore: remove useless dependencies 21 | 22 | ## [0.3.0] - 2021-03-17 23 | 24 | - feat: using adm-zip instead extract-zip 25 | 26 | ## [0.2.1] - 2021-01-29 27 | 28 | - fix: remove license initial value 29 | 30 | ## [0.2.0] - 2021-01-29 31 | 32 | - feat: license prompt default value 33 | - chore: update license year 34 | - chore: update deps 35 | 36 | ## [0.1.5] - 2020-12-10 37 | 38 | - chore: downgrade node-fetch to 2.x (#142) 39 | 40 | ## [0.1.4] - 2020-12-04 41 | 42 | - chore: update deps 43 | - docs: update docs 44 | 45 | ## [0.1.3] - 2020-08-16 46 | 47 | - feat: using self built api instead github api 48 | 49 | ## [0.1.2] - 2020-08-14 50 | 51 | - feat: setup after inquire 52 | - fix: extract zip strip 53 | 54 | ## [0.1.1] - 2020-08-09 55 | 56 | - fix: skip binary files when rendering templates (#5) 57 | - chore: update dependency ora to v5.0.0 58 | 59 | ## [0.1.0] - 2020-08-02 60 | 61 | - chore: initial release 62 | 63 | ## [0.0.0] - 2020-07-14 64 | 65 | - feat: initial commit 66 | 67 | 68 | 69 | [0.6.0]: https://github.com/zce/caz/compare/v0.5.1...v0.6.0 70 | [0.5.1]: https://github.com/zce/caz/compare/v0.5.0...v0.5.1 71 | [0.5.0]: https://github.com/zce/caz/compare/v0.4.0...v0.5.0 72 | [0.4.0]: https://github.com/zce/caz/compare/v0.3.0...v0.4.0 73 | [0.3.0]: https://github.com/zce/caz/compare/v0.2.1...v0.3.0 74 | [0.2.1]: https://github.com/zce/caz/compare/v0.2.0...v0.2.1 75 | [0.2.0]: https://github.com/zce/caz/compare/v0.1.5...v0.2.0 76 | [0.1.5]: https://github.com/zce/caz/compare/v0.1.4...v0.1.5 77 | [0.1.4]: https://github.com/zce/caz/compare/v0.1.3...v0.1.4 78 | [0.1.3]: https://github.com/zce/caz/compare/v0.1.2...v0.1.3 79 | [0.1.2]: https://github.com/zce/caz/compare/v0.1.1...v0.1.2 80 | [0.1.1]: https://github.com/zce/caz/compare/v0.1.0...v0.1.1 81 | [0.1.0]: https://github.com/zce/caz/compare/v0.0.0-alpha.2...v0.1.0 82 | [0.0.0]: https://github.com/zce/caz/releases/tag/v0.0.0-alpha.2 83 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2021 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 | Code Style 11 |
12 | NPM Downloads 13 | Install Size 14 | Repo size 15 | Dependencies Status 16 | DevDependencies Status 17 |

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