Skip to content

Commit

Permalink
Merge pull request #32 from maddevsio/gh-action
Browse files Browse the repository at this point in the history
Use as actions on github
  • Loading branch information
denisoed authored Mar 31, 2024
2 parents 3b10b33 + b5a90dd commit a49982b
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 28 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/analyzer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: SEO analyzer

on: [push]

jobs:
seo-analyzer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- run: npm i -g seo-analyzer
- run: seo-analyzer -h
40 changes: 32 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,45 @@ seo-analyzer -h
| Option | Args | Description |
| --- | --- | --- |
| -h, --help | null | Show all options. |
| -v, --version | null | Show version. |
| -u, --urls | [array] | Multiple url analysis. |
| -f, --files | [array] | Multiple file analysis. |
| -fl, --folder | [array] | Multiple folder analysis. |
| -iu, --ignoreUrls | [array] | Urls to ignore. |
| -if, --ignoreFiles | [array] | Files to ignore. |
| -ifl, --ignoreFolders | [array] | Folders to ignore. |
| -r, --rules | [array] | Rules to run. By default run all default rules. |
| -v, --version | null | **Display Application Version:** Displays the current version of the application. |
| -iu, --ignoreUrls | [array] | **Exclude Specific URLs from Analysis:** Excludes certain URLs from analysis to avoid processing unwanted web pages. |
| -if, --ignoreFiles | [array] | **Exclude Specific Files from Analysis:** Allows excluding certain files from analysis, preventing their processing. |
| -ifl, --ignoreFolders | [array] | **Exclude Specific Folders from Analysis:** Excludes specified folders from the analysis process, ignoring all files within those folders. |
| -u, --urls | [array] | **Perform SEO Analysis on Specified URLs:** Conducts SEO analysis for specified URLs, checking their compliance with certain SEO criteria. |
| -f, --files | [array] | **Perform SEO Analysis on Specified Files:** Performs SEO analysis on specified files, ensuring their adherence to optimization standards and rules. |
| -fl, --folder | [array] | **Perform SEO Analysis on Specified Folders:** Analyzes all files within specified folders for compliance with SEO rules and recommendations. |
| -r, --rules | [array] | **Apply Specific SEO Rules for Analysis:** Applies specific SEO rules during analysis, allowing the user to customize the inspection process. By default run all default rules. |

#### Example of using multiple url analysis

```sh
seo-analyzer -u https://maddevs.io https://maddevs.io/blog
```

## Use as actions on github

To use SEO analyzer as actions on github, you can create a workflow file in .github/workflows/analyzer.yml with the following content:

```yml
name: SEO analyzer

on: [push]

jobs:
seo-analyzer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- run: npm i -g seo-analyzer
- run: seo-analyzer -u https://maddevs.io
```
In the last step, you can specify the url you want to analyse.
## Installation to project
Install with npm
Expand Down
40 changes: 32 additions & 8 deletions README_RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,45 @@ seo-analyzer -h
| Option | Args | Description |
| --- | --- | --- |
| -h, --help | null | Показать справку. |
| -v, --version | null | Показать версию. |
| -u, --urls | [array] | Список url для анализа. |
| -f, --files | [array] | Список html файлов для анализа. |
| -fl, --folder | [array] | Список папок для анализа. |
| -iu, --ignoreUrls | [array] | Игнорируемые url. |
| -if, --ignoreFiles | [array] | Игнорируемые html файлы. |
| -ifl, --ignoreFolders | [array] | Игнорируемые папки. |
| -r, --rules | [array] | Список правил для анализа. Поумолчанию запускаются все дефолтные правила. |
| -v, --version | null | **Display Application Version:** Выводит информацию о текущей версии программы. |
| -iu, --ignoreUrls | [array] | **Exclude Specific URLs from Analysis:** Исключает определенные URL из анализа для предотвращения обработки нежелательных веб-страниц. |
| -if, --ignoreFiles | [array] | **Exclude Specific Files from Analysis:** Позволяет исключить из анализа определенные файлы, предотвращая их обработку. |
| -ifl, --ignoreFolders | [array] | **Exclude Specific Folders from Analysis:** Исключает указанные папки из процесса анализа, игнорируя все файлы внутри этих папок. |
| -u, --urls | [array] | **Perform SEO Analysis on Specified URLs:** Выполняет SEO-анализ для указанных URL-адресов, проверяя их на соответствие определенным SEO-критериям. |
| -f, --files | [array] | **Perform SEO Analysis on Specified Files:** Производит анализ SEO для указанных файлов, обеспечивая их соответствие стандартам и правилам оптимизации. |
| -fl, --folder | [array] | **Perform SEO Analysis on Specified Folders:** Анализирует все файлы в указанных папках на предмет соответствия SEO-правилам и рекомендациям. |
| -r, --rules | [array] | **Apply Specific SEO Rules for Analysis:** Применяет определенные правила SEO при анализе, позволяя пользователю кастомизировать процесс проверки. Поумолчанию запускаются все дефолтные правила. |

