# ldq-cli

> 一个前端脚手架,可以自动部署项目至服务器，也可以拉取项目模板构建项目

Latest version **0.0.15** (published 2022-09-10) · MIT license · 0 weekly downloads

## Install

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

Provides the command `dq`.

## 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.15 |
| Published | 2022-09-10 |
| First published | 2022-04-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 11 |
| Unpacked size | 24 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | left0ver |
| Maintainers | left0ver |
| Keywords | ldq-cli, cli, ldq, dq |

## Links

- npm: https://www.npmjs.com/package/ldq-cli
- Repository: https://github.com/left0ver/dq-cli
- Homepage: https://github.com/left0ver/dq-cli#readme
- Issues: https://github.com/left0ver/dq-cli/issues
- npm.io page: https://npm.io/package/ldq-cli

## Dependencies (11)

- [ora](https://npm.io/package/ora.md) ^5.4.1
- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [figlet](https://npm.io/package/figlet.md) ^1.5.2
- [archiver](https://npm.io/package/archiver.md) ^5.3.1
- [fs-extra](https://npm.io/package/fs-extra.md) ^10.1.0
- [inquirer](https://npm.io/package/inquirer.md) ^8.2.2
- [node-ssh](https://npm.io/package/node-ssh.md) ^12.0.4
- [progress](https://npm.io/package/progress.md) ^2.0.3
- [commander](https://npm.io/package/commander.md) ^9.2.0
- [kebab-case](https://npm.io/package/kebab-case.md) ^1.0.1
- [download-git-repo](https://npm.io/package/download-git-repo.md) ^3.0.2

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 0.0.15 (latest) — 2022-09-10
- 0.0.14 — 2022-07-20
- 0.0.13 — 2022-07-19
- 0.0.12 — 2022-07-16
- 0.0.11 — 2022-05-04
- 0.0.10 — 2022-05-03
- 0.0.9 — 2022-05-01
- 0.0.8 — 2022-05-01
- 0.0.7 — 2022-05-01
- 0.0.6 — 2022-04-29
- 0.0.5 — 2022-04-27
- 0.0.4 — 2022-04-27

## README

<div align='center'><img align='center' src='https://leftover-md.oss-cn-guangzhou.aliyuncs.com/img-md/logo1.jpg'/></div>

![GitHub](https://img.shields.io/github/license/left0ver/dq-cli) ![npm](https://img.shields.io/npm/v/ldq-cli)

dq-cli 是一个命令行工具，配置项简单，既可以一条命令即可让你将项目部署至 Linux 服务器，也可以拉取模板帮助你搭建迅速搭建一个前端工程化的项目

# 特点

- 命令行部署项目
- 使用现成的模板搭建项目，迅速搭建起一个规范的项目

# 模板

[模板列表](https://github.com/dq-cli-template),每套模板里面都内置了 eslint,prettier,stylelint,commitizen,commitlint,husky,你可以在这个基础上添加你自己的配置，也可以使用模板的配置,所有配置文件均可见,修改起来简单方便

# Install

```
 npm install ldq-cli -g
```

> 不要打错了哦

# Usage

```
dq --help

  Commands:
    init             初始化配置文件
    build [options]  将本地的指定文件夹部署到服务器
    create <project>  拉取模板创建项目
    help [command]   display help for command
```

### 命令行部署项目

1. 本命令行工具支持 ssh 连接和密码连接服务器两种方式，如果您需要适应 ssh 连接的方式，请先在客户端的电脑上生成对应的 ssh 密钥对，然后将公钥放到服务器上，参考 [教程](https://leftover.cn/2022/04/27/ssh%E5%AF%86%E9%92%A5%E8%BF%9C%E7%A8%8B%E8%BF%9E%E6%8E%A5%E6%9C%8D%E5%8A%A1%E5%99%A8/)，当然如果您不想这么麻烦，也可以使用密码的方式。

2. `password` 和私钥二者至少要有一个

3. 部署的时候会自动将服务器中原本的文件夹进行一个备份，备份的文件夹为`[your dirname].bak`

4. 命令行的配置项会覆盖配置文件中相同的配置项
5. 使用命令行的-e 选项,在上传完文件夹之后执行某个命令,命令的内容要加**引号**,执行命令是在根目录/下执行的，如果想要在某个具体的目录下执行，可以先 cd 到某个目录，具体情况见下面的 example,如果你想要执行某个 shell 脚本，您可以使用命令`sh [your script path]`

```bash
$ dq build --help

 Options:
-H --host [host]          服务器ip,默认localhost
-p --port [port]              设置ssh连接的端口号,默认是22
-u --user [username]          服务器登录的用户名,默认root
-k --privateKey [privateKey]  私钥保存的位置,绝对路径
-P --PWD [password]           登录密码
-l --local [localPath]        要上传的文件夹的位置,默认是当前工作目录的dist文件夹
-d --dest [destination]       要上传的服务器的哪个目录下,默认为：/,必须使用绝对路径
-c --config [config]          选择配置文件的路径,默认当前工作目录下的dq.config.json文件
-e --exec [command]           上传文件之后在服务器中执行的命令
-h, --help                    display help for command

$ dq -H  10.23.5.8 -p 22 -u root -k C:\Users\ASUS\.ssh\id_rsa_client -P 123456 -l ./dist -d /home/root/ -c .\config\dq.config.json -e 'cd /home/root/dist && npm i'

```

### 使用配置文件

默认配置文件和配置文件的配置项如下，您可以使用-c 指定配置文件路径，默认工作目录下的 dq.config.json 文件

```
{
  "host": "localhost",
  "port": 22,
  "username": "root",
  "privateKey": "",
  "password": "",
  "localPath": "./dist",
  "remotePath": "/",
  "command":""
}

```

## warn

`1. 该工具暂时只在Windows电脑上进行测试（其实是没钱买mac），如需在mac或者Linux上运行，请自测，以后会在Linux测试`

`2. Windows里面不要使用`bash` 运行，会导致路径对不上，导致部署的文件夹错误`

# Licence

dq-cli is used licensed as [MIT](https://github.com/left0ver/dq-cli/blob/main/LICENSE)

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