Remix と PostgreSQL を使うボイラープレートです。
-
compose.ymlは Copilot に聞きながら作成しました。 -
.gitignoreは GitHub の gitignore 集をベースに作成しました。 -
package.jsonはnpm init -yで作成されるものを出発点にしました。 -
https://remix.run/docs/en/main/start/quickstart を参考に、
npm i @remix-run/node @remix-run/react @remix-run/serve isbot@4 react react-domを実行しました。 -
npm i -D @remix-run/dev viteを実行しました。 -
さらに TypeScript 化するために、
npm i -D typescript ts-node @types/nodeを実行しました。 -
Copilot に従い、
package.jsonの"main":を"main": "index.tx"に書き換えました。 -
vite.config.tsとapp/root.tsxは https://remix.run/docs/en/main/start/quickstart のvite.config.jsとapp/root.jsxを TypeScript と見立ててそのままコピーしました。 -
tsconfig.jsonは https://remix.run/docs/en/main/guides/typescript からコピーしました。 -
https://remix.run/docs/en/main/start/quickstart に従い
package.jsonに"type": "module"を追加しました。 -
root.tsxで VSCode がCannot find name 'React'. ts(2304)と言うワーニング?エラー?を出したので、Copilotに聞いてnpm install --save-dev @types/react @types/react-domを実行しました。これで VSCode を再起動したところエラーは消えました。 -
また、この
@types/reactと@types/react-domは https://remix.run/docs/en/main/guides/typescript にも記載がありました。
ここまでやって
npx remix vite:dev
npx remix vite:build && npx remix-serve build/server/index.js
が動くようになりました。
compose.ymlから簡単に呼ぶためにpackage.jsonに script を追加しました。
npm i -D unocssしました。uno.config.tsを作りvite.config.tsを調整しました。root.tsxを更新して、app/routes/_index.tsxを作成しました。これには https://github.com/unocss/unocss/tree/main/examples/remix を参照しています。
ここまでやって http://localhost:5173/ が表示されるようになりましたが、CSSが当たっているように見えないので更に調整しました。
これには再度 https://github.com/unocss/unocss/tree/main/examples/remix を参照しています。
npm i -D vite-tsconfig-pathsしました。vite.config.tsを調整してvite-tsconfig.pathsを使うようにしました。uno.config.tsを調整して使用するプリセットを明示しました。
ここまでやってCSSが適用されるようになりました。
UnoCSSのViteプラグインを導入した。