2023-12-12 05:00:33 +08:00
|
|
|
import * as path from 'node:path';
|
|
|
|
import * as url from 'node:url';
|
2023-12-22 13:27:13 +08:00
|
|
|
import { rewriteRules } from './middleware.js';
|
2023-12-12 05:00:33 +08:00
|
|
|
|
|
|
|
const __filename = url.fileURLToPath(import.meta.url);
|
|
|
|
const __dirname = path.dirname(__filename);
|
2023-12-22 13:27:13 +08:00
|
|
|
|
|
|
|
// Production (CDN URLs, watch disabled)
|
|
|
|
export const prodConfig = {
|
2023-12-12 05:00:33 +08:00
|
|
|
hostname: '127.0.0.1',
|
|
|
|
notify: false,
|
|
|
|
open: false,
|
2023-12-22 13:27:13 +08:00
|
|
|
port: 8080,
|
|
|
|
server: {
|
|
|
|
baseDir: './docs',
|
|
|
|
},
|
|
|
|
snippet: false,
|
|
|
|
ui: false,
|
|
|
|
};
|
|
|
|
|
|
|
|
// Development (local URLs, watch enabled)
|
|
|
|
export const devConfig = {
|
|
|
|
...prodConfig,
|
2024-05-22 04:19:21 +08:00
|
|
|
files: ['CHANGELOG.md', 'docs/**/*', 'dist/**/*'],
|
2023-12-22 13:27:13 +08:00
|
|
|
port: 3000,
|
|
|
|
rewriteRules,
|
2024-04-17 11:52:48 +08:00
|
|
|
reloadDebounce: 1000,
|
|
|
|
reloadOnRestart: true,
|
2023-12-12 05:00:33 +08:00
|
|
|
server: {
|
2023-12-22 13:27:13 +08:00
|
|
|
...prodConfig.server,
|
2023-12-12 05:00:33 +08:00
|
|
|
routes: {
|
|
|
|
'/changelog.md': path.resolve(__dirname, 'CHANGELOG.md'),
|
2024-05-22 04:19:21 +08:00
|
|
|
'/dist': path.resolve(__dirname, 'dist'),
|
2023-12-12 05:00:33 +08:00
|
|
|
'/node_modules': path.resolve(__dirname, 'node_modules'), // Required for automated Vue tests
|
|
|
|
},
|
|
|
|
},
|
2023-12-22 13:27:13 +08:00
|
|
|
snippet: true,
|
2023-12-12 05:00:33 +08:00
|
|
|
};
|
|
|
|
|
2023-12-22 13:27:13 +08:00
|
|
|
// Test (local URLs, watch disabled)
|
|
|
|
export const testConfig = {
|
|
|
|
...devConfig,
|
|
|
|
port: 4000,
|
|
|
|
server: {
|
|
|
|
...devConfig.server,
|
2023-12-12 05:00:33 +08:00
|
|
|
middleware: [
|
|
|
|
// Blank page required for test environment
|
|
|
|
{
|
|
|
|
route: '/_blank.html',
|
|
|
|
handle(req, res, next) {
|
|
|
|
res.setHeader('Content-Type', 'text/html');
|
2024-05-20 00:49:33 +08:00
|
|
|
res.end('<!DOCTYPE html><html><body></body></html>');
|
2023-12-12 05:00:33 +08:00
|
|
|
next();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2023-12-22 13:27:13 +08:00
|
|
|
snippet: false,
|
|
|
|
watch: false,
|
2023-12-12 05:00:33 +08:00
|
|
|
};
|