From 856f2655bc9170a4e6180b305bcad2b1406addf7 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Tue, 12 Dec 2023 02:33:09 +0800 Subject: [PATCH] feat: rename utils to lib --- components.json | 6 +++--- src/background/index.ts | 4 ++-- src/{utils => lib}/components/Button.tsx | 2 +- src/{utils => lib}/config.ts | 0 src/{utils => lib}/offscreen.ts | 0 src/{utils => lib}/radar-rules.ts | 0 src/{utils => lib}/rss.ts | 0 src/{utils => lib}/rsshub.ts | 0 src/{utils => lib}/rules.ts | 0 src/{utils => lib}/style.css | 0 src/{utils => lib}/types.ts | 0 src/{utils => lib}/utils.ts | 0 src/popup/RSSItem.tsx | 6 +++--- src/popup/RSSList.tsx | 2 +- src/popup/index.tsx | 3 +-- src/sandboxes/index.ts | 6 +++--- 16 files changed, 14 insertions(+), 15 deletions(-) rename src/{utils => lib}/components/Button.tsx (98%) rename src/{utils => lib}/config.ts (100%) rename src/{utils => lib}/offscreen.ts (100%) rename src/{utils => lib}/radar-rules.ts (100%) rename src/{utils => lib}/rss.ts (100%) rename src/{utils => lib}/rsshub.ts (100%) rename src/{utils => lib}/rules.ts (100%) rename src/{utils => lib}/style.css (100%) rename src/{utils => lib}/types.ts (100%) rename src/{utils => lib}/utils.ts (100%) diff --git a/components.json b/components.json index e87fef1..3be408b 100644 --- a/components.json +++ b/components.json @@ -5,12 +5,12 @@ "tsx": true, "tailwind": { "config": "tailwind.config.js", - "css": "src/utils/style.css", + "css": "src/lib/style.css", "baseColor": "orange", "cssVariables": true }, "aliases": { - "components": "~/utils/components", - "utils": "~/utils/utils" + "components": "~/lib/components", + "utils": "~/lib/utils" } } \ No newline at end of file diff --git a/src/background/index.ts b/src/background/index.ts index f447dfc..c8e6189 100644 --- a/src/background/index.ts +++ b/src/background/index.ts @@ -1,6 +1,6 @@ import { sendToContentScript } from "@plasmohq/messaging" -import { setupOffscreenDocument } from "~/utils/offscreen" -import type { RSSData } from "~/utils/types"; +import { setupOffscreenDocument } from "~/lib/offscreen" +import type { RSSData } from "~/lib/types"; export {} console.log("HELLO WORLD FROM BGSCRIPTS") diff --git a/src/utils/components/Button.tsx b/src/lib/components/Button.tsx similarity index 98% rename from src/utils/components/Button.tsx rename to src/lib/components/Button.tsx index db20b3d..d754ca0 100644 --- a/src/utils/components/Button.tsx +++ b/src/lib/components/Button.tsx @@ -2,7 +2,7 @@ import * as React from "react" import { Slot } from "@radix-ui/react-slot" import { cva, type VariantProps } from "class-variance-authority" -import { cn } from "~/utils/utils" +import { cn } from "~/lib/utils" const buttonVariants = cva( "inline-flex items-center justify-center whitespace-nowrap 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/src/utils/config.ts b/src/lib/config.ts similarity index 100% rename from src/utils/config.ts rename to src/lib/config.ts diff --git a/src/utils/offscreen.ts b/src/lib/offscreen.ts similarity index 100% rename from src/utils/offscreen.ts rename to src/lib/offscreen.ts diff --git a/src/utils/radar-rules.ts b/src/lib/radar-rules.ts similarity index 100% rename from src/utils/radar-rules.ts rename to src/lib/radar-rules.ts diff --git a/src/utils/rss.ts b/src/lib/rss.ts similarity index 100% rename from src/utils/rss.ts rename to src/lib/rss.ts diff --git a/src/utils/rsshub.ts b/src/lib/rsshub.ts similarity index 100% rename from src/utils/rsshub.ts rename to src/lib/rsshub.ts diff --git a/src/utils/rules.ts b/src/lib/rules.ts similarity index 100% rename from src/utils/rules.ts rename to src/lib/rules.ts diff --git a/src/utils/style.css b/src/lib/style.css similarity index 100% rename from src/utils/style.css rename to src/lib/style.css diff --git a/src/utils/types.ts b/src/lib/types.ts similarity index 100% rename from src/utils/types.ts rename to src/lib/types.ts diff --git a/src/utils/utils.ts b/src/lib/utils.ts similarity index 100% rename from src/utils/utils.ts rename to src/lib/utils.ts diff --git a/src/popup/RSSItem.tsx b/src/popup/RSSItem.tsx index 6fcfd7f..86f5fee 100644 --- a/src/popup/RSSItem.tsx +++ b/src/popup/RSSItem.tsx @@ -1,8 +1,8 @@ import { useState } from "react" -import { defaultConfig, getConfig } from "~/utils/config" -import type { RSSData } from "~/utils/types" -import { Button } from "~/utils/components/Button" +import { defaultConfig, getConfig } from "~/lib/config" +import type { RSSData } from "~/lib/types" +import { Button } from "~/lib/components/Button" function RSSItem({ item }: { item: RSSData }) { const [config, setConfig] = useState(defaultConfig) diff --git a/src/popup/RSSList.tsx b/src/popup/RSSList.tsx index 9b41995..07aad59 100644 --- a/src/popup/RSSList.tsx +++ b/src/popup/RSSList.tsx @@ -1,5 +1,5 @@ import RSSItem from './RSSItem' -import type { RSSData } from '~/utils/types' +import type { RSSData } from '~/lib/types' function RSSList({ title, diff --git a/src/popup/index.tsx b/src/popup/index.tsx index a51c911..c56d7be 100644 --- a/src/popup/index.tsx +++ b/src/popup/index.tsx @@ -1,5 +1,5 @@ import { useState } from "react" -import "~/utils/style.css" +import "~/lib/style.css" import { sendToBackground } from "@plasmohq/messaging" import RSSList from "./RSSList" @@ -19,7 +19,6 @@ function IndexPopup() { websiteRSSHub: [], }, res)) }) - console.log("data", data) return (
diff --git a/src/sandboxes/index.ts b/src/sandboxes/index.ts index e18f631..7caea77 100644 --- a/src/sandboxes/index.ts +++ b/src/sandboxes/index.ts @@ -1,6 +1,6 @@ -import type { Rules } from "~/utils/types" -import { getPageRSS } from "~/utils/rss" -import { getPageRSSHub, getWebsiteRSSHub } from "~/utils/rsshub" +import type { Rules } from "~/lib/types" +import { getPageRSS } from "~/lib/rss" +import { getPageRSSHub, getWebsiteRSSHub } from "~/lib/rsshub" export { }