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

2
.env
View File

@ -1,2 +1,2 @@
REACT_APP_BASE_URL=/dashboard
REACT_APP_API_URL=https://tpay.shiblysolution.id/api/
REACT_APP_API_URL=https://tpay.shiblysolution.id/api/

34231
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

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