Skip to content

Commit 76bc1ce

Browse files
committed
Adds spdx license checker via feedback for #472 (comment)
1 parent ce102ca commit 76bc1ce

File tree

5 files changed

+21
-4
lines changed

5 files changed

+21
-4
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"postcss": "^8.1.10",
4040
"postcss-cli": "^8.3.0",
4141
"postcss-import": "^13.0.0",
42+
"spdx-correct": "^3.1.1",
4243
"tailwindcss": "^2.0.1"
4344
},
4445
"devDependencies": {

src/11ty/normalizeLicense.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const correct = require("spdx-correct");
2+
3+
module.exports = function(license, title) {
4+
let correctedLicenseName = correct(license);
5+
if(correctedLicenseName) {
6+
return correctedLicenseName;
7+
}
8+
console.log( `WARN Invalid license name for ${title}:`, license );
9+
return license;
10+
};

src/site/generators/expansive.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ language:
77
- Ejscript
88
license:
99
- GPL-2.0-only
10-
- Commercial
10+
- Embedthis Commercial
1111
templates:
1212
- Ejscript
1313
description: Expansive is a static site generator. It is written in Ejscript, and is blazing fast.
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1+
const correctLicense = require("../../11ty/normalizeLicense");
2+
13
module.exports = {
24
layout: "layouts/tool.njk",
3-
tags: ["generators"]
5+
tags: ["generators"],
6+
eleventyComputed: {
7+
license: (data) => {
8+
return (data.license || []).map(license => correctLicense(license, data.title));
9+
}
10+
}
411
}

src/site/generators/statamic.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ repo: statamic/ssg
55
twitter: statamic
66
language:
77
- PHP
8-
license:
9-
- Custom
8+
license: []
109
templates:
1110
- Antlers
1211
- HTML

0 commit comments

Comments
 (0)