Skip to content

Commit

Permalink
Move to Vite bundler
Browse files Browse the repository at this point in the history
Remix template commit ref: 6a9e17cd29fad733acf36a51936319702d05245c
  • Loading branch information
manuelpuchta committed Nov 8, 2024
1 parent 59788a3 commit 788d398
Show file tree
Hide file tree
Showing 12 changed files with 95 additions and 54 deletions.
5 changes: 2 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
# Include files required for building the application (except for node_modules these are installed by docker)
!app
!public
public/build
!LICENSE
!package-lock.json
!package.json
!README.md
!remix.config.js
!remix.env.d.ts
!SECURITY.md
!tailwind.config.js
!tsconfig.json
!postcss.config.mjs
!vite.config.ts
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Remix
/.cache
/build
/public/build

# Logs
logs
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ WORKDIR /home/node/src
# Move only the files to the final image that are really needed
COPY --chown=node:node package*.json LICENSE SECURITY.md ./
COPY --chown=node:node --from=production-dependencies /src/node_modules/ ./node_modules/
COPY --chown=node:node --from=build /src/build/ ./build/
COPY --chown=node:node --from=build /src/public/ ./public/
COPY --chown=node:node --from=build /src/build/server ./build/server
COPY --chown=node:node --from=build /src/build/client ./build/client

EXPOSE 3000
CMD ["npm", "run", "start"]
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ docker run -d -p 3000:3000 --name a2j-kommunikationsplattform a2j-kommunikations

The website is then available under http://localhost:3000

If you want to include any additional files during the build that are not in the `app` or `public` directories you need to add them to the `.dockerignore` file.
If you want to include any additional files during the build that are not in the `app` directories you need to add them to the `.dockerignore` file.

The `.github/workflows/pipeline.yml` GitHub Action includes a `build-and-push-image` job to build the Docker Image and push it to GitHub Packages.

Expand All @@ -107,7 +107,6 @@ If you're familiar with deploying node applications, the built-in Remix app serv
Make sure to deploy the output of `npm run build`

- `build/`
- `public/build/`

## Architecture Decision Records

Expand Down
14 changes: 4 additions & 10 deletions app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
import { cssBundleHref } from "@remix-run/css-bundle";
import type { LinksFunction } from "@remix-run/node";
import {
Links,
LiveReload,
Meta,
Outlet,
Scripts,
ScrollRestoration,
} from "@remix-run/react";

import stylesheet from "~/styles.css";
import fontsStylesheet from "@digitalservice4germany/angie/fonts.css";
import fontRegular from "~/../public/fonts/BundesSansWeb-Regular.woff2";
import fontBold from "~/../public/fonts/BundesSansWeb-Bold.woff2";
import stylesheet from "~/styles.css?url";
import fontsStylesheet from "@digitalservice4germany/angie/fonts.css?url";

export const links: LinksFunction = () => [
...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []),
{
rel: "preload",
as: "font",
type: "font/woff2",
href: fontRegular,
href: "/fonts/BundesSansWeb-Regular.woff2",
crossOrigin: "anonymous",
},
{
rel: "preload",
as: "font",
type: "font/woff2",
href: fontBold,
href: "/fonts/BundesSansWeb-Bold.woff2",
crossOrigin: "anonymous",
},
{ rel: "stylesheet", href: fontsStylesheet },
Expand All @@ -48,7 +43,6 @@ export default function App() {
<Outlet />
<ScrollRestoration />
<Scripts />
<LiveReload />
</body>
</html>
);
Expand Down
85 changes: 64 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"sideEffects": false,
"type": "module",
"scripts": {
"build": "remix build",
"dev": "remix dev --manual",
"start": "remix-serve ./build/index.js",
"build": "remix vite:build",
"dev": "remix vite:dev",
"start": "remix-serve ./build/server/index.js",
"typecheck": "tsc",
"test": "jest test",
"test:e2e": "playwright test --config=tests/e2e/playwright.config.ts",
Expand All @@ -23,7 +23,6 @@
"dependencies": {
"@digitalservice4germany/angie": "^1.2.0",
"@digitalservice4germany/style-dictionary": "^2.0.0",
"@remix-run/css-bundle": "^2.13.1",
"@remix-run/node": "^2.13.1",
"@remix-run/react": "^2.13.1",
"@remix-run/serve": "^2.13.1",
Expand All @@ -49,7 +48,9 @@
"prettier": "3.3.3",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.6.3"
"typescript": "^5.6.3",
"vite": "^5.4.10",
"vite-tsconfig-paths": "^5.1.0"
},
"engines": {
"node": ">=20.0.0"
Expand Down
3 changes: 3 additions & 0 deletions postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
plugins: { tailwindcss: {} },
};
8 changes: 0 additions & 8 deletions remix.config.js

This file was deleted.

2 changes: 0 additions & 2 deletions remix.env.d.ts

This file was deleted.

3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"],
"compilerOptions": {
"types": ["@remix-run/node", "vite/client"],
"skipLibCheck": true,
"module": "ESNext",
"lib": ["DOM", "DOM.Iterable", "ES2022"],
"isolatedModules": true,
"esModuleInterop": true,
Expand Down
10 changes: 10 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { vitePlugin as remix } from "@remix-run/dev";
import { installGlobals } from "@remix-run/node";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";

installGlobals();

export default defineConfig({
plugins: [remix(), tsconfigPaths()],
});

0 comments on commit 788d398

Please sign in to comment.