mirror of https://github.com/Xaymar/obs-StreamFX
Update copyright.js tool
It will now properly sort authors by date, and follow renames, which should give a much better coverage of copyright information.
This commit is contained in:
parent
0e913edccf
commit
4339a5f853
|
@ -133,8 +133,7 @@ async function git_retrieveAuthors(file) {
|
||||||
let proc = CHILD_PROCESS.spawn("git", [
|
let proc = CHILD_PROCESS.spawn("git", [
|
||||||
"--no-pager",
|
"--no-pager",
|
||||||
"log",
|
"log",
|
||||||
"--date-order",
|
"--follow",
|
||||||
"--reverse",
|
|
||||||
"--format=format:%aI|%aN <%aE>",
|
"--format=format:%aI|%aN <%aE>",
|
||||||
"--",
|
"--",
|
||||||
file
|
file
|
||||||
|
@ -190,7 +189,11 @@ async function git_retrieveAuthors(file) {
|
||||||
|
|
||||||
let author = authors.get(name);
|
let author = authors.get(name);
|
||||||
if (author) {
|
if (author) {
|
||||||
author.to = new Date(date)
|
let dt = new Date(date)
|
||||||
|
if (author.from > dt)
|
||||||
|
author.from = dt;
|
||||||
|
if (author.to < dt)
|
||||||
|
author.to = dt;
|
||||||
} else {
|
} else {
|
||||||
authors.set(name, {
|
authors.set(name, {
|
||||||
from: new Date(date),
|
from: new Date(date),
|
||||||
|
@ -203,6 +206,14 @@ async function git_retrieveAuthors(file) {
|
||||||
|
|
||||||
async function generateCopyright(file) {
|
async function generateCopyright(file) {
|
||||||
let authors = await git_retrieveAuthors(file)
|
let authors = await git_retrieveAuthors(file)
|
||||||
|
authors = new Map([...authors].sort((a, b) => {
|
||||||
|
if (a[1].from < b[1].from) {
|
||||||
|
return -1;
|
||||||
|
} else if (a[1].from > b[1].from) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}));
|
||||||
let lines = [];
|
let lines = [];
|
||||||
for (let entry of authors) {
|
for (let entry of authors) {
|
||||||
let from = entry[1].from.getUTCFullYear();
|
let from = entry[1].from.getUTCFullYear();
|
||||||
|
|
Loading…
Reference in New Issue