5.4.0
Restructure New Journal entries Colour tabs update with wind
This commit is contained in:
@@ -44,6 +44,7 @@ function cleanDist() {
|
||||
path.join(DIST, 'temperatures.html'),
|
||||
path.join(DIST, 'features.html'),
|
||||
path.join(DIST, 'stress-bands.html'),
|
||||
path.join(DIST, 'dashboard.html'),
|
||||
path.join(ASSETS, '_tmp_flat.css'),
|
||||
path.join(ASSETS, 'about.min.css'),
|
||||
];
|
||||
@@ -86,7 +87,10 @@ function bumpVersion() {
|
||||
// about.min.css with a version param, and injects the JS bundle.
|
||||
function rewriteHTML(html, version) {
|
||||
html = html.replace(/<link\s[^>]*href=["'][^"']*assets\/sunscope\.css[^"']*["'][^>]*>/gi, '');
|
||||
html = html.replace(/<script\s[^>]*src=["'][^"']*assets\/js\/[^"']*["'][^>]*><\/script>/gi, '');
|
||||
// Only strips the dev entry point (main.js) - other plain scripts these
|
||||
// pages load directly, like nav-account.js, are not part of the Preact
|
||||
// bundle and must survive untouched.
|
||||
html = html.replace(/<script\s[^>]*src=["'][^"']*assets\/js\/main\.js[^"']*["'][^>]*><\/script>/gi, '');
|
||||
// Rewrite standalone about.css reference to versioned minified file.
|
||||
html = html.replace(
|
||||
/(<link\s[^>]*href=["'][^"']*assets\/)about\.css[^"']*(["'][^>]*>)/gi,
|
||||
@@ -232,8 +236,12 @@ async function build() {
|
||||
|
||||
// 8. Copy static files
|
||||
console.log(' Copying static files...');
|
||||
// dashboard.html is copied as-is, not run through rewriteHTML - it is a
|
||||
// standalone page (inline CSS/JS, no #root) and has no use for the
|
||||
// Preact app bundle the other pages get.
|
||||
for (const f of ['robots.txt', 'sitemap.xml', 'og-image.png', 'favicon.svg', 'restore.php', 'track.php', 'stats.php',
|
||||
'verify-session.php', 'check-subscription.php', 'dev-unlock.php', 'secrets.local.php']) {
|
||||
'verify-session.php', 'check-subscription.php', 'dev-unlock.php', 'secrets.local.php', 'dashboard.html',
|
||||
'assets/js/nav-account.js']) {
|
||||
const src = path.join(ROOT, f);
|
||||
if (fs.existsSync(src)) {
|
||||
copyFile(src, path.join(DIST, f));
|
||||
@@ -241,6 +249,25 @@ async function build() {
|
||||
}
|
||||
}
|
||||
|
||||
// 9. Copy the dashboard backend (lib/ shared PHP + api/ endpoints)
|
||||
console.log(' Copying dashboard backend...');
|
||||
const copyDirRecursive = (src, dest) => {
|
||||
fs.mkdirSync(dest, { recursive: true });
|
||||
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
||||
const srcPath = path.join(src, entry.name);
|
||||
const destPath = path.join(dest, entry.name);
|
||||
if (entry.isDirectory()) copyDirRecursive(srcPath, destPath);
|
||||
else fs.copyFileSync(srcPath, destPath);
|
||||
}
|
||||
};
|
||||
for (const dir of ['lib', 'api']) {
|
||||
const src = path.join(ROOT, dir);
|
||||
if (fs.existsSync(src)) {
|
||||
copyDirRecursive(src, path.join(DIST, dir));
|
||||
console.log(' -> ' + dir + '/');
|
||||
}
|
||||
}
|
||||
|
||||
const elapsed = ((Date.now() - t0) / 1000).toFixed(2);
|
||||
console.log('');
|
||||
console.log('========================================');
|
||||
|
||||
Reference in New Issue
Block a user