Skip to content

Commit

Permalink
Blog Engine and more. (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuinox committed Nov 10, 2023
1 parent dcea92c commit eb972b8
Show file tree
Hide file tree
Showing 42 changed files with 3,046 additions and 374 deletions.
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"printWidth": 100
}
3 changes: 2 additions & 1 deletion .stylelintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "stylelint-config-standard",
"rules": {
"shorthand-property-no-redundant-values": null
"shorthand-property-no-redundant-values": null,
"color-function-notation": "legacy"
}
}
28 changes: 28 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Next.js: debug server-side",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev"
},
{
"name": "Next.js: debug client-side",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000"
},
{
"name": "Next.js: debug full stack",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev",
"serverReadyAction": {
"pattern": "- Local:.+(https?://.+)",
"uriFormat": "%s",
"action": "debugWithChrome"
}
}
]
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# draco-lang.github.io

Official website for the Draco programming language.
30 changes: 20 additions & 10 deletions generateAssets.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { Octokit } = require("@octokit/rest");
const fs = require("fs");
const createActionAuth = require("@octokit/auth-action");
const { createTokenAuth } = require("@octokit/auth-token");
const sharp = require("sharp");

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

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

for (let i = 0; i < response.data.length; i++) {
const element = response.data[i];
const promises = response.data.map(async element => {
console.log(`Downloading ${element.name}...`);
const resp = await fetch(element.download_url);
const emoji = await resp.text();
await fs.promises.writeFile(`public/generated/${element.name}`, emoji);
}
});
await Promise.all(promises);

response.data
.map(s => `${s.name.replace(/\.[^/.]+$/, "")}`)
.map(s => s.name.replace(/\.[^/.]+$/, ""))
.forEach(s => emojis.push(s));
await fs.promises.writeFile(
"src/generated/emojiTypes.ts",
Expand Down Expand Up @@ -130,4 +133,11 @@ ${logoLight}
</svg>
`;
return logoSvg;
}

async function downloadAndConvertSvgToPng(url, outputPath) {
const resp = await fetch(url);
const svgContent = await resp.text();
await sharp(Buffer.from(svgContent)).png().toFile(outputPath);
console.log(`SVG converted and saved as ${outputPath}`);
}
4 changes: 2 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ const nextConfig = {
images: {
unoptimized: true,
}
}
};

module.exports = nextConfig
module.exports = nextConfig;
Loading

0 comments on commit eb972b8

Please sign in to comment.