Skip to content

Commit

Permalink
refactor/chore: use bun
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Feb 4, 2024
1 parent 3ebfe6a commit 35cd027
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 39 deletions.
33 changes: 13 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,23 @@ jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version:
- 13.x

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- uses: oven-sh/setup-bun@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm set audit false && node -v && npm -v
- run: npm i
- run: npm run build
- run: cp -r src/img dist/img && touch dist/CNAME && echo "friends.skk.moe" > dist/CNAME
bun-version: latest
- run: bun i
- run: bun run build
- run: cp -r src/img dist/img
- name: Deploy
uses: peaceiris/actions-gh-pages@v2
env:
PERSONAL_TOKEN: ${{ secrets.ACCESS_TOKEN }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./dist
uses: peaceiris/actions-gh-pages@v3
with:
username: ${{ secrets.GIT_USERNAME }}
useremail: ${{ secrets.GIT_EMAIL }}
personal_token: ${{ secrets.ACCESS_TOKEN }}
publish_branch: gh-pages
publish_dir: ./dist
user_name: ${{ secrets.GIT_USERNAME }}
user_email: ${{ secrets.GIT_EMAIL }}
cname: friends.skk.moe
Binary file added bun.lockb
Binary file not shown.
3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict';

module.exports = require('eslint-config-sukka').sukka();
15 changes: 0 additions & 15 deletions index.js

This file was deleted.

11 changes: 11 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import yaml from 'js-yaml';

// Get document, or throw exception on error
(async () => {
try {
const doc = yaml.load(await Bun.file('./src/links.yml').text());
Bun.write('./dist/links.json', JSON.stringify(doc));
} catch (e) {
console.error(e);
}
})();
18 changes: 14 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
{
"name": "friends",
"version": "0.0.0",
"description": "",
"scripts": {
"build": "node index.js"
},
"private": true,
"description": "",
"repository": {
"type": "git",
"url": "git+https://github.com/SukkaW/Friends.git"
},
"scripts": {
"build": "bun run index.ts",
"lint": "eslint --format=sukka ."
},
"license": "ISC",
"dependencies": {
"js-yaml": "^3.13.1"
},
"devDependencies": {
"@eslint-sukka/ts": "^5.0.0",
"@types/bun": "^1.0.4",
"@types/js-yaml": "^4.0.9",
"eslint": "^8.56.0",
"eslint-config-sukka": "^5.0.0",
"eslint-formatter-sukka": "^5.0.0",
"typescript": "^5.3.3"
}
}

0 comments on commit 35cd027

Please sign in to comment.