mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add package.json name and version as defines to avoid importing the package.json in code
This commit is contained in:
parent
a34fbadaab
commit
facbda4f2f
6 changed files with 13 additions and 10 deletions
|
@ -265,7 +265,9 @@ module.exports = {
|
||||||
// Build time definitions
|
// Build time definitions
|
||||||
__JF_BUILD_VERSION__: 'readonly',
|
__JF_BUILD_VERSION__: 'readonly',
|
||||||
__USE_SYSTEM_FONTS__: 'readonly',
|
__USE_SYSTEM_FONTS__: 'readonly',
|
||||||
__WEBPACK_SERVE__: 'readonly'
|
__WEBPACK_SERVE__: 'readonly',
|
||||||
|
__PACKAGE_JSON_NAME__: 'readonly',
|
||||||
|
__PACKAGE_JSON_VERSION__: 'readonly'
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'@typescript-eslint/prefer-string-starts-ends-with': ['error']
|
'@typescript-eslint/prefer-string-starts-ends-with': ['error']
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import Package from '../../package.json';
|
|
||||||
import appSettings from '../scripts/settings/appSettings';
|
import appSettings from '../scripts/settings/appSettings';
|
||||||
import browser from '../scripts/browser';
|
import browser from '../scripts/browser';
|
||||||
import Events from '../utils/events.ts';
|
import Events from '../utils/events.ts';
|
||||||
|
@ -36,7 +35,7 @@ function getDeviceProfile(item) {
|
||||||
let profile;
|
let profile;
|
||||||
|
|
||||||
if (window.NativeShell) {
|
if (window.NativeShell) {
|
||||||
profile = window.NativeShell.AppHost.getDeviceProfile(profileBuilder, Package.version);
|
profile = window.NativeShell.AppHost.getDeviceProfile(profileBuilder, __PACKAGE_JSON_VERSION__);
|
||||||
} else {
|
} else {
|
||||||
const builderOpts = getBaseProfileOptions(item);
|
const builderOpts = getBaseProfileOptions(item);
|
||||||
profile = profileBuilder(builderOpts);
|
profile = profileBuilder(builderOpts);
|
||||||
|
@ -378,7 +377,7 @@ export const appHost = {
|
||||||
},
|
},
|
||||||
appVersion: function () {
|
appVersion: function () {
|
||||||
return window.NativeShell?.AppHost?.appVersion ?
|
return window.NativeShell?.AppHost?.appVersion ?
|
||||||
window.NativeShell.AppHost.appVersion() : Package.version;
|
window.NativeShell.AppHost.appVersion() : __PACKAGE_JSON_VERSION__;
|
||||||
},
|
},
|
||||||
getPushTokenInfo: function () {
|
getPushTokenInfo: function () {
|
||||||
return {};
|
return {};
|
||||||
|
|
|
@ -26,8 +26,6 @@ import { getSystemInfoQuery } from 'hooks/useSystemInfo';
|
||||||
import { toApi } from 'utils/jellyfin-apiclient/compat';
|
import { toApi } from 'utils/jellyfin-apiclient/compat';
|
||||||
import { queryClient } from 'utils/query/queryClient';
|
import { queryClient } from 'utils/query/queryClient';
|
||||||
|
|
||||||
import { version as WEB_VERSION } from '../../../package.json';
|
|
||||||
|
|
||||||
import '../../elements/emby-button/emby-button';
|
import '../../elements/emby-button/emby-button';
|
||||||
import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||||
|
|
||||||
|
@ -210,7 +208,7 @@ function refreshActiveRecordings(view, apiClient) {
|
||||||
|
|
||||||
function reloadSystemInfo(view, apiClient) {
|
function reloadSystemInfo(view, apiClient) {
|
||||||
view.querySelector('#buildVersion').innerText = __JF_BUILD_VERSION__;
|
view.querySelector('#buildVersion').innerText = __JF_BUILD_VERSION__;
|
||||||
view.querySelector('#webVersion').innerText = WEB_VERSION;
|
view.querySelector('#webVersion').innerText = __PACKAGE_JSON_VERSION__;
|
||||||
|
|
||||||
queryClient
|
queryClient
|
||||||
.fetchQuery(getSystemInfoQuery(toApi(apiClient)))
|
.fetchQuery(getSystemInfoQuery(toApi(apiClient)))
|
||||||
|
|
2
src/global.d.ts
vendored
2
src/global.d.ts
vendored
|
@ -18,4 +18,6 @@ export declare global {
|
||||||
const __JF_BUILD_VERSION__: string;
|
const __JF_BUILD_VERSION__: string;
|
||||||
const __USE_SYSTEM_FONTS__: string;
|
const __USE_SYSTEM_FONTS__: string;
|
||||||
const __WEBPACK_SERVE__: string;
|
const __WEBPACK_SERVE__: string;
|
||||||
|
const __PACKAGE_JSON_NAME__: string;
|
||||||
|
const __PACKAGE_JSON_VERSION__: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@ import './legacy/vendorStyles';
|
||||||
import { currentSettings } from './scripts/settings/userSettings';
|
import { currentSettings } from './scripts/settings/userSettings';
|
||||||
import taskButton from './scripts/taskbutton';
|
import taskButton from './scripts/taskbutton';
|
||||||
import RootApp from './RootApp.tsx';
|
import RootApp from './RootApp.tsx';
|
||||||
import { name as WEB_NAME, version as WEB_VERSION } from '../package.json';
|
|
||||||
|
|
||||||
import './styles/livetv.scss';
|
import './styles/livetv.scss';
|
||||||
import './styles/dashboard.scss';
|
import './styles/dashboard.scss';
|
||||||
|
@ -61,7 +60,7 @@ function loadCoreDictionary() {
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
// Log current version to console to help out with issue triage and debugging
|
// Log current version to console to help out with issue triage and debugging
|
||||||
console.log(`${WEB_NAME} version ${WEB_VERSION} build ${__JF_BUILD_VERSION__}`);
|
console.log(`${__PACKAGE_JSON_NAME__} version ${__PACKAGE_JSON_VERSION__} build ${__JF_BUILD_VERSION__}`);
|
||||||
|
|
||||||
// This is used in plugins
|
// This is used in plugins
|
||||||
window.Events = Events;
|
window.Events = Events;
|
||||||
|
|
|
@ -5,6 +5,7 @@ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
const { DefinePlugin } = require('webpack');
|
const { DefinePlugin } = require('webpack');
|
||||||
|
const packageJson = require('./package.json');
|
||||||
|
|
||||||
const Assets = [
|
const Assets = [
|
||||||
'native-promise-only/npo.js',
|
'native-promise-only/npo.js',
|
||||||
|
@ -52,7 +53,9 @@ const config = {
|
||||||
'Dev Server' :
|
'Dev Server' :
|
||||||
process.env.JELLYFIN_VERSION || 'Release'),
|
process.env.JELLYFIN_VERSION || 'Release'),
|
||||||
__USE_SYSTEM_FONTS__: JSON.stringify(!!process.env.USE_SYSTEM_FONTS),
|
__USE_SYSTEM_FONTS__: JSON.stringify(!!process.env.USE_SYSTEM_FONTS),
|
||||||
__WEBPACK_SERVE__: JSON.stringify(!!process.env.WEBPACK_SERVE)
|
__WEBPACK_SERVE__: JSON.stringify(!!process.env.WEBPACK_SERVE),
|
||||||
|
__PACKAGE_JSON_NAME__: JSON.stringify(packageJson.name),
|
||||||
|
__PACKAGE_JSON_VERSION__: JSON.stringify(packageJson.version)
|
||||||
}),
|
}),
|
||||||
new CleanWebpackPlugin(),
|
new CleanWebpackPlugin(),
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue