Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ bin/__py*
src/pages/blog/[...slug].astro
src/pages/blog/[...slug].astro
bun.lockb
test.css
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ SHELL ["/bin/ash", "-o", "pipefail", "-c"]
RUN --mount=type=secret,id=env,dst=/etc/secrets/.env \
TURSO_DB_AUTH_TOKEN=$(grep TURSO_DB_AUTH_TOKEN /etc/secrets/.env | cut -d '=' -f 2) \
TURSO_DB_URL=$(grep TURSO_DB_URL /etc/secrets/.env | cut -d '=' -f 2) \
export TURSO_DB_URL && export TURSO_DB_AUTH_TOKEN \
GITHUB_AUTH_TOKEN=$(grep GITHUB_AUTH_TOKEN /etc/secrets/.env | cut -d '=' -f 2) \
export TURSO_DB_URL && export TURSO_DB_AUTH_TOKEN && export GITHUB_AUTH_TOKEN \
&& cp /etc/secrets/.env .env \
&& npm install \
&& npm run prisma-generate \
Expand Down
150 changes: 60 additions & 90 deletions astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ import svgr from "vite-plugin-svgr";
import customImageResizer from "./bin/processImages.mjs";
import { remarkReadingTime } from "./src/plugins/remark-reading-time";
import { remarkSummary } from "./src/plugins/remark-summary";
import {
transformerNotationDiff,
transformerNotationHighlight,
transformerNotationWordHighlight,
} from "@shikijs/transformers";
import { transformerNotationDiff, transformerNotationHighlight, transformerNotationWordHighlight } from "@shikijs/transformers";
// import {
// transformerNotationDiff,
// transformerNotationErrorLevel,
Expand All @@ -32,52 +28,39 @@ import {
import expressiveCode from "astro-expressive-code";
// import wasm from "vite-plugin-wasm";
// import topLevelAwait from "vite-plugin-top-level-await";
import rehypeStarryNight from "@microflash/rehype-starry-night";
import simpleStackStream from "simple-stack-stream";
const __dirname = dirname(fileURLToPath(import.meta.url));

/**
* @type {import('astro').AstroConfig}
*/


// https://astro.build/config
export default defineConfig({
output: "server",
adapter: node({
mode: "standalone",
mode: "standalone"
}),
site: "https://www.railsdev.dev",
// prefetch: true,
integrations: [
customImageResizer,
expressiveCode(),
mdx({
remarkPlugins: [
remarkReadingTime,
// @ts-expect-error - This is a valid plugin that returns a Transformer,
// but the type definition is not compatible with the expected [unified.Plugin, string[]] type.
// remarkPlugins accepted both unified.Plugin, [unified.Plugin, string[]] and [unified.Plugin, { [key: string]: any }]
[
remarkShikiTwoSlash.default,
{
theme: "material-darker",
},
],
remarkSummary,
],
}),
sitemap(),
tailwind({
applyBaseStyles: false,
nesting: true,
}),
svelte(),
icon(),
// solid({
// include: ["**/solid/*"],
// }),
react({}),
robotsTxt(),
sitemap(),
],
integrations: [customImageResizer, expressiveCode(), mdx({
remarkPlugins: [remarkReadingTime,
// @ts-expect-error - This is a valid plugin that returns a Transformer,
// but the type definition is not compatible with the expected [unified.Plugin, string[]] type.
// remarkPlugins accepted both unified.Plugin, [unified.Plugin, string[]] and [unified.Plugin, { [key: string]: any }]
[remarkShikiTwoSlash.default, {
theme: "material-darker"
}], remarkSummary]
}), sitemap(), tailwind({
applyBaseStyles: false,
nesting: true
}), svelte(), icon(),
// solid({
// include: ["**/solid/*"],
// }),
react({}), robotsTxt(), sitemap(), simpleStackStream()],
markdown: {
remarkPlugins: [
// @ts-expect-error - This is a valid plugin that returns a Transformer,
Expand Down Expand Up @@ -108,74 +91,61 @@ export default defineConfig({
// },
// ],
],
rehypePlugins: [
[
rehypeAutolinkHeadings,
{
behavior: "append",
},
],
],
rehypePlugins: [[rehypeAutolinkHeadings, {
behavior: "append"
}]],
shikiConfig: {
theme: "material-theme-darker",
transformers: [
// {
// code(node) {
// this.addClassToHast(node, "language-js");
// },
// line(node, line) {
// node.properties["data-line"] = line;
// if ([1, 3, 4].includes(line))
// this.addClassToHast(node, "highlight");
// },
// span(node, line, col) {
// node.properties["data-token"] = `token:${line}:${col}`;
// },
// },
transformerNotationDiff(),
transformerNotationHighlight(),
// transformerNotationWordHighlight(),
],
// {
// code(node) {
// this.addClassToHast(node, "language-js");
// },
// line(node, line) {
// node.properties["data-line"] = line;
// if ([1, 3, 4].includes(line))
// this.addClassToHast(node, "highlight");
// },
// span(node, line, col) {
// node.properties["data-token"] = `token:${line}:${col}`;
// },
// },
transformerNotationDiff(), transformerNotationHighlight()
// transformerNotationWordHighlight(),
]
},
extendDefaultPlugins: true,
syntaxHighlight: false,
syntaxHighlight: false
},
vite: {
ssr: {
noExternal: ["@radix-ui/react-tabs"],
noExternal: ["@radix-ui/react-tabs"]
},
resolve: {
alias: {
$: path.resolve(__dirname, "./src"),
},
$: path.resolve(__dirname, "./src")
}
},
plugins: [
// wasm(),
// topLevelAwait(),
svgr({
include: "**/*.svg?react",
svgrOptions: {
plugins: ["@svgr/plugin-svgo", "@svgr/plugin-jsx"],
svgoConfig: {
plugins: [
"preset-default",
"removeTitle",
"removeDesc",
"removeDoctype",
"cleanupIds",
],
},
},
}),
],
// wasm(),
// topLevelAwait(),
svgr({
include: "**/*.svg?react",
svgrOptions: {
plugins: ["@svgr/plugin-svgo", "@svgr/plugin-jsx"],
svgoConfig: {
plugins: ["preset-default", "removeTitle", "removeDesc", "removeDoctype", "cleanupIds"]
}
}
})]
},
image: {
service: squooshImageService(),
service: squooshImageService()
},
redirects: {
"/blog": {
status: 308,
destination: "/blog/1",
},
},
});
destination: "/blog/1"
}
}
});
Binary file removed bun.lockb
Binary file not shown.
17 changes: 17 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.mjs",
"css": "./src/styles/global.css",
"baseColor": "slate",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "$/components",
"utils": "$/lib/utils"
}
}
9 changes: 9 additions & 0 deletions hexToRgb.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable @typescript-eslint/no-var-requires */
function hexToRgb(hex) {
const [, rr, gg, bb] = hex.match(
/^#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i
);

return `${Number.parseInt(rr, 16)} ${parseInt(gg, 16)} ${parseInt(bb, 16)}`;
}

Loading