Skip to content

Commit

Permalink
inital work derived from PBA book
Browse files Browse the repository at this point in the history
  • Loading branch information
nuke-web3 committed Jun 5, 2024
0 parents commit 3963b76
Show file tree
Hide file tree
Showing 77 changed files with 5,884 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .dprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"typescript": {
},
"json": {
},
"markdown": {
"ignoreDirective": "prettier-ignore",
"ignoreFileDirective": "prettier-ignore-file",
"ignoreStartDirective": "prettier-ignore-start",
"ignoreEndDirective": "prettier-ignore-end"
},
"toml": {
},
"excludes": [
"**/html*",
"**/.yarn",
"**/node_modules",
"tools/**/*min.js",
"tools/plugin/chart",
"tools/plugin/mermaid.js",
"**/*-lock.json"
],
// TODO get reveal template html files supported by dprint
// https://github.com/g-plane/markup_fmt/issues/15
// "markup": {
// },
"plugins": [
// "https://plugins.dprint.dev/g-plane/markup_fmt-v0.9.0.wasm",
"https://plugins.dprint.dev/typescript-0.87.1.wasm",
"https://plugins.dprint.dev/json-0.17.4.wasm",
"https://plugins.dprint.dev/markdown-0.16.1.wasm",
"https://plugins.dprint.dev/toml-0.5.4.wasm"
]
}
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length=120

[*.yml]
indent_style = space
indent_size = 2
35 changes: 35 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Checks
on:
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
push:
branches:
- main
pull_request:
branches:
- main

jobs:
ci-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache
id: cache
uses: actions/cache@v3
with:
path: ~/.cache/dprint # TODO add more paths here for various checkers
key: ${{ runner.os }}-${{ hashFiles('**/*dprint.json') }}

- name: Format Check (dprint)
uses: dprint/check@v2.2
with:
config-path: .dprint.json

# FIXME .mlc.toml config not working... https://github.com/becheran/mlc/issues/78
- name: Markup Link Checker (mlc)
uses: becheran/mlc@v0.16.2
with:
args: "./content/ --ignore-links '*slides.md,*slides.html,*twitter.com*,*sec.gov*,*support.giphy.com*,*bitdefender.com*,*etherscan.io*,*cryptoslate.com*,*golden.com*,'"

- name: Check for image issues (orphans and broken links)
run: ${PWD}/tools/scripts/orphan-image-scan.sh content/
78 changes: 78 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# From https://github.com/rust-lang/mdBook/wiki/Automated-Deployment%3A-GitHub-Actions#raw-example
name: Build `html-*` static files, publish `html-book` to Pages
on:
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
push:
branches:
- main

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write # need write to push to branches
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
env:
MDBOOK_VERSION: v0.4.34
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Bun (uses cache in action)
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.0.0
- name: Install js/ts dependencies with Bun
run: bun install

- name: Install mdBook
run: |
url="https://github.com/rust-lang/mdbook/releases/download/${MDBOOK_VERSION}/mdbook-${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz"
mkdir mdbook
curl -sSL $url | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- name: Build static slides to embed in gh-pages book
run: bun build-slides-gh-pages
- name: Build book
run: mdbook build
- name: Embed `html-slides` into `html-book`, fix relative paths
run: |
rsync -av html-slides/content/ html-book/ --ignore-existing
rsync -av html-slides/ --exclude 'content' html-book/ --ignore-existing
find html-book/ -regex .*\.html | xargs sed -i'' -e 's#./../../../#../../#g' > /dev/null
# TODO: Without making a _branch_ that bloats the .git object,
# we should push out the static build files in html-book/ and html-slides/ to some archive,
# thus the bok and slides will be usable anywhere independently and
# a simple download to have a copy locally without building it yourself

- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Fix permissions # https://github.com/actions/upload-pages-artifact#file-permissions
run: |
chmod -c -R +rX "html-book"
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./html-book

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Build artifacts
/html*

# Rust artifacts
**/target

# Jupyter artifacts
**/.ipynb_checkpoints/**

# Some common ones
tmp
tmp/**
*.log
log/**
.vscode
.idea/
*.iml
*.iws
*.eml
out/
.DS_Store
.svn
node_modules/
.sass-cache
_static/

# Yarn, not using zero-installs
# ref: https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
# Yarn Integrity file
.yarn-integrity

## Draw,io
*.bkp
*.dtmp
20 changes: 20 additions & 0 deletions .mlc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# FIXME this config is not working... https://github.com/becheran/mlc/issues/78
# Print debug information to console
debug = false
# Do not check web links
offline = false
# Check the exact file extension when searching for a file
match-file-extension = true
# List of files and directories which will be ignored
ignore-path = [""]
# List of links which will be ignored
ignore-links = [
"*slides.md,*slides.html,*twitter.com*,*sec.gov*,*support.giphy.com*,*bitdefender.com*,*etherscan.io*,*cryptoslate.com*,*golden.com*,",
]
# List of markup types which shall be checked
markup-types = ["Markdown", "Html"]
# Wait time in milliseconds between http request to the same host
# Consider use only if getting `429 - Too Many Requests`
throttle = 0
# Path to the root folder used to resolve all relative paths
root-dir = "./content/"
14 changes: 14 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Ignore build/dev artifacts:
html*
node_modules
build
.cache
.yarn
.github
public
package-lock.json
yarn.lock

# Ignore files that don't need *text* formatting
assets
plugin
15 changes: 15 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
arrowParens: "avoid",
endOfLine: "lf",
semi: true,
singleQuote: true,
trailingComma: "es5",
overrides: [
{
files: "*.md",
options: {
singleQuote: false,
},
},
],
};
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Contributing

See the [Contributing Guide](./content/contribute/index.md).
1 change: 1 addition & 0 deletions LICENSE.md
1 change: 1 addition & 0 deletions README.md
33 changes: 33 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[book]
title = "Nuke 🌄 's Book"
authors = ["Nuke-Web3"]
description = "The materials used in Nuke 🌄 's talks and workshops"
language = "en"
multilingual = false
src = "content"

[build]
build-dir = "html-book"
create-missing = false # opt out of helper to create missing stub files, we want to fail if the SUMMARY is incorrect.

[rust]
edition = "2021"

[output.html]
site-url = "/book/" # needed for gh-pages, MUST match repo name on github!
git-repository-url = "https://github.com/nuke-web3/book"
edit-url-template = "https://github.com/nuke-web3/book/edit/main/{path}"
default-theme = "Ayu"
preferred-dark-theme = "Ayu"

[output.html.print]
enable = false # disclude support for printable output (slides are mangled)

[output.html.search]
limit-results = 20
use-boolean-and = true
boost-title = 2
boost-hierarchy = 2
boost-paragraph = 1
expand = true
heading-split-level = 2
Binary file added bun.lockb
Binary file not shown.
14 changes: 14 additions & 0 deletions content/404.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Document not found (404)

🙃 This URL isn't working right now.
Try the search, maybe the content moved!

Press `s` or click top-left (🔍 icon) of the outermost window. ↖️

---

🫠 ... Is this _supposed_ to be some embedded slides but is an embedded 404 in a valid page?

- If you are _developing_ slides, you must rebuild & serve with `just s` command, embedded slides are NOT present in the mdBook watching serve 😭.
- If still broken, or you are looking at the hosted or slides - please `suggest an edit` so we can fix it together, pointing to the exact source of the problem.
Click the 📝 icon is top-right of the outermost window to open one up. ↗️
Loading

0 comments on commit 3963b76

Please sign in to comment.