Auto maintain of the year in licenses

This commit is contained in:
be5invis 2022-10-26 19:44:36 -07:00
parent 1e116ed291
commit b30e41ffb7
4 changed files with 30 additions and 7 deletions

View file

@ -82,11 +82,11 @@ export function assignFontNames(font, naming, isQuasiProportional) {
// Licensing
if (naming.miscNames) {
nameFont(font, Ot.Name.NameID.Copyright, naming.miscNames.copyright);
nameFont(font, Ot.Name.NameID.Manufacturer, naming.miscNames.manufacturer);
nameFont(font, Ot.Name.NameID.Designer, naming.miscNames.designer);
nameFont(font, Ot.Name.NameID.Description, naming.miscNames.description);
nameFont(font, Ot.Name.NameID.LicenseDescription, naming.miscNames.licence);
nameFont(font, Ot.Name.NameID.Copyright, ancNameEntry(naming.miscNames.copyright));
nameFont(font, Ot.Name.NameID.Manufacturer, ancNameEntry(naming.miscNames.manufacturer));
nameFont(font, Ot.Name.NameID.Designer, ancNameEntry(naming.miscNames.designer));
nameFont(font, Ot.Name.NameID.Description, ancNameEntry(naming.miscNames.description));
nameFont(font, Ot.Name.NameID.LicenseDescription, ancNameEntry(naming.miscNames.licence));
}
// Version
@ -109,6 +109,8 @@ export function assignFontNames(font, naming, isQuasiProportional) {
);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
function accumulateFlags(...entries) {
let s = 0;
for (const [flag, cond] of entries) {
@ -232,3 +234,9 @@ const slopeToMenuStyleMapShort = {
italic: "It",
oblique: "Obl"
};
/////////////////////////////////////////////////////////////////////////////////////////////////////
function ancNameEntry(input) {
return input.replace(/\{\{currentYear\}\}/g, () => String(new Date().getFullYear()));
}

View file

@ -3,7 +3,7 @@
### Changing the numbers may make the builder crash / hang / produce broken shapes.
[iosevka]
naming.copyright = 'Copyright 2015-2021, Renzhi Li (aka. Belleve Invis, belleve@typeof.net).'
naming.copyright = 'Copyright 2015-{{currentYear}}, Renzhi Li (aka. Belleve Invis, belleve@typeof.net).'
naming.licence = '''This font software is licenced under the SIL Open Font Licence, Version 1.1. This licence is available with a FAQ at: http://scripts.sil.org/OFL. This font software is distributed on an 'AS IS' basis, without warranties or conditions of any kind, either express or implied. See the SIL Open Font licence for the specific language, permissions and limitations governing your use of this font software.'''
naming.manufacturer = 'Belleve Invis'
naming.designer = 'Belleve Invis'

View file

@ -0,0 +1,9 @@
import fs from "fs";
export default main;
async function main(argv) {
let readme = await fs.promises.readFile(argv.path, "utf-8");
const currentYear = String(new Date().getFullYear());
readme = readme.replace(/Copyright \(c\) \d{4}-\d{4}/, `Copyright (c) 2015-${currentYear}`);
await fs.promises.writeFile(argv.path, readme);
}

View file

@ -831,7 +831,8 @@ const AmendReadme = task("amend-readme", async target => {
AmendReadmeFor("doc/stylistic-sets.md"),
AmendReadmeFor("doc/character-variants.md"),
AmendReadmeFor("doc/custom-build.md"),
AmendReadmeFor("doc/language-specific-ligation-sets.md")
AmendReadmeFor("doc/language-specific-ligation-sets.md"),
AmendLicenseYear
);
});
const AmendReadmeFor = task.make(
@ -851,6 +852,11 @@ const AmendReadmeFor = task.make(
});
}
);
const AmendLicenseYear = task("amend-readme:license-year", async target => {
return node(`utility/amend-readme/license-year.mjs`, {
path: "LICENSE.md"
});
});
///////////////////////////////////////////////////////////
// Sample Images