Skip to content

Commit 5c6a63c

Browse files
committed
update docs for npmjs package
1 parent 5a468cf commit 5c6a63c

4 files changed

Lines changed: 32 additions & 15 deletions

File tree

‎README.md‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ each result back to a JSON path and line (`address[0].postcode`, not `_:b3`),
1313
words it from the shape's own descriptions, and ships a CLI and report formats.
1414

1515
**[Documentation site](https://theodi.github.io/data-standard-validator/)** ·
16+
[npm package](https://www.npmjs.com/package/@theodi/data-standard-validator) ·
1617
[CLI reference](docs/cli.md) · [Library API](docs/api.md) ·
1718
[How it works](docs/how-it-works.md) ·
1819
[Web component](https://github.com/theodi/data-standard-validator-component) ·
@@ -23,14 +24,17 @@ words it from the shape's own descriptions, and ships a CLI and report formats.
2324
Requires Node.js 22 or later.
2425

2526
```bash
26-
npm install --save-dev @theodi/data-standard-validator # in a project
27-
npx @theodi/data-standard-validator --help # or run it without installing
27+
npm install --save-dev @theodi/data-standard-validator
28+
npx data-standard-validator --help
2829
```
2930

31+
For one-off use without adding it to a project, run
32+
`npx --yes @theodi/data-standard-validator --help`.
33+
3034
## Example
3135

3236
```bash
33-
npx @theodi/data-standard-validator -s person-shape.ttl person.json
37+
npx --yes @theodi/data-standard-validator -s person-shape.ttl person.json
3438
```
3539

3640
```text
@@ -56,11 +60,11 @@ report as JSON and Markdown.
5660
## Command line
5761

5862
```bash
59-
npx @theodi/data-standard-validator -s shapes.ttl data.json
63+
npx data-standard-validator -s shapes.ttl data.json
6064
```
6165

62-
Once installed in a project, the command is `data-standard-validator`. The exit
63-
code is 0 when every document conforms and 1 when one does not. See
66+
The command is available through `npx` after installation. The exit code is 0
67+
when every document conforms and 1 when one does not. See
6468
the [CLI reference](docs/cli.md) for every option, output format and exit code.
6569

6670
## Library

‎docs/api.md‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
# Library API
22

3+
Install the published package in your project:
4+
5+
```bash
6+
npm install @theodi/data-standard-validator
7+
```
8+
9+
The package is available on [npm](https://www.npmjs.com/package/@theodi/data-standard-validator).
10+
311
```ts
412
import {
513
validate, createValidator, formatReport, groupIssues,
614
} from '@theodi/data-standard-validator'
715
```
816

9-
The package is ESM-only and needs Node.js 22+ or a modern bundler. Node loads
10-
a build that can read file paths. Browsers and bundlers load a build without
11-
any filesystem code. Both have the same API.
17+
The package is ESM-only and needs Node.js 22+ or a modern bundler. Node.js
18+
projects can use the package directly; browser projects can import it through
19+
a bundler. Node loads a build that can read file paths. Browsers and bundlers
20+
load a build without any filesystem code. Both have the same API.
1221

1322
## `validate(options)`: one call
1423

‎docs/cli.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@ data-standard-validator [options] [documents...]
99
## Running it
1010

1111
```bash
12-
npx @theodi/data-standard-validator -s shape.ttl data.json # no install needed
13-
npm install -g @theodi/data-standard-validator # or install globally ...
14-
npm install -D @theodi/data-standard-validator # ... or per project, then run `npx data-standard-validator`
12+
npx --yes @theodi/data-standard-validator -s shape.ttl data.json
13+
npm install -g @theodi/data-standard-validator
14+
npm install --save-dev @theodi/data-standard-validator
1515
```
1616

17+
The first command runs the package without adding it to the project. After a
18+
local installation, run it with `npx data-standard-validator`; after a global
19+
installation, run `data-standard-validator` directly.
20+
1721
Node.js 22 or later is required.
1822

1923
## Arguments and options

‎docs/example.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ And a document, `person.json`, that breaks both rules:
4747
The default, for terminals:
4848

4949
```bash
50-
npx @theodi/data-standard-validator -s person-shape.ttl person.json
50+
npx --yes @theodi/data-standard-validator -s person-shape.ttl person.json
5151
```
5252

5353
```text
@@ -75,7 +75,7 @@ Add `--format json` to get the same report as data, for programs and web
7575
pages. The fields are described in [Report format](report-format.md).
7676

7777
```bash
78-
npx @theodi/data-standard-validator -s person-shape.ttl person.json --format json
78+
npx --yes @theodi/data-standard-validator -s person-shape.ttl person.json --format json
7979
```
8080

8181
```json
@@ -166,7 +166,7 @@ npx @theodi/data-standard-validator -s person-shape.ttl person.json --format jso
166166
Add `--format markdown` for GitHub job summaries and pull request comments:
167167

168168
```bash
169-
npx @theodi/data-standard-validator -s person-shape.ttl person.json --format markdown
169+
npx --yes @theodi/data-standard-validator -s person-shape.ttl person.json --format markdown
170170
```
171171

172172
````markdown

0 commit comments

Comments
 (0)