Revert vite build

This commit is contained in:
lyswhut
2023-08-17 17:49:47 +08:00
parent 99eb2856f7
commit 53bc50d05c
63 changed files with 11408 additions and 2565 deletions
+2 -2
View File
@@ -21,8 +21,8 @@ export const initGlobalData = () => {
global.staticPath =
process.env.NODE_ENV !== 'production'
? __STATIC_PATH__
: path.join(encodePath(__dirname), '../static')
? webpackStaticPath
: path.join(encodePath(__dirname), 'static')
}
export const initSingleInstanceHandle = () => {
+1 -1
View File
@@ -26,5 +26,5 @@ app.on('ready', () => {
})
// Require `main` process to boot app
import('./index')
require('./index')
+4 -5
View File
@@ -27,16 +27,15 @@ const winEvent = () => {
export const createWindow = async(userApi: LX.UserApi.UserApiInfo) => {
await closeWindow()
dir ??= process.env.NODE_ENV !== 'production' ? path.join(__USER_API_PATH__, 'renderer') : encodePath(__dirname)
dir ??= process.env.NODE_ENV !== 'production' ? webpackUserApiPath : path.join(encodePath(__dirname), 'userApi')
if (!html) {
html = await fs.promises.readFile(path.join(dir, 'user-api.html'), 'utf8')
html = await fs.promises.readFile(path.join(dir, 'renderer/user-api.html'), 'utf8')
}
const preloadUrl = process.env.NODE_ENV !== 'production'
? `${path.join(encodePath(__dirname), '../dist/user-api-preload.js')}`
: `${path.join(encodePath(__dirname), '../preload/user-api-preload.js')}`
// console.log(preloadUrl, html)
: `${path.join(encodePath(__dirname), 'user-api-preload.js')}`
// console.log(preloadUrl)
/**
* Initial window options
+1 -1
View File
@@ -139,7 +139,7 @@ export const createWindow = () => {
},
})
const winURL = process.env.NODE_ENV !== 'production' ? 'http://localhost:9081' : `file://${path.join(encodePath(__dirname), '../renderer-lyric/index.html')}`
const winURL = process.env.NODE_ENV !== 'production' ? 'http://localhost:9081/lyric.html' : `file://${path.join(encodePath(__dirname), 'lyric.html')}`
void browserWindow.loadURL(winURL + `?dark=${shouldUseDarkColors}&theme=${encodeURIComponent(JSON.stringify(theme))}`)
winEvent()
-1
View File
@@ -87,7 +87,6 @@ export const watchConfigKeys = [
export const buildLyricConfig = (appSetting: Partial<LX.AppSetting>): Partial<LX.DesktopLyric.Config> => {
const setting: Partial<LX.DesktopLyric.Config> = {}
for (const key of watchConfigKeys) {
// @ts-expect-error
if (key in appSetting) setting[key] = appSetting[key]
}
return setting
+1 -1
View File
@@ -99,7 +99,7 @@ export const createWindow = () => {
}
browserWindow = new BrowserWindow(options)
const winURL = process.env.NODE_ENV !== 'production' ? 'http://localhost:9080' : `file://${path.join(encodePath(__dirname), '../renderer/index.html')}`
const winURL = process.env.NODE_ENV !== 'production' ? 'http://localhost:9080' : `file://${path.join(encodePath(__dirname), 'index.html')}`
void browserWindow.loadURL(winURL + `?dt=${!!global.envParams.cmdParams.dt}&dark=${shouldUseDarkColors}&theme=${encodeURIComponent(JSON.stringify(theme))}`)
winEvent()
@@ -1,5 +1,5 @@
import { createInflate, constants as zlibConstants } from 'node:zlib'
import path from 'node:path'
// import path from 'path'
import { mainHandle } from '@common/mainIpc'
import { WIN_MAIN_RENDERER_EVENT_NAME } from '@common/ipcNames'
@@ -40,7 +40,7 @@ const handleDecode = async(lrc: string, tlrc: string, rlrc: string) => {
// const nativeBindingPath = path.join(__dirname, '../build/Release/qrc_decode.node')
// const nativeBindingPath = process.env.NODE_ENV !== 'production' ? path.join(__dirname, '../build/Release/qrc_decode.node')
// eslint-disable-next-line @typescript-eslint/no-var-requires
const addon = require(path.join(__QRC_DECODE_NODE_PATH__, 'qrc_decode.node'))
const addon = require('qrc_decode.node')
// console.log(addon)
qrc_decode = addon.qrc_decode
}
-1
View File
@@ -1,7 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"resolveJsonModule": true,
"typeRoots": [
"./types"
],
+2 -3
View File
@@ -9,7 +9,6 @@
// // }
// // }
declare const __STATIC_PATH__: string
declare const __USER_API_PATH__: string
declare const __QRC_DECODE_NODE_PATH__: string
declare const webpackStaticPath: string
declare const webpackUserApiPath: string
+1 -1
View File
@@ -18,7 +18,7 @@ const initTables = (db: Database.Database) => {
// 打开、初始化数据库
export const init = (lxDataPath: string): boolean | null => {
const databasePath = path.join(lxDataPath, 'lx.data.db')
const nativeBinding = path.join(__dirname, '../../node_modules/better-sqlite3/build/Release/better_sqlite3.node')
const nativeBinding = path.join(__dirname, '../node_modules/better-sqlite3/build/Release/better_sqlite3.node')
let dbFileExists = true
try {
+6 -6
View File
@@ -1,15 +1,15 @@
import { Worker } from 'node:worker_threads'
import * as Comlink from 'comlink'
import nodeEndpoint from 'comlink/dist/esm/node-adapter'
import path from 'node:path'
// import dbService from '../dbService/index'
export declare type DBSeriveTypes = Comlink.Remote<LX.WorkerDBSeriveListTypes>
export type DBSeriveTypes = Comlink.Remote<LX.WorkerDBSeriveListTypes>
export const createDBServiceWorker = () => {
// console.log(new URL('../dbService', import.meta.url))
// console.log(__dirname)
const worker: Worker = new Worker(path.join(__dirname, './dbService.worker'))
const worker: Worker = new Worker(new URL(
/* webpackChunkName: 'dbService.worker' */
'../dbService',
import.meta.url,
))
return Comlink.wrap<LX.WorkerDBSeriveListTypes>(nodeEndpoint(worker))
}