https://github.com/rubensworks/earl-badge.js
Creates SVG badges for EARL files
https://github.com/rubensworks/earl-badge.js
badge earl hacktoberfest rdf svg tests
Last synced: 2 months ago
JSON representation
Creates SVG badges for EARL files
- Host: GitHub
- URL: https://github.com/rubensworks/earl-badge.js
- Owner: rubensworks
- License: mit
- Created: 2019-10-19T19:32:20.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-16T23:18:27.000Z (about 1 year ago)
- Last Synced: 2024-12-19T02:38:00.990Z (10 months ago)
- Topics: badge, earl, hacktoberfest, rdf, svg, tests
- Language: TypeScript
- Homepage:
- Size: 338 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# EARL-Badge.js
[](https://github.com/rubensworks/earl-badge.js/actions?query=workflow%3ACI)
[](https://coveralls.io/github/rubensworks/earl-badge.js?branch=master)
[](https://www.npmjs.com/package/earl-badge)
This tool creates SVG badges for [EARL](https://www.w3.org/TR/EARL10-Schema/) test reports,
for representing the specification compliance of a certain tool.
These badges represent the percentage of passed tests for a specification's test suite for a given tool.
For example, a badge representing the JSON-LD 1.1 spec compliance could look as follows:

These EARL reports can be generated using a variety of tools in different programming languages,
such as [rdf-test-suite.js](https://github.com/rubensworks/rdf-test-suite.js).
## Installation
### Global
This allows the tool to be used from the CLI.
```bash
$ yarn global add earl-badge
```
or
```bash
$ npm install -g earl-badge
```
### Local
This allows the tool to be used as a library.
```bash
$ yarn add earl-badge
```
or
```bash
$ npm install earl-badge
```
## Usage
This tool can either be used to generate SVG files from command line,
or from code.
### CLI
This tool assumes that you have an [EARL](https://www.w3.org/TR/EARL10-Schema/) test report file for a tool.
Assuming that you have an EARL file at `mytool-earl.ttl`,
where your tool is identified in the EARL file by `http://example.org/mytool`,
and your tool implements the `JSON-LD 1.1` specification,
you can execute this tool as follows:
```
$ earl-badge "JSON-LD 1.1" http://example.org/mytool mytool-earl.ttl
```
This tool supports EARL files in most RDF serializations,
as long as they are supported by [`rdf-parse`](https://github.com/rubensworks/rdf-parse.js).
### Code
The SVG generation can also be called from code as follows:
```javascript
import { BadgeGeneratorEarl } from "earl-badge";
const svgString = await new BadgeGeneratorEarl().createSvgBadge({
filePath: 'mytool-earl.ttl',
specName: 'JSON-LD 1.1',
testSubject: 'http://example.org/mytool',
});
```
## License
This software is written by [Ruben Taelman](http://rubensworks.net/).
This code is released under the [MIT license](http://opensource.org/licenses/MIT).