Skip to content

Commit

Permalink
feat: --fields 'title=$("title").text()'
Browse files Browse the repository at this point in the history
  • Loading branch information
popstas committed Aug 16, 2020
1 parent 9bfb201 commit 5b130d0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,16 @@ Options:


## Custom fields

### Linux/Mac:
``` bash
site-audit-seo -d 1 -u https://example -f '{ "title": "$(`title`).text()" }'
site-audit-seo -d 1 -u https://example -f 'title=$("title").text()' -f 'h1=$("h1").text()'
```
You should pass JSON.

Single quotes `'` should be replaced to `

### Windows:
``` bash
site-audit-seo -d 1 -u https://example -f title=$('title').text() -f h1=$('h1').text()
```

## Remove fields from results
This will output fields from `seo` preset excluding canonical fields:
Expand Down Expand Up @@ -205,11 +208,8 @@ sudo chown -R $USER:$USER "$(npm prefix -g)/lib/node_modules/site-audit-seo/node
## Кастомные поля
Можно передать дополнительные поля так:
``` bash
site-audit-seo -d 1 -u https://example -f '{ "title": "$(`title`).text()" }'
site-audit-seo -d 1 -u https://example -f "title=$('title').text()" -f "h1=$('h1').text()"
```
Надо передавать JSON.

Одинарные кавычки `'` в команде надо менять на `

## Прогнать каждую страницу по Lighthouse
``` bash
Expand Down
8 changes: 5 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const saveAsXlsx = require('./save-as-xlsx');
const { exec } = require('child_process');
const os = require('os');

const fieldsCustom = {};

const list = val => {
return val ? val.split(',') : [];
}
Expand Down Expand Up @@ -43,8 +45,8 @@ program
.option('-d, --max-depth <depth>', 'Max scan depth', 10)
.option('-c, --concurrency <threads>', 'Threads number', 2)
.option('--lighthouse', 'Do lighthouse')
.option('--delay <ms>', 'Delay between requests', 0)
.option('-f, --fields <json>', 'JSON with custom fields', JSON.parse)
.option('--delay <ms>', 'Delay between requests', parseInt, 0)
.option('-f, --fields <json>', 'Field in format --field \'title=$("title").text()\'', fieldsCustomCollect, [])
.option('--no-skip-static', `Scan static files`)
.option('--no-limit-domain', `Scan not only current domain`)
.option('--docs-extensions', `Comma-separated extensions that will be add to table, default:doc,docx,xls,xlsx,ppt,pptx,pdf,rar,zip`, list)
Expand Down Expand Up @@ -184,7 +186,7 @@ async function start() {
outDir: program.outDir, // папка, куда сохраняются csv
color: program.color, // раскрашивать консоль
openFile: program.openFile, // открыть файл после сканирования
fields: program.fields, // дополнительные поля
fields: program.fields, // дополнительные поля, --fields 'title=$("title").text()'
removeCsv: program.removeCsv, // удалять csv после генерации xlsx
consoleValidate: program.consoleValidate, // выводить данные валидации в консоль
obeyRobotsTxt: !program.ignoreRobotsTxt, // не учитывать блокировки в robots.txt
Expand Down

0 comments on commit 5b130d0

Please sign in to comment.