Updated readme
Removed more files
This commit is contained in:
parent
e8059930e1
commit
91637e8c31
@ -11,8 +11,6 @@ server {
|
|||||||
add_header Cache-Control "public, max-age=604800, immutable";
|
add_header Cache-Control "public, max-age=604800, immutable";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Additional configurations can be added here if needed
|
|
||||||
# For example, error handling, logging, etc.
|
|
||||||
error_page 404 /index.html;
|
error_page 404 /index.html;
|
||||||
error_page 500 502 503 504 /index.html;
|
error_page 500 502 503 504 /index.html;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
export default {
|
|
||||||
plugins: {
|
|
||||||
tailwindcss: {},
|
|
||||||
autoprefixer: {},
|
|
||||||
},
|
|
||||||
}
|
|
@ -32,6 +32,11 @@ Inspired by [Ben Phelps' Homepage](https://gethomepage.dev/) and [Umbrel](https:
|
|||||||
|
|
||||||
# Change history
|
# Change history
|
||||||
|
|
||||||
|
## 1.4.0
|
||||||
|
|
||||||
|
- Rewrote the entire application to not use React. Now it's just a Node application that emits static HTML.
|
||||||
|
- Removed lots of packages
|
||||||
|
|
||||||
## 1.3.0
|
## 1.3.0
|
||||||
|
|
||||||
- Removed all JavaScript as part of the build step. The image will be slightly larger and take longer to start up and shut down, but the page will be even lighter.
|
- Removed all JavaScript as part of the build step. The image will be slightly larger and take longer to start up and shut down, but the page will be even lighter.
|
||||||
|
61
start.js
61
start.js
@ -1,61 +0,0 @@
|
|||||||
import { exec } from "child_process";
|
|
||||||
import fs from "fs/promises";
|
|
||||||
import puppeteer from "puppeteer";
|
|
||||||
|
|
||||||
function runNpmCommand(command) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
exec(`npm ${command}`, (error, stdout, stderr) => {
|
|
||||||
if (error) {
|
|
||||||
console.error(`Error executing command: ${error}`);
|
|
||||||
reject(error);
|
|
||||||
} else {
|
|
||||||
console.log(`Command output: ${stdout}`);
|
|
||||||
resolve(stdout);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async function renderHomePage() {
|
|
||||||
const browser = await puppeteer.launch({
|
|
||||||
headless: true,
|
|
||||||
args: ["--no-sandbox", "--disable-setuid-sandbox"],
|
|
||||||
executablePath: "chromium", // Remove this when running locally
|
|
||||||
});
|
|
||||||
const page = await browser.newPage();
|
|
||||||
|
|
||||||
await page.goto("http://localhost:4173", { waitUntil: "networkidle0" });
|
|
||||||
|
|
||||||
// Wait for any additional content to load
|
|
||||||
await page.waitForNetworkIdle();
|
|
||||||
|
|
||||||
// Get the rendered HTML content
|
|
||||||
const renderedHTML = await page.content();
|
|
||||||
|
|
||||||
// Save the rendered HTML to a file
|
|
||||||
fs.writeFile("./dist/index.html", renderedHTML);
|
|
||||||
|
|
||||||
await browser.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function runCommands() {
|
|
||||||
try {
|
|
||||||
console.log("Building React site");
|
|
||||||
await runNpmCommand("run build");
|
|
||||||
|
|
||||||
setTimeout(async () => {
|
|
||||||
console.log("Taking snapshot");
|
|
||||||
await renderHomePage();
|
|
||||||
await runNpmCommand("run html");
|
|
||||||
await runNpmCommand("run replace");
|
|
||||||
}, 2000);
|
|
||||||
|
|
||||||
console.log("Starting web server");
|
|
||||||
await runNpmCommand("run serve");
|
|
||||||
} catch (err) {
|
|
||||||
// Handle errors
|
|
||||||
console.error("An error occurred:", err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
runCommands();
|
|
Loading…
Reference in New Issue
Block a user