Skip to content

Commit b8317e8

Browse files
Merge pull request #33 from xarf/fix-npm-postinstall-script
Fix postinstall script not being included in npm package.
2 parents 648adba + 50d1f8a commit b8317e8

4 files changed

Lines changed: 21 additions & 26 deletions

File tree

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ A JavaScript/TypeScript library for parsing, validating, and generating [XARF v4
1919
## Installation
2020

2121
```bash
22-
npm install xarf
22+
npm install @xarf/xarf
2323
```
2424

2525
## Quick Start
2626

2727
### Parsing a Report
2828

2929
```typescript
30-
import { parse } from 'xarf';
30+
import { parse } from '@xarf/xarf';
3131

3232
// Missing first_seen and source_port produce validation errors.
3333
const { report, errors, warnings } = parse({
@@ -64,7 +64,7 @@ if (errors.length === 0) {
6464
### Creating a Report
6565

6666
```typescript
67-
import { createReport, createEvidence } from 'xarf';
67+
import { createReport, createEvidence } from '@xarf/xarf';
6868

6969
// Returns { content_type, payload (base64), hash, size, description }
7070
const evidence = createEvidence('message/rfc822', rawEmailContent, {
@@ -104,7 +104,7 @@ console.log(JSON.stringify(report, null, 2));
104104
Parse and validate a XARF report from JSON. Supports both v4 and v3 (legacy) formats — v3 reports are automatically converted to v4 with deprecation warnings.
105105

106106
```typescript
107-
import { parse } from 'xarf';
107+
import { parse } from '@xarf/xarf';
108108

109109
const { report, errors, warnings, info } = parse(jsonData, options?);
110110
```
@@ -127,7 +127,7 @@ const { report, errors, warnings, info } = parse(jsonData, options?);
127127
Create a validated XARF report with auto-generated metadata. Automatically fills `xarf_version`, `report_id` (UUID), and `timestamp` (ISO 8601) if not provided.
128128
129129
```typescript
130-
import { createReport } from 'xarf';
130+
import { createReport } from '@xarf/xarf';
131131

132132
const { report, errors, warnings } = createReport(input, options?);
133133
```
@@ -150,7 +150,7 @@ const { report, errors, warnings } = createReport(input, options?);
150150
Create an evidence object with automatic base64 encoding, hashing, and size calculation.
151151
152152
```typescript
153-
import { createEvidence } from 'xarf';
153+
import { createEvidence } from '@xarf/xarf';
154154

155155
const evidence = createEvidence(contentType, payload, options?);
156156
```
@@ -169,7 +169,7 @@ const evidence = createEvidence(contentType, payload, options?);
169169
Access schema-derived validation rules and metadata programmatically.
170170
171171
```typescript
172-
import { schemaRegistry } from 'xarf';
172+
import { schemaRegistry } from '@xarf/xarf';
173173

174174
// Get all valid categories
175175
schemaRegistry.getCategories();
@@ -211,7 +211,7 @@ if (info) {
211211
The library automatically detects XARF v3 reports (by the `Version` field) and converts them to v4 during parsing. Converted reports include `legacy_version: '3'` and deprecation warnings.
212212
213213
```typescript
214-
import { parse } from 'xarf';
214+
import { parse } from '@xarf/xarf';
215215

216216
const { report, warnings } = parse(v3Report);
217217

@@ -224,7 +224,7 @@ console.log(report.legacy_version); // '3'
224224
You can also use the low-level utilities directly:
225225
226226
```typescript
227-
import { isXARFv3, convertV3toV4, getV3DeprecationWarning } from 'xarf';
227+
import { isXARFv3, convertV3toV4, getV3DeprecationWarning } from '@xarf/xarf';
228228

229229
if (isXARFv3(jsonData)) {
230230
const warnings: string[] = [];

docs/MIGRATION_V3_TO_V4.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ XARF v4 introduces a category-based architecture that improves upon the v3 forma
99
The library automatically detects and converts v3 reports to v4 format:
1010

1111
```typescript
12-
import { parse } from 'xarf';
12+
import { parse } from '@xarf/xarf';
1313

1414
// v3 report is automatically detected and converted
1515
const { report, warnings } = parse(v3JsonData);
@@ -104,7 +104,7 @@ const { report, warnings } = parse(v3JsonData);
104104
When parsing v3 reports, you'll receive deprecation warnings:
105105

106106
```typescript
107-
import { parse } from 'xarf';
107+
import { parse } from '@xarf/xarf';
108108

109109
const { report, warnings } = parse(v3Report);
110110
// warnings includes:
@@ -121,7 +121,7 @@ const { report, warnings } = parse(v3Report);
121121
Use the library's automatic conversion:
122122

123123
```typescript
124-
import { parse } from 'xarf';
124+
import { parse } from '@xarf/xarf';
125125

126126
function processReport(jsonData: string | Record<string, unknown>) {
127127
const { report } = parse(jsonData);
@@ -140,7 +140,7 @@ function processReport(jsonData: string | Record<string, unknown>) {
140140
Track v3 report usage to plan deprecation:
141141

142142
```typescript
143-
import { parse } from 'xarf';
143+
import { parse } from '@xarf/xarf';
144144

145145
function trackLegacyUsage(jsonData: string | Record<string, unknown>) {
146146
const { report } = parse(jsonData);
@@ -157,7 +157,7 @@ function trackLegacyUsage(jsonData: string | Record<string, unknown>) {
157157
Update your report generators to produce v4 format:
158158

159159
```typescript
160-
import { createReport } from 'xarf';
160+
import { createReport } from '@xarf/xarf';
161161

162162
const { report } = createReport({
163163
category: 'messaging',

package-lock.json

Lines changed: 4 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@
7676
"jest": "^29.7.0",
7777
"lint-staged": "^16.2.7",
7878
"prettier": "^3.7.4",
79-
"tar": "^7.5.2",
8079
"ts-jest": "^29.4.6",
8180
"ts-prune": "^0.10.3",
8281
"typescript": "^5.3.3"
8382
},
8483
"files": [
84+
"scripts",
8585
"dist",
8686
"README.md",
8787
"LICENSE"
@@ -91,6 +91,7 @@
9191
},
9292
"dependencies": {
9393
"ajv": "^8.17.1",
94-
"ajv-formats": "^3.0.1"
94+
"ajv-formats": "^3.0.1",
95+
"tar": "^7.5.2"
9596
}
9697
}

0 commit comments

Comments
 (0)