mirror of
https://github.com/teableio/teable.git
synced 2026-03-23 00:04:56 +08:00
* feat: plugins * feat: dashboard panel and plugin publish procedure * chore: rename dashboard db name * feat: base query add cell format params * feat: dashboard and plugin render * feat: dashboard permission controll * chore: remove chart page * feat: add isExpand status * feat: auth plugin render * feat: chart plugin * chore: add plugin chart scripts * chore: remove dist * feat: plugin docker build and chart plugin init * chore: plugin chart build * chore: plugin chart lint * fix: base query e2e * fix: markdown preview theme * fix: plugin e2e * fix: first admin user * fix: insert env in nextjs-app/.env * fix: e2e error * fix: plugin rows * fix: plugin and dashboard service spec * fix: init official plugin lock attachments database table * fix: test error * fix: init plugin conflict on e2e * fix: init plugin conflict on e2e * fix: init plugin conflict on e2e * fix: init plugin conflict on e2e * chore: better message * fix: init plugin conflict on e2e * chore: remove lock
44 lines
1.4 KiB
JavaScript
44 lines
1.4 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
// Path to the server.js file
|
|
const serverJsPath = path.join(process.cwd(), '.next/standalone/plugins/chart/server.js');
|
|
|
|
// Read the file content
|
|
let serverJs = fs.readFileSync(serverJsPath, 'utf8');
|
|
|
|
// Modify the some environment variables and default environment variables
|
|
serverJs = serverJs
|
|
.replace(/process\.env\.PORT/g, 'process.env.PLUGIN_SERVER_PORT')
|
|
.replace(/process\.env\.HOSTNAME/g, "'0.0.0.0'")
|
|
.replace(/3000/g, '3002');
|
|
|
|
// Write the modified content back to the server.js file
|
|
fs.writeFileSync(serverJsPath, serverJs, 'utf8');
|
|
|
|
// Move the static directory
|
|
// Path for moving the static directory
|
|
const staticSrc = path.join(process.cwd(), '.next/static');
|
|
const staticDest = path.join(process.cwd(), '.next/standalone/plugins/chart/.next/static');
|
|
|
|
try {
|
|
// Check if the source directory exists
|
|
if (fs.existsSync(staticSrc)) {
|
|
// Ensure the destination directory exists
|
|
const destDir = path.dirname(staticDest);
|
|
if (!fs.existsSync(destDir)) {
|
|
fs.mkdirSync(destDir, { recursive: true });
|
|
}
|
|
|
|
// Move the directory
|
|
fs.renameSync(staticSrc, staticDest);
|
|
console.log('Directory moved successfully:', staticSrc, '->', staticDest);
|
|
} else {
|
|
console.log('Source directory does not exist:', staticSrc);
|
|
}
|
|
} catch (error) {
|
|
console.error('Error moving directory:', error);
|
|
}
|
|
|
|
|
|
console.log('File modifications complete.'); |