Skip to content

Commit

Permalink
Update v1.4.0 (#18)
Browse files Browse the repository at this point in the history
Features

- Add first blog post
- Add blog/posts pages
- Add tags/categories pages
- Add posts to home page
- Add rss
- Add open-graph generator
- Enable smooth scroll

Changes

- Update release workflow
  - Bump versions to `v3`
  - Replace deploy step
- Update dependencies
- Remove swup animations
- Only show two projects instead of four on homepage

Fixes

- Fix canonical url
  • Loading branch information
LucJosin authored Oct 20, 2023
1 parent bb951a9 commit 4d40ecf
Show file tree
Hide file tree
Showing 90 changed files with 6,962 additions and 558 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/checkout@v3

- name: Setup Node with yarn caching
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '18'
cache: yarn
Expand All @@ -27,6 +27,12 @@ jobs:
- name: Build Astro
run: yarn build

- uses: LucJosin/publish-orphan-branch@main
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
ARGS: '--dir "dist" --branch "release"'
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
publish_branch: release
enable_jekyll: false
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
15 changes: 1 addition & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,12 @@
</a>
</p>

Personal website built with [Astro](https://astro.build) + [Typescript](https://www.typescriptlang.org/).
Minimalist portfolio website/blog built with [Astro](https://astro.build) + [Typescript](https://www.typescriptlang.org/).

</div>

**Note**: The source for this site was not created to be a template or theme, but for my use. Feel free to take whatever inspiration from it that you want, but this code was not written to be cloned and deployed. As such, I do not provide support or guidance for doing that.

## Astro Integrations

See more Astro [integrations](https://astro.build/integrations/)

- [@astrojs/sitemap](https://www.npmjs.com/package/@astrojs/sitemap)
- [@swup/astro](https://www.npmjs.com/package/@swup/astro)
- [astro](https://www.npmjs.com/package/astro)
- [astro-icon](https://www.npmjs.com/package/astro-icon)
- [astro-compress](https://www.npmjs.com/package/astro-compress)
- [astro-robots-txt](https://www.npmjs.com/package/astro-robots-txt)
- [eslint-plugin-astro](https://www.npmjs.com/package/eslint-plugin-astro)
- [prettier-plugin-astro](https://www.npmjs.com/package/prettier-plugin-astro)

## Commands

All commands are run from the root of the project, from a terminal:
Expand Down
134 changes: 124 additions & 10 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
import sitemap from '@astrojs/sitemap';
import swup from '@swup/astro';
import compress from 'astro-compress';
import { defineConfig } from 'astro/config';
import { s } from 'hastscript';

import react from '@astrojs/react';
import sitemap from '@astrojs/sitemap';
import compress from 'astro-compress';
import astroExpressiveCode from 'astro-expressive-code';
import rename from 'astro-rename';
import robotsTxt from 'astro-robots-txt';

import remarkAlertBlocks from '@lucjosin/remark-alert-blocks';
import remarkCodeHighlight from '@lucjosin/remark-code-highlight';
import remarkImageCaption from '@lucjosin/remark-image-caption';
import remarkPostReference from '@lucjosin/remark-post-reference';
import remarkReadmeStats from '@lucjosin/remark-readme-stats';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import rehypeExternalLinks from 'rehype-external-links';
import rehypeSlug from 'rehype-slug';
import remarkCollapse from 'remark-collapse';
import numberedFootnoteLabels from 'remark-numbered-footnote-labels';
import remarkToc from 'remark-toc';

import HashRenamer from './src/lib/hash-renamer';

const cssPrefix = 'astro-';
const renamer = new HashRenamer(cssPrefix);

// https://astro.build/config
export default defineConfig({
// Your final, deployed URL.
Expand All @@ -16,25 +36,119 @@ export default defineConfig({
//
// ‘static’ - Building a static site to be deploy to any static host.
output: 'static',
// Astro sitemap.
// Astro integrations.
//
// Ref: https://docs.astro.build/en/guides/integrations-guide/
// Ref: https://docs.astro.build/en/guides/integrations-guide/sitemap/
integrations: [
swup({
theme: 'fade',
accessibility: false,
}),
// swup({
// theme: 'fade',
// accessibility: false,
// cache: false,
// }),
sitemap(),
robotsTxt({ sitemap: false }),
robotsTxt({
sitemap: true,
}),
rename({
rename: {
strategy: (key) => renamer.rename(key),
except: ['details'],
},
}),
compress(),
astroExpressiveCode(),
react(),
],
// Markdown configuration
markdown: {
rehypePlugins: [
rehypeSlug,
[
rehypeExternalLinks,
{
rel: 'noopener noreferrer',
target: '_blank',
content: [
s(
'svg.external-links',
{
xmlns: 'http://www.w3.org/2000/svg',
width: 16,
height: 16,
marginLeft: '1rem',
fill: 'currentColor',
viewBox: '0 0 24 24',
},
s('path', {
d: 'M14 3v2h3.59l-9.83 9.83l1.41 1.41L19 6.41V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7h-2v7Z',
})
),
],
},
],
[
rehypeAutolinkHeadings,
{
behavior: 'append',
properties: {
class: 'autolink-header',
ariaHidden: true,
tabIndex: -1,
},
content: [
s(
'svg.autolink-svg',
{
xmlns: 'http://www.w3.org/2000/svg',
width: 18,
height: 18,
marginLeft: '1rem',
fill: 'currentColor',
viewBox: '0 0 24 24',
},
s('path', {
d: 'M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z',
})
),
],
},
],
],
remarkPlugins: [
[
remarkReadmeStats,
{
darkBgColor: '111111',
lightBgColor: 'f0f0f0',
borderRadius: '10',
},
],
remarkPostReference,
numberedFootnoteLabels,
remarkAlertBlocks,
remarkCodeHighlight,
remarkImageCaption,
remarkToc,
[
remarkCollapse,
{
test: 'Table of contents',
},
],
],
extendDefaultPlugins: true,
},
// Astro icon.
//
// Ref: https://github.com/natemoo-re/astro-icon#setup
vite: {
ssr: {
external: ['svgo'],
external: ['svgo', '@resvg/resvg-js'],
},
// Fix 'resvg' on dev mode
optimizeDeps: { exclude: ['@resvg/resvg-js'] },
build: { rollupOptions: { external: ['@resvg/resvg-js'] } },
},
// Listen on all addresses, including LAN and public addresses.
//
Expand Down
40 changes: 32 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lucjosin/lucasjosino.com",
"version": "1.3.0",
"version": "1.4.0",
"private": true,
"scripts": {
"dev": "astro dev",
Expand All @@ -10,22 +10,46 @@
"astro": "astro"
},
"devDependencies": {
"@astrojs/sitemap": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"astro": "^3.0.12",
"@astrojs/sitemap": "^3.0.2",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"astro": "^3.3.2",
"astro-compress": "^2.0.15",
"astro-icon": "^0.8.1",
"astro-robots-txt": "^1.0.0",
"eslint": "^8.49.0",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-astro": "^0.29.0",
"eslint-plugin-astro": "^0.29.1",
"prettier": "^3.0.3",
"prettier-plugin-astro": "^0.12.0",
"svgo": "2.8.0",
"typescript": "^5.2.2"
},
"dependencies": {
"@swup/astro": "^1.3.0"
"@astrojs/react": "^3.0.3",
"@astrojs/rss": "^3.0.0",
"@lucjosin/remark-alert-blocks": "./plugins/remark-alert-blocks",
"@lucjosin/remark-code-highlight": "./plugins/remark-code-highlight",
"@lucjosin/remark-image-caption": "./plugins/remark-image-caption",
"@lucjosin/remark-post-reference": "./plugins/remark-post-reference",
"@lucjosin/remark-readme-stats": "./plugins/remark-readme-stats",
"@resvg/resvg-js": "^2.5.0",
"@swup/astro": "^1.3.2",
"@types/react": "^18.2.29",
"@types/react-dom": "^18.2.14",
"astro-expressive-code": "^0.26.2",
"astro-rename": "https://github.com/LucJosin/astro-rename.git",
"medium-zoom": "^1.0.8",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"reading-time": "^1.5.0",
"rehype-autolink-headings": "^7.0.0",
"rehype-external-links": "^3.0.0",
"rehype-slug": "^6.0.0",
"remark-collapse": "^0.1.2",
"remark-numbered-footnote-labels": "^1.1.0",
"remark-toc": "^8.0.1",
"satori": "^0.10.9",
"satori-html": "^0.3.2"
}
}
31 changes: 31 additions & 0 deletions plugins/remark-alert-blocks/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "@lucjosin/remark-alert-blocks",
"version": "1.0.0",
"type": "module",
"author": {
"name": "Lucas Josino",
"username": "LucJosin",
"email": "contact@lucasjosino.com",
"url": "https://lucasjosino.com"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org"
},
"homepage": "https://github.com/LucJosin/lucasjosino.com",
"bugs": {
"url": "https://github.com/LucJosin/lucasjosino.com",
"email": "hawapi@lucasjosino.com"
},
"license": "MIT",
"keywords": [
"remark-plugin",
"remark-alerts"
],
"main": "src/index.js",
"dependencies": {
"hastscript": "^8.0.0",
"unist-util-is": "^6.0.0",
"unist-util-visit": "^5.0.0"
}
}
59 changes: 59 additions & 0 deletions plugins/remark-alert-blocks/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { is } from 'unist-util-is';
import { visit } from 'unist-util-visit';

const alerts = {
'!!!info': 'info',
'!!!note': 'note',
'!!!tip': 'tip',
'!!!issue': 'issue',
'!!!success': 'success',
'!!!solution': 'solution',
'!!!check': 'check',
'!!!complete': 'complete',
'!!!warning': 'warning',
'!!!error': 'error',
'!!!danger': 'danger',
};

const INFO_REGEX = '!!!(?:.*?)(?:\\{(.*?)(?:#(.*))?\\})?\\s(.*)';

export default function remarkAlertBlocks() {
return function transformer(tree) {
visit(tree, 'paragraph', (paragraphNode, _, parent) => {
visit(paragraphNode, 'text', (textNode) => {
for (const alert in alerts) {
if (textNode.value.startsWith(alert)) {
const data = textNode.value.match(INFO_REGEX);

const id = data[1];
const className = data[2];
const text = data[3];

textNode.value = text;
parent.children = parent.children.map((node) => {
if (is(paragraphNode, node)) {
return {
type: 'wrapper',
children: [node],
data: {
hName: 'div',
hProperties: {
id,
className: [
'remark-alerts',
`remark-alert-${alerts[alert]}`,
className,
],
},
},
};
}

return node;
});
}
}
});
});
};
}
Loading

0 comments on commit 4d40ecf

Please sign in to comment.