From 48600cbd5c7b31fe8a78f98390844b626c9b35f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Grzegorczyk?= Date: Mon, 31 Jul 2023 07:59:05 +0200 Subject: [PATCH] Closes #56 Unify frontend and backend checker for licenses. --- .github/workflows/lint-and-test-frontend.yml | 2 +- backend/allowed-licenses.json | 10 ++++++++++ frontend/allowed-licenses.txt | 1 + frontend/licenses-exclude-packages.txt | 1 + frontend/package.json | 3 ++- frontend/scripts/windows_check_licenses.bat | 4 ++++ 6 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 frontend/allowed-licenses.txt create mode 100644 frontend/licenses-exclude-packages.txt create mode 100644 frontend/scripts/windows_check_licenses.bat diff --git a/.github/workflows/lint-and-test-frontend.yml b/.github/workflows/lint-and-test-frontend.yml index e253757..cedfb26 100644 --- a/.github/workflows/lint-and-test-frontend.yml +++ b/.github/workflows/lint-and-test-frontend.yml @@ -35,7 +35,7 @@ jobs: - name: Check licenses working-directory: ./frontend - run: npm run license-checker + run: npm run license-checker-linux - name: Lint working-directory: ./frontend diff --git a/backend/allowed-licenses.json b/backend/allowed-licenses.json index 4fb62c8..62c8290 100644 --- a/backend/allowed-licenses.json +++ b/backend/allowed-licenses.json @@ -1,5 +1,15 @@ [ "MIT", + "ISC", + "Apache-2.0", + "BSD-3-Clause", + "BSD-2-Clause", + "CC0-1.0", + "0BSD", + "Python-2.0", + "MPL-2.0", + "CC-BY-4.0", + "CC-BY-3.0", "EULA.md", "PostgreSQL" ] diff --git a/frontend/allowed-licenses.txt b/frontend/allowed-licenses.txt new file mode 100644 index 0000000..1da8cb8 --- /dev/null +++ b/frontend/allowed-licenses.txt @@ -0,0 +1 @@ +MIT;ISC;Apache-2.0;BSD-3-Clause;BSD-2-Clause;CC0-1.0;0BSD;Python-2.0;MPL-2.0;CC-BY-4.0;CC-BY-3.0;"EULA.md";"PostgreSQL" diff --git a/frontend/licenses-exclude-packages.txt b/frontend/licenses-exclude-packages.txt new file mode 100644 index 0000000..553df0b --- /dev/null +++ b/frontend/licenses-exclude-packages.txt @@ -0,0 +1 @@ +ksummarized@0.1.0 diff --git a/frontend/package.json b/frontend/package.json index edce638..81e0eb7 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,7 +10,8 @@ "format": "prettier --write .", "test": "vitest", "coverage": "vitest run --coverage", - "license-checker": "license-checker --excludePackage \"ksummarized@0.1.0\" --summary --onlyAllow \"MIT;ISC;Apache-2.0;BSD-3-Clause;BSD-2-Clause;CC0-1.0;0BSD;Python-2.0;MPL-2.0;CC-BY-4.0;CC-BY-3.0\"" + "license-checker-linux": "license-checker --excludePackage $(cat licenses-exclude-packages.txt) --summary --onlyAllow $(cat allowed-licenses.txt)", + "license-checker-windows": "cd scripts && windows_check_licenses.bat" }, "dependencies": { "@emotion/react": "^11.10.5", diff --git a/frontend/scripts/windows_check_licenses.bat b/frontend/scripts/windows_check_licenses.bat new file mode 100644 index 0000000..0b4dba1 --- /dev/null +++ b/frontend/scripts/windows_check_licenses.bat @@ -0,0 +1,4 @@ +cd .. &&^ +for /f "usebackq tokens=*" %%a in (`type allowed-licenses.txt`) do echo %%a &&^ +for /f "usebackq tokens=*" %%b in (`type licenses-exclude-packages.txt`) do echo %%b &&^ +license-checker --excludePackage %%b --summary --onlyAllow %%a