mirror of
https://github.com/marktext/marktext.git
synced 2025-05-02 22:59:11 +08:00

* Files via command-line are opened in the best window * Don't show FSW changed notification while saving * Fixed source-code mode setting and remove focus/typewritter option * Simplify ignore list * Fix invalid dialog parameter * Fix invalid dialog parameter (2) * Use async message box dialog * Update documentation * few changes * Check timer before calling clearTimeout * Improve switch style * Fix style
39 lines
1.3 KiB
JavaScript
39 lines
1.3 KiB
JavaScript
const GitRevisionPlugin = require('git-revision-webpack-plugin')
|
|
const { version } = require('../package.json')
|
|
|
|
const getEnvironmentDefinitions = function () {
|
|
let shortHash = 'N/A'
|
|
let fullHash = 'N/A'
|
|
try {
|
|
const gitRevisionPlugin = new GitRevisionPlugin()
|
|
shortHash = gitRevisionPlugin.version()
|
|
fullHash = gitRevisionPlugin.commithash()
|
|
} catch(_) {
|
|
// Ignore error if we build without git.
|
|
}
|
|
|
|
const isStableRelease = !!process.env.MARKTEXT_IS_STABLE
|
|
const versionSuffix = isStableRelease ? '' : ` (${shortHash})`
|
|
return {
|
|
'global.MARKTEXT_GIT_SHORT_HASH': JSON.stringify(shortHash),
|
|
'global.MARKTEXT_GIT_HASH': JSON.stringify(fullHash),
|
|
|
|
'global.MARKTEXT_VERSION': JSON.stringify(version),
|
|
'global.MARKTEXT_VERSION_STRING': JSON.stringify(`v${version}${versionSuffix}`),
|
|
'global.MARKTEXT_IS_STABLE': JSON.stringify(isStableRelease)
|
|
}
|
|
}
|
|
|
|
const getRendererEnvironmentDefinitions = function () {
|
|
const env = getEnvironmentDefinitions()
|
|
return {
|
|
'process.versions.MARKTEXT_VERSION': env['global.MARKTEXT_VERSION'],
|
|
'process.versions.MARKTEXT_VERSION_STRING': env['global.MARKTEXT_VERSION_STRING'],
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
getEnvironmentDefinitions: getEnvironmentDefinitions,
|
|
getRendererEnvironmentDefinitions: getRendererEnvironmentDefinitions
|
|
}
|