# @walrus/walrus-plugin-update-config

> update web config file

Latest version **0.1.2** (published 2019-10-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @walrus/walrus-plugin-update-config
pnpm add @walrus/walrus-plugin-update-config
yarn add @walrus/walrus-plugin-update-config
bun add @walrus/walrus-plugin-update-config
```

## 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.1.2 |
| Published | 2019-10-20 |
| First published | 2019-10-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 10.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | wangxingkang |
| Maintainers | wangxingkang, wangxingkang1314 |

## Links

- npm: https://www.npmjs.com/package/@walrus/walrus-plugin-update-config
- Repository: https://github.com/walrus-plus/walrus-plugin-update-config
- Homepage: https://github.com/walrus-plus/walrus-plugin-update-config#readme
- Issues: https://github.com/walrus-plus/walrus-plugin-update-config/issues
- npm.io page: https://npm.io/package/@walrus/walrus-plugin-update-config

## Dependencies (6)

- [@babel/core](https://npm.io/package/@babel/core.md) ^7.6.4
- [@babel/types](https://npm.io/package/@babel/types.md) ^7.6.3
- [@babel/parser](https://npm.io/package/@babel/parser.md) ^7.6.4
- [@walrus/types](https://npm.io/package/@walrus/types.md) ^0.2.1
- [@babel/traverse](https://npm.io/package/@babel/traverse.md) ^7.6.3
- [@walrus/shared-utils](https://npm.io/package/@walrus/shared-utils.md) ^0.2.1

## Recent versions

- 0.1.2 (latest) — 2019-10-20
- 0.1.1 — 2019-10-19
- 0.1.0 — 2019-10-17
- 0.0.1 — 2019-10-16

## README

<p align="center">
  <a href="https://github.com/walrus-plus/walrus">
    <img width="100" src="https://avatars0.githubusercontent.com/u/55735928?s=200&v=4">
  </a>
</p>

<h1 align="center">walrus-plugin-update-config</h1>

<h3 align="center">
转换项目配置文件内容
</h3>

> 插件使用场景: 需要在启动服务时，修改项目配置文件，可配合[umi-plugin-deploy-config](https://github.com/alitajs/umi-plugin-packages/tree/master/packages/umi-plugin-deploy-config)使用

[![NPM version](https://img.shields.io/npm/v/@walrus/walrus-plugin-update-config.svg?style=flat)](https://npmjs.org/package/@walrus/walrus-plugin-update-config)

## 📦 安装

```
// npm
npm install --dev @walrus/cli @walrus/walrus-plugin-update-config

// yarn
yarn add --dev @walrus/cli @walrus/walrus-plugin-update-config

```

## 🔨 使用

项目根目录下添加配置文件

```
// walrus.config.ts

import { IConfig } from '@walrus/types';

const config: IConfig = {
  plugins: [
    ['@walrus/walrus-plugin-update-config, {
      // 配置文件目录
      dir: '',
      // 配置文件名称
      fileName: '',
      // 迭代函数
      iterator: (key, obj) => {
        if (key === 'baseURL') {
          return 'test';
        }
        return obj[key];
      }
    }]
  ]
};
```

`package.json`添加如下代码

```
"scripts": {
  "update-config": "walrus update-config"
}
```

执行 `yarn update-config`

**可运行 `walrus help update-config` 查看帮助信息**

## 📝 配置项

|key|类型|默认值|是否必填|説明|
|---|---|----|-------|---|
|dir|`string`|`process.cwd()`|false|配置文件所在目录|
|fileName|`string`|`config.js`|false|配置文件名称|
|iterator|`function`|--|true|转换处理函数|

## 👷 命令行参数

* '--dir [dir]': 'config file dir (default: process.cwd())'
* '--file-name [name]': 'config file name (default: config.js)'

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