Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vite migration #874

Merged
merged 26 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ FROM base AS release
COPY --from=build /src/node_modules /src/node_modules
COPY --from=build /src/app/database /src/app/database
COPY --from=build /src/build /src/build
COPY --from=build /src/public /src/public
COPY --from=build /src/package.json /src/package.json
COPY --from=build /src/start.sh /src/start.sh
RUN chmod +x /src/start.sh
Expand Down
1 change: 0 additions & 1 deletion Dockerfile.image
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ FROM base AS release
COPY --from=build /src/node_modules /src/node_modules
COPY --from=build /src/app/database /src/app/database
COPY --from=build /src/build /src/build
COPY --from=build /src/public /src/public
COPY --from=build /src/package.json /src/package.json
COPY --from=build /src/docker-entrypoint.sh /src/docker-entrypoint.sh

Expand Down
2 changes: 0 additions & 2 deletions app/components/forms/calendar-input.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use client";

import { ChevronLeftIcon, ChevronRightIcon } from "@radix-ui/react-icons";
import { DayPicker } from "react-day-picker";

Expand Down
2 changes: 0 additions & 2 deletions app/components/forms/select.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use client";

import * as React from "react";
import * as SelectPrimitive from "@radix-ui/react-select";
import { tw } from "~/utils/tw";
Expand Down
2 changes: 0 additions & 2 deletions app/components/forms/switch.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use client";

import * as React from "react";
import * as SwitchPrimitives from "@radix-ui/react-switch";

Expand Down
3 changes: 2 additions & 1 deletion app/components/location/map.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import maplibregl from "maplibre-gl";
import { Marker, ScaleControl } from "react-map-gl";
import Map from "react-map-gl/maplibre";
// https://github.com/visgl/react-map-gl/issues/2272
import Map from "react-map-gl/dist/es5/exports-maplibre.js";
import { ClientOnly } from "remix-utils/client-only";

