update dynamic underpath

This commit is contained in:
Ubuntu
2025-02-01 16:12:42 +07:00
parent f35405f431
commit c3de7d9dad
4 changed files with 17212 additions and 17159 deletions

34231
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,58 +1,61 @@
{ {
"name": "new-tpay", "name": "new-tpay",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@emotion/react": "^11.14.0", "@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0", "@emotion/styled": "^11.14.0",
"@mui/icons-material": "^6.2.1", "@mui/icons-material": "^6.2.1",
"@mui/material": "^6.2.1", "@mui/material": "^6.2.1",
"@reduxjs/toolkit": "^2.5.0", "@reduxjs/toolkit": "^2.5.0",
"@testing-library/jest-dom": "^5.17.0", "@testing-library/jest-dom": "^5.17.0",
"@testing-library/user-event": "^13.5.0", "@testing-library/user-event": "^13.5.0",
"ajv": "^8.17.1", "ajv": "^8.17.1",
"ajv-keywords": "^5.1.0", "ajv-keywords": "^5.1.0",
"axios": "^1.7.9", "axios": "^1.7.9",
"chart.js": "^4.4.7", "chart.js": "^4.4.7",
"js-cookie": "^3.0.5", "dotenv": "^16.4.7",
"react": "^18.3.1", "js-cookie": "^3.0.5",
"react-chartjs-2": "^5.2.0", "react": "^18.3.1",
"react-circular-progressbar": "^2.1.0", "react-chartjs-2": "^5.2.0",
"react-dom": "^18.3.1", "react-circular-progressbar": "^2.1.0",
"react-redux": "^9.2.0", "react-dom": "^18.3.1",
"react-router-dom": "^7.1.1", "react-redux": "^9.2.0",
"react-scripts": "5.0.1", "react-router-dom": "^7.1.1",
"redux": "^5.0.1", "react-scripts": "5.0.1",
"web-vitals": "^2.1.4" "redux": "^5.0.1",
}, "web-vitals": "^2.1.4"
"scripts": { },
"start": "react-scripts start eslint-disable-next-line", "scripts": {
"build": "react-scripts build", "prebuild": "node set-homepage.js",
"test": "react-scripts test", "start": "react-scripts start eslint-disable-next-line",
"eject": "react-scripts eject" "build": "react-scripts build",
}, "test": "react-scripts test",
"eslintConfig": { "eject": "react-scripts eject"
"extends": [ },
"react-app", "eslintConfig": {
"react-app/jest" "extends": [
] "react-app",
}, "react-app/jest"
"browserslist": { ]
"production": [ },
">0.2%", "browserslist": {
"not dead", "production": [
"not op_mini all" ">0.2%",
], "not dead",
"development": [ "not op_mini all"
"last 1 chrome version", ],
"last 1 firefox version", "development": [
"last 1 safari version" "last 1 chrome version",
] "last 1 firefox version",
}, "last 1 safari version"
"devDependencies": { ]
"@babel/plugin-proposal-private-property-in-object": "^7.21.11", },
"@babel/plugin-transform-private-property-in-object": "^7.25.9", "devDependencies": {
"@testing-library/dom": "^10.4.0", "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@testing-library/react": "^16.1.0" "@babel/plugin-transform-private-property-in-object": "^7.25.9",
} "@testing-library/dom": "^10.4.0",
"@testing-library/react": "^16.1.0"
},
"homepage": "/dashboard"
} }

21
set-homepage.js Normal file
View File

@ -0,0 +1,21 @@
const fs = require('fs');
const path = require('path');
const dotenv = require('dotenv');
// Load environment variables from .env
dotenv.config();
// Get the REACT_APP_BASE_URL from .env
const baseUrl = process.env.REACT_APP_BASE_URL || '/';
// Read the package.json file
const packageJsonPath = path.join(__dirname, 'package.json');
const packageJson = require(packageJsonPath);
// Update the homepage field in package.json
packageJson.homepage = baseUrl;
// Write the updated package.json back to the file
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
console.log(`Updated homepage to ${baseUrl} in package.json`);