# auto-add-tags

> Obtain AST by reading vue and react source code, and then dynamically add tags

Latest version **0.0.4** (published 2021-06-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install auto-add-tags
pnpm add auto-add-tags
yarn add auto-add-tags
bun add auto-add-tags
```

Provides the commands `aat`, `auto-add-tags`.

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2021-06-29 |
| First published | 2021-02-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 131.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | yuexing |
| Maintainers | yuexing0921 |
| Keywords | AST, vue, react |

## Links

- npm: https://www.npmjs.com/package/auto-add-tags
- Repository: https://github.com/yuexing0921/auto-add-tags
- Homepage: https://github.com/yuexing0921/auto-add-tags#readme
- Issues: https://github.com/yuexing0921/auto-add-tags/issues
- npm.io page: https://npm.io/package/auto-add-tags

## Dependencies (8)

- [glob](https://npm.io/package/glob.md) ^7.1.6
- [chalk](https://npm.io/package/chalk.md) ^4.1.0
- [yargs](https://npm.io/package/yargs.md) ^16.2.0
- [fs-extra](https://npm.io/package/fs-extra.md) ^9.0.1
- [prettier](https://npm.io/package/prettier.md) ^2.2.1
- [jscodeshift](https://npm.io/package/jscodeshift.md) ^0.11.0
- [@vue/compiler-dom](https://npm.io/package/@vue/compiler-dom.md) ^3.0.5
- [@vue/compiler-core](https://npm.io/package/@vue/compiler-core.md) ^3.0.7

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.4 (latest) — 2021-06-29
- 0.0.3 — 2021-03-25
- 0.0.2 — 2021-03-15
- 0.0.1 — 2021-02-01

## README

# 说明
通过读取react、vue源码，获取AST，然后通过一定的规则动态的添加data标签，项目的初衷是为了标识埋点而创建
## 功能
1. 自动对代码进行埋点
2. check是否有重复埋点

## 快速使用

通过命令行的方式
``` bash
## 在项目的根目录下输入aat，默认类型是react代码
aat
## 如果是vue项目
aat -t vue 
```

通过代码的方式方式调用
``` javascript 
const addTags = require("auto-add-tags")
// 默认react代码
addTags.main()
// 如果是vue项目
addTags.main({type: "vue"})
```

如果需要更高级别的定制，可以参考下面的选项
## Reference
###  -d, --dir 
The directory or file to be converted, the default is the current src directory 

[string] [default: "src"]

###  -t, --type 
The supported type is react by default, and you can also enter vue|react

[string] [default: "react"]

###  --tagName
Automatically insert tags, the default value is data-xt

[string] [default: "data-xt"]

###  --min
The starting value of automatically adding tags, the default value is 0

[number] [default: 0]
###  --max
The maximum value of automatically added tags, the default value is Number.MAX_SAFE_INTEGER

[number] [default: 9007199254740991]

###   -f, --force
force updates                       

[boolean] [default: false]
###  -e, --elementNames
 Which components need to be tracked? not case sensitive，the default value is [link,a,route]  -e link a route 
 
[array] [default: ["a","link","route"]]
###  --eventNames
What events need to be tracked? not case sensitive。 the default value is [onclick,onsubmit]  --eventNames onclick onsubmit 
[array] [default: ["click", "submit", "change"]]

###   -c, --check 
Check if there are duplicate tags

[boolean] [default: false]
###  -r, --resultFile
Insert point record   
[string] [default: "tracePoint.json"]

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