Merge pull request #1 from naipotato/naipotato/fix-metadata

index.ts: fix releases tag creation
This commit is contained in:
mauro 🤙 2024-09-05 23:15:37 +02:00 committed by GitHub
commit 71a46cd301
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 60 additions and 33 deletions

View file

@ -6,33 +6,44 @@ import commandLineArgs from 'command-line-args';
const templateMetadata = `
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<metadata_license>MIT</metadata_license>
<project_license>MPL-2.0</project_license>
<id>io.github.zen_browser.zen</id>
<url type="homepage">https://get-zen.vercel.app</url>
<content_rating type="oars-1.1" />
<name>Zen</name>
<summary>Your browser, your way</summary>
<developer id="io.github.zen_browser.zen">
<name>Zen Team</name>
</developer>
<name>Zen Browser</name>
<summary>A fast, beautifull browser</summary>
<metadata_license>MIT</metadata_license>
<project_license>MPL-2.0</project_license>
<description>
<p>Zen Browser is a firefox based browser that will change the way you surf the web!</p>
<p>Zen is the best way to browse the web. Beautifully designed, privacy-focused, and packed with features. We care about your experience, not your data.</p>
<ul>
<li>Split views</li>
<li>Web Sidebar</li>
<li>Tab Groups</li>
<li>Customizable UI</li>
<li>Vertical Tabs</li>
<li>And more...</li>
<li>Split view</li>
<li>Web sidebar</li>
<li>Tab groups</li>
<li>Customizable interface</li>
<li>Vertical tabs</li>
<li>And more</li>
</ul>
</description>
<launchable type="desktop-id">io.github.zen_browser.zen.desktop</launchable>
<url type="homepage">https://zen-browser.app</url>
<url type="bugtracker">https://github.com/zen-browser/desktop/issues</url>
<url type="help">https://docs.zen-browser.app</url>
<url type="faq">https://docs.zen-browser.app/faq</url>
<url type="donation">https://www.patreon.com/zen_browser</url>
<url type="translate">https://crowdin.com/project/zen-browser</url>
<url type="contact">https://discord.com/servers/mauro-s-little-sweatshop-1088172780480114748</url>
<url type="vcs-browser">https://github.com/zen-browser</url>
<url type="contribute">https://docs.zen-browser.app/contribute/CONTRIBUTING</url>
<branding>
<color type="primary" scheme_preference="light">#d9d9d9</color>
<color type="primary" scheme_preference="dark">#f5f5f5</color>
</branding>
<screenshots>
<screenshot type="default">
<image>https://raw.githubusercontent.com/zen-browser/www/main/public/browser-1.png</image>
@ -44,14 +55,26 @@ const templateMetadata = `
<image>https://raw.githubusercontent.com/zen-browser/www/main/public/browser-3.png</image>
</screenshot>
<screenshot>
<image>https://raw.githubusercontent.com/zen-browser/www/main/public/browser-4.png</image>
<image>https://raw.githubusercontent.com/zen-browser/www/main/public/browser-4.jpg</image>
</screenshot>
</screenshots>
<branding>
<color type="primary" scheme_preference="light">#d9d9d9</color>
<color type="primary" scheme_preference="dark">#f5f5f5</color>
</branding>
<content_rating type="oars-1.1" />
<launchable type="desktop-id">io.github.zen_browser.zen.desktop</launchable>
<requires>
<display_length compare="ge">450</display_length>
</requires>
<recommends>
<internet>always</internet>
</recommends>
<supports>
<control>pointing</control>
<control>keyboard</control>
</supports>
</component>
`;
@ -66,7 +89,8 @@ interface Releases {
function createReleasesTag(releases: Releases) {
let releasesTag = metadata.root().ele('releases');
for (const [version, release] of Object.entries(releases)) {
for (const [version, release] of Object.entries(releases).toReversed()) {
releasesTag = releasesTag.ele('release', { version , date: release.date })
.ele('url', { type: 'details' })
.txt(`https://zen-browser.app/release-notes/${version}`)
@ -75,14 +99,17 @@ function createReleasesTag(releases: Releases) {
}
}
function createAndPushNewRelease(version: string) {
function createAndPushNewRelease(version: string): Releases {
const date = new Date();
const dateStr = date.toLocaleDateString('es-ES', { year: 'numeric', month: '2-digit', day: '2-digit' });
const dateStr = date.toISOString();
const releasesCopy: Releases = { ...releases };
releasesCopy[version] = { date: dateStr };
fs.writeFileSync(__dirname + '/releases.json', JSON.stringify(releasesCopy, null, 4));
console.log(`New release ${version} added! (${__dirname}/releases.json)`);
return date;
return releasesCopy;
}
const optionDefinitions = [
@ -95,7 +122,8 @@ function main() {
console.error('version is required!');
return;
}
createAndPushNewRelease(options.version);
const releases = createAndPushNewRelease(options.version);
createReleasesTag(releases);
const xml = metadata.end({ prettyPrint: true });
@ -105,4 +133,3 @@ function main() {
}
main();

View file

@ -1,14 +1,14 @@
{
"1.0.0-a.32": {
"date": "01/09/2024"
"date": "2024-08-28T12:38:00.000Z"
},
"1.0.0-a.34": {
"date": "01/09/2024"
"date": "2024-08-30T03:13:00.000Z"
},
"1.0.0-a.35": {
"date": "03/09/2024"
"date": "2024-09-03T20:52:00.000Z"
},
"1.0.0-a.37": {
"date": "05/09/2024"
"date": "2024-09-04T02:18:00.000Z"
}
}

View file

@ -11,7 +11,7 @@
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"target": "es2023", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */