chore: bump version to 1.6.12

This commit is contained in:
thecodrr
2021-12-16 12:03:42 +05:00
parent 60dcf14ce7
commit 24fdf20d41
10 changed files with 35 additions and 95 deletions

View File

@@ -1,9 +1,12 @@
const { execSync } = require("child_process"); const { execSync } = require("child_process");
const { cpus } = require("os"); const { cpus } = require("os");
const { version } = require("./package.json");
const NUM_CPUS = cpus().length; const NUM_CPUS = cpus().length;
const IS_CI = process.env.CI; const IS_CI = process.env.CI;
const gitHash = execSync("git rev-parse --short HEAD").toString().trim(); const gitHash = execSync("git rev-parse --short HEAD").toString().trim();
const APP_VERSION = version.replaceAll(".", "");
console.log("App version:", APP_VERSION);
module.exports = { module.exports = {
test: { test: {
TEST_ALL: true, TEST_ALL: true,
@@ -14,6 +17,7 @@ module.exports = {
INLINE_RUNTIME_CHUNK: false, INLINE_RUNTIME_CHUNK: false,
DISABLE_ESLINT_PLUGIN: true, DISABLE_ESLINT_PLUGIN: true,
REACT_APP_GIT_HASH: gitHash, REACT_APP_GIT_HASH: gitHash,
REACT_APP_VERSION: APP_VERSION,
}, },
dev: { dev: {
REACT_APP_CI: "true", REACT_APP_CI: "true",

View File

@@ -2,7 +2,7 @@
"name": "@notesnook/desktop", "name": "@notesnook/desktop",
"productName": "Notesnook", "productName": "Notesnook",
"description": "Your private note taking space", "description": "Your private note taking space",
"version": "1.6.11", "version": "1.6.12",
"private": true, "private": true,
"main": "./build/electron.js", "main": "./build/electron.js",
"homepage": "https://notesnook.com/", "homepage": "https://notesnook.com/",

View File

@@ -1,7 +1,7 @@
{ {
"name": "notesnook", "name": "notesnook",
"description": "Your private note taking space", "description": "Your private note taking space",
"version": "1.6.11", "version": "1.6.12",
"private": true, "private": true,
"main": "./src/App.js", "main": "./src/App.js",
"homepage": "https://notesnook.com/", "homepage": "https://notesnook.com/",

View File

@@ -1,5 +1,5 @@
import { Flex, Text } from "rebass"; import { Flex, Text } from "rebass";
import { getAppVersion } from "../../utils/useVersion"; import { appVersion } from "../../utils/version";
import Field from "../field"; import Field from "../field";
import Dialog from "./dialog"; import Dialog from "./dialog";
import platform from "platform"; import platform from "platform";
@@ -23,7 +23,7 @@ This is all optional, of course.`,
}; };
function getDeviceInfo() { function getDeviceInfo() {
const appVersion = getAppVersion().formatted; const appVersion = appVersion.formatted;
const os = platform.os; const os = platform.os;
const browser = `${platform.name} ${platform.version}`; const browser = `${platform.name} ${platform.version}`;

View File

@@ -71,3 +71,5 @@ self.addEventListener("message", (event) => {
}); });
// Any other custom service worker logic can go here. // Any other custom service worker logic can go here.
const VERSION = process.env.REACT_APP_VERSION;
console.log("App version:", VERSION);

View File

@@ -1,6 +1,6 @@
import Config from "./config"; import Config from "./config";
import { getPlatform } from "./platform"; import { getPlatform } from "./platform";
import { getAppVersion } from "./useVersion"; import { appVersion } from "./version";
export function loadTrackerScript() { export function loadTrackerScript() {
if (Config.get("telemetry") === "false") return; if (Config.get("telemetry") === "false") return;
@@ -68,7 +68,7 @@ export function trackVisit() {
window.umami.trackView("/"); window.umami.trackView("/");
trackEvent( trackEvent(
ANALYTICS_EVENTS.version, ANALYTICS_EVENTS.version,
`${getAppVersion().formatted}-${getPlatform().toLowerCase()}` `${appVersion.formatted}-${getPlatform().toLowerCase()}`
); );
} }
} }

View File

@@ -3,7 +3,7 @@ import { SUBSCRIPTION_STATUS } from "../common";
import { db } from "../common/db"; import { db } from "../common/db";
import Config from "./config"; import Config from "./config";
import { isUserPremium } from "../hooks/use-is-user-premium"; import { isUserPremium } from "../hooks/use-is-user-premium";
import { getAppVersion } from "./useVersion"; import { appVersion } from "./version";
var CACHED_ANNOUNCEMENTS = []; var CACHED_ANNOUNCEMENTS = [];
var cancelled = false; var cancelled = false;
@@ -65,7 +65,7 @@ async function shouldShowAnnouncement(announcement) {
show = show =
!announcement.appVersion || !announcement.appVersion ||
announcement.appVersion === getAppVersion().numerical; announcement.appVersion === appVersion.numerical;
if (!show) return false; if (!show) return false;

View File

@@ -1,84 +0,0 @@
// import { useEffect, useState } from "react";
// import { db } from "../common/db";
// import config from "./config";
var APP_VERSION = {
formatted: format(
1611,
process.env.REACT_APP_GIT_HASH,
process.env.REACT_APP_PLATFORM
),
numerical: 1611,
appUpdated: false,
appUpdateable: false,
changelog: undefined,
fetched: false,
};
var CACHED_VERSION = undefined;
function useVersion() {
// const [version, setVersion] = useState(APP_VERSION);
// useEffect(() => {
// (async function () {
// const version = await getVersion();
// setVersion(version);
// })();
// }, []);
return [APP_VERSION, APP_VERSION];
}
export default useVersion;
/**
*
* @param {number} version
* @param {string} hash
* @param {"web"|"desktop"} type
*/
function format(version, hash, type) {
const [major, minor, bugfix0, bugfix1] = version.toString().split("");
return `${major}.${minor}.${bugfix0}${bugfix1 || ""}-${hash}-${type}`;
}
export function getAppVersion() {
return APP_VERSION;
}
export function getCachedVersion() {
return CACHED_VERSION;
}
// export async function getVersion() {
// try {
// var app_version = config.get("app_version");
// if (!app_version) {
// app_version = APP_VERSION;
// config.set("app_version", APP_VERSION);
// }
// if (APP_VERSION.fetched) return CACHED_VERSION;
// const version = await db.version();
// if (!version) return APP_VERSION;
// const changelog = version.web_changelog || version.changelog;
// CACHED_VERSION = {
// formatted: format(version.web),
// numerical: version.web,
// appUpdated:
// version.web > app_version.numerical &&
// APP_VERSION.numerical === version.web,
// appUpdateable: version.web > APP_VERSION.numerical,
// updateSeverity: version.severity,
// changelog: !changelog ? undefined : changelog,
// fetched: true,
// };
// if (CACHED_VERSION.appUpdated) {
// config.set("app_version", CACHED_VERSION);
// }
// return CACHED_VERSION;
// } catch (e) {
// console.error(e);
// }
// return APP_VERSION;
// }

View File

@@ -0,0 +1,19 @@
export const appVersion = {
formatted: format(
process.env.REACT_APP_VERSION,
process.env.REACT_APP_GIT_HASH,
process.env.REACT_APP_PLATFORM
),
numerical: parseInt(process.env.REACT_APP_VERSION),
};
/**
*
* @param {number} version
* @param {string} hash
* @param {"web"|"desktop"} type
*/
function format(version, hash, type) {
const [major, minor, bugfix0, bugfix1] = version.toString().split("");
return `${major}.${minor}.${bugfix0}${bugfix1 || ""}-${hash}-${type}`;
}

View File

@@ -25,7 +25,7 @@ import { showLoadingDialog } from "../common/dialog-controller";
import { showToast } from "../utils/toast"; import { showToast } from "../utils/toast";
import { showPasswordDialog } from "../common/dialog-controller"; import { showPasswordDialog } from "../common/dialog-controller";
import { hardNavigate, hashNavigate } from "../navigation"; import { hardNavigate, hashNavigate } from "../navigation";
import useVersion from "../utils/useVersion"; import { appVersion } from "../utils/version";
import { CHECK_IDS } from "notes-core/common"; import { CHECK_IDS } from "notes-core/common";
import { openPaddleDialog } from "../common/checkout"; import { openPaddleDialog } from "../common/checkout";
import Tip from "../components/tip"; import Tip from "../components/tip";
@@ -139,7 +139,6 @@ function Settings(props) {
const toggleNightMode = useThemeStore((store) => store.toggleNightMode); const toggleNightMode = useThemeStore((store) => store.toggleNightMode);
const followSystemTheme = useThemeStore((store) => store.followSystemTheme); const followSystemTheme = useThemeStore((store) => store.followSystemTheme);
const [zoomFactor, setZoomFactor] = useZoomFactor(); const [zoomFactor, setZoomFactor] = useZoomFactor();
const [, version] = useVersion();
const toggleFollowSystemTheme = useThemeStore( const toggleFollowSystemTheme = useThemeStore(
(store) => store.toggleFollowSystemTheme (store) => store.toggleFollowSystemTheme
@@ -631,7 +630,7 @@ function Settings(props) {
<Tip <Tip
sx={{ mt: 2 }} sx={{ mt: 2 }}
text="About" text="About"
tip={`version ${version.formatted}`} tip={`version ${appVersion.formatted}`}
/> />
</> </>
)} )}