diff --git a/apps/web/.env-cmdrc.js b/apps/web/.env-cmdrc.js index d66c5a48d..f0f5fe793 100644 --- a/apps/web/.env-cmdrc.js +++ b/apps/web/.env-cmdrc.js @@ -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, }, diff --git a/apps/web/package.json b/apps/web/package.json index a8cb95821..f21b126fb 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -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", diff --git a/apps/web/scripts/deploy-beta.sh b/apps/web/scripts/deploy-beta.sh new file mode 100755 index 000000000..64e8bf622 --- /dev/null +++ b/apps/web/scripts/deploy-beta.sh @@ -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 \ No newline at end of file diff --git a/apps/web/src/components/dialogs/feature-dialog.tsx b/apps/web/src/components/dialogs/feature-dialog.tsx index 350589c83..0436fa6f1 100644 --- a/apps/web/src/components/dialogs/feature-dialog.tsx +++ b/apps/web/src/components/dialogs/feature-dialog.tsx @@ -37,9 +37,40 @@ const features: Record = { }, }, 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 button to report all bugs. + Thank you! + + ), + }, + { + icon: Icon.Warn, + title: "Notice 2", + subtitle: ( + <> + Switching between beta & 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 = { 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; diff --git a/apps/web/src/utils/version.ts b/apps/web/src/utils/version.ts index 59ba2c571..4d09922a0 100644 --- a/apps/web/src/utils/version.ts +++ b/apps/web/src/utils/version.ts @@ -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" });