Skip to content

Commit 5399c96

Browse files
committed
chore: initialize
0 parents  commit 5399c96

Some content is hidden

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

72 files changed

+11656
-0
lines changed

.github/workflows/deploy.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
# Allows you to run this workflow manually from the Actions tab on GitHub.
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout your repository using git
19+
uses: actions/checkout@v4
20+
- name: Install, build, and upload your site
21+
uses: withastro/action@v3
22+
23+
deploy:
24+
needs: build
25+
runs-on: ubuntu-latest
26+
environment:
27+
name: github-pages
28+
url: ${{ steps.deployment.outputs.page_url }}
29+
steps:
30+
- name: Deploy to GitHub Pages
31+
id: deployment
32+
uses: actions/deploy-pages@v4

.gitignore

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# build output
2+
dist/
3+
# generated types
4+
.astro/
5+
6+
# dependencies
7+
node_modules/
8+
9+
# logs
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
pnpm-debug.log*
14+
15+
16+
# environment variables
17+
.env
18+
.env.production
19+
20+
# macOS-specific files
21+
.DS_Store
22+
23+
# jetbrains setting folder
24+
.idea/
25+
26+
# Obsidian config
27+
.obsidian/

.husky/commit-msg

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx --no -- commitlint --config commitlint.config.js --edit

.husky/pre-commit

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm run lint

.prettierrc

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"singleQuote": true,
3+
"semi": true,
4+
"proseWrap": "never",
5+
"plugins": ["prettier-plugin-astro", "prettier-plugin-tailwindcss"],
6+
"overrides": [
7+
{
8+
"files": "*.astro",
9+
"options": {
10+
"parser": "astro"
11+
}
12+
}
13+
]
14+
}

.vscode/extensions.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"recommendations": ["astro-build.astro-vscode", "unifiedjs.vscode-mdx"],
3+
"unwantedRecommendations": [],
4+
}

.vscode/launch.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"command": "./node_modules/.bin/astro dev",
6+
"name": "Development server",
7+
"request": "launch",
8+
"type": "node-terminal"
9+
}
10+
]
11+
}

.vscode/settings.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"prettier.documentSelectors": ["**/*.astro"],
3+
"[astro]": {
4+
"editor.defaultFormatter": "esbenp.prettier-vscode"
5+
},
6+
"eslint.validate": [
7+
"javascript",
8+
"javascriptreact",
9+
"astro",
10+
"typescript",
11+
"typescriptreact"
12+
],
13+
"i18n-ally.localesPaths": [
14+
"src/i18n",
15+
"src/i18n/lang"
16+
]
17+
}

LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 SlateDesign
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# FastLabs / Blog
2+
3+
[fast.github.io](https://fast.github.io)
4+
5+
FastLabs is a community of open source contributors focused on building high-quality Rust crates. We collaborate on various projects to enhance the Rust ecosystem and provide reliable tools for developers.
6+
7+
## Thanks
8+
9+
- [slate-blog](https://github.com/SlateDesign/slate-blog) - For providing the blog template

astro.config.mjs

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { defineConfig } from 'astro/config';
2+
import react from '@astrojs/react';
3+
import svgr from 'vite-plugin-svgr';
4+
import tailwindcss from "@tailwindcss/vite";
5+
import mdx from '@astrojs/mdx';
6+
import sitemap from '@astrojs/sitemap';
7+
import remarkGemoji from 'remark-gemoji';
8+
import remarkMath from 'remark-math';
9+
import rehypeKatex from 'rehype-katex';
10+
import codeImport from 'remark-code-import';
11+
import remarkBlockContainers from 'remark-block-containers';
12+
import astroExpressiveCode from 'astro-expressive-code';
13+
import rehypeFigure from 'rehype-figure';
14+
import remarkFigureCaption from "@microflash/remark-figure-caption";
15+
16+
import { remarkModifiedTime } from './plugins/remark-modified-time';
17+
import { remarkReadingTime } from './plugins/remark-reading-time';
18+
import slateConfig from './slate.config';
19+
20+
function computedIntegrations() {
21+
const result = [astroExpressiveCode(), mdx(), react(), sitemap(slateConfig.sitemap)];
22+
23+
return result;
24+
}
25+
26+
function generateAstroConfigure() {
27+
const astroConfig = {
28+
site: slateConfig.site,
29+
integrations: computedIntegrations(),
30+
markdown: {
31+
remarkPlugins: [
32+
remarkGemoji,
33+
remarkMath,
34+
codeImport,
35+
// [codesandbox, { mode: 'button' }],
36+
remarkBlockContainers,
37+
remarkFigureCaption,
38+
],
39+
rehypePlugins: [rehypeKatex, rehypeFigure],
40+
},
41+
vite: {
42+
plugins: [
43+
svgr(),
44+
tailwindcss(),
45+
],
46+
},
47+
};
48+
49+
if (slateConfig.lastModified) {
50+
astroConfig.markdown.remarkPlugins.push(remarkModifiedTime);
51+
}
52+
53+
if (slateConfig.readTime) {
54+
astroConfig.markdown.remarkPlugins.push(remarkReadingTime);
55+
}
56+
57+
return astroConfig;
58+
}
59+
60+
// https://astro.build/config
61+
export default defineConfig(generateAstroConfigure());

commitlint.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default {extends: ['@commitlint/config-conventional']};

eslint.config.js

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import globals from 'globals';
2+
import { configs as astroEslintConfigs } from 'eslint-plugin-astro';
3+
import pluginJs from '@eslint/js';
4+
import tseslint from 'typescript-eslint';
5+
// import pluginReactConfig from 'eslint-plugin-react/configs/recommended.js';
6+
7+
export default [
8+
pluginJs.configs.recommended,
9+
...tseslint.configs.recommended,
10+
...astroEslintConfigs.recommended,
11+
...astroEslintConfigs['jsx-a11y-recommended'],
12+
// pluginReactConfig,
13+
{
14+
ignores: ['node_modules', 'dist', '.astro', 'src/env.d.ts', '**/.obsidian'],
15+
},
16+
{
17+
languageOptions: {
18+
globals: {
19+
...globals.browser,
20+
...globals.node,
21+
},
22+
},
23+
},
24+
{
25+
files: ['**/*.astro'],
26+
processor: 'astro/client-side-ts',
27+
languageOptions: {
28+
parserOptions: {
29+
parser: '@typescript-eslint/parser',
30+
extraFileExtensions: ['.astro'],
31+
},
32+
},
33+
},
34+
];

package.json

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"name": "fastblog",
3+
"version": "1.0.0",
4+
"type": "module",
5+
"sideEffects": false,
6+
"author": "fastlabs dev",
7+
"packageManager": "[email protected]",
8+
"scripts": {
9+
"prepare": "husky",
10+
"dev": "astro dev",
11+
"start": "astro dev",
12+
"build": "npm run tsc && astro check && astro build",
13+
"preview": "astro preview",
14+
"astro": "astro",
15+
"tsc": "tsc --noEmit",
16+
"lint": "npm run tsc && npm run lint:script && astro check",
17+
"lint-fix": "npm run lint-fix:script",
18+
"lint-fix:script": "npm run lint:script -- --fix",
19+
"lint:script": "eslint",
20+
"format": "prettier --write \"src/**/*.{js,ts,jsx,tsx,astro}\"",
21+
"sync-latest": "./scripts/sync-latest-blog.sh"
22+
},
23+
"dependencies": {
24+
"@astrojs/check": "^0.9.4",
25+
"@astrojs/mdx": "^4.0.8",
26+
"@astrojs/react": "^4.2.0",
27+
"@astrojs/rss": "^4.0.11",
28+
"@astrojs/sitemap": "^3.2.1",
29+
"@docsearch/css": "^3.6.2",
30+
"@docsearch/react": "^3.6.2",
31+
"@microflash/remark-figure-caption": "^2.0.2",
32+
"@radix-ui/colors": "^3.0.0",
33+
"@tailwindcss/vite": "^4.0.3",
34+
"@types/node": "^22.8.4",
35+
"@types/react": "^18.3.12",
36+
"@types/react-dom": "^18.3.1",
37+
"astro": "^5.2.5",
38+
"astro-expressive-code": "^0.37.1",
39+
"classnames": "^2.5.1",
40+
"dayjs": "^1.11.13",
41+
"i18next": "^24.2.2",
42+
"mdast-util-to-string": "^4.0.0",
43+
"react": "^18.3.1",
44+
"react-dom": "^18.3.1",
45+
"reading-time": "^1.5.0",
46+
"rehype-figure": "^1.0.1",
47+
"rehype-katex": "^7.0.1",
48+
"remark-block-containers": "^1.1.0",
49+
"remark-code-import": "^1.2.0",
50+
"remark-gemoji": "^8.0.0",
51+
"remark-math": "^6.0.0",
52+
"sharp": "^0.33.5",
53+
"tailwindcss": "^4.0.3",
54+
"typescript": "^5.6.3",
55+
"vite-plugin-svgr": "^4.2.0"
56+
},
57+
"devDependencies": {
58+
"@commitlint/cli": "^19.5.0",
59+
"@commitlint/config-conventional": "^19.8.0",
60+
"@eslint/js": "9.14.0",
61+
"@typescript-eslint/parser": "^8.12.2",
62+
"eslint": "9.14.0",
63+
"eslint-config-prettier": "^9.1.0",
64+
"eslint-plugin-astro": "^1.3.0",
65+
"eslint-plugin-import": "^2.31.0",
66+
"eslint-plugin-jsx-a11y": "^6.10.2",
67+
"eslint-plugin-react": "^7.37.2",
68+
"globals": "^15.11.0",
69+
"husky": "^9.1.6",
70+
"postcss-import": "^16.1.0",
71+
"prettier": "^3.3.3",
72+
"prettier-plugin-astro": "^0.14.1",
73+
"prettier-plugin-tailwindcss": "^0.6.11",
74+
"sanitize-html": "^2.14.0",
75+
"typescript-eslint": "^8.12.2"
76+
},
77+
"pnpm": {
78+
"onlyBuiltDependencies": [
79+
"@parcel/watcher",
80+
"esbuild",
81+
"sharp"
82+
]
83+
}
84+
}

plugins/remark-modified-time.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* @Description: Automatically add last modified time
3+
*/
4+
import { execSync } from 'child_process';
5+
6+
export function remarkModifiedTime() {
7+
return function (tree, file) {
8+
const filepath = file.history[0];
9+
const result = execSync(`git log -1 --pretty="format:%cI" "${filepath}"`);
10+
file.data.astro.frontmatter.lastModified = result.toString();
11+
};
12+
}

plugins/remark-reading-time.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* @file: Add reading time
3+
*/
4+
import getReadingTime from 'reading-time';
5+
import { toString } from 'mdast-util-to-string';
6+
7+
export function remarkReadingTime() {
8+
return function (tree, { data }) {
9+
const textOnPage = toString(tree);
10+
const readingTime = getReadingTime(textOnPage);
11+
// data.astro.frontmatter.minutesRead = i18next.t('blog.readingTime', {
12+
// minutes: Math.round(readingTime.minutes),
13+
// });
14+
data.astro.frontmatter.minutesRead = Math.round(readingTime.minutes);
15+
};
16+
}

0 commit comments

Comments
 (0)