# tea-detector

> Simple SEO detecting cli tool which allows customized rules.

Latest version **1.0.4** (published 2018-10-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install tea-detector
pnpm add tea-detector
yarn add tea-detector
bun add tea-detector
```

Provides the command `tea-detect`.

## 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.4 |
| Published | 2018-10-24 |
| First published | 2018-10-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.14.4 |
| Dependencies | 4 |
| Unpacked size | 16.2 KB |
| Known vulnerabilities | 0 (+24 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | tea lin |
| Maintainers | tea-lin |

## Links

- npm: https://www.npmjs.com/package/tea-detector
- Repository: https://github.com/bestteadahan/seo_detector
- Homepage: https://github.com/bestteadahan/seo_detector#readme
- Issues: https://github.com/bestteadahan/seo_detector/issues
- npm.io page: https://npm.io/package/tea-detector

## Dependencies (4)

- [axios](https://npm.io/package/axios.md) ^0.18.0
- [is-url](https://npm.io/package/is-url.md) ^1.2.4
- [commander](https://npm.io/package/commander.md) ^2.19.0
- [node-html-parser](https://npm.io/package/node-html-parser.md) ^1.1.10

## Recent versions

- 1.0.4 (latest) — 2018-10-24
- 1.0.3 — 2018-10-24
- 1.0.2 — 2018-10-24
- 1.0.1 — 2018-10-24
- 1.0.0 — 2018-10-23

## README

# Simple SEO detector cli tool
![Travis CI](https://travis-ci.org/bestteadahan/seo_detector.svg?branch=master)

## Installation
**NOTE!** Add "--global" flag to ensure cli working well
```
$ npm install tea-detector --global
```

## Usage

### 1. Get Help
```
$ tea-detect -h

Options:
  -V, --version           output the version number
  -f, --file [name|path]  The input file path(ex: demo.html)
  -u, --url [addr]        The url source (ex: http://www.demo.com)
  -o, --output [name]     The output file name (ex: result.txt)
  -c, --conf              Using custom rules: myrules.json
  -r, --rules [rule_no,...]    The number of rule that applied to detector, seperate by ","
  -h, --help              output usage information
```

### 2. Detect File/URL By Using Default Rules
```
// Read from file(s)
$ tea-detect -f file1[,file2...]

// Read from url(s)
$ tea-detect -u url1[,url2...]
```

### 3. Detect By Using Specific Rules
```
// Only use rule no. 1,3 and 5
$ tea-detect -f file.html -r 1,3,5
```

### 4. Default Rules
Please check `lib/seorule_conf_default.json` in this repository.
5 Default Rules Below:
1. Detect if any \<img> tag without alt attribute
2. Detect if any \<a> tag without rel attribute
3. In \<head> tag
    + Detect if header doesn’t have \<title> tag
    + Detect if header doesn’t have \<meta name=“descriptions” ... /> tag
    + Detect if header doesn’t have \<meta name=“keywords” ... /> tag
4. Detect if there’re more than 15 \<strong> tag in HTML
5. Detect if a HTML have more than one \<h1> tag

### 5. Custom Your Rule
Please create a JSON file named `myrules.json` in your project root.
Format:
+ Json array
+ Each element defines a SEO detect rule.
+ Keys in rule level (all required):
    + "no": \<string> Rule number
    + "region": \<string> The document area to be detected
    + "conditions": \<Array> The rule's conditions
+ Keys in condition level:
    + "tag": \<string> Tag name (required)
    + "attr": \<string> Tag attribute
    + "val": \<string> The attribute's value (only enabled while "attr" key is exist)
    + "length": \<number> The max. tag number (detected if there are more tags than this)

Example:
```
[
    {
        "no": "1",
        "region": "body",
        "conditions": [
            {
                "tag": "img",
                "attr": "alt"
            }
        ]
    },
    ...
]
```

### 6. Test Your Custom Rules Before Detect
**Remind:** Please make sure [mocha.js](https://mochajs.org/) has been installed in your env

+ copy `test/rule.spec.js` to your project
+ Modify your `package.json` as:
```
...
"scripts": {
    "test": "mocha test/rule.spec.js"
},
...
```
+ Run `npm test` in console
+ If everything looks ok, then run `tea-detect -f file.html -c`

###

### 7. Save Detection Result
You can save all the results into file
```
$ tea-detect -f file.html -o log.txt
```
(note) It will also create an error log automatically.

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