#### Пример использования с множеством url

```sh
seo-analyzer -u https://maddevs.io https://maddevs.io/blog
```

## Используйте как github-action

Чтобы использовать SEO-анализатор как github-action, вам нужно создать файл в папке .github/workflows/analyzer.yml со следующим содержанием:

```yml
name: SEO analyzer

on: [push]

jobs:
seo-analyzer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- run: npm i -g seo-analyzer
- run: seo-analyzer -u https://maddevs.io
```
На последнем шаге вы можете указать url, который хотите проанализировать.
## Установка в проект
Установка с помощью npm
Expand Down
File renamed without changes.
49 changes: 38 additions & 11 deletions bin/index.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,54 @@
#!/usr/bin/env node
const { Command } = require('commander');
const ver = require('./version');
const analyzers = require('./analyzers');
const version = require('./version');
const analyzer = require('./analyzer');

const program = new Command();

program
.option('-v, --version', 'Show version', ver, '')
.option(
'-v, --version',
'Display Application Version: Displays the current version of the application.'
)
// IGNORES
.option('-iu, --ignore-urls <ignoreUrls...>', 'Multiple ignore urls')
.option('-if, --ignore-files <ignoreFiles...>', 'Multiple ignore files')
.option(
'-iu, --ignore-urls <ignoreUrls...>',
'Exclude Specific URLs from Analysis: Excludes certain URLs from analysis to avoid processing unwanted web pages.'
)
.option(
'-if, --ignore-files <ignoreFiles...>',
'Exclude Specific Files from Analysis: Allows excluding certain files from analysis, preventing their processing.'
)
.option(
'-ifl, --ignore-folders <ignoreFolders...>',
'Multiple ignore folders'
'Exclude Specific Folders from Analysis: Excludes specified folders from the analysis process, ignoring all files within those folders.'
)
// INPUTS
.option('-u, --urls <urls...>', 'Multiple url analysis')
.option('-f, --files <files...>', 'Multiple files analysis')
.option('-fl, --folders <folders...>', 'Multiple folders analysis')
.option(
'-u, --urls <urls...>',
'Perform SEO Analysis on Specified URLs: Conducts SEO analysis for specified URLs, checking their compliance with certain SEO criteria.'
)
.option(
'-f, --files <files...>',
'Perform SEO Analysis on Specified Files: Performs SEO analysis on specified files, ensuring their adherence to optimization standards and rules.'
)
.option(
'-fl, --folders <folders...>',
'Perform SEO Analysis on Specified Folders: Analyzes all files within specified folders for compliance with SEO rules and recommendations.'
)
// RULES
.option('-r, --rules <rules...>', 'Multiple rules')
.option(
'-r, --rules <rules...>',
'Apply Specific SEO Rules for Analysis: Applies specific SEO rules during analysis, allowing the user to customize the inspection process.'
)
.parse(process.argv);

const options = program.opts();

analyzers(options);
if (!Object.keys(options).length) {
program.outputHelp();
} else if (options.version) {
version();
} else {
analyzer(options);
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "seo-analyzer",
"version": "3.0.9",
"version": "3.1.1",
"description": "A library for analyze a HTML files to show all of the SEO defects",
"main": "dist/seo-analyzer.js",
"types": "dist/seo-analyzer.d.ts",
Expand Down

0 comments on commit a49982b

Please sign in to comment.