Generate thirdparty list

This commit is contained in:
AkiraFukushima 2023-05-10 01:01:01 +09:00
parent 2b94fa66d6
commit 350246bf76
No known key found for this signature in database
GPG Key ID: B6E51BAC4DE1A957
5 changed files with 66 additions and 2 deletions

34
.github/workflows/thirdparty.yml vendored Normal file
View File

@ -0,0 +1,34 @@
name: Thirdparty
on:
schedule:
- cron: '54 10 * * *'
permissions:
contents: write
pull-requests: write
jobs:
update:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions/checkout@v2
- name: Install packages
run: |
yarn install
npm install -g license-checker
- name: Check
run: |
yarn run thirdparty
- uses: peter-evans/create-pull-request@v4
with:
commit-message: "[Auto update] Thirdparty libraries list"
branch: auto-update/thirdparty
base: master
delete-branch: true
title: "[Auto update] Thirdparty libraries list"

3
.gitignore vendored
View File

@ -11,4 +11,5 @@ thumbs.db
packages/*
!.gitkeep
*.db
*.provisionprofile
*.provisionprofile
/thirdparty.json

View File

@ -35,7 +35,8 @@
"pack:renderer": "webpack --node-env=production --mode production --progress --config .electron-vue/webpack.renderer.config.js",
"typecheck": "tsc -p . --noEmit",
"spec": "NODE_ENV=test jest -u --maxWorkers=3",
"postinstall": "electron-builder install-app-deps"
"postinstall": "electron-builder install-app-deps",
"thirdparty": "license-checker --production --json > thirdparty.json && node scripts/thirdparty.js"
},
"jest": {
"moduleFileExtensions": [

27
scripts/thirdparty.js Normal file
View File

@ -0,0 +1,27 @@
const path = require('path')
const fs = require('fs')
const npmPath = path.join(__dirname, '../thirdparty.json')
const outPath = path.join(__dirname, '../', 'src', 'config', 'thirdparty.json')
const npmData = JSON.parse(fs.readFileSync(npmPath))
let npm = Object.keys(npmData).map(k => {
let r = {
package_name: k,
license: npmData[k].licenses
}
if (npmData[k].publisher) {
r = Object.assign(r, {
publisher: npmData[k].publisher
})
}
if (npmData[k].repository) {
r = Object.assign(r, {
repository: npmData[k].repository
})
}
return r
})
fs.writeFileSync(outPath, JSON.stringify(npm))

File diff suppressed because one or more lines are too long