[go: nahoru, domu]

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

Add ESlint and Conform Apps & Packages #589

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7534bba
use RSCs in @dub/ui
versecafe Jan 19, 2024
e3d5016
remove accidental temp comment from readme
versecafe Jan 19, 2024
9dd7fed
final UI component that can be moved
versecafe Jan 20, 2024
c6aa72f
clean unused code and document change
versecafe Jan 20, 2024
7ce96c1
typo cleanup
versecafe Jan 20, 2024
16a75db
Merge branch 'dubinc:main' into use-rscs-in-ui-package
versecafe Jan 20, 2024
469bf4f
eslitn package + configs set up
versecafe Jan 29, 2024
698d09a
partial packages eslint conformance
versecafe Jan 29, 2024
dffc46c
Merge branch 'main' into eslint
versecafe Jan 29, 2024
71725e5
Merge branch 'main' into pr/572
steven-tey Jan 30, 2024
fc51c6b
Merge branch 'use-rscs-in-ui-package' of https://github.com/versecafe…
steven-tey Jan 30, 2024
bcadf64
Update pnpm-lock.yaml
steven-tey Jan 30, 2024
e825fe8
small fixes
steven-tey Jan 30, 2024
cfe62fb
Merge branch 'main' into eslint
versecafe Feb 4, 2024
d19b356
fix lockfile
versecafe Feb 4, 2024
a053826
turbo.json fix caching behaviour for env var update, and fix minor er…
versecafe Feb 4, 2024
f33ee0a
Merge branch 'dubinc:main' into use-rscs-in-ui-package
versecafe Feb 4, 2024
5a6c03a
Merge branch 'temp-test' into eslint
versecafe Feb 4, 2024
be1f9a2
Revert "Merge branch 'temp-test' into eslint"
versecafe Feb 4, 2024
405c271
fix pnpm lock
versecafe Feb 5, 2024
3eccb0a
further compliance ui from 82 to 57 problems
versecafe Feb 5, 2024
e78d84f
minor cleaning
versecafe Feb 5, 2024
8b13f90
clean web to bring conformance up
versecafe Feb 5, 2024
b5b77a9
Merge branch 'main' into eslint
versecafe Feb 5, 2024
6768190
fix up lockfile
versecafe Feb 5, 2024
63246e6
Merge branch 'main' into eslint
versecafe Feb 6, 2024
141d4fb
Merge branch 'main' into eslint
versecafe Feb 9, 2024
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
Next Next commit
use RSCs in @dub/ui
  • Loading branch information
versecafe committed Jan 19, 2024
commit 7534bba6077db643f39d45f610fdcebf5d50cbc4
94 changes: 94 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,97 @@ We love our contributors! Here's how you can contribute:
## License

