From 7f72d5a2054b36d15d278dcecd0eaf8433f47fd7 Mon Sep 17 00:00:00 2001 From: Andrei Andreev Date: Wed, 30 Nov 2022 01:03:24 +0100 Subject: [PATCH] Add release build config --- .env.master | 1 + .../{deploy.yml => deploy-master.yml} | 2 +- .github/workflows/deploy-release.yml | 31 +++++++++++++++++++ javascripts/core/devtools.js | 2 +- javascripts/game.js | 5 +++ package.json | 3 +- vue.config.js | 8 +++-- 7 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 .env.master rename .github/workflows/{deploy.yml => deploy-master.yml} (89%) create mode 100644 .github/workflows/deploy-release.yml diff --git a/.env.master b/.env.master new file mode 100644 index 000000000..e4c8e86fa --- /dev/null +++ b/.env.master @@ -0,0 +1 @@ +VUE_APP_DEV=true \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy-master.yml similarity index 89% rename from .github/workflows/deploy.yml rename to .github/workflows/deploy-master.yml index 9d0331bfa..486577e3c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy-master.yml @@ -22,7 +22,7 @@ jobs: cache: 'npm' - run: npm ci - run: npm run build - - uses: JamesIves/github-pages-deploy-action@4.1.3 + - uses: JamesIves/github-pages-deploy-action@4.4.1 with: branch: gh-pages folder: dist diff --git a/.github/workflows/deploy-release.yml b/.github/workflows/deploy-release.yml new file mode 100644 index 000000000..7f50df72c --- /dev/null +++ b/.github/workflows/deploy-release.yml @@ -0,0 +1,31 @@ +name: Deploy 🚀 + +on: + push: + branches: + - master + workflow_dispatch: + branches: + - master + +jobs: + build: + name: Deploy 🚀 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + lfs: true + - uses: actions/setup-node@v2 + with: + node-version: '14' + cache: 'npm' + - run: npm ci + - run: npm run build + - uses: JamesIves/github-pages-deploy-action@4.4.1 + with: + token: ${{ secrets.GH_PUBLISH_TOKEN }} + repository-name: IvarK/AyyLmao5Hours + branch: master + folder: dist + single-commit: true diff --git a/javascripts/core/devtools.js b/javascripts/core/devtools.js index d35786c04..46f1fe9c7 100644 --- a/javascripts/core/devtools.js +++ b/javascripts/core/devtools.js @@ -3,7 +3,7 @@ import { sha512_256 } from "js-sha512"; import { DC } from "./constants"; import FullScreenAnimationHandler from "./full-screen-animation-handler"; -export const DEV = true; +export const DEV = process.env.VUE_APP_DEV === "true"; /* eslint-disable no-console */ // Disabling no-console here seems diff --git a/javascripts/game.js b/javascripts/game.js index 9bfbaf2a8..d4fea6f3c 100644 --- a/javascripts/game.js +++ b/javascripts/game.js @@ -6,6 +6,7 @@ import { SpeedrunMilestones } from "./core/speedrun"; import { supportedBrowsers } from "./supported-browsers"; import Payments from "./core/payments"; +import { DEV } from "./core/devtools"; if (GlobalErrorHandler.handled) { throw new Error("Initialization failed"); @@ -1048,6 +1049,10 @@ export function browserCheck() { export function init() { // eslint-disable-next-line no-console console.log("🌌 Antimatter Dimensions: Reality Update 🌌"); + if (DEV) { + // eslint-disable-next-line no-console + console.log("👨‍💻 Development Mode 👩‍💻"); + } GameStorage.load(); Tabs.all.find(t => t.config.id === player.options.lastOpenTab).show(true); Payments.init(); diff --git a/package.json b/package.json index 7551f86a5..09bf98535 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,8 @@ "private": true, "scripts": { "serve": "node build/check-npm.js && vue-cli-service serve", - "build": "node build/pre-build.js && vue-cli-service build && node build/post-build.js", + "build:master": "node build/pre-build.js && vue-cli-service build --mode master && node build/post-build.js", + "build:release": "node build/pre-build.js && vue-cli-service build && node build/post-build.js", "lint": "vue-cli-service lint" }, "dependencies": { diff --git a/vue.config.js b/vue.config.js index 4cfc00658..57e166892 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,11 +1,13 @@ /** * @type {import('@vue/cli-service').ProjectOptions} */ + +const isDev = process.env.VUE_APP_DEV === "true"; + module.exports = { publicPath: "./", lintOnSave: false, configureWebpack: { - devtool: "eval-source-map", - }, - runtimeCompiler: true + devtool: isDev ? "eval-source-map" : "source-map", + } };