# bam-auto-tool

> Bamboodiary Utility Auto Tool Plugin.

Latest version **0.0.6** (published 2021-08-23) · 0 weekly downloads

## Install

```sh
npm install bam-auto-tool
pnpm add bam-auto-tool
yarn add bam-auto-tool
bun add bam-auto-tool
```

## 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.6 |
| Published | 2021-08-23 |
| First published | 2021-06-20 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 24 |
| Unpacked size | 62.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | willy874 |
| Keywords | bamboo, bamboodiary |

## Links

- npm: https://www.npmjs.com/package/bam-auto-tool
- npm.io page: https://npm.io/package/bam-auto-tool

## Dependencies (24)

- [uuid](https://npm.io/package/uuid.md) ^8.3.2
- [dayjs](https://npm.io/package/dayjs.md) ^1.10.4
- [mysql](https://npm.io/package/mysql.md) ^2.18.1
- [colors](https://npm.io/package/colors.md) ^1.4.0
- [dotenv](https://npm.io/package/dotenv.md) ^8.2.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [parse5](https://npm.io/package/parse5.md) ^6.0.1
- [rollup](https://npm.io/package/rollup.md) ^2.45.2
- [postcss](https://npm.io/package/postcss.md) ^8.3.0
- [webpack](https://npm.io/package/webpack.md) ^4.46.0
- [prettier](https://npm.io/package/prettier.md) 2.2.1
- [css-loader](https://npm.io/package/css-loader.md) ^5.2.6
- [raw-loader](https://npm.io/package/raw-loader.md) ^4.0.2
- [webpack-cli](https://npm.io/package/webpack-cli.md) ^4.7.2
- [style-loader](https://npm.io/package/style-loader.md) ^2.0.0
- [postcss-loader](https://npm.io/package/postcss-loader.md) ^4.3.0
- [@rollup/plugin-json](https://npm.io/package/@rollup/plugin-json.md) ^4.1.0
- [bam-utility-plugins](https://npm.io/package/bam-utility-plugins.md) ^0.1.6
- [@rollup/plugin-alias](https://npm.io/package/@rollup/plugin-alias.md) ^3.1.2
- [rollup-plugin-cleaner](https://npm.io/package/rollup-plugin-cleaner.md) ^1.0.0
- [rollup-plugin-postcss](https://npm.io/package/rollup-plugin-postcss.md) ^4.0.0
- [terser-webpack-plugin](https://npm.io/package/terser-webpack-plugin.md) ^4.2.3
- [rollup-plugin-commonjs](https://npm.io/package/rollup-plugin-commonjs.md) ^10.1.0
- [rollup-plugin-node-resolve](https://npm.io/package/rollup-plugin-node-resolve.md) ^5.2.0

## Recent versions

- 0.0.6 (latest) — 2021-08-23
- 0.0.5 — 2021-08-22
- 0.0.4 — 2021-06-20

## README

# BAM AUTO TOOL

本工具協助專案運行，產生各種專案所需的相應檔案。

## 使用方式

1. 在 root 建立 `tool.config.js`
2. 對應的工具建立對應的物件名稱，將其 config 寫入。
3. 在 `package.json` 的 `scripts` 加入指令執行 `node tool.config.js`。

```js
require('bam-auto-tool')({
  index: {},
  svg: {},
  model: {},
})
```

```json
package.json
{
  "scripts": {
    "tool": "node tool.config.js"
  }
}
```

## Create Index

該工具用來建立資料夾的索引檔，可以選擇使用 ESM 或是 CJS，預設採用 ESM 模式。

### 設定建立範例

```js
// tool.config.js
const indexConfig = {
  input: [
    'folder/filenA',
    {
      path: 'filenB',
      fileNameHandler: filename => {
        return rename(filename)
      },
    },
  ],
  output: {
    type: 'cjs',
  },
}
```

### input API

| name            | type                    | default                 | description                               |
| --------------- | ----------------------- | ----------------------- | ----------------------------------------- |
| input           | Object , Array , String | undefined               | input path or input setting.              |
| output          | Object , Array , String | undefined               | output setting.                           |
| path            | String                  | \`${root}\`             | if input not string, index folder folder. |
| type            | String                  | 'esm'                   | file type,support cjs & esm.              |
| prefix          | String                  | ''                      | file ouput name, prefix text.             |
| suffix          | String                  | ''                      | file ouput name, suffix text.             |
| filename        | String                  | index.js                | index file name.                          |
| fileNameHandler | Function                | (f) => ConverBigHump(f) | file ouput name,fix rule.                 |

### 規則

- 當 input、output 的設定衝突時，以 input 的設定優先。
- path 會自動加上 root，以 cmd 指令的位置為準。
- filename 只能在 output 使用

### 指令

```bash
$ npm run tool index
```

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