Skip to content

Commit

Permalink
Introducing license-report-config.json (#1716)
Browse files Browse the repository at this point in the history
* Added info to `catalog.json`

* Added license-report-config.json with test

* Enable auto-suggestions

* Removed `additionalItems` for the strict mode

* Full schema test case

* Typo fixed
  • Loading branch information
pubmikeb authored Jul 8, 2021
1 parent 85eedf1 commit 7de307d
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/api/json/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -1518,6 +1518,14 @@
],
"url": "https://json.schemastore.org/libman.json"
},
{
"name": "license-report-config.json",
"description": "JSON schema for license report tool configuration file",
"fileMatch": [
"license-report-config.json"
],
"url": "https://json.schemastore.org/license-report-config.json"
},
{
"name": "local.settings.json",
"description": "JSON schema for Azure Functions local.settings.json files",
Expand Down
110 changes: 110 additions & 0 deletions src/schemas/json/license-report-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "JSON schema for license report tool configuration file",
"properties": {
"output": {
"default": "json",
"description": "license report output format",
"enum": [
"json",
"table",
"csv",
"html"
],
"type": "string"
},
"html": {
"type": "object",
"description": "HTML output format",
"properties": {
"cssFile": {
"default": "path.resolve(__dirname, '..', 'defaultHtmlStyle.css')",
"type": "string"
},
"tableify": {
"description": "passed directly to tableify (see: https://github.com/kessler/node-tableify)",
"type": "object"
}
}
},
"delimiter": {
"default": ",",
"description": "CSV output format",
"type": "string"
},
"escapeCsvFields": {
"default": "false",
"description": "CSV output format: escape fields containing delimiter character",
"type": "boolean"
},
"only": {
"default": "null",
"description": "export deps. or deps/dev-/opt-/peer- deps. falsey -> output everything",
"type": "object"
},
"registry": {
"default": "https://registry.npmjs.org/",
"description": "NPM registry URL",
"type": "string"
},
"exclude": {
"description": "package names that will be excluded from the report",
"items": {
"type": "string"
},
"type": "array"
},
"fields": {
"description": "fields participating in the report and their order",
"items": {
"enum": [
"department",
"relatedTo",
"name",
"licensePeriod",
"material",
"licenseType",
"link",
"remoteVersion",
"installedVersion",
"author"
],
"type": "string"
},
"type": "array"
},
"comment": {
"description": "export deps. or deps/dev-/opt-/peer- deps. falsey -> output everything",
"properties": {
"label": {
"type": "string",
"default": "comment"
},
"value": {
"type": "string",
"default": ""
}
},
"type": "object"
},
"httpRetryOptions": {
"properties": {
"delay": {
"type": "number",
"default": 1000
},
"maxAttempts": {
"type": "number",
"default": 5
}
},
"type": "object"
},
"package": {
"description": "path to the package.json",
"default": "./package.json",
"type": "string"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"fields": [
"name",
"installedVersion",
"author",
"licenseType"
],
"output": "json"
}
28 changes: 28 additions & 0 deletions src/test/license-report-config/full-license-report-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"comment": {
"label": "comment",
"value": "Test comment"
},
"delimiter": ",",
"fields": [
"name",
"installedVersion",
"author",
"licenseType"
],
"escapeCsvFields": true,
"exclude": [
""
],
"html": {
"cssFile": "path.resolve(__dirname, '..', 'defaultHtmlStyle.css')",
"tableify": {}
},
"httpRetryOptions": {
"delay": 1000,
"maxAttempts": 5
},
"output": "json",
"package": "./package.json",
"registry": "https://registry.npmjs.org/"
}

0 comments on commit 7de307d

Please sign in to comment.