From 0b446ec1345df3db908be82efc43f8cbe632f411 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Sun, 7 Apr 2024 18:12:33 -0600 Subject: [PATCH] misc tweaks for new vite build --- package-lock.json | 25 ++----------------------- package.json | 7 ++++--- project.task.yaml | 2 -- src/views/AccountViewView.vue | 6 +++--- vue.config.js | 28 ---------------------------- 5 files changed, 9 insertions(+), 59 deletions(-) diff --git a/package-lock.json b/package-lock.json index e4d0665ab..2469bfebd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,7 +35,6 @@ "ethereum-cryptography": "^2.1.3", "ethereumjs-util": "^7.1.5", "ethr-did-resolver": "^8.1.2", - "git-describe": "^4.1.1", "jdenticon": "^3.2.0", "js-generate-password": "^0.1.9", "js-yaml": "^4.1.0", @@ -8716,6 +8715,7 @@ }, "node_modules/@types/semver": { "version": "7.5.3", + "dev": true, "license": "MIT" }, "node_modules/@types/stack-utils": { @@ -13281,28 +13281,6 @@ "node": ">=6" } }, - "node_modules/git-describe": { - "version": "4.1.1", - "license": "MIT", - "dependencies": { - "@types/semver": "^7.3.8", - "lodash": "^4.17.21" - }, - "engines": { - "node": ">=4.0.0" - }, - "optionalDependencies": { - "semver": "^5.6.0" - } - }, - "node_modules/git-describe/node_modules/semver": { - "version": "5.7.2", - "license": "ISC", - "optional": true, - "bin": { - "semver": "bin/semver" - } - }, "node_modules/glob": { "version": "7.2.3", "devOptional": true, @@ -15035,6 +15013,7 @@ }, "node_modules/lodash": { "version": "4.17.21", + "devOptional": true, "license": "MIT" }, "node_modules/lodash.clonedeep": { diff --git a/package.json b/package.json index 376b9acd9..72a716ab2 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,11 @@ "scripts": { "dev": "vite", "serve": "vite preview", - "build": "eslint --ext .js,.ts,.vue --ignore-path .gitignore src && vite build", + "build": "VITE_GIT_HASH=`git log -1 --pretty=format:%h` vite build", "lint": "eslint --ext .js,.ts,.vue --ignore-path .gitignore src", - "lint-fix": "eslint --ext .js,.ts,.vue --ignore-path .gitignore --fix src" + "lint-fix": "eslint --ext .js,.ts,.vue --ignore-path .gitignore --fix src", + "postbuild": "cp ./sw_scripts-combined.js dist/", + "prebuild": "eslint --ext .js,.ts,.vue --ignore-path .gitignore src && node sw_combine.js" }, "dependencies": { "@dicebear/collection": "^5.4.1", @@ -37,7 +39,6 @@ "ethereum-cryptography": "^2.1.3", "ethereumjs-util": "^7.1.5", "ethr-did-resolver": "^8.1.2", - "git-describe": "^4.1.1", "jdenticon": "^3.2.0", "js-generate-password": "^0.1.9", "js-yaml": "^4.1.0", diff --git a/project.task.yaml b/project.task.yaml index fe000a1f7..6fdc7b815 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -6,8 +6,6 @@ tasks : - 24 contextual tutorials https://docs.google.com/document/d/11C_K3RM0rgo0onih20KFhcIzukZyq_CRWqaWX5om_kM/edit#heading=h.iwiwcydou5hw -- 24 Move to Vite assignee:jason - - feeds - add "remote" filter, if they choose 'visible' then warn that they won't see any others, cache list & don't reload front page on change - .1 add shortcut from project (etc?) to the public project page in a browser diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index edf8e0818..9fcc63d65 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -931,11 +931,11 @@ export default class AccountViewView extends Vue { // Trigger the download this.downloadDatabaseBackup(this.downloadUrl); - // Revoke the temporary URL -- not yet because of DuckDuckGo download failure - //URL.revokeObjectURL(this.downloadUrl); - // Notify the user that the download has started this.notifyDownloadStarted(); + + // Revoke the temporary URL -- after a pause to avoid DuckDuckGo download failure + setTimeout(() => URL.revokeObjectURL(this.downloadUrl), 1000); } catch (error) { this.handleExportError(error); } diff --git a/vue.config.js b/vue.config.js index 02fb8b38c..8877110eb 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,36 +1,8 @@ -const { defineConfig } = require("@vue/cli-service"); -const { gitDescribeSync } = require("git-describe"); -const { exec } = require("child_process"); -import.meta.env.VITE_GIT_HASH = gitDescribeSync().hash; const TIME_SAFARI_APP_TITLE = import.meta.env.VITE_TIME_SAFARI_APP_TITLE || require("./package.json").name; module.exports = defineConfig({ - transpileDependencies: true, - configureWebpack: { - devtool: "source-map", - experiments: { - topLevelAwait: true, - }, - plugins: [ - { - // Still don't know why this runs three times. - apply: (compiler) => { - compiler.hooks.beforeCompile.tap("BeforeCompile", () => { - // Execute combine-sw.js script - exec("node sw_combine.js", (error, stdout, stderr) => { - if (error || stderr) { - console.error("Service worker files error:", error || stderr); - } else { - console.log("Finished combining service worker files.", stdout); - } - }); - }); - }, - }, - ], - }, pwa: { name: TIME_SAFARI_APP_TITLE, iconPaths: { -- 2.30.2