Inspired by [Plausible](https://plausible.io/), Dub is open-source under the GNU Affero General Public License Version 3 (AGPLv3) or any later version. You can [find it here](https://github.com/dubinc/dub/blob/main/LICENSE.md).

# Old
```
Route (app) Size First Load JS
┌ ○ /_not-found 893 B 85.4 kB
├ ● /[domain] 3.49 kB 713 kB
├ ℇ /[domain]/stats/[key] 1.69 kB 269 kB
├ ○ /admin.dub.co 3.59 kB 157 kB
├ ○ /admin.dub.co/links 200 B 296 kB
├ ○ /admin.dub.co/login 1.71 kB 198 kB
├ ○ /app.dub.co 5.89 kB 298 kB
├ ○ /app.dub.co/[slug] 201 B 296 kB
├ λ /app.dub.co/[slug]/[domain]/[[...key]] 160 B 84.7 kB
├ ○ /app.dub.co/[slug]/analytics 1.52 kB 301 kB
├ ○ /app.dub.co/[slug]/domains 12.4 kB 250 kB
├ ○ /app.dub.co/[slug]/settings 7.68 kB 179 kB
├ ○ /app.dub.co/[slug]/settings/billing 8.94 kB 202 kB
├ ○ /app.dub.co/[slug]/settings/people 9.29 kB 200 kB
├ ○ /app.dub.co/[slug]/settings/security 9.97 kB 191 kB
├ λ /app.dub.co/analytics 160 B 84.7 kB
├ ℇ /app.dub.co/auth/saml 399 B 196 kB
├ λ /app.dub.co/links 160 B 84.7 kB
├ λ /app.dub.co/links/[key] 160 B 84.7 kB
├ ℇ /app.dub.co/login 1.71 kB 198 kB
├ ℇ /app.dub.co/register 894 B 224 kB
├ ○ /app.dub.co/settings 6.6 kB 161 kB
├ ○ /app.dub.co/settings/tokens 4.82 kB 182 kB
├ ○ /app.dub.co/welcome 12.1 kB 727 kB
├ ℇ /banned/[domain]/[key] 239 B 187 kB
├ ℇ /expired/[domain]/[key] 238 B 187 kB
├ ℇ /inspect/[domain]/[key] 3.86 kB 217 kB
├ ● /protected/[domain]/[key] 1.09 kB 190 kB
├ ℇ /proxy/[domain]/[key] 193 B 84.7 kB
├ ℇ /rewrite/[url] 160 B 84.7 kB
+ First Load JS shared by all 84.5 kB
├ chunks/046fd414-c22de0896b393186.js 53.3 kB
├ chunks/4237-adea44edabf2faaa.js 29 kB
└ other shared chunks (total) 2.18 kB


ƒ Middleware 133 kB

○ (Static) prerendered as static content
● (SSG) prerendered as static HTML (uses getStaticProps)
λ (Dynamic) server-rendered on demand using Node.js
ℇ (Edge Runtime) server-rendered on demand using the Edge Runtime
```

# New
```
Route (app) Size First Load JS
┌ ○ /_not-found 893 B 85.5 kB
├ ● /[domain] 1.35 kB 718 kB
├ ℇ /[domain]/stats/[key] 1.57 kB 249 kB
├ ○ /admin.dub.co 3.8 kB 139 kB
├ ○ /admin.dub.co/links 189 B 276 kB
├ ○ /admin.dub.co/login 2.08 kB 197 kB
├ ○ /app.dub.co 6.07 kB 277 kB
├ ○ /app.dub.co/[slug] 189 B 276 kB
├ λ /app.dub.co/[slug]/[domain]/[[...key]] 160 B 84.7 kB
├ ○ /app.dub.co/[slug]/analytics 1.63 kB 279 kB
├ ○ /app.dub.co/[slug]/domains 8.31 kB 231 kB
├ ○ /app.dub.co/[slug]/settings 6.86 kB 159 kB
├ ○ /app.dub.co/[slug]/settings/billing 7.37 kB 182 kB
├ ○ /app.dub.co/[slug]/settings/people 8.49 kB 180 kB
├ ○ /app.dub.co/[slug]/settings/security 9.13 kB 179 kB
├ λ /app.dub.co/analytics 160 B 84.7 kB
├ ℇ /app.dub.co/auth/saml 506 B 195 kB
├ λ /app.dub.co/links 160 B 84.7 kB
├ λ /app.dub.co/links/[key] 160 B 84.7 kB
├ ℇ /app.dub.co/login 2.08 kB 197 kB
├ ℇ /app.dub.co/register 1.25 kB 201 kB
├ ○ /app.dub.co/settings 5.79 kB 163 kB
├ ○ /app.dub.co/settings/tokens 7.49 kB 162 kB
├ ○ /app.dub.co/welcome 6.94 kB 740 kB
├ ℇ /banned/[domain]/[key] 356 B 186 kB
├ ℇ /expired/[domain]/[key] 356 B 186 kB
├ ℇ /inspect/[domain]/[key] 3.98 kB 195 kB
├ ● /protected/[domain]/[key] 1.23 kB 189 kB
├ ℇ /proxy/[domain]/[key] 193 B 84.8 kB
├ ℇ /rewrite/[url] 160 B 84.7 kB
+ First Load JS shared by all 84.6 kB
├ chunks/046fd414-c22de0896b393186.js 53.3 kB
├ chunks/4237-adea44edabf2faaa.js 29 kB
└ other shared chunks (total) 2.21 kB


ƒ Middleware 133 kB

○ (Static) prerendered as static content
● (SSG) prerendered as static HTML (uses getStaticProps)
λ (Dynamic) server-rendered on demand using Node.js
ℇ (Edge Runtime) server-rendered on demand using the Edge Runtime
```
6 changes: 2 additions & 4 deletions apps/web/app/app.dub.co/(auth)/welcome/page-client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useAddProjectModal } from "@/ui/modals/add-project-modal";
import { useUpgradePlanModal } from "@/ui/modals/upgrade-plan-modal";
import Interim from "@/ui/welcome/interim";
import Intro from "@/ui/welcome/intro";
import { Background } from "@dub/ui";
import va from "@vercel/analytics";
import { AnimatePresence } from "framer-motion";
import { ArrowLeft } from "lucide-react";
Expand Down Expand Up @@ -40,8 +39,7 @@ export default function WelcomePageClient() {
}, [searchParams]);

