# @nutui/carefree

> A H5 debugging tool independent of wifi hotspots

Latest version **1.0.0** (published 2019-10-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @nutui/carefree
pnpm add @nutui/carefree
yarn add @nutui/carefree
bun add @nutui/carefree
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-10-23 |
| First published | 2018-09-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | lifeifan,hufeng |
| Maintainers | eryue, nutui |
| Keywords | webpack, debug, h5, mobile |

## Links

- npm: https://www.npmjs.com/package/@nutui/carefree
- Repository: http://git.jd.com/jdcfe/carefree
- npm.io page: https://npm.io/package/@nutui/carefree

## Dependencies (6)

- [chalk](https://npm.io/package/chalk.md) ^2.4.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.10
- [moment](https://npm.io/package/moment.md) ^2.22.2
- [cross-env](https://npm.io/package/cross-env.md) ^5.2.0
- [@nutui/upload](https://npm.io/package/@nutui/upload.md) ^0.1.3
- [qrcode-terminal](https://npm.io/package/qrcode-terminal.md) ^0.12.0

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2019-10-23
- 0.4.0 — 2018-12-20
- 0.3.1 — 2018-12-20
- 0.3.0 — 2018-12-20
- 0.2.0 — 2018-11-07
- 0.1.9 — 2018-11-07
- 0.1.8 — 2018-11-07
- 0.1.7 — 2018-11-07
- 0.1.6 — 2018-11-06
- 0.0.3 — 2018-09-11
- 0.0.2 — 2018-09-10

## README

本webpack插件功能：
1. 处理静态资源路径，并以watch mode编译
2. 将编译后的文件自动上传到指定服务器指定目录
3. 在终端打印出页面入口地址并生成二维码，供手机扫描访问
4. 监听模式下，一旦保存修改，将自动增量编译
5. 有变化的文件会被自动增量上传到服务器
6. 手机刷新页面或再次扫码即可

### 安装

```bash
npm install @nutui/carefree --save-dev
```

### 使用
1. 在`webpack`配置文件中引入

```javascript
const Carefree = require('@nutui/carefree');

plugins: [
    new Carefree({
        //配置项
    })
]
```
2. 在`package.json`的`scripts`字段中添加`carefree-dev`和`carefree-build`命令

```javascript
// package.json
scripts: {
    ...
    "carefree-dev": "cross-env NODE_ENV=carefree carefree_env=dev webpack -w --colors --progress",
    "carefree-build": "cross-env carefree_env=build npm run upload",
    ...
}
```
3. 如果想在启用脚本时暂时不使用`carefree`，可在脚本里修改`carefree_env`为`cross-env carefree_env=stop`
4. 命令行将会打印出二维码，推荐命令行终端的主题为暗黑系
5. 目前支持`ssh`与`ftp`两种上传方式
6. `upload`设置为`false`将只打印二维码，不上传静态资源
7. 默认关闭`devtool`以减小上传文件的体积，需要时可以设置为`webpack`的`devtool`相应值

### Carefree参数说明
| 参数 | 说明 | 默认值 | 是否必填
|----- | ----- | ----- | -----
| upload | 是否上传 | true | 否
| devtool | 参考webpack的devtool配置 | false | 否
| publicPath | 同webpackConfig.output.publicPath | - | 是
| qrcodeUrl | 扫二维码后跳转的地址 | publicPath + 'index.html' | 否
| ftp.host | 服务器ip | -- | 是
| ftp.port | 服务器 | -- | 是
| ftp.source | 待上传的目录 | -- | 是
| ftp.target | 服务器端的项目目录 | -- | 是
| ftp.username | 服务器用户名 | -- | 是
| ftp.password | 服务器密码 | -- | 是
| ssh[option] | 同ftp相关配置项 | -- | 是

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