# tmp-cli

> tmp-cli

Latest version **0.0.1** (published 2018-07-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install tmp-cli
pnpm add tmp-cli
yarn add tmp-cli
bun add tmp-cli
```

Provides the commands `tmpcli`, `tmpcli-init`, `tmpcli-token`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2018-07-11 |
| First published | 2018-07-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.0.0 |
| Dependencies | 17 |
| Unpacked size | 27.5 KB |
| Known vulnerabilities | 0 (+28 in 3 direct dependencies) |
| Install scripts | no |
| Author | lianjiajyFE |
| Maintainers | zhuhongyan |
| Keywords | tmpcli, cli, spa, scaffold, FE |

## Links

- npm: https://www.npmjs.com/package/tmp-cli
- Repository: http://git.lianjia.com/transaction/tmp-cli
- Issues: http://git.lianjia.com/transaction/tmp-cli
- npm.io page: https://npm.io/package/tmp-cli

## Dependencies (17)

- [ora](https://npm.io/package/ora.md) ^0.4.0
- [uuid](https://npm.io/package/uuid.md) ^3.0.1
- [async](https://npm.io/package/async.md) ^2.1.4
- [axios](https://npm.io/package/axios.md) ^0.15.3
- [chalk](https://npm.io/package/chalk.md) ^1.1.3
- [rimraf](https://npm.io/package/rimraf.md) ^2.5.4
- [semver](https://npm.io/package/semver.md) ^5.3.0
- [shelljs](https://npm.io/package/shelljs.md) ^0.7.8
- [inquirer](https://npm.io/package/inquirer.md) ^2.0.0
- [commander](https://npm.io/package/commander.md) ^2.9.0
- [minimatch](https://npm.io/package/minimatch.md) ^3.0.0
- [handlebars](https://npm.io/package/handlebars.md) ^4.0.6
- [metalsmith](https://npm.io/package/metalsmith.md) ^2.3.0
- [consolidate](https://npm.io/package/consolidate.md) ^0.14.5
- [read-metadata](https://npm.io/package/read-metadata.md) ^1.0.0
- [download-git-repo](https://npm.io/package/download-git-repo.md) ^0.2.1
- [validate-npm-package-name](https://npm.io/package/validate-npm-package-name.md) ^2.2.2

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2018-07-11

## README

### tmp-cli
tmp-cli work for FE projects cli template projects
egg：vue-cli
    

### 安装 
依赖 [Node.js](https://nodejs.org/en/) (>=6.x)：

```
$ npm install tmp-cli -g
```

### 用法
```
$ tmp-cli init <template-name> <project-name>
```

初始化时可以关联一个远程仓库: 

```
tmp-cli init <template-name> <project-name> -o remote-repo-url
```

示例:

```
$ tmp-cli init dwqs/vue-startup my-project

$ tmp-cli init waka-templates/vue-webpack2 my-project
```

关联一个远程仓库:

```
$ tmp-cli init vuejs-templates/webpack-simple my-project -o git@github.com:xxx/xxx.git
```

上述命令会从 [vuejs-templates/webpack-simple](https://github.com/vuejs-templates/webpack-simple) 拉取 `webpack` 模板来初始化你的 `./my-project/` 项目.


### 基本命令

* `tmp-cli` or `tmp-cli -h` --- 查看 tmp-cli 的帮助信息
* `tmp-cli init template-name your-project-name` --- 用指定的模板初始化你的项目.
* `tmp-cli token -u your-github-user-name -p your-personal-token` --- 设置 auth token，用于[Rate Limiting](https://developer.github.com/v3/#rate-limiting).

`tmp-cli list` 和 `tmp-cli init` 命令都会向 `api.github.com` 发起请求。在没设置 auth token 的情况下，github限制的请求频率是 60次/小时，超过次数之后，github会拒绝请求，返回403。

而设置token后，请求频率是5000次/小时。

相关文档：

* [Rate Limiting](https://developer.github.com/v3/#rate-limiting)
* [Basic Authentication](https://developer.github.com/v3/auth/#basic-authentication)

### 远程仓库
tmp-cli 允许使用他人的 github repo 作为项目的模板:

```
tmp-cli init username/repo my-project
```

运行上述命令之后，将会使用 `username/repo` 作为模板来初始化你的项目. 但该仓库目录结构需要符合 [template](https://github.com/zhuhongyan/test)) 中的说明.

### 本地模板

tmp-cli 支持使用本地模板初始化项目:

```
tmp-cli init ~/local/template/path my-project
```

>模板书写指南和样本：[template](https://github.com/zhuhongyan/test)

## Note

模板必须符合两条规则：

* 模板根目录下有 `template` 目录
* 模板根目录下有 `meta.{js,json}` 文件

**当你使用他人的github仓库或者本地模板时，如果github仓库或者本地模板的根目录没有 `template` 目录， tmp-cli 将会使用该仓库或者本地模板所在的目录作为渲染模板。**

例如，你的本地模板目录是 `~/my-templates`，如果 `my-templates` 下没有 `template` 目录，tmp-cli 则会使用 `my-templates` 作为渲染模板。

## Thanks
To [metalsmith scaffolder](https://github.com/metalsmith/metalsmith/blob/master/examples/project-scaffolder) for the head start.cli脚手架

---
_Source: https://npm.io/package/tmp-cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