return (
<div className="flex h-screen flex-col items-center">
<Background />
<>
<AddProjectModal />
<UpgradePlanModal />
<AnimatePresence mode="wait">
Expand All @@ -61,6 +59,6 @@ export default function WelcomePageClient() {
</>
)}
</AnimatePresence>
</div>
</>
);
}
11 changes: 10 additions & 1 deletion apps/web/app/app.dub.co/(auth)/welcome/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { constructMetadata } from "@dub/utils";
import { Background } from "@dub/ui";
import WelcomePageClient from "./page-client";
import { Suspense } from "react";

export const runtime = "nodejs";

Expand All @@ -8,5 +10,12 @@ export const metadata = constructMetadata({
});

export default function WelcomePage() {
return <WelcomePageClient />;
return (
<div className="flex h-screen flex-col items-center">
<Background />
<Suspense fallback={<div/>}>
<WelcomePageClient />
</Suspense>
</div>
);
}
1 change: 1 addition & 0 deletions apps/web/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module.exports = {
useDeploymentId: true,
useDeploymentIdServerActions: true,
},
transpilePackages: ["@dub/ui"],
webpack: (config, { webpack, isServer }) => {
if (isServer) {
config.plugins.push(
Expand Down
4 changes: 3 additions & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"dependencies": {
"@boxyhq/saml-jackson": "^1.14.2",
"@dub/tailwind-config": "workspace:*",
"@dub/ui": "workspace:*",
"@dub/utils": "workspace:*",
"@next-auth/prisma-adapter": "^1.0.5",
"@planetscale/database": "^1.7.0",
Expand Down Expand Up @@ -88,6 +87,9 @@
"use-debounce": "^8.0.4",
"vaul": "^0.6.8"
},
"peerDependencies": {
"@dub/ui": "workspace:*"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
"@types/dotenv-flow": "^3.3.2",
Expand Down
9 changes: 2 additions & 7 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@
"description": "UI components for Dub.co",
"version": "0.0.43",
"sideEffects": false,
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist/**"
],
"main": "./src/index.tsx",
"types": "./src/index.tsx",
"scripts": {
"build": "tsup",
"lint": "eslint src/",
"dev": "tsup --watch",
"check-types": "tsc --noEmit"
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/accordion.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client"

import { cn } from "@dub/utils";
import * as AccordionPrimitive from "@radix-ui/react-accordion";
import { ChevronDown } from "lucide-react";
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/form.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import { cn } from "@dub/utils";
import { InputHTMLAttributes, ReactNode, useMemo, useState } from "react";
import { Button } from "./button";
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/hooks/use-cookies.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import Cookies from "js-cookie";
import { useEffect, useState } from "react";

Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/hooks/use-current-anchor.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import { useEffect, useState } from "react";

export default function useCurrentAnchor() {
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/hooks/use-intersection-observer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import { RefObject, useEffect, useState } from "react";

interface Args extends IntersectionObserverInit {
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/hooks/use-local-storage.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import { useEffect, useState } from "react";

export default function useLocalStorage<T>(
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/hooks/use-media-query.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import { useEffect, useState } from "react";

export default function useMediaQuery() {
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/hooks/use-router-stuff.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import { usePathname, useRouter, useSearchParams } from "next/navigation";

export default function useRouterStuff() {
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/hooks/use-scroll.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import { useCallback, useEffect, useState } from "react";

export default function useScroll(threshold: number) {
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/hooks/use-toast-with-undo.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import { useEffect } from "react";
import { toast } from "sonner";
import Success from "../icons/success";
Expand Down