mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-06 20:42:57 +08:00
✨ Feature(custom): upgrade to electron v39 and electron-vite 5.0, suppress derecation notification
This commit is contained in:
@@ -4,10 +4,12 @@ import { fileURLToPath } from 'node:url'
|
||||
|
||||
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
|
||||
import { defineConfig } from 'electron-vite'
|
||||
export default defineConfig({
|
||||
main: {
|
||||
plugins: [externalizeDepsPlugin()],
|
||||
build: {
|
||||
externalizeDeps: true,
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve('src/renderer'),
|
||||
@@ -20,14 +22,10 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
preload: {
|
||||
plugins: [
|
||||
externalizeDepsPlugin(),
|
||||
VueI18nPlugin({
|
||||
/* options */
|
||||
// locale messages resource pre-compile option
|
||||
include: resolve(dirname(fileURLToPath(import.meta.url)), './src/renderer/i18n/locales/**'),
|
||||
}),
|
||||
],
|
||||
build: {
|
||||
externalizeDeps: true,
|
||||
},
|
||||
plugins: [],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve('src/renderer'),
|
||||
@@ -48,9 +46,16 @@ export default defineConfig({
|
||||
'#': resolve('src/universal'),
|
||||
},
|
||||
},
|
||||
plugins: [vue()],
|
||||
plugins: [
|
||||
vue(),
|
||||
VueI18nPlugin({
|
||||
/* options */
|
||||
// locale messages resource pre-compile option
|
||||
include: resolve(dirname(fileURLToPath(import.meta.url)), './src/renderer/i18n/locales/**'),
|
||||
}),
|
||||
],
|
||||
server: {
|
||||
port: 3000,
|
||||
port: 30303,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
36
package.json
36
package.json
@@ -22,7 +22,8 @@
|
||||
"build:linux": "electron-vite build && electron-builder --linux",
|
||||
"bump": "bump-version",
|
||||
"cz": "git-cz",
|
||||
"dev": "electron-vite dev --watch",
|
||||
"dev": "cross-env NODE_ENV=development electron-vite dev",
|
||||
"dev:prod": "cross-env NODE_ENV=production electron-vite dev",
|
||||
"i18n": "node ./scripts/gen-i18n-types.js",
|
||||
"link": "node ./scripts/link.js",
|
||||
"lint": "eslint --ext .js,.jsx,.ts,.tsx,.vue src/ scripts/ .",
|
||||
@@ -41,14 +42,14 @@
|
||||
"upload-dist": "node ./scripts/upload-dist-to-r2.cjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.931.0",
|
||||
"@aws-sdk/lib-storage": "^3.931.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.931.0",
|
||||
"@aws-sdk/client-s3": "^3.958.0",
|
||||
"@aws-sdk/lib-storage": "^3.958.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.958.0",
|
||||
"@nodelib/fs.walk": "^3.0.1",
|
||||
"@octokit/rest": "^22.0.1",
|
||||
"@piclist/i18n": "^2.0.0",
|
||||
"@piclist/store": "^3.0.0",
|
||||
"@smithy/node-http-handler": "^4.4.5",
|
||||
"@smithy/node-http-handler": "^4.4.7",
|
||||
"ali-oss": "^6.23.0",
|
||||
"axios": "^1.13.2",
|
||||
"chalk": "^5.6.2",
|
||||
@@ -56,14 +57,14 @@
|
||||
"cos-nodejs-sdk-v5": "^2.15.4",
|
||||
"dayjs": "^1.11.19",
|
||||
"electron-updater": "^6.6.2",
|
||||
"fast-xml-parser": "^5.3.1",
|
||||
"form-data": "^4.0.4",
|
||||
"fs-extra": "^11.3.2",
|
||||
"got": "^14.6.3",
|
||||
"fast-xml-parser": "^5.3.3",
|
||||
"form-data": "^4.0.5",
|
||||
"fs-extra": "^11.3.3",
|
||||
"got": "^14.6.5",
|
||||
"hpagent": "^1.2.0",
|
||||
"js-yaml": "^4.1.1",
|
||||
"lodash-es": "^4.17.21",
|
||||
"marked": "^17.0.0",
|
||||
"lodash-es": "^4.17.22",
|
||||
"marked": "^17.0.1",
|
||||
"mime": "^4.1.0",
|
||||
"mitt": "^3.0.1",
|
||||
"multer": "^2.0.2",
|
||||
@@ -71,15 +72,15 @@
|
||||
"nodejs-file-downloader": "^4.13.0",
|
||||
"piclist": "^2.0.4",
|
||||
"qiniu": "7.14.0",
|
||||
"semver": "^7.7.2",
|
||||
"semver": "^7.7.3",
|
||||
"shell-path": "3.0.0",
|
||||
"ssh2-no-cpu-features": "^2.0.0",
|
||||
"tunnel": "^0.0.6",
|
||||
"upyun": "^3.4.6",
|
||||
"uuid": "^11.1.0",
|
||||
"vue": "^3.5.22",
|
||||
"uuid": "^13.0.0",
|
||||
"vue": "^3.5.26",
|
||||
"webdav": "^5.8.0",
|
||||
"write-file-atomic": "^6.0.0"
|
||||
"write-file-atomic": "^7.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@electron/notarize": "^3.1.1",
|
||||
@@ -101,12 +102,13 @@
|
||||
"@videojs-player/vue": "^1.0.0",
|
||||
"@vitejs/plugin-vue": "^6.0.3",
|
||||
"baseline-browser-mapping": "^2.9.11",
|
||||
"cross-env": "^10.1.0",
|
||||
"dexie": "^3.2.4",
|
||||
"dotenv": "^17.2.3",
|
||||
"dpdm": "^3.14.0",
|
||||
"electron": "^38.4.0",
|
||||
"electron": "^39.2.7",
|
||||
"electron-builder": "^26.0.12",
|
||||
"electron-vite": "^4.0.1",
|
||||
"electron-vite": "^5.0.0",
|
||||
"eslint": "^9.39.2",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-jsonc": "^2.21.0",
|
||||
|
||||
@@ -43,7 +43,7 @@ export function setMiniWindowShape(win: BrowserWindow) {
|
||||
win.setShape(shape)
|
||||
}
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const preloadPath = fileURLToPath(new URL('../preload/index.mjs', import.meta.url))
|
||||
|
||||
const { width: defaultWindowWidth, height: defaultWindowHeight } = getDefaultWindowSizes()
|
||||
@@ -181,7 +181,7 @@ windowList.set(IWindowList.TRAY_WINDOW, {
|
||||
if (!app.isPackaged && process.env.ELECTRON_RENDERER_URL) {
|
||||
window.loadURL(process.env.ELECTRON_RENDERER_URL)
|
||||
} else {
|
||||
window.loadFile(path.join(__dirname, '../renderer/index.html'))
|
||||
window.loadFile(path.join(dirname, '../renderer/index.html'))
|
||||
}
|
||||
window.on('blur', () => {
|
||||
window.hide()
|
||||
@@ -197,7 +197,7 @@ windowList.set(IWindowList.SETTING_WINDOW, {
|
||||
if (!app.isPackaged && process.env.ELECTRON_RENDERER_URL) {
|
||||
window.loadURL(`${process.env.ELECTRON_RENDERER_URL}#main-page/upload`)
|
||||
} else {
|
||||
window.loadFile(path.join(__dirname, '../renderer/index.html'), {
|
||||
window.loadFile(path.join(dirname, '../renderer/index.html'), {
|
||||
hash: 'main-page/upload',
|
||||
})
|
||||
}
|
||||
@@ -222,7 +222,7 @@ windowList.set(IWindowList.MINI_WINDOW, {
|
||||
if (!app.isPackaged && process.env.ELECTRON_RENDERER_URL) {
|
||||
window.loadURL(`${process.env.ELECTRON_RENDERER_URL}#mini-page`)
|
||||
} else {
|
||||
window.loadFile(path.join(__dirname, '../renderer/index.html'), {
|
||||
window.loadFile(path.join(dirname, '../renderer/index.html'), {
|
||||
hash: 'mini-page',
|
||||
})
|
||||
}
|
||||
@@ -237,7 +237,7 @@ windowList.set(IWindowList.RENAME_WINDOW, {
|
||||
if (!app.isPackaged && process.env.ELECTRON_RENDERER_URL) {
|
||||
window.loadURL(`${process.env.ELECTRON_RENDERER_URL}#rename-page`)
|
||||
} else {
|
||||
window.loadFile(path.join(__dirname, '../renderer/index.html'), {
|
||||
window.loadFile(path.join(dirname, '../renderer/index.html'), {
|
||||
hash: 'rename-page',
|
||||
})
|
||||
}
|
||||
@@ -259,7 +259,7 @@ windowList.set(IWindowList.TOOLBOX_WINDOW, {
|
||||
if (!app.isPackaged && process.env.ELECTRON_RENDERER_URL) {
|
||||
window.loadURL(`${process.env.ELECTRON_RENDERER_URL}#toolbox-page`)
|
||||
} else {
|
||||
window.loadFile(path.join(__dirname, '../renderer/index.html'), {
|
||||
window.loadFile(path.join(dirname, '../renderer/index.html'), {
|
||||
hash: 'toolbox-page',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import yaml from 'js-yaml'
|
||||
import type { ILocales, ILocalesKey } from '#/types/i18n'
|
||||
import type { II18nItem, IStringKeyMap } from '#/types/types'
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
const builtinI18nList: II18nItem[] = [
|
||||
{
|
||||
@@ -26,7 +26,7 @@ const builtinI18nList: II18nItem[] = [
|
||||
]
|
||||
class I18nManager {
|
||||
private i18n: I18n | null = null
|
||||
private builtinI18nFolder = path.join(__dirname, '../../resources', 'i18n').replace('app.asar', 'app.asar.unpacked')
|
||||
private builtinI18nFolder = path.join(dirname, '../../resources', 'i18n').replace('app.asar', 'app.asar.unpacked')
|
||||
private outterI18nFolder = ''
|
||||
private localesMap = new Map<string, ILocales>()
|
||||
private currentLanguage: string = 'zh-CN'
|
||||
|
||||
@@ -39,6 +39,7 @@ import { CLIPBOARD_IMAGE_FOLDER } from '~/utils/static'
|
||||
import updateChecker from '~/utils/updateChecker'
|
||||
|
||||
const isDevelopment = process.env.NODE_ENV !== 'production'
|
||||
process.noDeprecation = true
|
||||
|
||||
const handleStartUpFiles = (argv: string[], cwd: string) => {
|
||||
const files = getUploadFiles(argv, cwd, logger)
|
||||
|
||||
@@ -11,7 +11,7 @@ import { i18nManager } from '~/i18n'
|
||||
|
||||
const configPath = dbPathChecker()
|
||||
const CONFIG_DIR = path.dirname(configPath)
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
function beforeOpen() {
|
||||
if (process.platform === 'darwin') {
|
||||
@@ -50,7 +50,7 @@ function resolveMacWorkFlow() {
|
||||
try {
|
||||
copyFileOutsideOfElectronAsar(
|
||||
path
|
||||
.join(__dirname, '../../resources', 'Upload pictures with PicList.workflow')
|
||||
.join(dirname, '../../resources', 'Upload pictures with PicList.workflow')
|
||||
.replace('app.asar', 'app.asar.unpacked'),
|
||||
dest,
|
||||
)
|
||||
@@ -93,7 +93,7 @@ function resolveClipboardImageGenerator() {
|
||||
|
||||
return files.map(item => {
|
||||
return {
|
||||
origin: path.join(__dirname, '../../resources', item).replace('app.asar', 'app.asar.unpacked'),
|
||||
origin: path.join(dirname, '../../resources', item).replace('app.asar', 'app.asar.unpacked'),
|
||||
dest: path.join(CONFIG_DIR, item),
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user