From 87ac4c63f636ebf075ed186bb5b825473353b89c Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Fri, 22 Dec 2023 15:35:40 -0500 Subject: [PATCH] refactor: switch to using vite --- app/root.tsx | 2 +- remix.env.d.ts => env.d.ts | 0 package-lock.json | 225 ++++++++++++++++++++++++------------- package.json | 10 +- remix.config.js | 9 -- tsconfig.json | 6 +- vite.config.ts | 10 ++ 7 files changed, 168 insertions(+), 94 deletions(-) rename remix.env.d.ts => env.d.ts (100%) delete mode 100644 remix.config.js create mode 100644 vite.config.ts diff --git a/app/root.tsx b/app/root.tsx index a450b4a..8394e81 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -9,7 +9,7 @@ import { } from "@remix-run/react"; import Header from "@/components/LayoutHeader"; // Adjust the import path as needed import Footer from "@/components/LayoutFooter"; // Adjust the import path as needed -import globalStyles from "./styles/global.css"; +import globalStyles from "../styles/global.scss?inline"; import { cssBundleHref } from "@remix-run/css-bundle"; // Adjust the import path as needed export const links: LinksFunction = () => [ diff --git a/remix.env.d.ts b/env.d.ts similarity index 100% rename from remix.env.d.ts rename to env.d.ts diff --git a/package-lock.json b/package-lock.json index 1ccd8ed..a211308 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,7 +37,7 @@ }, "devDependencies": { "@faker-js/faker": "^8.3.1", - "@remix-run/dev": "^2.4.0", + "@remix-run/dev": "^2.4.1", "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", @@ -52,7 +52,9 @@ "tailwindcss": "^3.3.0", "tailwindcss-animate": "^1.0.7", "ts-node": "^10.9.1", - "typescript": "^5.2.2" + "typescript": "^5.2.2", + "vite": "^5.0.10", + "vite-tsconfig-paths": "^4.2.2" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -2379,9 +2381,9 @@ } }, "node_modules/@remix-run/dev": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@remix-run/dev/-/dev-2.4.0.tgz", - "integrity": "sha512-qQsZv+uPw8IhAdUwIIaZqnJfgJXLahYuWHFQIcS7kBhr+PdwW6SA3gvmUhnkDrqV+HJdP1bUpwXYGT+vbDQGiQ==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@remix-run/dev/-/dev-2.4.1.tgz", + "integrity": "sha512-T8GLCKpZ8AX/NCJ+vyMmcTq328xo9stvDSXG2hSJx7njz4Q9sC25miQLXPRb3Lx/Sdf4YlJhWQpR6uq5pnXCZg==", "dev": true, "dependencies": { "@babel/core": "^7.21.8", @@ -2394,9 +2396,9 @@ "@babel/types": "^7.22.5", "@mdx-js/mdx": "^2.3.0", "@npmcli/package-json": "^4.0.1", - "@remix-run/node": "2.4.0", - "@remix-run/router": "1.14.0", - "@remix-run/server-runtime": "2.4.0", + "@remix-run/node": "2.4.1", + "@remix-run/router": "1.14.1", + "@remix-run/server-runtime": "2.4.1", "@types/mdx": "^2.0.5", "@vanilla-extract/integration": "^6.2.0", "arg": "^5.0.1", @@ -2419,7 +2421,6 @@ "lodash": "^4.17.21", "lodash.debounce": "^4.0.8", "minimatch": "^9.0.0", - "node-fetch": "^2.6.9", "ora": "^5.4.1", "picocolors": "^1.0.0", "picomatch": "^2.3.1", @@ -2446,7 +2447,7 @@ "node": ">=18.0.0" }, "peerDependencies": { - "@remix-run/serve": "^2.4.0", + "@remix-run/serve": "^2.4.1", "typescript": "^5.1.0", "vite": "^5.0.0" }, @@ -2462,6 +2463,40 @@ } } }, + "node_modules/@remix-run/dev/node_modules/@remix-run/router": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.14.1.tgz", + "integrity": "sha512-Qg4DMQsfPNAs88rb2xkdk03N3bjK4jgX5fR24eHCTR9q6PrhZQZ4UJBPzCHJkIpTRN1UKxx2DzjZmnC+7Lj0Ow==", + "dev": true, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@remix-run/dev/node_modules/@remix-run/server-runtime": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@remix-run/server-runtime/-/server-runtime-2.4.1.tgz", + "integrity": "sha512-aQyBa0U8Db4E9sv2sruMfPDBYB4jlqvZ43YvkaZ1BGjUzi84ssfmaHdWgX/QveB6hi61RABTi6v8DV548kmRQg==", + "dev": true, + "dependencies": { + "@remix-run/router": "1.14.1", + "@types/cookie": "^0.5.3", + "@web3-storage/multipart-parser": "^1.0.0", + "cookie": "^0.5.0", + "set-cookie-parser": "^2.4.8", + "source-map": "^0.7.3" + }, + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "typescript": "^5.1.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/@remix-run/dev/node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -2534,11 +2569,11 @@ } }, "node_modules/@remix-run/express": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@remix-run/express/-/express-2.4.0.tgz", - "integrity": "sha512-9vVs1cMoBHRVm4fFpEFAMmrYywKV4uKnyJgaM3Kw31O4EFtqbd1ai3SW6YhKuatxfD1YxYlpoHZ1XwXcnWRDuQ==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@remix-run/express/-/express-2.4.1.tgz", + "integrity": "sha512-BTFfKrETeU3zn18YvaWs78i+vyvckG/BeR/A7hSYyJTaRfpw9r5OWq/wGM6jaObG7u4ut64lcY9adhvyV7BBeQ==", "dependencies": { - "@remix-run/node": "2.4.0" + "@remix-run/node": "2.4.1" }, "engines": { "node": ">=18.0.0" @@ -2554,11 +2589,11 @@ } }, "node_modules/@remix-run/node": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@remix-run/node/-/node-2.4.0.tgz", - "integrity": "sha512-wYwBTGiZgRmpS1qoysracyJLExP3mo0HgkIzfTm1SX/i56mdCAAe1DFSwezAVXunTY0TPHXolJeeJCVwzz0gdA==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@remix-run/node/-/node-2.4.1.tgz", + "integrity": "sha512-TENt5OiTnjZmoayqpEiU0207JIFF7TbagQ4UT0dFI9oKQrNQJvkDd2JQBEldd8TLDuSYxU8iu7+CXZ/kl3O35w==", "dependencies": { - "@remix-run/server-runtime": "2.4.0", + "@remix-run/server-runtime": "2.4.1", "@remix-run/web-fetch": "^4.4.2", "@remix-run/web-file": "^3.1.0", "@remix-run/web-stream": "^1.1.0", @@ -2579,6 +2614,38 @@ } } }, + "node_modules/@remix-run/node/node_modules/@remix-run/router": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.14.1.tgz", + "integrity": "sha512-Qg4DMQsfPNAs88rb2xkdk03N3bjK4jgX5fR24eHCTR9q6PrhZQZ4UJBPzCHJkIpTRN1UKxx2DzjZmnC+7Lj0Ow==", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@remix-run/node/node_modules/@remix-run/server-runtime": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@remix-run/server-runtime/-/server-runtime-2.4.1.tgz", + "integrity": "sha512-aQyBa0U8Db4E9sv2sruMfPDBYB4jlqvZ43YvkaZ1BGjUzi84ssfmaHdWgX/QveB6hi61RABTi6v8DV548kmRQg==", + "dependencies": { + "@remix-run/router": "1.14.1", + "@types/cookie": "^0.5.3", + "@web3-storage/multipart-parser": "^1.0.0", + "cookie": "^0.5.0", + "set-cookie-parser": "^2.4.8", + "source-map": "^0.7.3" + }, + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "typescript": "^5.1.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/@remix-run/react": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/@remix-run/react/-/react-2.4.0.tgz", @@ -2612,12 +2679,12 @@ } }, "node_modules/@remix-run/serve": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@remix-run/serve/-/serve-2.4.0.tgz", - "integrity": "sha512-S9x7WEtIwL1xh3nf9gMIv++GXp8dKmyZi+9/uE6o5Am1BxV3wQNuQrtVlA8aPa8Wvr4vKlN+4mmIJNejlzSzDg==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@remix-run/serve/-/serve-2.4.1.tgz", + "integrity": "sha512-GvIDkPjbMv6U8KJKyxhnTiwZpGXoO/IwJ9tN+b9RwTufMPL9Vi19p/uxptdeHDtCDXb4CRz+Id0izZD/CUrV2A==", "dependencies": { - "@remix-run/express": "2.4.0", - "@remix-run/node": "2.4.0", + "@remix-run/express": "2.4.1", + "@remix-run/node": "2.4.1", "chokidar": "^3.5.3", "compression": "^1.7.4", "express": "^4.17.1", @@ -2718,8 +2785,7 @@ "optional": true, "os": [ "android" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-android-arm64": { "version": "4.9.1", @@ -2732,8 +2798,7 @@ "optional": true, "os": [ "android" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-darwin-arm64": { "version": "4.9.1", @@ -2746,8 +2811,7 @@ "optional": true, "os": [ "darwin" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-darwin-x64": { "version": "4.9.1", @@ -2760,8 +2824,7 @@ "optional": true, "os": [ "darwin" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { "version": "4.9.1", @@ -2774,8 +2837,7 @@ "optional": true, "os": [ "linux" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { "version": "4.9.1", @@ -2788,8 +2850,7 @@ "optional": true, "os": [ "linux" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { "version": "4.9.1", @@ -2802,8 +2863,7 @@ "optional": true, "os": [ "linux" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { "version": "4.9.1", @@ -2816,8 +2876,7 @@ "optional": true, "os": [ "linux" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { "version": "4.9.1", @@ -2830,8 +2889,7 @@ "optional": true, "os": [ "linux" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-linux-x64-musl": { "version": "4.9.1", @@ -2844,8 +2902,7 @@ "optional": true, "os": [ "linux" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { "version": "4.9.1", @@ -2858,8 +2915,7 @@ "optional": true, "os": [ "win32" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { "version": "4.9.1", @@ -2872,8 +2928,7 @@ "optional": true, "os": [ "win32" - ], - "peer": true + ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { "version": "4.9.1", @@ -2886,8 +2941,7 @@ "optional": true, "os": [ "win32" - ], - "peer": true + ] }, "node_modules/@rushstack/eslint-patch": { "version": "1.5.1", @@ -6990,6 +7044,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globrex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", + "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", + "dev": true + }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", @@ -11299,8 +11359,6 @@ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.9.1.tgz", "integrity": "sha512-pgPO9DWzLoW/vIhlSoDByCzcpX92bKEorbgXuZrqxByte3JFk2xSW2JEeAcyLc9Ru9pqcNNW+Ob7ntsk2oT/Xw==", "dev": true, - "optional": true, - "peer": true, "bin": { "rollup": "dist/bin/rollup" }, @@ -12437,6 +12495,26 @@ "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", "dev": true }, + "node_modules/tsconfck": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-2.1.2.tgz", + "integrity": "sha512-ghqN1b0puy3MhhviwO2kGF8SeMDNhEbnKxjK7h6+fvY9JAxqvXi8y5NAHSQv687OVboS2uZIByzGd45/YxrRHg==", + "dev": true, + "bin": { + "tsconfck": "bin/tsconfck.js" + }, + "engines": { + "node": "^14.13.1 || ^16 || >=18" + }, + "peerDependencies": { + "typescript": "^4.3.5 || ^5.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/tsconfig-paths": { "version": "3.14.2", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", @@ -13018,8 +13096,6 @@ "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.10.tgz", "integrity": "sha512-2P8J7WWgmc355HUMlFrwofacvr98DAjoE52BfdbwQtyLH06XKwaL/FMnmKM2crF0iX4MpmMKoDlNCB1ok7zHCw==", "dev": true, - "optional": true, - "peer": true, "dependencies": { "esbuild": "^0.19.3", "postcss": "^8.4.32", @@ -13564,6 +13640,25 @@ } } }, + "node_modules/vite-tsconfig-paths": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/vite-tsconfig-paths/-/vite-tsconfig-paths-4.2.2.tgz", + "integrity": "sha512-dq0FjyxHHDnp0uS3P12WEOX2W7NeuLzX9AWP38D7Zw2CTbFErapwQVlCiT5DMJcVWKQ1MMdTe92PZl/rBQ7qcw==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "globrex": "^0.1.2", + "tsconfck": "^2.1.0" + }, + "peerDependencies": { + "vite": "*" + }, + "peerDependenciesMeta": { + "vite": { + "optional": true + } + } + }, "node_modules/vite/node_modules/@esbuild/android-arm": { "version": "0.19.9", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.9.tgz", @@ -13576,7 +13671,6 @@ "os": [ "android" ], - "peer": true, "engines": { "node": ">=12" } @@ -13593,7 +13687,6 @@ "os": [ "android" ], - "peer": true, "engines": { "node": ">=12" } @@ -13610,7 +13703,6 @@ "os": [ "android" ], - "peer": true, "engines": { "node": ">=12" } @@ -13627,7 +13719,6 @@ "os": [ "darwin" ], - "peer": true, "engines": { "node": ">=12" } @@ -13644,7 +13735,6 @@ "os": [ "darwin" ], - "peer": true, "engines": { "node": ">=12" } @@ -13661,7 +13751,6 @@ "os": [ "freebsd" ], - "peer": true, "engines": { "node": ">=12" } @@ -13678,7 +13767,6 @@ "os": [ "freebsd" ], - "peer": true, "engines": { "node": ">=12" } @@ -13695,7 +13783,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=12" } @@ -13712,7 +13799,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=12" } @@ -13729,7 +13815,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=12" } @@ -13746,7 +13831,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=12" } @@ -13763,7 +13847,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=12" } @@ -13780,7 +13863,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=12" } @@ -13797,7 +13879,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=12" } @@ -13814,7 +13895,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=12" } @@ -13831,7 +13911,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=12" } @@ -13848,7 +13927,6 @@ "os": [ "netbsd" ], - "peer": true, "engines": { "node": ">=12" } @@ -13865,7 +13943,6 @@ "os": [ "openbsd" ], - "peer": true, "engines": { "node": ">=12" } @@ -13882,7 +13959,6 @@ "os": [ "sunos" ], - "peer": true, "engines": { "node": ">=12" } @@ -13899,7 +13975,6 @@ "os": [ "win32" ], - "peer": true, "engines": { "node": ">=12" } @@ -13916,7 +13991,6 @@ "os": [ "win32" ], - "peer": true, "engines": { "node": ">=12" } @@ -13933,7 +14007,6 @@ "os": [ "win32" ], - "peer": true, "engines": { "node": ">=12" } @@ -13944,8 +14017,6 @@ "integrity": "sha512-U9CHtKSy+EpPsEBa+/A2gMs/h3ylBC0H0KSqIg7tpztHerLi6nrrcoUJAkNCEPumx8yJ+Byic4BVwHgRbN0TBg==", "dev": true, "hasInstallScript": true, - "optional": true, - "peer": true, "bin": { "esbuild": "bin/esbuild" }, diff --git a/package.json b/package.json index 06fba3f..5cee025 100644 --- a/package.json +++ b/package.json @@ -9,10 +9,10 @@ "scripts": { "build": "run-s \"build:*\"", "build:css": "npm run generate:css -- --style=compressed", - "build:remix": "remix build", + "build:remix": "remix vite:build", "dev": "run-p \"dev:*\"", "dev:css": "npm run generate:css -- --watch", - "dev:remix": "remix dev", + "dev:remix": "remix vite:dev", "generate:css": "sass styles/:app/styles/", "start": "remix-serve ./build/index.js", "typecheck": "tsc", @@ -48,7 +48,7 @@ }, "devDependencies": { "@faker-js/faker": "^8.3.1", - "@remix-run/dev": "^2.4.0", + "@remix-run/dev": "^2.4.1", "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", @@ -63,6 +63,8 @@ "tailwindcss": "^3.3.0", "tailwindcss-animate": "^1.0.7", "ts-node": "^10.9.1", - "typescript": "^5.2.2" + "typescript": "^5.2.2", + "vite": "^5.0.10", + "vite-tsconfig-paths": "^4.2.2" } } diff --git a/remix.config.js b/remix.config.js deleted file mode 100644 index 8eb27bc..0000000 --- a/remix.config.js +++ /dev/null @@ -1,9 +0,0 @@ -/** @type {import('@remix-run/dev').AppConfig} */ -export default { - ignoredRouteFiles: ["**/.*"], - // appDirectory: "app", - // assetsBuildDirectory: "public/build", - // publicPath: "/build/", - // serverBuildPath: "build/index.js", - browserNodeBuiltinsPolyfill: { modules: { fs: true } }, -}; diff --git a/tsconfig.json b/tsconfig.json index a27e527..22706a1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "include": [ - "remix.env.d.ts", + "env.d.ts", "**/*.ts", "**/*.tsx" ], @@ -13,9 +13,9 @@ "isolatedModules": true, "esModuleInterop": true, "jsx": "react-jsx", - "moduleResolution": "Bundler", "resolveJsonModule": true, - "module": "ES2022", + "module": "ESNext", + "moduleResolution": "Bundler", "target": "ES2022", "strict": true, "allowJs": true, diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..44138dd --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,10 @@ +import { unstable_vitePlugin as remix } from "@remix-run/dev"; +import { defineConfig } from "vite"; +import { installGlobals } from "@remix-run/node"; +import tsconfigPaths from "vite-tsconfig-paths"; + +installGlobals(); + +export default defineConfig({ + plugins: [remix({ ignoredRouteFiles: ["**/.*"] }), tsconfigPaths()], +});