Skip to content

Commit

Permalink
Auto-generate third-party license notices (#370)
Browse files Browse the repository at this point in the history
Closes #294
Closes #371
  • Loading branch information
Keavon committed Sep 6, 2021
1 parent 208e4bb commit fc7d3aa
Show file tree
Hide file tree
Showing 8 changed files with 306 additions and 14 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ jobs:
strategy:
matrix:
checks:
- 'security advisories'
- 'banned licenses and crates'
- 'crate security advisories'
- 'crate license compatibility'

# Prevent sudden announcement of a new advisory from failing ci:
continue-on-error: ${{ matrix.checks == 'security advisories' }}
continue-on-error: ${{ matrix.checks == 'crate security advisories' }}

steps:
- uses: actions/checkout@v2

- uses: EmbarkStudios/cargo-deny-action@v1
if: matrix.checks == 'security advisories'
if: matrix.checks == 'crate security advisories'
with:
command: check advisories

- uses: EmbarkStudios/cargo-deny-action@v1
if: matrix.checks == 'banned licenses and crates'
if: matrix.checks == 'crate license compatibility'
with:
command: check bans licenses sources
21 changes: 21 additions & 0 deletions about.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Be careful to prevent auto-formatting from breaking this file's indentation
// Replace this file with JSON output once this is resolved: https://github.com/EmbarkStudios/cargo-about/issues/73

module.exports = [
{{#each licenses}}
{
licenseName: `{{name}}`,
licenseText: `{{text}}`,
packages: [
{{#each used_by}}
{
name: `{{crate.name}}`,
version: `{{crate.version}}`,
author: `{{crate.authors}}`,
repository: `{{crate.repository}}`,
},
{{/each}}
],
},
{{/each}}
];
6 changes: 6 additions & 0 deletions about.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accepted = [
"Apache-2.0",
"MIT",
]
ignore-build-dependencies = true
ignore-dev-dependencies = true
1 change: 1 addition & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
dist/
wasm/pkg/
rust-licenses.js
134 changes: 134 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"description": "Graphite's web app frontend. Planned to be replaced by a native GUI written in Rust in the future.",
"private": true,
"scripts": {
"serve": "vue-cli-service serve || npm install && vue-cli-service serve",
"build": "vue-cli-service build || npm install && vue-cli-service build",
"serve": "vue-cli-service serve || (npm install && vue-cli-service serve)",
"build": "cd .. && cargo install cargo-about && cargo about generate about.hbs > frontend/rust-licenses.js && cd frontend && (vue-cli-service build || (npm install && vue-cli-service build))",
"lint": "vue-cli-service lint || (npm install && vue-cli-service lint)",
"lint-no-fix": "vue-cli-service lint --no-fix || (echo 'Please run `npm run lint`. If the linter execution fails, try running `npm install` first.' && false)"
"lint-no-fix": "vue-cli-service lint --no-fix || (echo 'There were lint errors. Please run `npm run lint` to fix auto-them. If the linter execution fails, try running `npm install` first.' && false)"
},
"repository": {
"type": "git",
Expand All @@ -34,6 +34,7 @@
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-prettier-vue": "^3.1.0",
"eslint-plugin-vue": "^7.17.0",
"license-checker-webpack-plugin": "^0.2.1",
"prettier": "^2.3.2",
"sass": "^1.39.0",
"sass-loader": "^8.0.2",
Expand Down
16 changes: 11 additions & 5 deletions frontend/src/components/widgets/inputs/MenuBarInput.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="menu-bar-input">
<div class="entry-container">
<div @click="handleLogoClick(entry)" class="entry">
<div @click="() => window.open('https://www.graphite.design', '_blank')" class="entry">
<IconLabel :icon="'GraphiteLogo'" />
</div>
</div>
Expand Down Expand Up @@ -152,7 +152,16 @@ const menuEntries: MenuListEntries = [
{
label: "Help",
ref: undefined,
children: [[{ label: "Menu entries coming soon" }]],
children: [
[
{ label: "Report a Bug", action: () => window.open("https://github.com/GraphiteEditor/Graphite/issues/new", "_blank") },
{ label: "Visit on GitHub", action: () => window.open("https://github.com/GraphiteEditor/Graphite", "_blank") },
],
[
{ label: "Graphite License", action: () => window.open("https://raw.githubusercontent.com/GraphiteEditor/Graphite/master/LICENSE.txt", "_blank") },
{ label: "Third-Party Licenses", action: () => window.open("/third-party-licenses.txt", "_blank") },
],
],
},
];
Expand All @@ -165,9 +174,6 @@ export default defineComponent({
if (menuEntry.ref) menuEntry.ref.setOpen();
else throw new Error("The menu bar floating menu has no associated ref");
},
handleLogoClick() {
window.open("https://www.graphite.design", "_blank");
},
},
data() {
return {
Expand Down
Loading

0 comments on commit fc7d3aa

Please sign in to comment.