Got the site building a little bit

This commit is contained in:
Jordan Roher 2023-12-16 14:12:06 -08:00
parent 8e42011629
commit 714a831ead
6 changed files with 37 additions and 16 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
node_modules
.DS_Store
dist
dist-ssr
src/*.js
src/**/*.js

View File

@ -7,6 +7,24 @@
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="root"><p>Hello, world!</p></div>
<div id="root">
<div className="min-h-screen">
<div className=min-h-screen flex flex-col max-w-screen-2xl mx-auto xl:flex-row>
<div className=p-4 w-full xl:w-auto xl:max-w-xs xl:min-h-screenborder-0 border-solid border-gray-300 dark:border-gray-700 border-b xl:border-r xl:border-b-0>
<div className="p-2 xl:p-4 flex flex-nowrap justify-center items-center gap-2 xl:flex-wrap">
<img src={icon} alt={title} className="inline-block w-16 h-16" />
<h1>{title}</h1>
</div>
</div>
<div className=p-4 flex-grow min-h-screen>
<ServiceCatalogList catalogs={mySerices} />
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -8,7 +8,7 @@
"version": "1.3.0",
"type": "commonjs",
"scripts": {
"build": "tsc src/static.ts && node src/static.js",
"build": "tsc && node src/static.js",
"html": "html-minifier --remove-comments --collapse-whitespace --input-dir ./dist --output-dir ./dist --file-ext html",
"replace": "npm run replace:script",
"replace:script": "replace-in-file --configFile replace-script.cjs"

View File

@ -5,10 +5,11 @@ interface IProps {
icon?: string;
}
export const Header = function ({ icon, title }) {
export const Header = function (props: IProps) {
const { icon, title } = props;
return `
<div className="p-2 xl:p-4 flex flex-nowrap justify-center items-center gap-2 xl:flex-wrap">
${!is.null(icon) && `<img src={icon} alt={title} className="inline-block w-16 h-16" />`}
${!is.null(icon) && `<img src=${icon} alt=${title} className="inline-block w-16 h-16" />`}
<h1>{title}</h1>
</div>
`;

View File

@ -3,28 +3,29 @@ import * as path from "path";
import { IndexPage } from "./pages/index";
import { PAGEICON, PAGETITLE } from "./variables";
const indexFilePath = path.join(__dirname, "../", "index.html");
const indexFileInPath = path.join(__dirname, "../", "index.html");
const indexFileOutPath = path.join(__dirname, "../", "index-2.html");
async function writeIndexPage(contents: string): Promise<boolean> {
async function readIndexPage(): Promise<string> {
return new Promise(async (resolve, reject) => {
try {
await fs.writeFile(indexFilePath, contents);
return resolve(true);
const index = await fs.readFile(indexFileInPath);
return resolve(index.toString());
} catch (exception) {
console.error("Could not write index.html file");
console.error("Could not read index.html file");
reject(exception);
}
});
}
async function readIndexPage(): Promise<string> {
async function writeIndexPage(contents: string): Promise<boolean> {
return new Promise(async (resolve, reject) => {
try {
const index = await fs.readFile(indexFilePath);
return resolve(index.toString());
await fs.writeFile(indexFileOutPath, contents);
return resolve(true);
} catch (exception) {
console.error("Could not read index.html file");
console.error("Could not write index.html file");
reject(exception);
}
});

View File

@ -8,5 +8,5 @@
"resolveJsonModule": true,
"module": "CommonJS"
},
"include": ["src"]
"include": ["src/static.ts"]
}