mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-25 07:59:48 +01:00
feat: move changelog logic to @notesnook/desktop
This commit is contained in:
1
apps/web/.github/workflows/release.yml
vendored
1
apps/web/.github/workflows/release.yml
vendored
@@ -44,7 +44,6 @@ jobs:
|
||||
uses: actions/setup-node@v2.1.5
|
||||
with:
|
||||
node-version: 15.x
|
||||
- run: npm ci
|
||||
|
||||
- name: Download notesnook-web build
|
||||
uses: actions/download-artifact@v2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const { autoUpdater } = require("electron-updater");
|
||||
const { EVENTS } = require("./events");
|
||||
const { sendMessageToRenderer } = require("./ipc/utils");
|
||||
const { getChangelog } = require("../src/utils/version");
|
||||
const { getChangelog } = require("./changelog");
|
||||
|
||||
async function configureAutoUpdater() {
|
||||
autoUpdater.setFeedURL({
|
||||
|
||||
26
apps/web/desktop/changelog.js
Normal file
26
apps/web/desktop/changelog.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const showdown = require("showdown");
|
||||
|
||||
var converter = new showdown.Converter();
|
||||
converter.setFlavor("github");
|
||||
|
||||
module.exports.getChangelog = async function (tag) {
|
||||
try {
|
||||
if (!tag) return;
|
||||
|
||||
const url = `https://api.github.com/repos/streetwriters/notesnook/releases/tags/v${tag}`;
|
||||
const response = await fetch(url, {
|
||||
headers: { Accept: "application/json" },
|
||||
});
|
||||
if (!response.ok) return "No changelog found.";
|
||||
|
||||
const release = await response.json();
|
||||
if (!release) return "No changelog found.";
|
||||
|
||||
const { body } = release;
|
||||
|
||||
const html = converter.makeHtml(body);
|
||||
return html;
|
||||
} catch {
|
||||
return "No changelog found.";
|
||||
}
|
||||
};
|
||||
@@ -12,7 +12,8 @@
|
||||
"electron-better-ipc": "^2.0.1",
|
||||
"electron-serve": "^1.1.0",
|
||||
"electron-updater": "^4.6.5",
|
||||
"isomorphic-fetch": "^3.0.0"
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
"showdown": "^2.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node-fetch": "^2.6.1",
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import showdown from "showdown";
|
||||
|
||||
export const appVersion = {
|
||||
formatted: format(
|
||||
process.env.REACT_APP_VERSION,
|
||||
@@ -57,27 +55,4 @@ export function getServiceWorkerVersion(serviceWorker) {
|
||||
});
|
||||
}
|
||||
|
||||
var converter = new showdown.Converter();
|
||||
converter.setFlavor("github");
|
||||
|
||||
export async function getChangelog(tag) {
|
||||
try {
|
||||
if (!tag) return;
|
||||
|
||||
const url = `https://api.github.com/repos/streetwriters/notesnook/releases/tags/v${tag}`;
|
||||
const response = await fetch(url, {
|
||||
headers: { Accept: "application/json" },
|
||||
});
|
||||
if (!response.ok) return "No changelog found.";
|
||||
|
||||
const release = await response.json();
|
||||
if (!release) return "No changelog found.";
|
||||
|
||||
const { body } = release;
|
||||
|
||||
const html = converter.makeHtml(body);
|
||||
return html;
|
||||
} catch {
|
||||
return "No changelog found.";
|
||||
}
|
||||
}
|
||||
export { getChangelog } from "@notesnook/desktop/changelog";
|
||||
|
||||
Reference in New Issue
Block a user