From b7ad87e25f63232a56d263a41e2b2032f6c9c7d4 Mon Sep 17 00:00:00 2001 From: FleetAdmiralJakob Date: Mon, 8 Jan 2024 20:20:10 +0100 Subject: [PATCH] revert(fix): Restructured the old ui package --- apps/web/package.json | 2 +- apps/web/src/components/Layout.tsx | 2 +- apps/web/src/pages/_app.tsx | 2 +- apps/web/src/pages/home/index.tsx | 12 +- packages/{components => ui}/package.json | 16 +-- .../{components/src/ui => ui/src}/button.tsx | 2 +- .../src/ui => ui/src}/collapsible.tsx | 0 .../src/ui => ui/src}/hover-card.tsx | 2 +- packages/{components => ui}/src/index.ts | 0 packages/{components => ui}/src/map.tsx | 0 .../src/ui => ui/src}/scroll-area.tsx | 2 +- .../src/ui => ui/src}/skeleton.tsx | 2 +- .../{components/src/ui => ui/src}/sonner.tsx | 0 .../{components => ui}/tailwind.config.ts | 0 packages/{components => ui}/tsconfig.json | 0 pnpm-lock.yaml | 135 +++++------------- 16 files changed, 60 insertions(+), 117 deletions(-) rename packages/{components => ui}/package.json (80%) rename packages/{components/src/ui => ui/src}/button.tsx (98%) rename packages/{components/src/ui => ui/src}/collapsible.tsx (100%) rename packages/{components/src/ui => ui/src}/hover-card.tsx (97%) rename packages/{components => ui}/src/index.ts (100%) rename packages/{components => ui}/src/map.tsx (100%) rename packages/{components/src/ui => ui/src}/scroll-area.tsx (98%) rename packages/{components/src/ui => ui/src}/skeleton.tsx (88%) rename packages/{components/src/ui => ui/src}/sonner.tsx (100%) rename packages/{components => ui}/tailwind.config.ts (100%) rename packages/{components => ui}/tsconfig.json (100%) diff --git a/apps/web/package.json b/apps/web/package.json index 37849150..f9c39c88 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -28,7 +28,7 @@ "@vercel/speed-insights": "^1.0.2", "@weatherio/api": "workspace:^0.1.0", "@weatherio/types": "workspace:^0.1.0", - "@weatherio/components": "workspace:^0.1.0", + "@weatherio/ui": "workspace:^0.1.0", "classnames": "^2.5.1", "dayjs": "^1.11.10", "next": "^14.0.4", diff --git a/apps/web/src/components/Layout.tsx b/apps/web/src/components/Layout.tsx index 4bbcb47e..37ce0db5 100644 --- a/apps/web/src/components/Layout.tsx +++ b/apps/web/src/components/Layout.tsx @@ -7,7 +7,7 @@ import { FaMapMarkedAlt, FaShare } from "react-icons/fa"; import { IoIosSettings, IoMdContact } from "react-icons/io"; import { LuMenu, LuX } from "react-icons/lu"; -import { cn } from "@weatherio/components"; +import { cn } from "@weatherio/ui"; interface LayoutProps { title?: string; diff --git a/apps/web/src/pages/_app.tsx b/apps/web/src/pages/_app.tsx index bda38f95..12294e3a 100644 --- a/apps/web/src/pages/_app.tsx +++ b/apps/web/src/pages/_app.tsx @@ -11,7 +11,7 @@ import { SpeedInsights } from "@vercel/speed-insights/next"; import { AxiomWebVitals } from "next-axiom"; import { appWithTranslation } from "next-i18next"; -import { Toaster } from "@weatherio/components/ui/sonner"; +import { Toaster } from "@weatherio/ui/sonner"; import { PWALifeCycle } from "~/components/PWALifecycle"; import { api } from "~/lib/utils/api"; diff --git a/apps/web/src/pages/home/index.tsx b/apps/web/src/pages/home/index.tsx index df9bfdd8..afa296b0 100644 --- a/apps/web/src/pages/home/index.tsx +++ b/apps/web/src/pages/home/index.tsx @@ -27,19 +27,19 @@ import { PiSunglasses } from "react-icons/pi"; import { WiRaindrop } from "react-icons/wi"; import type { IDailyForecast, IHourlyForecast } from "@weatherio/types"; -import { Button } from "@weatherio/components/ui/button"; +import { Button } from "@weatherio/ui/button"; import { Collapsible, CollapsibleContent, CollapsibleTrigger, -} from "@weatherio/components/ui/collapsible"; +} from "@weatherio/ui/collapsible"; import { HoverCard, HoverCardContent, HoverCardTrigger, -} from "@weatherio/components/ui/hover-card"; -import { ScrollArea, ScrollBar } from "@weatherio/components/ui/scroll-area"; -import { Skeleton } from "@weatherio/components/ui/skeleton"; +} from "@weatherio/ui/hover-card"; +import { ScrollArea, ScrollBar } from "@weatherio/ui/scroll-area"; +import { Skeleton } from "@weatherio/ui/skeleton"; import type { WindSpeedUnitType } from "~/states"; import Layout from "~/components/Layout"; @@ -47,7 +47,7 @@ import { MoonPhaseInfo } from "~/components/moon-phase-info"; import { api } from "~/lib/utils/api"; import { activeCity$, temperatureUnit$, windSpeedUnit$ } from "~/states"; -const Map = dynamic(() => import("@weatherio/components/map"), { ssr: false }); +const Map = dynamic(() => import("@weatherio/ui/map"), { ssr: false }); dayjs.extend(utc); dayjs.extend(timezone); diff --git a/packages/components/package.json b/packages/ui/package.json similarity index 80% rename from packages/components/package.json rename to packages/ui/package.json index 63f321e3..9e12b99b 100644 --- a/packages/components/package.json +++ b/packages/ui/package.json @@ -1,17 +1,17 @@ { - "name": "@weatherio/components", + "name": "@weatherio/ui", "private": true, "version": "0.1.0", "type": "module", "exports": { ".": "./src/index.ts", - "./ui/button": "./src/ui/button.tsx", - "./ui/collapsible": "./src/ui/collapsible.tsx", - "./ui/hover-card": "./src/ui/hover-card.tsx", - "./ui/scroll-area": "./src/ui/scroll-area.tsx", - "./ui/skeleton": "./src/ui/skeleton.tsx", - "./ui/sonner": "./src/ui/sonner.tsx", - "./map": "./src/map.tsx" + "./button": "./src/button.tsx", + "./collapsible": "./src/collapsible.tsx", + "./hover-card": "./src/hover-card.tsx", + "./map": "./src/map.tsx", + "./scroll-area": "./src/scroll-area.tsx", + "./skeleton": "./src/skeleton.tsx", + "./sonner": "./src/sonner.tsx" }, "license": "MIT", "scripts": { diff --git a/packages/components/src/ui/button.tsx b/packages/ui/src/button.tsx similarity index 98% rename from packages/components/src/ui/button.tsx rename to packages/ui/src/button.tsx index 2170ca77..3554a3c7 100644 --- a/packages/components/src/ui/button.tsx +++ b/packages/ui/src/button.tsx @@ -3,7 +3,7 @@ import * as React from "react"; import { Slot } from "@radix-ui/react-slot"; import { cva } from "class-variance-authority"; -import { cn } from "../index"; +import { cn } from "."; const buttonVariants = cva( "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", diff --git a/packages/components/src/ui/collapsible.tsx b/packages/ui/src/collapsible.tsx similarity index 100% rename from packages/components/src/ui/collapsible.tsx rename to packages/ui/src/collapsible.tsx diff --git a/packages/components/src/ui/hover-card.tsx b/packages/ui/src/hover-card.tsx similarity index 97% rename from packages/components/src/ui/hover-card.tsx rename to packages/ui/src/hover-card.tsx index 1e9840b8..b434f360 100644 --- a/packages/components/src/ui/hover-card.tsx +++ b/packages/ui/src/hover-card.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import * as HoverCardPrimitive from "@radix-ui/react-hover-card"; -import { cn } from "../index"; +import { cn } from "."; const HoverCard = HoverCardPrimitive.Root; diff --git a/packages/components/src/index.ts b/packages/ui/src/index.ts similarity index 100% rename from packages/components/src/index.ts rename to packages/ui/src/index.ts diff --git a/packages/components/src/map.tsx b/packages/ui/src/map.tsx similarity index 100% rename from packages/components/src/map.tsx rename to packages/ui/src/map.tsx diff --git a/packages/components/src/ui/scroll-area.tsx b/packages/ui/src/scroll-area.tsx similarity index 98% rename from packages/components/src/ui/scroll-area.tsx rename to packages/ui/src/scroll-area.tsx index 2350e9c2..bd6b4346 100644 --- a/packages/components/src/ui/scroll-area.tsx +++ b/packages/ui/src/scroll-area.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"; -import { cn } from "../index"; +import { cn } from "."; const ScrollArea = React.forwardRef< React.ElementRef, diff --git a/packages/components/src/ui/skeleton.tsx b/packages/ui/src/skeleton.tsx similarity index 88% rename from packages/components/src/ui/skeleton.tsx rename to packages/ui/src/skeleton.tsx index 0a688f2a..e1ca576b 100644 --- a/packages/components/src/ui/skeleton.tsx +++ b/packages/ui/src/skeleton.tsx @@ -1,4 +1,4 @@ -import { cn } from "../index"; +import { cn } from "."; function Skeleton({ className, diff --git a/packages/components/src/ui/sonner.tsx b/packages/ui/src/sonner.tsx similarity index 100% rename from packages/components/src/ui/sonner.tsx rename to packages/ui/src/sonner.tsx diff --git a/packages/components/tailwind.config.ts b/packages/ui/tailwind.config.ts similarity index 100% rename from packages/components/tailwind.config.ts rename to packages/ui/tailwind.config.ts diff --git a/packages/components/tsconfig.json b/packages/ui/tsconfig.json similarity index 100% rename from packages/components/tsconfig.json rename to packages/ui/tsconfig.json diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d8fee3af..ceed1466 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -74,12 +74,12 @@ importers: '@weatherio/api': specifier: workspace:^0.1.0 version: link:../../packages/api - '@weatherio/components': - specifier: workspace:^0.1.0 - version: link:../../packages/components '@weatherio/types': specifier: workspace:^0.1.0 version: link:../../packages/types + '@weatherio/ui': + specifier: workspace:^0.1.0 + version: link:../../packages/ui classnames: specifier: ^2.5.1 version: 2.5.1 @@ -258,7 +258,41 @@ importers: specifier: workspace:^0.1.0 version: link:../../tooling/typescript - packages/components: + packages/e2e-web-tests: + dependencies: + '@weatherio/web': + specifier: workspace:* + version: link:../../apps/web + start-server-and-test: + specifier: ^2.0.3 + version: 2.0.3 + devDependencies: + '@types/node': + specifier: ^20.10.6 + version: 20.10.6 + '@weatherio/eslint-config': + specifier: workspace:^0.2.0 + version: link:../../tooling/eslint + '@weatherio/prettier-config': + specifier: workspace:^0.1.0 + version: link:../../tooling/prettier + '@weatherio/tsconfig': + specifier: workspace:^0.1.0 + version: link:../../tooling/typescript + + packages/types: + devDependencies: + '@weatherio/eslint-config': + specifier: workspace:^0.2.0 + version: link:../../tooling/eslint + '@weatherio/prettier-config': + specifier: workspace:^0.1.0 + version: link:../../tooling/prettier + '@weatherio/tsconfig': + specifier: workspace:^0.1.0 + version: link:../../tooling/typescript + + packages/ui: dependencies: '@radix-ui/react-collapsible': specifier: ^1.0.3 @@ -334,40 +368,6 @@ importers: specifier: ^5.3.3 version: 5.3.3 - packages/e2e-web-tests: - dependencies: - '@weatherio/web': - specifier: workspace:* - version: link:../../apps/web - start-server-and-test: - specifier: ^2.0.3 - version: 2.0.3 - devDependencies: - '@types/node': - specifier: ^20.10.6 - version: 20.10.6 - '@weatherio/eslint-config': - specifier: workspace:^0.2.0 - version: link:../../tooling/eslint - '@weatherio/prettier-config': - specifier: workspace:^0.1.0 - version: link:../../tooling/prettier - '@weatherio/tsconfig': - specifier: workspace:^0.1.0 - version: link:../../tooling/typescript - - packages/types: - devDependencies: - '@weatherio/eslint-config': - specifier: workspace:^0.2.0 - version: link:../../tooling/eslint - '@weatherio/prettier-config': - specifier: workspace:^0.1.0 - version: link:../../tooling/prettier - '@weatherio/tsconfig': - specifier: workspace:^0.1.0 - version: link:../../tooling/typescript - tooling/eslint: dependencies: '@next/eslint-plugin-next': @@ -6248,7 +6248,7 @@ packages: react: '*' react-dom: '*' dependencies: - next: 14.0.4(react-dom@18.2.0)(react@18.2.0) + next: 14.0.4(@babel/core@7.23.7)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) dev: false @@ -6293,46 +6293,6 @@ packages: - babel-plugin-macros dev: false - /next@14.0.4(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-qbwypnM7327SadwFtxXnQdGiKpkuhaRLE2uq62/nRul9cj9KhQ5LhHmlziTNqUidZotw/Q1I9OjirBROdUJNgA==} - engines: {node: '>=18.17.0'} - hasBin: true - peerDependencies: - '@opentelemetry/api': ^1.1.0 - react: ^18.2.0 - react-dom: ^18.2.0 - sass: ^1.3.0 - peerDependenciesMeta: - '@opentelemetry/api': - optional: true - sass: - optional: true - dependencies: - '@next/env': 14.0.4 - '@swc/helpers': 0.5.2 - busboy: 1.6.0 - caniuse-lite: 1.0.30001572 - graceful-fs: 4.2.11 - postcss: 8.4.31 - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - styled-jsx: 5.1.1(react@18.2.0) - watchpack: 2.4.0 - optionalDependencies: - '@next/swc-darwin-arm64': 14.0.4 - '@next/swc-darwin-x64': 14.0.4 - '@next/swc-linux-arm64-gnu': 14.0.4 - '@next/swc-linux-arm64-musl': 14.0.4 - '@next/swc-linux-x64-gnu': 14.0.4 - '@next/swc-linux-x64-musl': 14.0.4 - '@next/swc-win32-arm64-msvc': 14.0.4 - '@next/swc-win32-ia32-msvc': 14.0.4 - '@next/swc-win32-x64-msvc': 14.0.4 - transitivePeerDependencies: - - '@babel/core' - - babel-plugin-macros - dev: false - /no-case@2.3.2: resolution: {integrity: sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==} dependencies: @@ -7631,23 +7591,6 @@ packages: react: 18.2.0 dev: false - /styled-jsx@5.1.1(react@18.2.0): - resolution: {integrity: sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==} - engines: {node: '>= 12.0.0'} - peerDependencies: - '@babel/core': '*' - babel-plugin-macros: '*' - react: '>= 16.8.0 || 17.x.x || ^18.0.0-0' - peerDependenciesMeta: - '@babel/core': - optional: true - babel-plugin-macros: - optional: true - dependencies: - client-only: 0.0.1 - react: 18.2.0 - dev: false - /sucrase@3.32.0: resolution: {integrity: sha512-ydQOU34rpSyj2TGyz4D2p8rbktIOZ8QY9s+DGLvFU1i5pWJE8vkpruCjGCMHsdXwnD7JDcS+noSwM/a7zyNFDQ==} engines: {node: '>=8'}