feat: add beta version notice

This commit is contained in:
thecodrr
2022-07-04 14:51:47 +05:00
parent 70d3a3d088
commit c20267ae47
5 changed files with 55 additions and 8 deletions

View File

@@ -10,6 +10,9 @@ const APP_VERSION = version.replaceAll(".", "");
console.log("App version:", APP_VERSION);
console.log("Ip address:", ip.address());
module.exports = {
beta: {
REACT_APP_BETA: true,
},
test: {
TEST_ALL: true,
},

View File

@@ -1,7 +1,7 @@
{
"name": "notesnook",
"description": "Your private note taking space",
"version": "1.8.10",
"version": "2.0.0",
"private": true,
"main": "./src/App.js",
"homepage": "https://notesnook.com/",
@@ -107,6 +107,7 @@
"start": "env-cmd -e all,dev,web react-scripts start",
"start:desktop": "env-cmd -e all,desktop react-scripts start",
"build": "env-cmd -e all,web react-scripts build",
"build:beta": "env-cmd -e all,web,beta react-scripts build",
"build:profile": "env-cmd -e all,web react-scripts build --profile",
"build:desktop": "env-cmd -e all,desktop react-scripts build",
"deploy": "./scripts/deploy.sh",

View File

@@ -0,0 +1,3 @@
yarn build:beta
rsync -aPzz --exclude "*.map" --exclude "*.txt" ./build/* thecodrr@94.237.75.100:/home/thecodrr/beta.notesnook.com/public_html $1

View File

@@ -37,9 +37,40 @@ const features: Record<FeatureKeys, Feature> = {
},
},
highlights: {
title: "✨ Highlights ✨",
subtitle: `Welcome to v${appVersion.clean}`,
subFeatures: [],
title: appVersion.isBeta
? "Welcome to Notesnook Beta!"
: "✨ Highlights ✨",
subtitle: appVersion.isBeta
? `v${appVersion.clean}-beta`
: `Welcome to v${appVersion.clean}`,
subFeatures: appVersion.isBeta
? [
{
icon: Icon.Warn,
title: "Notice",
subtitle: (
<>
This is the beta version and as such will contain bugs. Things
are expected to break but should be generally stable. Please use
the <Code text="Report an issue" /> button to report all bugs.
Thank you!
</>
),
},
{
icon: Icon.Warn,
title: "Notice 2",
subtitle: (
<>
Switching between beta &amp; stable versions can cause weird
issues including data loss. It is recommended that you do not
use both simultaneously. You can switch once the beta version
enters stable.
</>
),
},
]
: [],
cta: {
title: "Got it",
icon: Icon.Checkmark,
@@ -52,7 +83,8 @@ const features: Record<FeatureKeys, Feature> = {
const key = `${appVersion.numerical}:highlights`;
const hasShownBefore = Config.get(key, false) as boolean;
const hasShownAny = Config.has((k) => k.endsWith(":highlights"));
const hasShownAny =
appVersion.isBeta || Config.has((k) => k.endsWith(":highlights"));
if (!hasShownAny) Config.set(key, true);
return hasShownAny && !isTesting() && !hasShownBefore;

View File

@@ -4,14 +4,21 @@ export const appVersion = {
formatted: format(
process.env.REACT_APP_VERSION,
process.env.REACT_APP_GIT_HASH,
process.env.REACT_APP_PLATFORM as Platforms
process.env.REACT_APP_PLATFORM as Platforms,
process.env.REACT_APP_BETA === "true"
),
clean: formatVersion(process.env.REACT_APP_VERSION),
numerical: parseInt(process.env.REACT_APP_VERSION || "0"),
isBeta: process.env.REACT_APP_BETA === "true",
};
function format(version?: string, hash?: string, type?: "web" | "desktop") {
return `${formatVersion(version)}-${hash}-${type}`;
function format(
version?: string,
hash?: string,
type?: "web" | "desktop",
beta?: boolean
) {
return `${formatVersion(version)}-${hash}-${type}${beta ? "-beta" : ""}`;
}
function formatVersion(version?: string) {
@@ -38,6 +45,7 @@ export function getServiceWorkerVersion(
formatted: formatVersion(version),
numerical: parseInt(version),
clean: formatVersion(version),
isBeta: appVersion.isBeta,
});
});
serviceWorker.postMessage({ type: "GET_VERSION" });