Parses machine-interpretable Debian Copyright files (.dep5
) into object files.
This can be valuable when extracting License and Copyright statements from the configuration file.
- Easy to use
- Parsing of Debian Copyright files into objects
import { DebianCopyright } from "@dev-build-deploy/dep5-it";
// Parse a .dep5 file
const dep5 = DebianCopyright.fromFile(".reuse/dep5");
// Show the results
console.log(JSON.stringify(dep5, null, 2));
Example output
{
"header": {
"format": "https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/",
"upstreamName": "dep5-it",
"upstreamContact": [
"Kevin de Jong <monkaii@hotmail.com>"
],
"source": "https://github.com/dev-build-deploy/dep5-it"
},
"files": [
{
"files": [
"test/fixtures/*"
],
"copyright": "2023 Kevin de Jong <monkaii@hotmail.com>",
"license": "MIT"
},
{
"files": [
"tsconfig*.json"
],
"copyright": "2023 Kevin de Jong <monkaii@hotmail.com>",
"license": "CC0-1.0"
},
{
"files": [
"package*.json"
],
"copyright": "2023 Kevin de Jong <monkaii@hotmail.com>",
"license": "CC0-1.0"
}
]
}
You can filter on the file stanza associated with the given file name:
import { DebianCopyright } from "@dev-build-deploy/dep5-it";
// Parse a .dep5 file
const dep5 = DebianCopyright.fromFile(".reuse/dep5");
// Retrieve specific File Stanza
const fileStanza = dep5.getFileStanza("test/fixtures/basic-file.dep5.fixture");
console.log(JSON.stringify(fileStanza, null, 2));
Example output
{
"files": [
"test/fixtures/*"
],
"copyright": "2023 Kevin de Jong <monkaii@hotmail.com>",
"license": "MIT"
}
If you have suggestions for how dep5-it
could be improved, or want to report a bug, open an issue! We'd love all and any contributions.
For more, check out the Contributing Guide.
- MIT © 2023 Kevin de Jong <monkaii@hotmail.com>