Add parameters env and prebuild script
This commit is contained in:
parent
92da334aee
commit
527bc77822
3
.env
3
.env
@ -1 +1,4 @@
|
|||||||
REACT_APP_IMAGE_BASE_URL=https://img2.baidu.com
|
REACT_APP_IMAGE_BASE_URL=https://img2.baidu.com
|
||||||
|
REACT_APP_ASSISTANT_DISPLAY_NAME_EN=
|
||||||
|
REACT_APP_ASSISTANT_DISPLAY_NAME_ZH=
|
||||||
|
REACT_APP_LOGO_FILE=
|
||||||
|
@ -53,11 +53,11 @@
|
|||||||
"lint": "eslint src --ext ts",
|
"lint": "eslint src --ext ts",
|
||||||
"test": "mocha",
|
"test": "mocha",
|
||||||
"build": "webpack --config webpack.config.js",
|
"build": "webpack --config webpack.config.js",
|
||||||
"vscode": "webpack --config webpack.config.js && mv dist/* ../dist",
|
"vscode": "node prebuild.js && webpack --config webpack.config.js && mv dist/* ../dist",
|
||||||
"vscode:watch": "webpack --config webpack.config.js --watch",
|
"vscode:watch": "webpack --config webpack.config.js --watch",
|
||||||
"dev": "webpack serve --config webpack.config.js --open",
|
"dev": "webpack serve --config webpack.config.js --open",
|
||||||
"build:idea": "webpack --config webpack.idea.config.js",
|
"build:idea": "webpack --config webpack.idea.config.js",
|
||||||
"idea": "webpack --config webpack.idea.config.js && mv dist/main.js dist/main.html ../src/main/resources/static && echo '🎆done'"
|
"idea": "node prebuild.js && webpack --config webpack.idea.config.js && mv dist/main.js dist/main.html ../src/main/resources/static && echo '🎆done'"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.21.8",
|
"@babel/core": "^7.21.8",
|
||||||
|
23
prebuild.js
Normal file
23
prebuild.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
require('dotenv').config();
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const logoPath = process.env.REACT_APP_LOGO_FILE;
|
||||||
|
if (!logoPath) {
|
||||||
|
console.warn('REACT_APP_LOGO_FILE is not defined in your environment variables');
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
if (!fs.existsSync(logoPath)) {
|
||||||
|
console.warn('Logo file does not exist.');
|
||||||
|
process.exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
const destPath = path.join(__dirname, 'src/views/components/MessageAvatar/avatar_devchat.svg');
|
||||||
|
|
||||||
|
try {
|
||||||
|
fs.copyFileSync(logoPath, destPath)
|
||||||
|
fs.chmodSync(destPath, 0o644)
|
||||||
|
} catch(e) {
|
||||||
|
console.warn(`Failed to copy logo ${e}`)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user