Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate site to Astro #346

Merged
merged 66 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 51 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
820e79a
First commit; migrate new Astro work from other repo
lucperkins Jun 8, 2024
4f8204b
Add support for custom header IDs
lucperkins Jun 8, 2024
a705681
Remove type check from CI
lucperkins Jun 8, 2024
aa13ec6
Fix issue with custom header IDs
lucperkins Jun 8, 2024
02aad46
Fix URL in pinning doc
lucperkins Jun 8, 2024
0b524df
Fix external link issue
lucperkins Jun 8, 2024
c6fbfc5
Add Nix terms section to main page
lucperkins Jun 12, 2024
586576f
Add signup section
lucperkins Jun 12, 2024
6f30df7
Add singup modal
lucperkins Jun 12, 2024
5f78dc8
Add templating for concept pages
lucperkins Jun 12, 2024
0a1ee83
Fix Alpine errors and add more components
lucperkins Jun 12, 2024
f820a05
Finish admonition implementation
lucperkins Jun 12, 2024
a83a9a3
Fix CI issues
lucperkins Jun 18, 2024
1ce8582
Add about page
lucperkins Jun 18, 2024
de24a82
Get Brief component working
lucperkins Jun 18, 2024
a509c3a
Add error handling to Brief component
lucperkins Jun 18, 2024
fd8ab01
Add FlakeHub to Lychee ignore
lucperkins Jun 18, 2024
2a820fd
Update npm deps
lucperkins Jun 19, 2024
8eac777
Add custom headings
lucperkins Jun 19, 2024
79a0171
Fix prose headings
lucperkins Jun 19, 2024
6ce2e23
Fix pagination in /start pages
lucperkins Jun 19, 2024
4892140
Fix formatting
lucperkins Jun 19, 2024
c53a580
Fix merge conflicts with main
lucperkins Aug 7, 2024
6bb3e8c
Fix nix-develop doc by adding order param
lucperkins Aug 7, 2024
84c6ab7
Update pnpm dependencies
lucperkins Aug 7, 2024
0e88068
Fix merge conflicts with main
lucperkins Nov 13, 2024
6bdeb6d
Fix build error
lucperkins Nov 13, 2024
45c8208
More small fixes
lucperkins Nov 14, 2024
0ab87c2
Update lockfiles
lucperkins Nov 14, 2024
4a9639c
Fix Language component
lucperkins Nov 18, 2024
20cd834
Fix language selector component
lucperkins Nov 18, 2024
7d3ec50
Add some missing shell command titles
lucperkins Nov 18, 2024
c4529e3
Style Nix store path component
lucperkins Nov 18, 2024
50b4fdc
Add support for Markdown emoji
lucperkins Nov 18, 2024
966e56f
Add missing code sample titles
lucperkins Nov 18, 2024
21df44c
Remove alex check
lucperkins Nov 18, 2024
ffbff47
Provide template for quick start and concepts landing pages
lucperkins Nov 19, 2024
47e4dca
Fix related and external sources
lucperkins Nov 19, 2024
2f9774c
Fix link icons
lucperkins Nov 19, 2024
c923329
Fix start page dropdown
lucperkins Nov 19, 2024
36b2714
Fix inline comments
lucperkins Nov 19, 2024
1d990a9
Begin with feedback widget
lucperkins Nov 19, 2024
b64450b
Finish page survey
lucperkins Nov 19, 2024
47de60c
Fix build
lucperkins Nov 19, 2024
2460a52
Add cookie consent
lucperkins Nov 19, 2024
5270e78
Fix modal flash
lucperkins Nov 19, 2024
a28ab35
Fix merge conflicts with main
lucperkins Nov 19, 2024
b818b2a
Fix build error
lucperkins Nov 19, 2024
d258e19
Reformat
lucperkins Nov 19, 2024
121a185
Fix hero button hover
lucperkins Nov 19, 2024
6823baa
Fix favicon link
lucperkins Nov 19, 2024
dabb39a
Update Posthog project key
lucperkins Nov 20, 2024
c8a6248
Add feedback bar to quick start pages
lucperkins Nov 20, 2024
a26bbc5
Improve aesthetic of feedback textarea
lucperkins Nov 20, 2024
f8e67d9
Streamline signup modal
lucperkins Nov 20, 2024
a78d544
Update dependencies and remove unneeded items from dev shell
lucperkins Nov 20, 2024
d77999d
Add separate Posthog component
lucperkins Nov 22, 2024
1791e5f
Streamline cookie consent
lucperkins Nov 22, 2024
c68a20f
Convert cookie consent component to Astro
lucperkins Nov 22, 2024
03c5d3a
Fix show logic on consent banner
lucperkins Nov 22, 2024
2dad9d7
Re-work dark mode logic
lucperkins Nov 22, 2024
94780b1
Add more x-cloak directives
lucperkins Nov 22, 2024
a10d0b2
Add missing titles
lucperkins Nov 22, 2024
a615928
Revert to current posthog-js
lucperkins Nov 22, 2024
65837ce
Fix cookie consent
lucperkins Nov 26, 2024
29ee926
Fix TS error
lucperkins Nov 26, 2024
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
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ jobs:
- nix-system: "x86_64-linux"
runner: "ubuntu-22.04"
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Build packages in pkg templates
run: ./scripts/build-pkg-templates.sh
- name: Build packages in pkg templates
run: ./scripts/build-pkg-templates.sh
1 change: 0 additions & 1 deletion .github/workflows/flakehub-publish-rolling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ jobs:
with:
rolling: true
visibility: "public"

11 changes: 4 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
# Nix artifacts
result

# Tailwind artifacts
.temp.*.tailwind.config.cjs

# htmltest artifacts
/tmp/

# Lychee cache
.lycheecache

# îles artifacts
/.iles-ssg-temp/
# Astro artifacts
/.astro/

# Site build
/dist/
__unconfig_iles.config.ts
.direnv
7 changes: 6 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/.astro/
/.direnv/
/.vscode/
/dist/
pnpm-lock.yaml
*.d.ts
/nix/
**/*.mdx

30 changes: 13 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,17 @@ Zero to Nix's "stack" 🥞:

The site uses a number of custom [MDX] components to spice up the usual Markdown content.

| Component | What it does |
| :----------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------- |
| Component | What it does |
| :----------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------- |
| [`Admonition`](./src/components/mdx/Admonition.vue) | An admonition block of type `danger`, `info`, `success`, or `warning`.<br /><br />Adding an `id` makes it a stateful callout dropdown. |
| [`Concept`](./src/components/mdx/concepts/Concept.vue) | Add a hoverable tool tip for a concept |
| [`Language`](./src/components/mdx/stateful/Language.vue) | Displays which (programming) language the user has selected |
| [`Languages`](./src/components/mdx/stateful/Languages.vue) | Provides a (programming) language selector |
| [`NixStorePath`](./src/components/concepts/NixStorePath.vue) | Provides a colorful visualization of Nix store path components |
| [`Shell`](./src/components/code/Shell.vue) | Provides language- and system-specific shell commands |
| [`SpecificLanguage`](./src/components/mdx/stateful/SpecificLanguage.vue) | Displays the enclosed content only if the user has selected a specific language |
| [`System`](./src/components/mdx/stateful/System.vue) | Displays the currently selected system (Linux vs. macOS) |
| [`Systems`](./src/components/stateful/Systems.vue) | Provides a system selector (Linux vs. macOS) |

> **Note**: any time you use one of these components in an [MDX] file, you need to add a `client:load` directive to it.
> This is one of [îles][iles]' so-called [hydration directives][hydration].
> There are other directives available, but [`client:load`][client-load] is the one that we need to use, as it ensures that the component is loaded as soon as the user comes to the page.
| [`Concept`](./src/components/mdx/concepts/Concept.vue) | Add a hoverable tool tip for a concept |
| [`Language`](./src/components/mdx/stateful/Language.vue) | Displays which (programming) language the user has selected |
| [`Languages`](./src/components/mdx/stateful/Languages.vue) | Provides a (programming) language selector |
| [`NixStorePath`](./src/components/concepts/NixStorePath.vue) | Provides a colorful visualization of Nix store path components |
| [`Shell`](./src/components/code/Shell.vue) | Provides language- and system-specific shell commands |
| [`SpecificLanguage`](./src/components/mdx/stateful/SpecificLanguage.vue) | Displays the enclosed content only if the user has selected a specific language |
| [`System`](./src/components/mdx/stateful/System.vue) | Displays the currently selected system (Linux vs. macOS) |
| [`Systems`](./src/components/stateful/Systems.vue) | Provides a system selector (Linux vs. macOS) |

## Directory structure

Expand Down Expand Up @@ -152,7 +148,7 @@ We also recommend adding these settings to your local `.vscode/settings.json`:
"editor.formatOnSave": false,
// This is a nice helper for longer sentences
"editor.wordWrapColumn": 100,
"editor.wordWrap": "wordWrapColumn"
"editor.wordWrap": "wordWrapColumn",
},
// Format everything using the Prettier config
"editor.defaultFormatter": "esbenp.prettier-vscode",
Expand All @@ -164,8 +160,8 @@ We also recommend adding these settings to your local `.vscode/settings.json`:
"dist": true,
"pnpm-lock.yaml": true,
"*.d.ts": true,
"tmp": true
}
"tmp": true,
},
}
```

Expand Down
41 changes: 41 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import alpinejs from "@astrojs/alpinejs";
import mdx from "@astrojs/mdx";
import react from "@astrojs/react";
import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind";
import { pluginCollapsibleSections } from "@expressive-code/plugin-collapsible-sections";
import { pluginLineNumbers } from "@expressive-code/plugin-line-numbers";
import expressiveCode from "astro-expressive-code";
import icon from "astro-icon";
import { defineConfig } from "astro/config";
import remarkEmoji from "remark-emoji";
import remarkHeadingId from "remark-heading-id";

export default defineConfig({
integrations: [
alpinejs({
entrypoint: "./src/entrypoint",
}),
expressiveCode({
themes: ["github-dark"],
emitExternalStylesheet: true,
defaultProps: {
showLineNumbers: false,
},
plugins: [pluginCollapsibleSections(), pluginLineNumbers()],
}),
icon(),
mdx({
//gfm: true,
remarkPlugins: [remarkEmoji, remarkHeadingId],
}),
sitemap(),
tailwind(),
react(),
],
server: {
open: true,
port: 3000,
},
site: "https://zero-to-nix.com",
});
79 changes: 0 additions & 79 deletions components.d.ts

This file was deleted.

12 changes: 0 additions & 12 deletions composables.d.ts

This file was deleted.

2 changes: 0 additions & 2 deletions env.d.ts

This file was deleted.

12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 5 additions & 22 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
{
description = "Zero to Nix: Your guide to learning Nix and flakes";

inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2405.*.tar.gz";
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*";

outputs =
{ self
, nixpkgs
}:

let
# Conveniences for Nixpkgs
overlays = [
(self: super: {
nodejs = super.nodejs_18;
pnpm = super.nodePackages.pnpm;
alex = super.nodePackages.alex;
})
];

# Systems supported
allSystems = [
"x86_64-linux" # 64-bit Intel/AMD Linux
Expand All @@ -27,7 +18,7 @@
];

forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit overlays system; };
pkgs = import nixpkgs { inherit system; };
});

# Helper function for scripting
Expand All @@ -44,7 +35,6 @@

# Language
vale
alex

# Link checking
htmltest
Expand All @@ -53,6 +43,9 @@
# JS
nodejs
pnpm

# Serve locally
static-web-server
];

run = pkg: runPkg pkgs pkg;
Expand Down Expand Up @@ -99,14 +92,6 @@
${run "vale"} src/pages
'')

(writeScriptBin "check-sensitivity" ''
${run "alex"} --quiet src/pages
'')

(writeScriptBin "check-types" ''
${run "pnpm"} run typecheck
'')

(writeScriptBin "preview" ''
build
${run "pnpm"} run preview
Expand All @@ -118,8 +103,6 @@
build-ci
check-internal-links
lint-style
check-sensitivity
check-types
'')
];

Expand Down
Loading
Loading