From cb1b30d8267eb14a73c779cd609560c43327d74b Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Mon, 9 Oct 2023 10:42:46 -0400 Subject: [PATCH] ci: setup --- lib/vite-plugin-scope-tailwind | 1 - package.json | 136 +++++++++--------- .../lume/LumeIdentity/LumeIdentity.tsx | 25 ++-- src/components/ui/button.tsx | 6 +- src/components/ui/input.tsx | 6 +- src/index.ts | 7 + src/main.ts | 4 - tailwind.config.ts | 14 +- tsconfig.build.json | 47 ------ tsconfig.json | 41 ------ tsconfig.node.json | 13 -- vite.config.ts | 20 +-- 12 files changed, 107 insertions(+), 213 deletions(-) delete mode 160000 lib/vite-plugin-scope-tailwind create mode 100644 src/index.ts delete mode 100644 src/main.ts delete mode 100644 tsconfig.build.json delete mode 100644 tsconfig.json delete mode 100644 tsconfig.node.json diff --git a/lib/vite-plugin-scope-tailwind b/lib/vite-plugin-scope-tailwind deleted file mode 160000 index cec13df..0000000 --- a/lib/vite-plugin-scope-tailwind +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cec13df7edcb480dfb111de3c74887f1c3ffb7e2 diff --git a/package.json b/package.json index 30efe6e..a8e9a5f 100644 --- a/package.json +++ b/package.json @@ -1,66 +1,74 @@ { - "$schema": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/package.json", - "name": "sdk", - "private": true, - "version": "0.0.0", - "type": "module", - "main": "./src/main.ts", - "types": "./src/main.ts", - "scripts": { - "dev": "vite", - "build-pkg": "tsc -p ./tsconfig.build.json && vite build", - "build": "zx ./scripts/build.mjs", - "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", - "preview": "vite preview", - "storybook": "storybook dev -p 6006", - "build-storybook": "storybook build" - }, - "dependencies": { - "@lumeweb/kernel-network-registry-client": "0.1.0-develop.10", - "@lumeweb/libkernel": "0.1.0-develop.65", - "@radix-ui/react-dialog": "^1.0.5", - "@radix-ui/react-icons": "^1.3.0", - "@radix-ui/react-slot": "^1.0.2", - "class-variance-authority": "^0.7.0", - "clsx": "^2.0.0", - "framer-motion": "^10.16.4", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "tailwind-merge": "^1.14.0", - "tailwindcss-animate": "^1.0.7", - "vite-plugin-node-polyfills": "^0.15.0", - "vite-plugin-optimizer": "^1.4.2" - }, - "devDependencies": { - "@storybook/addon-essentials": "^7.4.6", - "@storybook/addon-interactions": "^7.4.6", - "@storybook/addon-links": "^7.4.6", - "@storybook/addon-onboarding": "^1.0.8", - "@storybook/blocks": "^7.4.6", - "@storybook/react": "^7.4.6", - "@storybook/react-vite": "^7.4.6", - "@storybook/testing-library": "^0.2.2", - "@types/react": "^18.2.15", - "@types/react-dom": "^18.2.7", - "@types/uniqid": "^5.3.2", - "@typescript-eslint/eslint-plugin": "^6.0.0", - "@typescript-eslint/parser": "^6.0.0", - "@vitejs/plugin-react": "^4.0.3", - "autoprefixer": "^10.4.16", - "eslint": "^8.45.0", - "eslint-plugin-react-hooks": "^4.6.0", - "eslint-plugin-react-refresh": "^0.4.3", - "eslint-plugin-storybook": "^0.6.14", - "json": "^11.0.0", - "postcss": "^8.4.31", - "storybook": "^7.4.6", - "tailwindcss": "^3.3.3", - "typescript": "^5.0.2", - "uniqid": "^5.4.0", - "vite": "^4.4.5", - "vite-plugin-dts": "^3.6.0", - "vite-plugin-scope-tailwind": "^1.1.3", - "vite-plugin-svgr": "^4.1.0", - "zx": "^7.2.3" - } + "name": "@lumreb/sdk", + "private": true, + "version": "0.1.0", + "type": "module", + "main": "src/index.ts", + "types": "./src/main.ts", + "scripts": { + "prepare": "presetter bootstrap", + "build": "run build", + "storybook": "storybook dev -p 6006", + "build-storybook": "storybook build" + }, + "dependencies": { + "@lumeweb/kernel-network-registry-client": "0.1.0-develop.10", + "@lumeweb/libkernel": "0.1.0-develop.65", + "@radix-ui/react-dialog": "^1.0.5", + "@radix-ui/react-icons": "^1.3.0", + "@radix-ui/react-slot": "^1.0.2", + "class-variance-authority": "^0.7.0", + "clsx": "^2.0.0", + "framer-motion": "^10.16.4", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "tailwind-merge": "^1.14.0", + "tailwindcss-animate": "^1.0.7", + "vite-plugin-node-polyfills": "^0.15.0" + }, + "devDependencies": { + "@lumeweb/node-library-preset": "*", + "@radix-ui/react-dialog": "^1.0.5", + "@radix-ui/react-icons": "^1.3.0", + "@storybook/addon-essentials": "^7.4.6", + "@storybook/addon-interactions": "^7.4.6", + "@storybook/addon-links": "^7.4.6", + "@storybook/addon-onboarding": "^1.0.8", + "@storybook/blocks": "^7.4.6", + "@storybook/react": "^7.4.6", + "@storybook/react-vite": "^7.4.6", + "@storybook/testing-library": "^0.2.2", + "@types/react": "^18.2.25", + "@types/react-dom": "^18.2.11", + "@types/uniqid": "^5.3.2", + "@typescript-eslint/eslint-plugin": "^6.7.4", + "@typescript-eslint/parser": "^6.7.4", + "@vitejs/plugin-react": "^4.1.0", + "autoprefixer": "^10.4.16", + "class-variance-authority": "^0.7.0", + "eslint": "^8.51.0", + "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-react-refresh": "^0.4.3", + "eslint-plugin-storybook": "^0.6.15", + "framer-motion": "^10.16.4", + "json": "^11.0.0", + "postcss": "^8.4.31", + "presetter": "*", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "storybook": "^7.4.6", + "tailwind-merge": "^1.14.0", + "tailwindcss": "^3.3.3", + "tailwindcss-animate": "^1.0.7", + "typescript": "^5.2.2", + "uniqid": "^5.4.0", + "vite": "^4.4.11", + "vite-plugin-dts": "^3.6.0", + "vite-plugin-node-polyfills": "^0.15.0", + "vite-plugin-optimizer": "^1.4.2", + "vite-plugin-scope-tailwind": "^1.1.3", + "vite-plugin-svgr": "^4.1.0" + }, + "readme": "ERROR: No README data found!", + "_id": "@lumeweb/sdk@0.1.0" } diff --git a/src/components/lume/LumeIdentity/LumeIdentity.tsx b/src/components/lume/LumeIdentity/LumeIdentity.tsx index 2166b62..ee6ba46 100644 --- a/src/components/lume/LumeIdentity/LumeIdentity.tsx +++ b/src/components/lume/LumeIdentity/LumeIdentity.tsx @@ -1,9 +1,9 @@ -import { Button } from "../../ui/button.tsx"; +import { Button } from "../../ui/button"; import { SwitchableComponent, SwitchableComponentProvider, useSwitchableComponent, -} from "../../SwitchableComponent.tsx"; +} from "../../SwitchableComponent"; import * as ComponentList from "./components"; import { LumeIdentityContext, Session } from "./LumeIdentityContext"; import { LazyMotion, domAnimation } from "framer-motion"; @@ -14,23 +14,23 @@ import { useState } from "react"; const LumeIdentity: FC = () => { const { visibleComponent, setVisibleComponent } = useSwitchableComponent( - ComponentList.SubmitButton + ComponentList.SubmitButton, ); const isSubmitButtonInView = [ComponentList.SubmitButton.index].includes( - visibleComponent.index + visibleComponent.index, ); const isLoginWithAccountKey = [ComponentList.SeedPhraseInput.index].includes( - visibleComponent.index + visibleComponent.index, ); const isCreatingAccount = [ComponentList.SetupAccountKey.index].includes( - visibleComponent.index + visibleComponent.index, ); const isShowingSeedPhrase = [ ComponentList.SeedPhraseGeneration.index, ].includes(visibleComponent.index); const isFinalStep = [ComponentList.SeedPhraseGeneration.index].includes( - visibleComponent.index + visibleComponent.index, ); const shouldShowBackButton = isCreatingAccount; @@ -62,16 +62,14 @@ const LumeIdentity: FC = () => { {!isFinalStep ? ( <>
+ className={`relative h-7 w-full overflow-hidden ${coloredOrLine}`}> + xmlns="http://www.w3.org/2000/svg"> { setVisibleComponent( shouldShowBackButton ? ComponentList.SubmitButton - : ComponentList.SetupAccountKey + : ComponentList.SetupAccountKey, ) - } - > + }> {shouldShowBackButton ? "Go Back" : "Create an Account"} diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx index 0e5a063..75ed073 100644 --- a/src/components/ui/button.tsx +++ b/src/components/ui/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.ts"; +import { cn } from "../utils"; const buttonVariants = cva( "inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50", @@ -31,7 +31,7 @@ const buttonVariants = cva( variant: "default", size: "default", }, - } + }, ); export interface ButtonProps @@ -50,7 +50,7 @@ const Button = React.forwardRef( {...props} /> ); - } + }, ); Button.displayName = "Button"; diff --git a/src/components/ui/input.tsx b/src/components/ui/input.tsx index 478e3d4..9d66996 100644 --- a/src/components/ui/input.tsx +++ b/src/components/ui/input.tsx @@ -1,6 +1,6 @@ import * as React from "react"; -import { cn } from "../utils.ts"; +import { cn } from "../utils"; export interface InputProps extends React.InputHTMLAttributes {} @@ -12,13 +12,13 @@ const Input = React.forwardRef( type={type} className={cn( "flex h-9 w-full text-white rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 focus:border-white", - className + className, )} ref={ref} {...props} /> ); - } + }, ); Input.displayName = "Input"; diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..cb41247 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,7 @@ +export { + default as LumeProvider, + useLume, +} from "./components/lume/LumeProvider"; +export { default as LumeDashboard } from "./components/lume/LumeDashboard/LumeDashboard"; +export { default as LumeIdentity } from "./components/lume/LumeIdentity/LumeIdentity"; +import "../styles/globals.css"; diff --git a/src/main.ts b/src/main.ts deleted file mode 100644 index 8f05aaf..0000000 --- a/src/main.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { default as LumeProvider, useLume } from './components/lume/LumeProvider.tsx'; -export { default as LumeDashboard } from './components/lume/LumeDashboard/LumeDashboard.tsx'; -export { default as LumeIdentity } from './components/lume/LumeIdentity/LumeIdentity.tsx'; -import "../styles/globals.css"; diff --git a/tailwind.config.ts b/tailwind.config.ts index a3117f0..9c986f8 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -1,15 +1,9 @@ -import {type Config} from "tailwindcss"; +import { type Config } from "tailwindcss"; export default { darkMode: ["class"], - content: [ - './src/**/*.{ts,tsx}', - ], - safelist: [ - 'text-primary', - 'text-red-500', - 'text-orange-500', - ], + content: ["./src/**/*.{ts,tsx}"], + safelist: ["text-primary", "text-red-500", "text-orange-500"], theme: { container: { center: true, @@ -76,4 +70,4 @@ export default { }, }, plugins: [require("tailwindcss-animate")], -} satisfies Config +} satisfies Config; diff --git a/tsconfig.build.json b/tsconfig.build.json deleted file mode 100644 index 9a8e25e..0000000 --- a/tsconfig.build.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "useDefineForClassFields": true, - "lib": [ - "ES2020", - "DOM", - "DOM.Iterable" - ], - "composite": true, - "module": "ESNext", - "skipLibCheck": true, - /* Bundler mode */ - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": "react-jsx", - /* Linting */ - "strict": true, - "outDir": "./dist", - "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true, - "baseUrl": ".", - // "paths": { - // "@/*": ["src/*"], - // "@/styles/*": ["styles/*"], - // }, - "typeRoots": [ - "src/vite-env.d.ts" - ] - }, - "include": [ - "./src/**/*", - // "./src/components/lume/LumeDashboard/LumeDashboard." - ], - "exclude": [ - "**/*.stories.tsx" - ], - "references": [ - { - "path": "./tsconfig.node.json" - } - ] -} diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 154d159..0000000 --- a/tsconfig.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "useDefineForClassFields": true, - "lib": [ - "ES2020", - "DOM", - "DOM.Iterable" - ], - "composite": true, - "module": "ESNext", - "skipLibCheck": true, - /* Bundler mode */ - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": "react-jsx", - /* Linting */ - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true, - "baseUrl": ".", - // "paths": { - // "@/*": ["src/*"], - // "@/styles/*": ["styles/*"], - // }, - "typeRoots": ["src/vite-env.d.ts"] - }, - "include": [ - "src", - "scripts", - ], - "references": [ - { - "path": "./tsconfig.node.json" - } - ] -} diff --git a/tsconfig.node.json b/tsconfig.node.json deleted file mode 100644 index eb2a7ac..0000000 --- a/tsconfig.node.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "compilerOptions": { - "composite": true, - "skipLibCheck": true, - "module": "ESNext", - "moduleResolution": "bundler", - "allowSyntheticDefaultImports": true - }, - "include": [ - "vite.config.ts", - "lib" - ] -} diff --git a/vite.config.ts b/vite.config.ts index 654cf7c..b4a1e6b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,6 +1,6 @@ import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; -//import scopeTailwind from "./lib/vite-plugin-scope-tailwind/src/main" +import scopeTailwind from "vite-plugin-scope-tailwind"; import { resolve } from "path"; import svgr from "vite-plugin-svgr"; import dts from "vite-plugin-dts"; @@ -13,7 +13,7 @@ export default defineConfig({ plugins: [ svgr(), react(), - // scopeTailwind({ react: true, classNameTransformers: ["cn"] }), + scopeTailwind({ react: true }), dts({ tsconfigPath: "tsconfig.build.json", }), @@ -38,24 +38,18 @@ export default defineConfig({ // }, }, build: { - manifest: true, - outDir: "dist", + manifest: false, + outDir: "lib", emptyOutDir: true, sourcemap: true, minify: false, lib: { - entry: resolve(__dirname, "src/main.ts"), - name: "lume-sdk", + entry: resolve(__dirname, "src/index.ts"), + name: "sdk", fileName: (format) => `lib.${format}.js`, }, rollupOptions: { - external: [ - "react", - "react-dom", - // "framer-motion", - // "tailwind-merge", - // "class-variance-authority" - ], + external: ["react", "react-dom"], }, }, });