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

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`);