# m-cli-utils

> FE Cli 工具方法集 for m-fe-cli

Latest version **0.1.6** (published 2022-05-02) · BSD-3-Clause license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install m-cli-utils
pnpm add m-cli-utils
yarn add m-cli-utils
bun add m-cli-utils
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2022-05-02 |
| First published | 2022-05-02 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 25.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | haimian |
| Maintainers | chj736881645 |
| Keywords | m-cli-utils, m-fe-cli, m-fe-cli-tool |

## Links

- npm: https://www.npmjs.com/package/m-cli-utils
- npm.io page: https://npm.io/package/m-cli-utils

## Dependencies (7)

- [ora](https://npm.io/package/ora.md) ^5.1.0
- [semver](https://npm.io/package/semver.md) ^7.3.4
- [shelljs](https://npm.io/package/shelljs.md) ^0.8.4
- [fs-extra](https://npm.io/package/fs-extra.md) ^9.0.1
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.1
- [@irim/cli-base](https://npm.io/package/@irim/cli-base.md) ^1.1.8
- [@types/shelljs](https://npm.io/package/@types/shelljs.md) ^0.8.9

## Recent versions

- 0.1.6 (latest) — 2022-05-02

## README

# m-cli-utils

M-CLI 以及相关的插件需要用到的 utils 方法及常量

## Getting Started

* `$ npm install m-cli-utils --save`

## API

### consts 静态常量

| name              | desc                                        | type   | value                              |
| ----------------- | ------------------------------------------- | ------ | ---------------------------------- |
| WORKSPACE         | 当前的执行目录，即 process.cwd()            | string |                                    |
| CONFIG_PATH       | 全局配置根目录 ~/.feconfig                  | string |                                    |
| PLUGIN_PATH       | 全局插件根目录 ~/.feconfig/lib/node_modules | string |                                    |
| USER_PROFILE      | 用户信息配置文件 ~/.feconfig/profile.json   | string |                                    |
| NPM_REGISTRY_URL | npm registry 地址                          | string | `'https://registry.npmjs.org'` |

### version 版本号相关方法

1. `checkUpdate(registry: string, current: string): Promise<false | string>` 检查是否需要更新，如果有新版本，则返回版本号

2. `needUpdate(registry: string, current: string): Promise<boolean>` 是否有新版本，以及是否需要升级(控制台二次确认)

### userinfo 用户信息相关方法

1. `getInfo(): Promise<UserConfig>` 获取用户信息，如果没果，则会调用设置

2. `setInfo(isUpdate = false)` 设置用户信息, isUpdate 表示强制更新

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