Skip to content

Commit

Permalink
refactor: migrate to TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
U-cauda-elongata committed Jul 15, 2024
1 parent 3200e3b commit 4c4a0a4
Show file tree
Hide file tree
Showing 20 changed files with 1,256 additions and 186 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Check
on:
push:
branches:
- main
paths:
- Makefile
- elm.json
- package.json
- pnpm-lock.yaml
- 'src/**'
workflow_dispatch: {}

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- run: pnpm install
- name: Setup Elm
uses: mpizenberg/[email protected]
with:
cache-key: elm-home-${{ hashFiles('elm-tooling.json', 'elm.json') }}
- run: make --always-make check
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ all: docs/index.html NikumaruFont.en.woff2 COPYING
src/Translations.elm: public/translations/en.json
pnpx elm-i18next-gen --source public/translations/en.json --target src/ --type both --overwrite

docs/index.html: fonts elm.json src/Translations.elm src/*.elm src/*/*.elm src/*/*/*.elm
src/Main.elm.d.ts: src/InteropDefinitions.elm
pnpx elm-ts-interop --output src/Main.elm.d.ts

docs/index.html: fonts elm.json src/Translations.elm src/Main.elm.d.ts src/*.elm src/*/*.elm src/*/*/*.elm
pnpx vite build --base ''

fonts: public/NikumaruFont.en.woff2 public/NikumaruFont.ja.woff2
Expand All @@ -22,6 +25,15 @@ COPYING: scripts/collect_licenses.sh src/COPYING.in elm.json docs/index.html
cp src/COPYING.in COPYING
./scripts/collect_licenses.sh >> COPYING

check: check-elm check-ts

check-elm:
elm make --output=/dev/null src/Main.elm

check-ts: src/Main.elm.d.ts
pnpx eslint src/index.ts
tsc --noEmit

clean:
rm -r docs || true
rm public/NikumaruFont.en.woff2 || true
Expand Down
4 changes: 3 additions & 1 deletion elm.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"dependencies": {
"direct": {
"ChristophP/elm-i18next": "4.2.1",
"dillonkearns/elm-ts-json": "2.1.1",
"elm/browser": "1.0.2",
"elm/core": "1.0.5",
"elm/html": "1.0.0",
Expand All @@ -24,7 +25,8 @@
"elm/bytes": "1.0.8",
"elm/file": "1.0.5",
"elm/parser": "1.1.0",
"elm/virtual-dom": "1.0.3"
"elm/virtual-dom": "1.0.3",
"elm-community/dict-extra": "2.4.0"
}
},
"test-dependencies": {
Expand Down
23 changes: 23 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";


export default [
{
files: ["**/*.{js,mjs,cjs,ts}"],
rules: {
"@typescript-eslint/switch-exhaustiveness-check": "error",
},
},
{
languageOptions: {
globals: globals.browser,
parserOptions: {
project: true,
}
}
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
];
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<meta name="referrer" content="origin" />
<link href="feed/latest.json" rel="preload" as="fetch" crossorigin="" />
<link href="style.css" rel="stylesheet" />
<script type="module" src="src/index.js"></script>
<script type="module" src="src/index"></script>
<meta name="description" content="けものフレンズ/けもVの公式 YouTube 配信を一覧するツール" />
<meta name="keywords" content="けものフレンズ,けもフレ,けものフレンズVぷろじぇくと,けもV,ケープペンギン,ケープペンギンちゃんねる,ケプ子,African Penguin,フンボルトペンギン,フンボルトペンギンちゃんねる,フルル,Humboldt Penguin,シマハイイロギツネ,シマハイシン,シマハイ,Island Fox,コヨーテ,howlcast,Coyote,Coyo,ダイアウルフ,ダイアはここにいる,Dire Wolf,カラカル,カラ騒ぎ,Caracal,VTuber,YouTube" />
<meta property="og:title" name="twitter:title" content="けものフレンズ配信カレンダー" />
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
},
"license": "GPL-3.0-only",
"devDependencies": {
"@eslint/js": "^9.7.0",
"elm-i18next-gen": "^1.1.0",
"elm-tooling": "^1.8.0",
"eslint": "9.x",
"globals": "^15.8.0",
"typescript-eslint": "^7.16.1",
"vite": "^5.3.3",
"vite-plugin-elm": "^3.0.1",
"vite-plugin-html": "^3.2.2"
Expand Down
Loading

0 comments on commit 4c4a0a4

Please sign in to comment.