Skip to content

Commit eb972b8

Browse files
authored
Blog Engine and more. (#11)
1 parent dcea92c commit eb972b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3046
-374
lines changed

.prettierrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"printWidth": 100
3+
}

.stylelintrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": "stylelint-config-standard",
33
"rules": {
4-
"shorthand-property-no-redundant-values": null
4+
"shorthand-property-no-redundant-values": null,
5+
"color-function-notation": "legacy"
56
}
67
}

.vscode/launch.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Next.js: debug server-side",
6+
"type": "node-terminal",
7+
"request": "launch",
8+
"command": "npm run dev"
9+
},
10+
{
11+
"name": "Next.js: debug client-side",
12+
"type": "chrome",
13+
"request": "launch",
14+
"url": "http://localhost:3000"
15+
},
16+
{
17+
"name": "Next.js: debug full stack",
18+
"type": "node-terminal",
19+
"request": "launch",
20+
"command": "npm run dev",
21+
"serverReadyAction": {
22+
"pattern": "- Local:.+(https?://.+)",
23+
"uriFormat": "%s",
24+
"action": "debugWithChrome"
25+
}
26+
}
27+
]
28+
}

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# draco-lang.github.io
2+
23
Official website for the Draco programming language.

generateAssets.js

+20-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const { Octokit } = require("@octokit/rest");
22
const fs = require("fs");
3-
const createActionAuth = require("@octokit/auth-action");
3+
const { createTokenAuth } = require("@octokit/auth-token");
4+
const sharp = require("sharp");
45

56
const fullLogo = {
67
light: "https://raw.githubusercontent.com/Draco-lang/Language-suggestions/main/Resources/Logo-Long.svg",
@@ -21,14 +22,15 @@ async function main() {
2122
fs.mkdirSync("public/generated", { recursive: true });
2223
}
2324

24-
downloadThemedImage(fullLogo, "public/generated/Logo-Long.svg", true);
25-
downloadThemedImage(shortLogo, "public/generated/Logo-Short.svg", true);
26-
downloadThemedImage(githubLogo, "public/generated/github-logo.svg", false);
27-
download("https://raw.githubusercontent.com/Draco-lang/Language-suggestions/main/Resources/Derpy-Outlined.svg", "public/generated/derpy.svg");
25+
await downloadThemedImage(fullLogo, "public/generated/Logo-Long.svg", true);
26+
await downloadThemedImage(shortLogo, "public/generated/Logo-Short.svg", true);
27+
await downloadThemedImage(githubLogo, "public/generated/github-logo.svg", false);
28+
await downloadAndConvertSvgToPng("https://raw.githubusercontent.com/Draco-lang/Language-suggestions/main/Resources/Logo-Short-Inverted-Outline.svg", "public/generated/Logo-Short-Inverted-Outline.png");
29+
await download("https://raw.githubusercontent.com/Draco-lang/Language-suggestions/main/Resources/Derpy-Outlined.svg", "public/generated/derpy.svg");
2830
emojis.push("derpy");
2931
let octokit;
3032
if (process.env.GITHUB_TOKEN !== undefined && process.env.GITHUB_TOKEN.length > 0) {
31-
const auth = createActionAuth();
33+
const auth = createTokenAuth(process.env.GITHUB_TOKEN);
3234
const authentication = await auth();
3335
octokit = new Octokit({
3436
auth: authentication.token
@@ -43,15 +45,16 @@ async function main() {
4345
path: "Resources/Emojis"
4446
});
4547

46-
for (let i = 0; i < response.data.length; i++) {
47-
const element = response.data[i];
48+
const promises = response.data.map(async element => {
4849
console.log(`Downloading ${element.name}...`);
4950
const resp = await fetch(element.download_url);
5051
const emoji = await resp.text();
5152
await fs.promises.writeFile(`public/generated/${element.name}`, emoji);
52-
}
53+
});
54+
await Promise.all(promises);
55+
5356
response.data
54-
.map(s => `${s.name.replace(/\.[^/.]+$/, "")}`)
57+
.map(s => s.name.replace(/\.[^/.]+$/, ""))
5558
.forEach(s => emojis.push(s));
5659
await fs.promises.writeFile(
5760
"src/generated/emojiTypes.ts",
@@ -130,4 +133,11 @@ ${logoLight}
130133
</svg>
131134
`;
132135
return logoSvg;
136+
}
137+
138+
async function downloadAndConvertSvgToPng(url, outputPath) {
139+
const resp = await fetch(url);
140+
const svgContent = await resp.text();
141+
await sharp(Buffer.from(svgContent)).png().toFile(outputPath);
142+
console.log(`SVG converted and saved as ${outputPath}`);
133143
}

next.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ const nextConfig = {
66
images: {
77
unoptimized: true,
88
}
9-
}
9+
};
1010

11-
module.exports = nextConfig
11+
module.exports = nextConfig;

0 commit comments

Comments
 (0)