adstxt-validator 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -19
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# adstxt-validator
|
|
2
2
|
|
|
3
3
|
A comprehensive TypeScript library for parsing, validating, and cross-checking ads.txt files against sellers.json data. This package provides robust validation capabilities with detailed error reporting and optimization features.
|
|
4
4
|
|
|
5
|
-
> **Note**: This package is available on GitHub Packages. For internal use within the adstxt-manager monorepo, the package is also available as `@adstxt-manager/ads-txt-validator`.
|
|
6
|
-
|
|
7
5
|
## Features
|
|
8
6
|
|
|
9
7
|
- **Complete ads.txt parsing**: Parse ads.txt files and extract records and variables
|
|
@@ -17,16 +15,8 @@ A comprehensive TypeScript library for parsing, validating, and cross-checking a
|
|
|
17
15
|
|
|
18
16
|
## Installation
|
|
19
17
|
|
|
20
|
-
### From GitHub Packages
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npm install @miyaichi/ads-txt-validator
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### From internal monorepo
|
|
27
|
-
|
|
28
18
|
```bash
|
|
29
|
-
npm install
|
|
19
|
+
npm install adstxt-validator
|
|
30
20
|
```
|
|
31
21
|
|
|
32
22
|
## Quick Start
|
|
@@ -34,7 +24,7 @@ npm install @adstxt-manager/ads-txt-validator
|
|
|
34
24
|
### Basic Usage
|
|
35
25
|
|
|
36
26
|
```typescript
|
|
37
|
-
import { parseAdsTxtContent, crossCheckAdsTxtRecords } from '
|
|
27
|
+
import { parseAdsTxtContent, crossCheckAdsTxtRecords } from 'adstxt-validator';
|
|
38
28
|
|
|
39
29
|
// Parse ads.txt content
|
|
40
30
|
const adsTxtContent = `
|
|
@@ -68,7 +58,7 @@ import {
|
|
|
68
58
|
parseAdsTxtContent,
|
|
69
59
|
crossCheckAdsTxtRecords,
|
|
70
60
|
SellersJsonProvider,
|
|
71
|
-
} from '
|
|
61
|
+
} from 'adstxt-validator';
|
|
72
62
|
|
|
73
63
|
// Create optimized provider
|
|
74
64
|
const sellersJsonProvider: SellersJsonProvider = {
|
|
@@ -517,7 +507,7 @@ The package uses comprehensive error keys for different validation scenarios:
|
|
|
517
507
|
### Basic Parsing
|
|
518
508
|
|
|
519
509
|
```typescript
|
|
520
|
-
import { parseAdsTxtContent } from '
|
|
510
|
+
import { parseAdsTxtContent } from 'adstxt-validator';
|
|
521
511
|
|
|
522
512
|
const adsTxtContent = `
|
|
523
513
|
# Ads.txt file
|
|
@@ -538,7 +528,7 @@ console.log(`Found ${validRecords.length} valid records`);
|
|
|
538
528
|
### Cross-checking with Sellers.json
|
|
539
529
|
|
|
540
530
|
```typescript
|
|
541
|
-
import { crossCheckAdsTxtRecords, parseAdsTxtContent } from '
|
|
531
|
+
import { crossCheckAdsTxtRecords, parseAdsTxtContent } from 'adstxt-validator';
|
|
542
532
|
|
|
543
533
|
const getSellersJson = async (domain: string) => {
|
|
544
534
|
try {
|
|
@@ -574,7 +564,7 @@ validatedEntries.forEach((entry) => {
|
|
|
574
564
|
When using this package as an external library, you can configure the base URL for help links:
|
|
575
565
|
|
|
576
566
|
```typescript
|
|
577
|
-
import { configureMessages, createValidationMessage } from '
|
|
567
|
+
import { configureMessages, createValidationMessage } from 'adstxt-validator';
|
|
578
568
|
|
|
579
569
|
// Configure the message system with your application's base URL
|
|
580
570
|
configureMessages({
|
|
@@ -743,7 +733,7 @@ For static HTML applications, you can implement fragment-based navigation:
|
|
|
743
733
|
### Content Optimization
|
|
744
734
|
|
|
745
735
|
```typescript
|
|
746
|
-
import { optimizeAdsTxt } from '
|
|
736
|
+
import { optimizeAdsTxt } from 'adstxt-validator';
|
|
747
737
|
|
|
748
738
|
const messyAdsTxtContent = `
|
|
749
739
|
# Ads.txt file
|
|
@@ -762,7 +752,7 @@ console.log(optimizedContent);
|
|
|
762
752
|
### Error Handling
|
|
763
753
|
|
|
764
754
|
```typescript
|
|
765
|
-
import { parseAdsTxtContent, isAdsTxtRecord } from '
|
|
755
|
+
import { parseAdsTxtContent, isAdsTxtRecord } from 'adstxt-validator';
|
|
766
756
|
|
|
767
757
|
const parsedEntries = parseAdsTxtContent(adsTxtContent);
|
|
768
758
|
|
package/package.json
CHANGED