All checks were successful
buildbot/nix-build .#checks.x86_64-linux.clan-dep-age Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-bash Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-fakeroot Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-e2fsprogs Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-git Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-vm-manager-no-breakpoints Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-nix Build done.
buildbot/nix-build .#checks.x86_64-linux.check-for-breakpoints Build done.
buildbot/nix-build .#checks.aarch64-darwin.nixos-test_install_machine Build done.
buildbot/nix-build .#checks.aarch64-darwin.nixos-test-backup Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-docs Build done.
buildbot/nix-build .#checks.x86_64-linux.borgbackup Build done.
buildbot/nix-build .#checks.x86_64-linux.nixos-test-backup Build done.
buildbot/nix-build .#checks.aarch64-darwin.nixos-flash-installer Build done.
buildbot/nix-build .#checks.x86_64-linux.package-module-docs Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-vm-manager-pytest Build done.
buildbot/nix-build .#checks.aarch64-darwin.nixos-iso-installer Build done.
buildbot/nix-build .#checks.x86_64-linux.renderClanOptions Build done.
buildbot/nix-build .#checks.aarch64-linux.nixos-test_install_machine Build done.
buildbot/nix-build .#checks.aarch64-linux.nixos-flash-installer Build done.
buildbot/nix-build .#checks.x86_64-linux."clan-dep-python3.11-mypy" Build done.
buildbot/nix-build .#checks.x86_64-linux."clan-dep-python3.11-qemu" Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-rsync Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-sops Build done.
buildbot/nix-build .#checks.aarch64-linux.nixos-test-backup Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-sshpass Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-zbar Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-openssh Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-webview-ui Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-default Build done.
buildbot/nix-build .#checks.x86_64-linux.nixos-test_install_machine Build done.
buildbot/nix-build .#checks.x86_64-linux.package-clan-cli Build done.
buildbot/nix-build .#checks.x86_64-linux.treefmt Build done.
buildbot/nix-build .#checks.x86_64-linux.package-gui-installer-archlinux Build done.
buildbot/nix-build .#checks.x86_64-linux.package-gui-installer-deb Build done.
buildbot/nix-build .#checks.x86_64-linux.package-gui-installer-rpm Build done.
buildbot/nix-build .#checks.x86_64-linux.package-impure-checks Build done.
buildbot/nix-build .#checks.x86_64-linux.package-gui-installer-apk Build done.
buildbot/nix-build .#checks.x86_64-linux.package-docs Build done.
buildbot/nix-build .#checks.x86_64-linux.lib-jsonschema-nix-unit-tests Build done.
buildbot/nix-build .#checks.x86_64-linux.package-clan-vm-manager Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-dep-tor Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-pytest-without-core Build done.
buildbot/nix-build .#checks.aarch64-linux.nixos-iso-installer Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-clan-cli Build done.
buildbot/nix-build .#checks.x86_64-linux.lib-jsonschema-example-valid Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-clan-vm-manager Build done.
buildbot/nix-build .#checks.x86_64-linux.container Build done.
buildbot/nix-build .#checks.x86_64-linux.deltachat Build done.
buildbot/nix-build .#checks.x86_64-linux.package-clan-cli-docs Build done.
buildbot/nix-build .#checks.x86_64-linux.package-clan-ts-api Build done.
buildbot/nix-build .#checks.x86_64-linux.package-default Build done.
buildbot/nix-build .#checks.x86_64-linux.module-schema Build done.
buildbot/nix-build .#checks.x86_64-linux.package-editor Build done.
buildbot/nix-build .#checks.x86_64-linux.package-moonlight-sunshine-accept Build done.
buildbot/nix-build .#checks.x86_64-linux.package-merge-after-ci Build done.
buildbot/nix-build .#checks.x86_64-linux.package-zerotier-members Build done.
buildbot/nix-build .#checks.x86_64-linux.package-zerotierone Build done.
buildbot/nix-build .#checks.x86_64-linux.package-module-schema Build done.
buildbot/nix-build .#checks.x86_64-linux.nixos-iso-installer Build done.
buildbot/nix-build .#checks.x86_64-linux.wayland-proxy-virtwl Build done.
buildbot/nix-build .#checks.x86_64-linux.syncthing Build done.
buildbot/nix-build .#checks.x86_64-linux.package-iso-installer Build done.
buildbot/nix-build .#checks.x86_64-linux.zt-tcp-relay Build done.
buildbot/nix-build .#checks.x86_64-linux.test-backups Build done.
buildbot/nix-build .#checks.x86_64-linux.package-deploy-docs Build done.
buildbot/nix-build .#checks.x86_64-linux.package-pending-reviews Build done.
buildbot/nix-build .#checks.x86_64-linux.package-tea-create-pr Build done.
buildbot/nix-build .#checks.x86_64-linux.package-webview-ui Build done.
buildbot/nix-build .#checks.x86_64-linux.package-zt-tcp-relay Build done.
buildbot/nix-build .#checks.x86_64-linux.matrix-synapse Build done.
buildbot/nix-build .#checks.x86_64-linux.package-function-schema Build done.
buildbot/nix-build .#checks.x86_64-linux.secrets Build done.
buildbot/nix-build .#checks.x86_64-linux.nixos-flash-installer Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-pytest-with-core Build done.
buildbot/nix-build .#checks.x86_64-linux.flash Build done.
buildbot/nix-build .#checks.x86_64-linux.test-installation Build done.
buildbot/nix-eval Build done.
checks / checks-impure (pull_request) Successful in 2m7s
90 lines
2.5 KiB
JavaScript
90 lines
2.5 KiB
JavaScript
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const distPath = path.resolve(__dirname, "dist");
|
|
const manifestPath = path.join(distPath, ".vite/manifest.json");
|
|
const outputPath = path.join(distPath, "index.html");
|
|
|
|
const postcss = require("postcss");
|
|
const css_url = require("postcss-url");
|
|
|
|
fs.readFile(manifestPath, { encoding: "utf8" }, (err, data) => {
|
|
if (err) {
|
|
return console.error("Failed to read manifest:", err);
|
|
}
|
|
|
|
const manifest = JSON.parse(data);
|
|
/** @type {{ file: string; name: string; src: string; isEntry: bool; css: string[]; } []} */
|
|
const assets = Object.values(manifest);
|
|
|
|
console.log(`Generate custom index.html from ${manifestPath} ...`);
|
|
// Start with a basic HTML structure
|
|
let htmlContent = `<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Webview UI</title>`;
|
|
|
|
// Add linked stylesheets
|
|
assets.forEach((asset) => {
|
|
// console.log(asset);
|
|
if (asset.src === "index.html") {
|
|
asset.css.forEach((cssEntry) => {
|
|
// css to be processed
|
|
|
|
const css = fs.readFileSync(`dist/${cssEntry}`, "utf8");
|
|
|
|
// process css
|
|
postcss()
|
|
.use(
|
|
css_url({
|
|
url: (asset, dir) => {
|
|
const res = path.basename(asset.url);
|
|
console.log(`Rewriting CSS url(): ${asset.url} to ${res}`);
|
|
return res;
|
|
},
|
|
})
|
|
)
|
|
.process(css, {
|
|
from: `dist/${cssEntry}`,
|
|
to: `dist/${cssEntry}`,
|
|
})
|
|
.then((result) => {
|
|
fs.writeFileSync(`dist/${cssEntry}`, result.css, "utf8");
|
|
});
|
|
|
|
// Extend the HTML content with the linked stylesheet
|
|
console.log(`Relinking html css stylesheet: ${cssEntry}`);
|
|
htmlContent += `\n <link rel="stylesheet" href="${cssEntry}">`;
|
|
});
|
|
}
|
|
});
|
|
|
|
htmlContent += `
|
|
</head>
|
|
<body>
|
|
<div id="app"></div>
|
|
`;
|
|
// Add scripts
|
|
assets.forEach((asset) => {
|
|
if (asset.file.endsWith(".js")) {
|
|
console.log(`Relinking js script: ${asset.file}`);
|
|
htmlContent += `\n <script src="${asset.file}"></script>`;
|
|
}
|
|
});
|
|
|
|
htmlContent += `
|
|
</body>
|
|
</html>`;
|
|
|
|
// Write the HTML file
|
|
fs.writeFile(outputPath, htmlContent, (err) => {
|
|
if (err) {
|
|
console.error("Failed to write custom index.html:", err);
|
|
} else {
|
|
console.log("Custom index.html generated successfully!");
|
|
}
|
|
});
|
|
});
|