Skip to content
Closed
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
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## TLDR;

## What Does This Do?

## Brief Details?

## How Do The Tests Prove The Change Works?
63 changes: 63 additions & 0 deletions .github/workflows/deploy-website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Deploy Website to GitHub Pages

on:
workflow_dispatch:

permissions:
contents: write
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: stable

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: website/package-lock.json

- name: Install website dependencies
working-directory: website
run: npm ci

- name: Generate API documentation
working-directory: website
run: ./scripts/generate-api-docs.sh

- name: Build website
working-directory: website
run: npx @11ty/eleventy --pathprefix=/dart_node/

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: website/_site

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ node_modules/
*.js.map

examples/mobile/rn/.expo/

# Website generated files
website/_site/
website/src/api/
website/.dart-doc-temp/
115 changes: 115 additions & 0 deletions website/eleventy.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import syntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight";
import pluginRss from "@11ty/eleventy-plugin-rss";
import eleventyNavigationPlugin from "@11ty/eleventy-navigation";

export default function(eleventyConfig) {
// Plugins
eleventyConfig.addPlugin(syntaxHighlight);
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPlugin(eleventyNavigationPlugin);

// Passthrough copy for assets
eleventyConfig.addPassthroughCopy("src/assets");
eleventyConfig.addPassthroughCopy("src/api");
eleventyConfig.addPassthroughCopy("src/robots.txt");

// Watch targets
eleventyConfig.addWatchTarget("src/assets/");

// Collections
eleventyConfig.addCollection("posts", function(collectionApi) {
return collectionApi.getFilteredByGlob("src/blog/*.md").sort((a, b) => {
return b.date - a.date;
});
});

eleventyConfig.addCollection("docs", function(collectionApi) {
return collectionApi.getFilteredByGlob("src/docs/**/*.md");
});

// Tag collection - get all unique tags from blog posts
eleventyConfig.addCollection("tagList", function(collectionApi) {
const tagSet = new Set();
collectionApi.getFilteredByGlob("src/blog/*.md").forEach(post => {
(post.data.tags || []).forEach(tag => {
tag !== 'post' && tag !== 'posts' && tagSet.add(tag);
});
});
return [...tagSet].sort();
});

// Category collection - get all unique categories from blog posts
eleventyConfig.addCollection("categoryList", function(collectionApi) {
const categorySet = new Set();
collectionApi.getFilteredByGlob("src/blog/*.md").forEach(post => {
post.data.category && categorySet.add(post.data.category);
});
return [...categorySet].sort();
});

// Posts by tag - creates a collection for each tag
eleventyConfig.addCollection("postsByTag", function(collectionApi) {
const postsByTag = {};
collectionApi.getFilteredByGlob("src/blog/*.md").forEach(post => {
(post.data.tags || []).forEach(tag => {
tag !== 'post' && tag !== 'posts' && (postsByTag[tag] = postsByTag[tag] || []).push(post);
});
});
Object.keys(postsByTag).forEach(tag => {
postsByTag[tag].sort((a, b) => b.date - a.date);
});
return postsByTag;
});

// Posts by category - creates a collection for each category
eleventyConfig.addCollection("postsByCategory", function(collectionApi) {
const postsByCategory = {};
collectionApi.getFilteredByGlob("src/blog/*.md").forEach(post => {
post.data.category && (postsByCategory[post.data.category] = postsByCategory[post.data.category] || []).push(post);
});
Object.keys(postsByCategory).forEach(cat => {
postsByCategory[cat].sort((a, b) => b.date - a.date);
});
return postsByCategory;
});

// Filters
eleventyConfig.addFilter("dateFormat", (dateObj) => {
return new Date(dateObj).toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric'
});
});

eleventyConfig.addFilter("isoDate", (dateObj) => {
return new Date(dateObj).toISOString();
});

eleventyConfig.addFilter("limit", (arr, limit) => {
return arr.slice(0, limit);
});

eleventyConfig.addFilter("capitalize", (str) => {
return str ? str.charAt(0).toUpperCase() + str.slice(1) : '';
});

eleventyConfig.addFilter("slugify", (str) => {
return str ? str.toLowerCase().replace(/\s+/g, '-').replace(/[^\w-]+/g, '') : '';
});

// Shortcodes
eleventyConfig.addShortcode("year", () => `${new Date().getFullYear()}`);

return {
dir: {
input: "src",
output: "_site",
includes: "_includes",
data: "_data"
},
templateFormats: ["md", "njk", "html"],
markdownTemplateEngine: "njk",
htmlTemplateEngine: "njk"
};
}
Loading
Loading