Skip to content

Commit

Permalink
feat(whatislove-dev): add webmentions to articles wd-512 (#533)
Browse files Browse the repository at this point in the history
* feat(whatislove-dev): add button block wd-512

* feat(whatislove-dev): add input block wd-512

* feat(whatislove-dev): add mentions markup wd-512

* feat(whatislove-dev): add webmentions to articles wd-512

* build(whatislove-dev): add cron rebuild functionality wd-512

* build(whatislove-dev): add api keys to cd action wd-512

* ci(whatislove-dev): add secrets to ci action wd-512
  • Loading branch information
what1s1ove authored May 30, 2024
1 parent d04d6a0 commit 0c3eac2
Show file tree
Hide file tree
Showing 22 changed files with 682 additions and 30 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Continuous Delivery

on:
schedule:
- cron: '0 0 * * *'
push:
branches:
- main
Expand Down Expand Up @@ -28,7 +30,7 @@ jobs:
dependencies:
name: Install Dependencies
needs: release
if: ${{ needs.release.outputs.release_created }}
if: ${{ needs.release.outputs.release_created || github.event_name == 'schedule' }}
runs-on: ubuntu-latest
steps:
- name: Code Checkout
Expand Down Expand Up @@ -88,6 +90,8 @@ jobs:
run: npm run build
env:
VITE_DB_API_KEY: ${{ secrets.DB_API_KEY }}
DEVTO_API_KEY: ${{ secrets.DEVTO_API_KEY }}
WEBMENTION_API_KEY: ${{ secrets.WEBMENTION_API_KEY }}

- name: Upload Artifact
uses: actions/upload-artifact@v4
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ jobs:

- name: Code Building
run: npm run build
env:
VITE_DB_API_KEY: ${{ secrets.DB_API_KEY }}
DEVTO_API_KEY: ${{ secrets.DEVTO_API_KEY }}
WEBMENTION_API_KEY: ${{ secrets.WEBMENTION_API_KEY }}

- name: Code Linting
run: npm run ci:lint
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ node_modules
build
process.mp4

# cache
.cache

# misc
.DS_Store
.env
10 changes: 10 additions & 0 deletions apps/whatislove-dev/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# COMMON
#
ENVIRONMENT=development

#
# API
#
DEVTO_API_KEY=1234567890
WEBMENTION_API_KEY=0987654321
17 changes: 10 additions & 7 deletions apps/whatislove-dev/eleventy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { parseHTML } from 'linkedom'
import markdownIt from 'markdown-it'
import { existsSync } from 'node:fs'
import { mkdir, readFile, writeFile } from 'node:fs/promises'
import process from 'node:process'
import svgo from 'svgo'

import { default as environment } from './src/data/environment.js'
import { addToc, replaceImgWrapper } from './src/transforms/transforms.js'

/** @typedef {import('./package.json')} */
Expand Down Expand Up @@ -45,7 +45,7 @@ let CollectionPath = /** @type {const} */ ({
PAGES: `src/pages/!(404)/index.njk`,
})

let isDevelopment = process.env[`NODE_ENV`] === `development`
let isDevelopment = environment.COMMON.ENVIRONMENT === `development`
let rawPackageJson = await readFile(new URL(`package.json`, import.meta.url))
let packageJson = /** @type {(text: string) => PackageJson} */ (JSON.parse)(
rawPackageJson.toString(),
Expand Down Expand Up @@ -95,11 +95,14 @@ let init = (config) => {
})

config.addFilter(`dateFormatted`, (value) => {
return /** @type {Date} */ (value).toLocaleString(`en-US`, {
day: `numeric`,
month: `short`,
year: `numeric`,
})
return new Date(/** @type {Date | string} */ (value)).toLocaleString(
`en-US`,
{
day: `numeric`,
month: `short`,
year: `numeric`,
},
)
})

config.addFilter(`shuffle`, (items) => {
Expand Down
3 changes: 2 additions & 1 deletion apps/whatislove-dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"start": "concurrently -k -p \"{name}: {time}\" -n \"CLIENT,SERVER\" -c \"green,blue\" \"npm:start:client\" \"npm:start:server\"",
"start:client": "NODE_ENV=development npx @11ty/eleventy --serve --quiet",
"start:client": "npx @11ty/eleventy --serve --quiet",
"start:server": "json-server --watch src/database.json --port 3001",
"build:clean": "rm -rf build",
"build": "npm run build:clean && npx @11ty/eleventy",
Expand Down Expand Up @@ -34,6 +34,7 @@
"@types/markdown-it": "14.1.1",
"bemlint": "1.7.0",
"browserslist": "4.22.1",
"dotenv": "16.4.5",
"esbuild": "0.19.5",
"html-minifier-terser": "7.2.0",
"json-server": "0.17.4",
Expand Down
16 changes: 16 additions & 0 deletions apps/whatislove-dev/src/data/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'dotenv/config'
import process from 'node:process'

let data = {
API: {
DEVTO_API_KEY: /** @type {string} */ (process.env[`DEVTO_API_KEY`]),
WEBMENTION_API_KEY: /** @type {string} */ (
process.env[`WEBMENTION_API_KEY`]
),
},
COMMON: {
ENVIRONMENT: /** @type {string} */ (process.env[`ENVIRONMENT`]),
},
}

export default data
Loading

0 comments on commit 0c3eac2

Please sign in to comment.