Skip to content

Commit

Permalink
chore: add update log script and md
Browse files Browse the repository at this point in the history
  • Loading branch information
Almo7aya committed May 9, 2023
1 parent ea83aef commit 9f7f907
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 1 deletion.
28 changes: 28 additions & 0 deletions UPDATELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## v0.2.4

### Features

- add auto start support
- add single instance plugin
- refactor user changed logic

### Bug Fixes

- hide menus on windows and linux
- fix legacy downloads logic
- fix user profile picture nav link
- hide upload music tab
- fix windows closing bug
- disable cross-fade temporally
- fix initFonts method
- delay splash screen on launch

---

## v0.2.3


### Bug Fixes

- fix miniplayer position in windows

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"dependencies": {
"@actions/github": "^5.1.1",
"fs-extra": "^11.1.1",
"node-fetch": "^3.3.1"
},
"scripts": {
Expand Down
45 changes: 45 additions & 0 deletions updatelog.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import fs from "fs-extra";
import path from "path";

const UPDATE_LOG = "UPDATELOG.md";

// parse the UPDATELOG.md
export async function resolveUpdateLog(tag) {
const cwd = process.cwd();

const reTitle = /^## v[\d\.]+/;
const reEnd = /^---/;

const file = path.join(cwd, UPDATE_LOG);

if (!(await fs.pathExists(file))) {
throw new Error("could not found UPDATELOG.md");
}

const data = await fs.readFile(file).then((d) => d.toString("utf8"));

const map = {};
let p = "";

data.split("\n").forEach((line) => {
if (reTitle.test(line)) {
p = line.slice(3).trim();
if (!map[p]) {
map[p] = [];
} else {
throw new Error(`Tag ${p} dup`);
}
} else if (reEnd.test(line)) {
p = "";
} else if (p) {
map[p].push(line);
}
});

if (!map[tag]) {
throw new Error(`could not found "${tag}" in UPDATELOG.md`);
}

return map[tag].join("\n").trim();
}

3 changes: 2 additions & 1 deletion updater.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fetch from 'node-fetch';
import { getOctokit, context } from '@actions/github';
import { resolveUpdateLog } from './updatelog.mjs';

const UPDATE_TAG_NAME = 'anghami-desktop-updater';
const UPDATE_JSON_FILE = 'update.json';
Expand Down Expand Up @@ -33,7 +34,7 @@ async function resolveUpdater() {

const updateData = {
version: tag.name,
notes: 'TODO',
notes: await resolveUpdateLog(tag.name),
pub_date: new Date().toISOString(),
platforms: {
win64: { signature: '', url: '' }, // compatible with older formats
Expand Down
28 changes: 28 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,34 @@ formdata-polyfill@^4.0.10:
dependencies:
fetch-blob "^3.1.2"

fs-extra@^11.1.1:
version "11.1.1"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.1.1.tgz#da69f7c39f3b002378b0954bb6ae7efdc0876e2d"
integrity sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==
dependencies:
graceful-fs "^4.2.0"
jsonfile "^6.0.1"
universalify "^2.0.0"

graceful-fs@^4.1.6, graceful-fs@^4.2.0:
version "4.2.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==

is-plain-object@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344"
integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==

jsonfile@^6.0.1:
version "6.1.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==
dependencies:
universalify "^2.0.0"
optionalDependencies:
graceful-fs "^4.1.6"

node-domexception@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5"
Expand Down Expand Up @@ -183,6 +206,11 @@ universal-user-agent@^6.0.0:
resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-6.0.0.tgz#3381f8503b251c0d9cd21bc1de939ec9df5480ee"
integrity sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==

universalify@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==

web-streams-polyfill@^3.0.3:
version "3.2.1"
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6"
Expand Down

0 comments on commit 9f7f907

Please sign in to comment.