export const ShelfMap = ({
Expand Down
4 changes: 2 additions & 2 deletions app/components/location/scan-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export function ScanDetails() {
<p>Date/Time: {lastScan.dateTime}</p>
<p>
Device:{" "}
{lastScan.ua.device.name
? lastScan.ua.device.name
{lastScan.ua.device.model && lastScan.ua.device.vendor
? `${lastScan.ua.device.vendor} - ${lastScan.ua.device.model}`
: "Unknown device"}
</p>
<p>Browser: {lastScan.ua.browser.name}</p>
Expand Down
2 changes: 0 additions & 2 deletions app/components/shared/dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use client";

import * as React from "react";
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
// import { Check, ChevronRight, Circle } from "lucide-react";
Expand Down
2 changes: 0 additions & 2 deletions app/components/shared/hover-card.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use client";

import * as React from "react";
import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
import { tw } from "~/utils/tw";
Expand Down
2 changes: 0 additions & 2 deletions app/components/shared/modal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use client";

import * as React from "react";
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
import { tw } from "~/utils/tw";
Expand Down
2 changes: 0 additions & 2 deletions app/components/shared/tabs.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use client";

import * as React from "react";
import * as TabsPrimitive from "@radix-ui/react-tabs";
import { tw } from "~/utils/tw";
Expand Down
6 changes: 3 additions & 3 deletions app/modules/scan/utils.server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Scan } from ".prisma/client";
import type { Scan } from "@prisma/client";
import parser from "ua-parser-js";
import { getDateTimeFormat } from "~/utils/client-hints";
import { ShelfError } from "~/utils/error";
var parser = require("ua-parser-js");

export function parseScanData({
scan,
Expand All @@ -26,7 +26,7 @@ export function parseScanData({
: "Unknown location";

const dateTime = getDateTimeFormat(request).format(scan.createdAt);
const ua = parser(scan.userAgent);
const ua = parser(scan.userAgent || "");

return {
scannedBy,
Expand Down
2 changes: 1 addition & 1 deletion app/modules/user/service.server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
// 👋 see https://vitest.dev/guide/environment.html#environments-for-specific-files

// mock db
vitest.mock("~/database", () => ({
vitest.mock("~/database/db.server", () => ({
db: {
$transaction: vitest.fn().mockImplementation((callback) => callback(db)),
user: {
Expand Down
8 changes: 3 additions & 5 deletions app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { json } from "@remix-run/node";
import {
Link,
Links,
LiveReload,
Meta,
Outlet,
Scripts,
Expand All @@ -22,9 +21,9 @@ import { ErrorContent } from "./components/errors";
import { HomeIcon } from "./components/icons/library";
import MaintenanceMode from "./components/layout/maintenance-mode";
import { Clarity } from "./components/marketing/clarity";
import fontsStylesheetUrl from "./styles/fonts.css";
import globalStylesheetUrl from "./styles/global.css";
import styles from "./tailwind.css";
import fontsStylesheetUrl from "./styles/fonts.css?url";
import globalStylesheetUrl from "./styles/global.css?url";
import styles from "./tailwind.css?url";
import { ClientHintCheck, getHints } from "./utils/client-hints";
import { getBrowserEnv } from "./utils/env";
import { data } from "./utils/http.server";
Expand Down Expand Up @@ -97,7 +96,6 @@ function Document({ children, title }: PropsWithChildren<{ title?: string }>) {
}}
/>
<Scripts />
<LiveReload />
</body>
</html>
);
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_layout+/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Toaster } from "~/components/shared/toast";
import { config } from "~/config/shelf.config";
import { db } from "~/database/db.server";
import { getSelectedOrganisation } from "~/modules/organization/context.server";
import styles from "~/styles/layout/index.css";
import styles from "~/styles/layout/index.css?url";
import {
initializePerPageCookieOnLayout,
setCookie,
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_layout+/assets.$assetId.duplicate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { Button } from "~/components/shared/button";
import { Spinner } from "~/components/shared/spinner";
import { db } from "~/database/db.server";
import { duplicateAsset } from "~/modules/asset/service.server";
import styles from "~/styles/layout/custom-modal.css";
import styles from "~/styles/layout/custom-modal.css?url";
import { MAX_DUPLICATES_ALLOWED } from "~/utils/constants";
import { sendNotification } from "~/utils/emitter/send-notification.server";
import { ShelfError, makeShelfError } from "~/utils/error";
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_layout+/assets.$assetId.give-custody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { WarningBox } from "~/components/shared/warning-box";
import { db } from "~/database/db.server";
import { createNote } from "~/modules/asset/service.server";
import { getUserByID } from "~/modules/user/service.server";
import styles from "~/styles/layout/custom-modal.css";
import styles from "~/styles/layout/custom-modal.css?url";
import { sendNotification } from "~/utils/emitter/send-notification.server";
import { ShelfError, makeShelfError } from "~/utils/error";
import { isFormProcessing } from "~/utils/form";
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_layout+/assets.$assetId.release-custody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { db } from "~/database/db.server";
import { createNote } from "~/modules/asset/service.server";
import { releaseCustody } from "~/modules/custody/service.server";
import { getUserByID } from "~/modules/user/service.server";
import styles from "~/styles/layout/custom-modal.css";
import styles from "~/styles/layout/custom-modal.css?url";
import { sendNotification } from "~/utils/emitter/send-notification.server";
import { ShelfError, makeShelfError } from "~/utils/error";
import { isFormProcessing } from "~/utils/form";
Expand Down
4 changes: 2 additions & 2 deletions app/routes/_layout+/assets.$assetId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
import { redirect, json } from "@remix-run/node";
import { useFetcher, useLoaderData } from "@remix-run/react";

import mapCss from "maplibre-gl/dist/maplibre-gl.css";
import mapCss from "maplibre-gl/dist/maplibre-gl.css?url";
import { useZorm } from "react-zorm";
import { z } from "zod";
import ActionsDropdown from "~/components/assets/actions-dropdown";
Expand Down Expand Up @@ -37,7 +37,7 @@ import {
import type { ShelfAssetCustomFieldValueType } from "~/modules/asset/types";
import { getScanByQrId } from "~/modules/scan/service.server";
import { parseScanData } from "~/modules/scan/utils.server";
import assetCss from "~/styles/asset.css";
import assetCss from "~/styles/asset.css?url";

import { appendToMetaTitle } from "~/utils/append-to-meta-title";
import { checkExhaustiveSwitch } from "~/utils/check-exhaustive-switch";
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_layout+/assets.$assetId.update-location.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
getAsset,
updateAsset,
} from "~/modules/asset/service.server";
import styles from "~/styles/layout/custom-modal.css";
import styles from "~/styles/layout/custom-modal.css?url";
import { sendNotification } from "~/utils/emitter/send-notification.server";
import { makeShelfError } from "~/utils/error";
import { isFormProcessing } from "~/utils/form";
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_layout+/assets._index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
updateAssetsWithBookingCustodians,
} from "~/modules/asset/service.server";
import { getOrganizationTierLimit } from "~/modules/tier/service.server";
import assetCss from "~/styles/assets.css";
import assetCss from "~/styles/assets.css?url";
import { appendToMetaTitle } from "~/utils/append-to-meta-title";
import { setCookie, userPrefs } from "~/utils/cookies.server";
import { ShelfError, makeShelfError } from "~/utils/error";
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_layout+/bookings.$bookingId.add-assets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { bookingsSelectedAssetsAtom } from "~/atoms/selected-assets-atoms";
import { AssetImage } from "~/components/assets/asset-image";
import { AvailabilityLabel } from "~/components/booking/availability-label";
import { AvailabilitySelect } from "~/components/booking/availability-select";
import styles from "~/components/booking/styles.css";
import styles from "~/components/booking/styles.css?url";
import { FakeCheckbox } from "~/components/forms/fake-checkbox";
import Input from "~/components/forms/input";
import { List } from "~/components/list";
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_layout+/bookings.new.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { json, redirect } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
import { DateTime } from "luxon";
import { BookingForm, NewBookingFormSchema } from "~/components/booking/form";
import styles from "~/components/booking/styles.new.css";
import styles from "~/components/booking/styles.new.css?url";
import { db } from "~/database/db.server";

import { upsertBooking } from "~/modules/booking/service.server";
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_layout+/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { ErrorContent } from "~/components/errors";
import Header from "~/components/layout/header";
import { db } from "~/database/db.server";

import styles from "~/styles/layout/skeleton-loading.css";
import styles from "~/styles/layout/skeleton-loading.css?url";
import { appendToMetaTitle } from "~/utils/append-to-meta-title";
import { getLocale } from "~/utils/client-hints";
import { userPrefs } from "~/utils/cookies.server";
Expand Down
4 changes: 2 additions & 2 deletions app/routes/_layout+/locations.$locationId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
MetaFunction,
} from "@remix-run/node";
import { useLoaderData, useNavigate } from "@remix-run/react";
import mapCss from "maplibre-gl/dist/maplibre-gl.css";
import mapCss from "maplibre-gl/dist/maplibre-gl.css?url";
import { z } from "zod";
import { AssetImage } from "~/components/assets/asset-image";
import { ChevronRight } from "~/components/icons/library";
Expand All @@ -27,7 +27,7 @@ import { Tag as TagBadge } from "~/components/shared/tag";
import TextualDivider from "~/components/shared/textual-divider";
import { Td, Th } from "~/components/table";
import { deleteLocation, getLocation } from "~/modules/location/service.server";
import assetCss from "~/styles/asset.css";
import assetCss from "~/styles/asset.css?url";
import { appendToMetaTitle } from "~/utils/append-to-meta-title";
import {
setCookie,
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_layout+/scanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Header from "~/components/layout/header";
import type { HeaderData } from "~/components/layout/header/types";
import { Spinner } from "~/components/shared/spinner";
import { useQrScanner } from "~/hooks/use-qr-scanner";
import scannerCss from "~/styles/scanner.css";
import scannerCss from "~/styles/scanner.css?url";
import { appendToMetaTitle } from "~/utils/append-to-meta-title";
import { makeShelfError } from "~/utils/error";
import { error } from "~/utils/http.server";
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_layout+/settings.team.add-member.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Input from "~/components/forms/input";
import { UserIcon } from "~/components/icons/library";
import { Button } from "~/components/shared/button";
import { db } from "~/database/db.server";
import styles from "~/styles/layout/custom-modal.css";
import styles from "~/styles/layout/custom-modal.css?url";
import { sendNotification } from "~/utils/emitter/send-notification.server";
import { makeShelfError, maybeUniqueConstraintViolation } from "~/utils/error";
import { isFormProcessing } from "~/utils/form";
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_layout+/settings.team.invite-user.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { db } from "~/database/db.server";
import { useCurrentOrganization } from "~/hooks/use-current-organization-id";
import { createInvite } from "~/modules/invite/service.server";
import { assertUserCanInviteUsersToWorkspace } from "~/modules/tier/service.server";
import styles from "~/styles/layout/custom-modal.css";
import styles from "~/styles/layout/custom-modal.css?url";
import { sendNotification } from "~/utils/emitter/send-notification.server";
import { ShelfError, makeShelfError } from "~/utils/error";
import { isFormProcessing } from "~/utils/form";
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_welcome+/welcome.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { LinksFunction } from "@remix-run/node";
import WelcomeCarousel from "~/components/welcome/carousel";
import carouselStyles from "~/styles/layout/carousel.css";
import carouselStyles from "~/styles/layout/carousel.css?url";

export const links: LinksFunction = () => [
{
Expand Down
2 changes: 1 addition & 1 deletion docs/shelf.config.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This file has a few configuration options, that are used to adjust and disable c

```ts
// remix.config.ts
import { ENABLE_PREMIUM_FEATURES } from "~/utils";
import { ENABLE_PREMIUM_FEATURES } from "~/utils/env";
import { Config } from "./types";

export const config: Config = {
Expand Down
2 changes: 1 addition & 1 deletion remix.env.d.ts → env.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/// <reference types="@remix-run/dev" />
/// <reference types="vite/client" />
/// <reference types="@remix-run/node" />
Loading
Loading