✅ COMPLETED: 1. Dockerfile uses port 80 (astro preview) 2. BaseLayout imports globals.css 3. globals.css with Tailwind v4 @theme syntax 4. index.astro has Header, Footer, FixedContact 5. All image references fixed to existing files 6. Hero uses hdpe_pipe_main.jpg 7. Product cards use hdpe001.jpg 8. pt-20 on main for fixed header ✅ TESTED LOCALLY: - Build: 15 pages in 1.27s - Docker build successful - Port 80 working - Images load - CSS works Ready for Easypanel deployment.
53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
/*
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
Author Natsu @xiaoxiaojx
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
const stripJsonComments = require("./strip-json-comments");
|
|
|
|
/** @typedef {import("../Resolver").FileSystem} FileSystem */
|
|
|
|
/**
|
|
* @typedef {object} ReadJsonOptions
|
|
* @property {boolean=} stripComments Whether to strip JSONC comments
|
|
*/
|
|
|
|
/**
|
|
* Read and parse JSON file (supports JSONC with comments)
|
|
* @template T
|
|
* @param {FileSystem} fileSystem the file system
|
|
* @param {string} jsonFilePath absolute path to JSON file
|
|
* @param {ReadJsonOptions} options Options
|
|
* @returns {Promise<T>} parsed JSON content
|
|
*/
|
|
async function readJson(fileSystem, jsonFilePath, options = {}) {
|
|
const { stripComments = false } = options;
|
|
const { readJson } = fileSystem;
|
|
if (readJson && !stripComments) {
|
|
return new Promise((resolve, reject) => {
|
|
readJson(jsonFilePath, (err, content) => {
|
|
if (err) return reject(err);
|
|
resolve(/** @type {T} */ (content));
|
|
});
|
|
});
|
|
}
|
|
|
|
const buf = await new Promise((resolve, reject) => {
|
|
fileSystem.readFile(jsonFilePath, (err, data) => {
|
|
if (err) return reject(err);
|
|
resolve(data);
|
|
});
|
|
});
|
|
|
|
const jsonText = /** @type {string} */ (buf.toString());
|
|
// Strip comments to support JSONC (e.g., tsconfig.json with comments)
|
|
const jsonWithoutComments = stripComments
|
|
? stripJsonComments(jsonText, { trailingCommas: true, whitespace: true })
|
|
: jsonText;
|
|
return JSON.parse(jsonWithoutComments);
|
|
}
|
|
|
|
module.exports.readJson = readJson;
|