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

Port Documentation pages, and REMOVE DOCPAD #247

Merged
merged 16 commits into from
Mar 4, 2024
Merged
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
39 changes: 38 additions & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
const { EleventyRenderPlugin } = require("@11ty/eleventy");
const Image = require("@11ty/eleventy-img");
const Sharp = require('sharp');
const fs = require('fs');
const path = require('path');
const { EleventyHtmlBasePlugin } = require("@11ty/eleventy");

module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(EleventyRenderPlugin);
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);

eleventyConfig.ignores.add("**/README.md");
eleventyConfig.ignores.add("**/LICENSE.md");

// used to set the current active dropdown list item to active, depending on current page
eleventyConfig.addShortcode("dropdownActive", function(dropdownItem) {
Expand Down Expand Up @@ -31,7 +38,37 @@ module.exports = function(eleventyConfig) {
return Image.generateHTML(metadata, imageAttributes);
});


eleventyConfig.addPassthroughCopy({ "src/files/images": "images" });

// gets folders for documentation collections, except for the images folder!
let docPath = path.join(__dirname, "11ty-source/documentation/flixel-docs/documentation");
let dirs = fs.readdirSync(docPath, { withFileTypes: true }).map(dirent => dirent.name).filter(dirent => dirent != "images");

for (const dir in dirs)
{
const cleanDir = dirs[dir].replace(/^[^a-zA-Z]+/g, "");
console.log("Clean DIR: ", cleanDir);
eleventyConfig.addCollection(cleanDir, function(collection) {
let cool = fs.readdirSync(path.join(docPath, dirs[dir]));
// console.log("Dir: ", dirs[dir]);
var collectionItem = collection.getFilteredByGlob(`**/flixel-docs/documentation/${dirs[dir]}/**`);
// console.log("Collection item: ", collectionItem);
collectionItem.map(item => item.data.tags.push(cleanDir));
collectionItem.map(item => item.data.docGroup = cleanDir);
// collectionItem.map(item => console.log(item.data));
// collectionItem.data.push(cleanDir);
return collectionItem;
});
}


eleventyConfig.addFilter("docsRegexp", function (value) {
let replacedValue = value.replace(/^[\d\-]+/, "");
replacedValue = replacedValue.replace(/\.html$/, "");
// console.log(replacedValue);
return replacedValue;
});

// Return your Object options:
return {
Expand All @@ -50,4 +87,4 @@ async function resizeImage(src, width, height, mode) {
fastShrinkOnLoad: false
}})
.toBuffer();
}
}
90 changes: 45 additions & 45 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
name: CI

on:
on:
push:
pull_request:
repository_dispatch:
workflow_dispatch:
inputs:
deploy_gh_pages:
description: 'Deploy to gh_pages branch (for use in forks)'
description: "Deploy to gh_pages branch (for use in forks)"
required: false
type: boolean

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'latest'
- uses: krdlab/setup-haxe@v1
- name: Build Site
run: |
ls -lah
npm install
npm run build
ls -lah
haxe --run RemoveRedirects
# - name: Highlighting
# run: |
# git clone --recursive https://github.com/ninjamuffin99/Highlighter
# cd Highlighter
# npm install
# node bin/highlighter.js ../out
# cd ..
- name: Deploy gh_pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{secrets.GITHUB_TOKEN}}
publish_dir: ./out
force_orphan: true
if: inputs.deploy_gh_pages == true
- name: Deploy Master
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{secrets.GITHUB_TOKEN}}
publish_dir: ./out
force_orphan: true
cname: haxeflixel.com
if: github.ref == 'refs/heads/master'
- name: Deploy Dev
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{secrets.ACCESS_TOKEN}}
publish_dir: ./out
force_orphan: true
cname: dev.haxeflixel.com
external_repository: HaxeFlixel/dev.haxeflixel.com
if: github.ref == 'refs/heads/dev'
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "latest"
- uses: krdlab/setup-haxe@v1
- name: Build Site
run: |
ls -lah
npm install
npm run build ${{ inputs.deploy_gh_pages && format('{0}', github.event.repository.name ) || '' }}
ls -lah
haxe --run RemoveRedirects
# - name: Highlighting
# run: |
# git clone --recursive https://github.com/ninjamuffin99/Highlighter
# cd Highlighter
# npm install
# node bin/highlighter.js ../out
# cd ..
- name: Deploy gh_pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{secrets.GITHUB_TOKEN}}
publish_dir: ./out
force_orphan: true
if: inputs.deploy_gh_pages == true
- name: Deploy Master
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{secrets.GITHUB_TOKEN}}
publish_dir: ./out
force_orphan: true
cname: haxeflixel.com
if: github.ref == 'refs/heads/master'
- name: Deploy Dev
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{secrets.ACCESS_TOKEN}}
publish_dir: ./out
force_orphan: true
cname: dev.haxeflixel.com
external_repository: HaxeFlixel/dev.haxeflixel.com
if: github.ref == 'refs/heads/dev'
49 changes: 49 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Tests
on: [push, pull_request]

jobs:
npm_install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "latest"
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
- uses: actions/cache@v4
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm install

test_matrix:
needs: npm_install
strategy:
fail-fast: false
matrix:
tests: ["test:js", "test:prettier", "test:liquid"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "latest"
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
- uses: actions/cache@v4
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm install
- run: npm run ${{ matrix.tests }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ node_modules/
docpad.js
.idea
src/documents/documentation
flixel-docs/
npm-debug.log*
out
debug.log
.DS_Store
package-lock.json
package-lock.json
3 changes: 3 additions & 0 deletions .liquidrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"engine": "11ty"
}
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/*.js
**/vendor/
5 changes: 5 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tabWidth: 2
useTabs: true
printWidth: 100
bracketSameLine: true
plugins: ["@shopify/prettier-plugin-liquid"]
8 changes: 8 additions & 0 deletions .vscode/extensions.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"sissel.shopify-liquid", // Liquid syntax highlighting
"syler.sass-indented", // Sass syntax highlighting
"standard.vscode-standard", // Javascript formatting / linting
"esbenp.prettier-vscode", // General linting (JSON + Liquid)
],
}
13 changes: 10 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"files.associations": {
"*.eco": "html"
},
"[liquid]": {
"editor.formatOnSave": true
}
}
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "standard.vscode-standard"
},
"standard.autoFixOnSave": true
}
20 changes: 11 additions & 9 deletions 11ty-source/404.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ title: "Page not found"
layout: 404-layout
permalink: 404.html
---

<div class="container">
<div class="row">

<h2>Strange, we are unable to find the page you have requested.</h2>

<p>It might have been removed, lost or never existed.
You could try and find it using <a href="https://google.com/search?q=site%3Ahaxeflixel.com">search</a>
<div class="row">
<h2>Strange, we are unable to find the page you have requested.</h2>

<p>Otherwise ask on our <a href="https://github.com/HaxeFlixel/flixel/discussions">forums</a></p>
<p>
It might have been removed, lost or never existed. You could try and find it using
<a href="https://google.com/search?q=site%3Ahaxeflixel.com">search</a>
</p>

<p>
Otherwise ask on our
<a href="https://github.com/HaxeFlixel/flixel/discussions">forums</a>
</p>
</div>
</div>
</div>
Loading
Loading