Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
scarf005 committed Dec 12, 2023
0 parents commit 7f2f34a
Show file tree
Hide file tree
Showing 27 changed files with 1,649 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish on GitHub Pages

on:
push:
branches: [ main ]

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

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Setup Deno environment
uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Build site
run: deno task build

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

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: '_site'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
37 changes: 37 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lint_and_fmt:
runs-on: ubuntu-latest
strategy:
matrix:
deno: [v1.x]
steps:
- uses: actions/checkout@v2
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno }}
- name: Lint files
run: deno lint
- name: Check formatting
run: deno fmt --check
test:
runs-on: ubuntu-latest
strategy:
matrix:
deno: [v1.x, canary]
steps:
- uses: actions/checkout@v2
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno }}
- name: Run unit tests on Deno
run: deno test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_site
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"deno.enable": true,
"deno.lint": true,
"deno.unstable": true,
"deno.config": "./deno.json",
"[json][jsonc][markdown][typescript][typescriptreact]": {
"editor.defaultFormatter": "denoland.vscode-deno"
}
}
661 changes: 661 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Cataclysm: Bright Nights Blog

Weekly changelogs and development updates for Cataclysm: Bright Nights.

## How to run

```sh
git https://github.com/scarf005/bn-blog
cd bn-blog
deno task serve
```

## License

[AGPL 3.0 only](./LICENSE)
11 changes: 11 additions & 0 deletions _config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { lume } from "./lume_core.ts"
import relativeUrls from "lume/plugins/relative_urls.ts"

const site = lume()

site.copy([".css"])
site.ignore("./README.md")
site.data("layout", "_includes/base.ts")
site.use(relativeUrls())

export default site
35 changes: 35 additions & 0 deletions _includes/base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
export const repo = "https://github.com/scarf005/bn-blog"

const footer = /*html*/ `
<footer>
© 2023 <a href="https://github.com/scarf005">scarf</a>
| <a href="https://www.gnu.org/licenses/agpl-3.0.en.html">AGPL-3.0-Only</a>
| <a href="${repo}">Source</a>
</footer>
`

const render = (title: string, { content, head = "" }: Lume.Data): string => /*html*/ `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>${title}</title>
<link rel="stylesheet" href="/assets/style.css">
${head}
</head>
<body>
<main>
<h1>${title}</h1>
${content}
</main>
${footer}
</body>
</html>
`

export default (data: Lume.Data) => {
const title = data.title ?? data.page.data.basename

return render(title, data)
}
15 changes: 15 additions & 0 deletions assets/list.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ul {
list-style: none;
}

ul ul li {
list-style: disc;
}

ul ul li li {
list-style: circle;
}

ul ul li li li {
list-style: square;
}
32 changes: 32 additions & 0 deletions assets/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
body {
display: flex;
flex-direction: column;
align-items: center;
margin: 40px auto;
max-width: 800px;
line-height: 1.6;
font-size: 18px;
color: #444;
}

@media (max-aspect-ratio: 1/1) {
body {
font-size: 2em;
}
}

img {
max-width: 100%;
display: block;
height: auto;
}

a {
text-decoration-line: underline;
}

h1,
h2,
h3 {
line-height: 1.2;
}
24 changes: 24 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"exclude": ["_site"],
"tasks": {
"lume": "echo \"import 'lume/cli.ts'\" | deno run --unstable -A -",
"build": "deno task lume",
"serve": "deno task lume -s"
},
"fmt": {
"semiColons": false,
"lineWidth": 100,
"useTabs": true,
"proseWrap": "never"
},
"compilerOptions": {
"types": ["lume/types.ts"],
"exactOptionalPropertyTypes": true,
"noErrorTruncation": true
},
"unstable": ["ffi", "http"],
"nodeModulesDir": false,
"imports": {
"lume/": "https://deno.land/x/lume@v2.0.1/"
}
}

0 comments on commit 7f2f34a

Please sign in to comment.