diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 6f01500..5a5dd49 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -8,6 +8,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc - uses: oven-sh/setup-bun@v2 - run: bun install --frozen-lockfile # - run: bun run type-check # FIXME: make type-check pass, it wasn't working when I started working on this @@ -16,6 +19,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc - uses: oven-sh/setup-bun@v2 - run: bun install --frozen-lockfile - run: bun run build diff --git a/.nvmrc b/.nvmrc index b6a7d89..6f4247a 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16 +26 diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..0119358 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,9 @@ +# AGENTS.md + +このリポジトリで作業する AI エージェント向けの約束ごと。 + +## 学園祭トップページへのリンクは festival.utcode.net に固定する + +- ヘッダーやクリア後の「戻る」の遷移先は `https://festival.utcode.net` にし、`kf77.utcode.net` のような回ごとの URL を書かない。`festival.utcode.net` は utcode.net の DNS 設定で最新の学園祭サイトにリダイレクトされるため。回ごとの URL を書くと、学園祭のたびにこのリポジトリを直す必要がある。 +- 文言も「五月祭」「駒場祭」ではなく「学園祭」にする。同じ理由で、回ごとに書き換えずに済むようにするため。 +- リンク先が古い学園祭を指しているときは、このリポジトリではなく `festival.utcode.net` のリダイレクト先を直す。手順は ut-code/festival-website の README の「毎世代やること」にある。 diff --git a/README.md b/README.md index 87d4916..b33b8bf 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Forked from: https://github.com/ut-code/school-festival ## 依存 -- Node.js +- Node.js 26 以上 - Go - GNU Make diff --git a/package.json b/package.json index 8fbfbe5..26d5ea6 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "はじめてのプログラミング教室", "scripts": { "dev": "parcel src/index.html", - "build": "parcel build src/index.html && cp -R public/* dist", + "build": "parcel build src/index.html --no-scope-hoist --public-url ./ && cp -R public/* dist", "lint": "eslint ./src", "lint-fix": "eslint ./src --fix", "type-check": "tsc --noEmit", diff --git a/src/App.tsx b/src/App.tsx index a67673a..1f79bbc 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,19 +1,18 @@ import { useEffect, useState } from "react"; +import { useAtom } from "jotai"; import { GlobalHeader } from "./assets/GlobalHeader"; import { TutorialDialog, type TutorialDialogPropsStep, } from "./components/Dialogs/TutorialDialog"; import { Maze } from "./maze"; -import { useAtom } from "jotai"; import { isHintOpen } from "./atoms"; export function App(): JSX.Element { const [hint, setHint] = useState(null); const [isHintFirstView, setIsHintFirstView] = useState(true); - const [_, setHintVisible] = useAtom(isHintOpen); + const [, setHintVisible] = useAtom(isHintOpen); useEffect(() => { - hint; setIsHintFirstView(true); setHintVisible(true); }, [hint, setHintVisible]); diff --git a/src/assets/GlobalHeader.tsx b/src/assets/GlobalHeader.tsx index 15f0aaa..1198b31 100644 --- a/src/assets/GlobalHeader.tsx +++ b/src/assets/GlobalHeader.tsx @@ -7,11 +7,11 @@ import { Spacer, chakra, } from "@chakra-ui/react"; -import { useEffect, useState } from "react"; +import { useState } from "react"; import { RiGithubFill, RiQuestionFill } from "react-icons/ri"; +import { useAtom } from "jotai"; import { CommonHelp } from "../components/Dialogs/HelpDialog"; import { Logo } from "../components/Logo"; -import { useAtom } from "jotai"; import { isHintOpen } from "../atoms"; type Props = { @@ -20,7 +20,7 @@ type Props = { }; export function GlobalHeader({ Hint, children }: Props) { const [showCommonHelp, setShowCommonHelp] = useState(false); - const [_, setShowHint] = useAtom(isHintOpen); + const [, setShowHint] = useAtom(isHintOpen); return ( <> @@ -46,7 +46,7 @@ export function GlobalHeader({ Hint, children }: Props) { window.location.href = "https://festival.utcode.net"; }} > - 五月祭トップページへ + 学園祭トップページへ @@ -80,14 +83,14 @@ export function TutorialDialog(props: TutorialDialogProps): JSX.Element { )} {(!props.isFirstView || selectedIndex === props.steps.length - 1) && ( - )} diff --git a/src/components/VariableList/index.tsx b/src/components/VariableList/index.tsx index 7953098..7a95a98 100644 --- a/src/components/VariableList/index.tsx +++ b/src/components/VariableList/index.tsx @@ -46,15 +46,19 @@ export default function VariableList({ variableNames.map((name) => ({ name, value: interpreter.getVariable( - ((javascriptGenerator as any).nameDB_ as Names).getName( + ( + javascriptGenerator as unknown as { + nameDB_: Names; + } + ).nameDB_.getName( // eslint-disable-line name, - Names.NameType.VARIABLE, - ), + Names.NameType.VARIABLE + ) // 空白文字を _ に置き換えたあと encodeURIComponent で UTF-8 に変換し、さらに % を _ に置き換え // encodeURIComponent(name.replace(/\s+/g, "_")).replace(/%/g, "_") ), - })), + })) ); }; interpreter.addListener("step", onStep); @@ -76,12 +80,22 @@ export default function VariableList({ {variables?.map(({ name, value }) => { let rendered: ReactNode = renderVariable?.(value); if (!rendered) { - if (typeof value === "string") rendered = {value.toString()}; - else if (typeof value === "number" || typeof value === "boolean") + if (typeof value === "string") + rendered = {value.toString()}; + else if ( + typeof value === "number" || + typeof value === "boolean" + ) rendered = {value.toString()}; - else if (value === null) rendered = null; - else if (value === undefined) rendered = 値がありません; - else throw new Error(`変数 ${name} の値 ${value} を表示できません。`, { cause: value }); + else if (value === null) + rendered = null; + else if (value === undefined) + rendered = 値がありません; + else + throw new Error( + `変数 ${name} の値 ${value} を表示できません。`, + { cause: value } + ); } return ( diff --git a/src/components/Video/index.tsx b/src/components/Video/index.tsx index 1e0f518..7573601 100644 --- a/src/components/Video/index.tsx +++ b/src/components/Video/index.tsx @@ -14,6 +14,7 @@ export function Video(props: { } = props; return ( + // eslint-disable-next-line jsx-a11y/media-has-caption