Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
dallyh committed Feb 22, 2024
2 parents 81b2543 + 479127f commit be2cc98
Show file tree
Hide file tree
Showing 200 changed files with 28,632 additions and 14,180 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:

permissions:
pull-requests: write # GitHub Actions bot permissions
pull-requests: write # GitHub Actions bot permissions

jobs:
build:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
environment: github-pages
runs-on: ubuntu-latest
env:
UNDER_CONSTRUCTION: ${{ vars.UNDER_CONSTRUCTION }}
UNDER_CONSTRUCTION: ${{ vars.UNDER_CONSTRUCTION }}
steps:
- name: Print out under construction variables
run: |
echo "Repository variable : ${{ vars.UNDER_CONSTRUCTION }}"
echo "Environment variable : ${{ env.UNDER_CONSTRUCTION }}"
echo "Repository variable : ${{ vars.UNDER_CONSTRUCTION }}"
echo "Environment variable : ${{ env.UNDER_CONSTRUCTION }}"
- name: Checkout your repository using git
uses: actions/checkout@v4
- name: Install, build, and upload your site
Expand Down
4 changes: 0 additions & 4 deletions .prettierrc.json

This file was deleted.

14 changes: 14 additions & 0 deletions .prettierrc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/** @type {import("prettier").Config} */
export default {
printWidth: 210,
tabWidth: 4,
plugins: ["prettier-plugin-astro"],
overrides: [
{
files: "*.astro",
options: {
parser: "astro",
},
},
],
};
4 changes: 2 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"recommendations": ["astro-build.astro-vscode", "lokalise.i18n-ally"],
"unwantedRecommendations": []
"recommendations": ["astro-build.astro-vscode", "lokalise.i18n-ally"],
"unwantedRecommendations": []
}
18 changes: 9 additions & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}
22 changes: 15 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
{
"i18n-ally.localesPaths": [
"src/i18n/locales"
],
"i18n-ally.localesPaths": ["src/i18n/locales"],
"i18n-ally.namespace": true,
"i18n-ally.pathMatcher": "{locale}/{namespaces}.json",
"i18n-ally.pathMatcher": "{locale}/{namespaces}.yaml",
"i18n-ally.enabledFrameworks": ["i18next", "custom"],
"i18n-ally.keystyle": "nested",
"i18n-ally.annotationDelimiter": "."
}
"i18n-ally.keystyle": "flat",
"i18n-ally.annotationDelimiter": ":",
"i18n-ally.annotationInPlace": false,
"i18n-ally.dirStructure": "dir",
"i18n-ally.displayLanguage": "en",
"i18n-ally.extract.keygenStyle": "snake_case",
"i18n-ally.indent": 4,
"i18n-ally.review.enabled": false,
"i18n-ally.review.gutters": false,
"i18n-ally.sortCompare": "locale",
"i18n-ally.sortKeys": true,
"i18n-ally.sortLocale": "en"
}
58 changes: 45 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,49 @@
# Welcome to my [Website!](https://daliborhon.com)
This page was created as a fun project of mine, trying to learn something more about web development, and get better with my coding skills. In the beginning I decided to use ASP.NET Core Razor Pages (because I have experience with C#) with combination of Blazor components. Later on I found out that ASP.NET is a little bit overkill for such a simple website, so I switched to static site generator called Astro. Of cource plain JavaScript (later on TypeScript) and other standard tools and languages had to be used as well. When I initially started, I did not have much experience with web development, so this project tool longer than I expected. Anyways it was a great journey, and now I can say that I know a lot more than before. And what's better? I enjoyed it!
# Welcome to my [Website!](https://daliborhon.dev)

Initially I started with a template called Start Bootstrap (Licensed under MIT), because as I mentioned I did not have any previous experience on writing plain HTML and using CSS. Using Bootstrap seemed like a good decision. In the process I figured out that I wasn’t really learning on how to create a website, I was learning on how to use Bootstrap. That is why I decided to not use it anymore, and focus more on learning the "basics" first.
<p align="center">
<img alt="GitHub Actions Workflow Status" src="https://img.shields.io/github/actions/workflow/status/dallyh/daliborhon.dev/deploy.yaml">
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/dallyh/daliborhon.dev">
</p>

## Info

This is an [Astro](https://astro.build) project for my personal website, which I play to use as a blog.
The project is continually in development, as I also take it as an opportunity to learn something new.

This is a fully static website hosted on GitHub pages, using a fully static CMS for content management.

I guess for experienced developers a lot of things in this repo will not make any sense, however, everybody has to start somewhere.

## Stack

- Frameworks:
- [Astro](https://astro.build)
- Some of the UI: [React](https://react.dev/)
- Internationalization [i18next](https://www.i18next.com/)
- Content Management System: [Static CMS](https://staticcms.org)
- User authorization: [Static CMS GitHub OAuth provider](https://github.com/dallyh/static-cms-gh-oauth-provider)

## Deployment

Deployments are done either on a new commit to the `main` branch (production), or on a new pull request for `main` branch.

Pull request creates a new build just for that particular pull request, which is used to preview the site.
Previews are hosted [here](https://github.com/dallyh/deploy-previews).

## Commands

## 🧞 Commands
All commands are run from the root of the project, from a terminal:

| Command | Action |
| :--------------------- | :------------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:3000` |
| `npm run host` | Starts local dev server hosted at network |
| `npm run build` | Build production site to `./dist/` |
| `npm run preview` | Preview the build locally |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro preview` |
| `npm run astro --help` | Get help using the Astro CLI |
| Command | Action |
| :------------------------ | :--------------------------------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run dev-host` | Starts local dev server hosted at a network |
| `npm run build` | Build production site to `./dist/` |
| `npm run preview` | Preview the build locally |
| `npm run preview-host` | Preview the build hosted at a network |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro preview` |
| `npm run sync` | Runs the `astro sync` command to generate content collection types |
| `npm run prettier-check` | Runs the `prettier . --check` command to check for formatting problems |
| `npm run prettier-format` | Runs the `prettier . --write` command to fix formatting problems |
| `npm run astro --help` | Get help using the Astro CLI |
68 changes: 47 additions & 21 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import { defineConfig } from "astro/config";
import { i18n, filterSitemapByDefaultLocale } from "astro-i18n-aut/integration";
import react from "@astrojs/react";
import * as i18n from "./src/config/i18n";
import sitemap from "@astrojs/sitemap";
import { loadEnv } from "vite";
const { SITE_URL, SITE_BASE } = loadEnv(process.env.NODE_ENV, process.cwd(), "");

const URL = SITE_URL ?? "https://www.daliborhon.dev"
import pagefind from "astro-pagefind";
import icon from "astro-icon";
import rehypeSlug from "rehype-slug";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import rehypeToc from "rehype-toc";

const { SITE_URL, SITE_BASE } = loadEnv(process.env.NODE_ENV, process.cwd(), "");
const PORT = 4321;
const URL = import.meta.env.DEV ? `http://localhost:${PORT}` : SITE_URL ?? "https://www.daliborhon.dev/";
console.log(`Using SITE_URL: '${URL}'`);
console.log(`Using SITE_BASE: '${SITE_BASE}'`)

// i18n
const defaultLocale = "cs";
const locales = {
en: "en",
cs: "cs",
};
console.log(`Using SITE_BASE: '${SITE_BASE === undefined ? "/" : SITE_BASE}'`);

// https://astro.build/config
export default defineConfig({
Expand All @@ -26,20 +24,48 @@ export default defineConfig({
format: "directory",
},
prefetch: true,
markdown: {
rehypePlugins: [rehypeSlug, [rehypeAutolinkHeadings, { behavior: "append" }], [rehypeToc, { headings: ["h1", "h2", "h3"] }]],
shikiConfig: {
// Choose from Shiki's built-in themes (or add your own)
// https://github.com/shikijs/shiki/blob/main/docs/themes.md
theme: "material-theme-palenight",
},
},
i18n: {
defaultLocale: i18n.defaultLocale,
locales: i18n.locales,
routing: {
prefixDefaultLocale: false,
},
},
integrations: [
react(),
i18n({
locales,
defaultLocale
}),
sitemap({
i18n: {
locales,
defaultLocale,
defaultLocale: i18n.defaultLocale,
// All urls that don't contain `es` or `fr` after `https://stargazers.club/` will be treated as default locale, i.e. `en`
locales: {
...i18n.localeKeys,
},
},
filter: (page) => page !== `'${URL}admin'`,
}),
pagefind(),
icon({
iconDir: "src/assets/icons",
include: {
bi: ["*"],
devicon: ["*"],
},
filter: filterSitemapByDefaultLocale({
defaultLocale,
}),
}),
],
vite: {
server: {
port: PORT,
},
optimizeDeps: {
exclude: ["@resvg/resvg-js"],
},
},
});
Loading

0 comments on commit be2cc98

Please sign in to comment.