mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-09-05 23:47:43 +08:00
✨ Feature: add global value for PicGo get GUI_VERSION & CORE_VERSION
This commit is contained in:
@@ -16,4 +16,7 @@ picgo.saveConfig({
|
|||||||
PICGO_ENV: 'GUI'
|
PICGO_ENV: 'GUI'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
picgo.GUI_VERSION = global.PICGO_GUI_VERSION
|
||||||
|
|
||||||
export default picgo! as PicGoCore
|
export default picgo! as PicGoCore
|
||||||
|
|||||||
@@ -2,11 +2,18 @@ import fs from 'fs-extra'
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import os from 'os'
|
import os from 'os'
|
||||||
import { remote, app } from 'electron'
|
import { remote, app } from 'electron'
|
||||||
|
import pkg from 'root/package.json'
|
||||||
|
|
||||||
const APP = process.type === 'renderer' ? remote.app : app
|
const APP = process.type === 'renderer' ? remote.app : app
|
||||||
const STORE_PATH = APP.getPath('userData')
|
const STORE_PATH = APP.getPath('userData')
|
||||||
|
|
||||||
|
function injectPicGoVersion () {
|
||||||
|
global.PICGO_GUI_VERSION = pkg.version
|
||||||
|
global.PICGO_CORE_VERSION = pkg.dependencies.picgo.replace('^', '')
|
||||||
|
}
|
||||||
|
|
||||||
function beforeOpen () {
|
function beforeOpen () {
|
||||||
|
injectPicGoVersion()
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
resolveMacWorkFlow()
|
resolveMacWorkFlow()
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+10
@@ -20,3 +20,13 @@ declare interface IWindowManager {
|
|||||||
deleteById: (id: number) => void
|
deleteById: (id: number) => void
|
||||||
getAvailableWindow: () => BrowserWindow
|
getAvailableWindow: () => BrowserWindow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://stackoverflow.com/questions/35074713/extending-typescript-global-object-in-node-js/44387594#44387594
|
||||||
|
declare global {
|
||||||
|
namespace NodeJS {
|
||||||
|
interface Global {
|
||||||
|
PICGO_GUI_VERSION: string
|
||||||
|
PICGO_CORE_VERSION: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user