Merge branch 'MSP-3074_App-version' into 'main'
MSP-3074 remove interface Window from configUtils, remove <link> from... Closes MSP-3074 See merge request isp/isp-admin-ui!12
This commit is contained in:
commit
285c0e87aa
10 files changed
+47
-29
No files matched your search
@@ -13,7 +13,7 @@
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:import/typescript"
|
||||
],
|
||||
"ignorePatterns": ["node_modules", "build"],
|
||||
"ignorePatterns": ["node_modules", "build", "generateVersionFile.cjs"],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaFeatures": {
|
||||
|
||||
@@ -13,3 +13,4 @@ tests/**/*.jsx
|
||||
!.yarn/versions
|
||||
.pnp.*
|
||||
.env
|
||||
version.json
|
||||
@@ -1,3 +1,5 @@
|
||||
## 0.3.2
|
||||
- Добавлен generateVersionFile.cjs
|
||||
## 0.3.1
|
||||
-Добавлена обработка ошибок в интерсепторсе
|
||||
## 0.3.0
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
const fs = require('fs');
|
||||
const packageJson = require('./package.json');
|
||||
|
||||
function writeJsonFile(filePath, data) {
|
||||
fs.writeFileSync(filePath, JSON.stringify(data));
|
||||
}
|
||||
|
||||
function readHtmlFile(filePath) {
|
||||
return fs.readFileSync(filePath, 'utf8');
|
||||
}
|
||||
|
||||
function writeHtmlFile(filePath, data) {
|
||||
fs.writeFileSync(filePath, data);
|
||||
}
|
||||
|
||||
const welcomePagePath = 'build/index.html';
|
||||
|
||||
let indexHtml = readHtmlFile(welcomePagePath);
|
||||
|
||||
const scriptTagRegex = /<script type="module">window\.AppVersion\s*=\s*'.*';<\/script>/;
|
||||
const scriptTag = `<script type="module">window.AppVersion = '${packageJson.version}';</script>`;
|
||||
indexHtml = indexHtml
|
||||
.replace(scriptTagRegex, '')
|
||||
.replace('</head>', `${scriptTag}</head>`);
|
||||
|
||||
writeHtmlFile(welcomePagePath, indexHtml);
|
||||
|
||||
const versionData = {
|
||||
version: packageJson.version,
|
||||
};
|
||||
|
||||
writeJsonFile('build/version.json', versionData);
|
||||
writeJsonFile('version.json', versionData);
|
||||
+4
-5
@@ -2,15 +2,14 @@
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + React + TS</title>
|
||||
<script>
|
||||
window.AppVersion = '<%=APP_VERSION%>'
|
||||
<script type="module" src="/src/index.tsx"></script>
|
||||
<script type="module">
|
||||
window.AppVersion = APP_VERSION
|
||||
</script>
|
||||
</head>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/index.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "isp-admin-ui",
|
||||
"version": "0.2.4",
|
||||
"version": "0.3.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "isp-admin-ui",
|
||||
"version": "0.2.4",
|
||||
"version": "0.3.1",
|
||||
"dependencies": {
|
||||
"@reduxjs/toolkit": "^2.2.3",
|
||||
"@types/react-router-dom": "^5.3.3",
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "isp-admin-ui",
|
||||
"private": true,
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"build": "tsc && vite build && node generateVersionFile.cjs",
|
||||
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||
"preview": "vite preview",
|
||||
"fix:prettier": "prettier --write \"src/**/*.{ts,tsx, js}\"",
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
import { Layout } from 'antd'
|
||||
|
||||
import UserMenu from '@components/UserMenu/UserMenu.tsx'
|
||||
|
||||
import './header.scss'
|
||||
|
||||
|
||||
const { Header: AntdHeader } = Layout
|
||||
|
||||
const Header = () => {
|
||||
return (
|
||||
<AntdHeader className="header">
|
||||
<UserMenu />
|
||||
</AntdHeader>
|
||||
)
|
||||
}
|
||||
|
||||
export default Header
|
||||
@@ -1,6 +1,6 @@
|
||||
declare global {
|
||||
interface Window {
|
||||
config?: any
|
||||
config: { [key: string]: any };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
@@ -1 +1,2 @@
|
||||
/// <reference types="vite/client" />
|
||||
declare const APP_VERSION: string
|
||||
Reference in new issue
Block a user