-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ef30a0
commit a733be0
Showing
5 changed files
with
68 additions
and
18 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
body { | ||
margin: 5rem auto; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
width: 500px; | ||
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif; | ||
} | ||
|
||
h1 { | ||
padding: 0; | ||
margin-top: 2.3rem; | ||
} | ||
|
||
ul { | ||
list-style: none; | ||
padding: 0; | ||
} | ||
|
||
ul li:first-child:last-child a { | ||
border-radius: 0.5rem; | ||
} | ||
|
||
ul li:first-child a { | ||
border-radius: 0.5rem 0.5rem 0 0; | ||
} | ||
|
||
ul li:last-child a { | ||
border-radius: 0 0 0.5rem 0.5rem; | ||
} | ||
|
||
a { | ||
display: block; | ||
color: #000; | ||
font-size: 1.2rem; | ||
padding: 1rem; | ||
background-color: #EEEE; | ||
} | ||
|
||
a:hover { | ||
background-color: #DDD; | ||
} | ||
|
||
img { | ||
width: 100px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,42 @@ | ||
import fs from 'node:fs/promises'; | ||
import path from 'node:path'; | ||
|
||
const TALKS_PATH = 'dist/'; | ||
const OUTPUT_PATH = 'dist/index.html'; | ||
const TALKS_PATH = 'talks/'; | ||
const OUTPUT_PATH = 'dist'; | ||
const PUBLIC_PATH = 'public/'; | ||
const talks = []; | ||
|
||
const talksFiles = await fs.readdir(TALKS_PATH, { withFileTypes: true }); | ||
for (const file of talksFiles) { | ||
if (file.isDirectory()) { | ||
talks.push(file.name); | ||
try { | ||
const rawPackageJson = await fs.readFile(path.join(file.path, file.name, 'package.json')); | ||
const packageJson = JSON.parse(rawPackageJson.toString()); | ||
talks.push({path: file.name, title: packageJson.title, author: packageJson.author}); | ||
} catch (err) { | ||
console.error(err); | ||
} | ||
} | ||
} | ||
|
||
const createLinkList = (talks) => talks.map(talk => `<li><a href="./${talk}">${talk}</a></li>`).join(''); | ||
await fs.writeFile(OUTPUT_PATH, `<!DOCTYPE html> | ||
const createLinkList = (talks) => talks.map(talk => `<li><a href="./${talk.path}">${talk.title} by ${talk.author.name}</a></li>`).join(''); | ||
await fs.writeFile(path.join(OUTPUT_PATH, 'index.html'), `<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Our internal talks</title> | ||
<link rel="stylesheet" href="styles.css" /> | ||
</head> | ||
<body> | ||
<img src="logo.png" alt="openscript logo" /> | ||
<h1>Internal talks</h1> | ||
<ul> | ||
${createLinkList(talks)} | ||
${createLinkList(talks.reverse())} | ||
</ul> | ||
</body> | ||
</html> | ||
`); | ||
|
||
await fs.copyFile(path.join(PUBLIC_PATH, 'styles.css'), path.join(OUTPUT_PATH, 'styles.css')); | ||
await fs.copyFile(path.join(PUBLIC_PATH, 'logo.png'), path.join(OUTPUT_PATH, 'logo.png')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters