From 5236f46268c02ff20c6c29902504bda8bc9e963b Mon Sep 17 00:00:00 2001 From: Arno V Date: Tue, 17 Sep 2024 16:13:13 -0400 Subject: [PATCH] feat(Header): extracting Header as a standalone package --- .release-please-manifest.json | 3 +- packages/ui-components/package.json | 9 ++-- .../ui-components/src/components/index.ts | 2 +- packages/ui-header/README.md | 3 ++ packages/ui-header/package.json | 48 +++++++++++++++++++ packages/ui-header/postcss.config.cjs | 6 +++ packages/ui-header/src/common/constants.ts | 1 + .../src/components/Header/Header.tsx | 0 .../src/components/Header/HeaderTypes.d.ts | 0 .../Header/__tests__/Header.test.tsx | 0 packages/ui-header/src/components/index.ts | 2 + packages/ui-header/src/index.css | 3 ++ packages/ui-header/src/style.ts | 1 + packages/ui-header/src/vite-env.d.ts | 1 + packages/ui-header/tailwind.config.js | 2 + packages/ui-header/tsconfig.json | 4 ++ packages/ui-header/tsup.config.ts | 2 + packages/ui-header/vite.config.ts | 2 + packages/ui-header/vitest.config.js | 4 ++ pnpm-lock.yaml | 28 +++++++++++ release-please-config.json | 3 +- 21 files changed, 115 insertions(+), 9 deletions(-) create mode 100644 packages/ui-header/README.md create mode 100644 packages/ui-header/package.json create mode 100644 packages/ui-header/postcss.config.cjs create mode 100644 packages/ui-header/src/common/constants.ts rename packages/{ui-components => ui-header}/src/components/Header/Header.tsx (100%) rename packages/{ui-components => ui-header}/src/components/Header/HeaderTypes.d.ts (100%) rename packages/{ui-components => ui-header}/src/components/Header/__tests__/Header.test.tsx (100%) create mode 100644 packages/ui-header/src/components/index.ts create mode 100644 packages/ui-header/src/index.css create mode 100644 packages/ui-header/src/style.ts create mode 100644 packages/ui-header/src/vite-env.d.ts create mode 100644 packages/ui-header/tailwind.config.js create mode 100644 packages/ui-header/tsconfig.json create mode 100644 packages/ui-header/tsup.config.ts create mode 100644 packages/ui-header/vite.config.ts create mode 100644 packages/ui-header/vitest.config.js diff --git a/.release-please-manifest.json b/.release-please-manifest.json index cc3a2c39..e0ef894a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -11,5 +11,6 @@ "packages/ui-anchor": "1.1.0", "packages/ui-bubble": "1.0.0", "packages/ui-card": "1.0.0", - "packages/ui-footer": "1.0.0" + "packages/ui-footer": "1.0.0", + "packages/ui-header": "0.0.0" } diff --git a/packages/ui-components/package.json b/packages/ui-components/package.json index f5e1a8f8..f7bada1b 100644 --- a/packages/ui-components/package.json +++ b/packages/ui-components/package.json @@ -14,9 +14,7 @@ "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", - "files": [ - "dist" - ], + "files": ["dist"], "scripts": { "build:check": "tsc", "build:js": "vite build", @@ -52,13 +50,12 @@ "@versini/ui-bubble": "workspace:../ui-bubble", "@versini/ui-card": "workspace:../ui-card", "@versini/ui-footer": "workspace:../ui-footer", + "@versini/ui-header": "workspace:../ui-header", "@versini/ui-hooks": "workspace:../ui-hooks", "@versini/ui-icons": "workspace:../ui-icons", "@versini/ui-private": "workspace:../ui-private", "clsx": "2.1.1", "tailwindcss": "3.4.11" }, - "sideEffects": [ - "**/*.css" - ] + "sideEffects": ["**/*.css"] } diff --git a/packages/ui-components/src/components/index.ts b/packages/ui-components/src/components/index.ts index 1a76809c..e1e00aa6 100644 --- a/packages/ui-components/src/components/index.ts +++ b/packages/ui-components/src/components/index.ts @@ -3,8 +3,8 @@ import { Bubble } from "@versini/ui-bubble"; import { Button, ButtonIcon } from "@versini/ui-button"; import { Card } from "@versini/ui-card"; import { Footer } from "@versini/ui-footer"; +import { Header } from "@versini/ui-header"; -import { Header } from "./Header/Header"; import { Main } from "./Main/Main"; import { Menu } from "./Menu/Menu"; import { MenuItem } from "./Menu/MenuItem"; diff --git a/packages/ui-header/README.md b/packages/ui-header/README.md new file mode 100644 index 00000000..bed5218d --- /dev/null +++ b/packages/ui-header/README.md @@ -0,0 +1,3 @@ +# @versini/ui-header + +A simple header component for React. diff --git a/packages/ui-header/package.json b/packages/ui-header/package.json new file mode 100644 index 00000000..248cbf2c --- /dev/null +++ b/packages/ui-header/package.json @@ -0,0 +1,48 @@ +{ + "name": "@versini/ui-header", + "version": "0.0.0", + "license": "MIT", + "author": "Arno Versini", + "publishConfig": { + "access": "public" + }, + "homepage": "https://github.com/aversini/ui-components", + "repository": { + "type": "git", + "url": "git@github.com:aversini/ui-components.git" + }, + "type": "module", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "files": ["dist"], + "scripts": { + "build:check": "tsc", + "build:js": "vite build", + "build:types": "tsup", + "build": "npm-run-all --serial clean build:check build:js build:types", + "clean": "rimraf dist tmp", + "dev:js": "vite build --watch --mode development", + "dev:types": "tsup --watch src", + "dev": "npm-run-all clean --parallel dev:js dev:types", + "lint": "biome lint src", + "start": "static-server dist --port 5173", + "test:coverage:ui": "vitest --coverage --ui", + "test:coverage": "vitest run --coverage", + "test:watch": "vitest", + "test": "vitest run" + }, + "peerDependencies": { + "react": "^18.3.1", + "react-dom": "^18.3.1" + }, + "devDependencies": { + "@versini/ui-styles": "workspace:../ui-styles" + }, + "dependencies": { + "@tailwindcss/typography": "0.5.15", + "@versini/ui-private": "workspace:../ui-private", + "clsx": "2.1.1", + "tailwindcss": "3.4.11" + }, + "sideEffects": ["**/*.css"] +} diff --git a/packages/ui-header/postcss.config.cjs b/packages/ui-header/postcss.config.cjs new file mode 100644 index 00000000..e873f1a4 --- /dev/null +++ b/packages/ui-header/postcss.config.cjs @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +}; diff --git a/packages/ui-header/src/common/constants.ts b/packages/ui-header/src/common/constants.ts new file mode 100644 index 00000000..ad7bc71d --- /dev/null +++ b/packages/ui-header/src/common/constants.ts @@ -0,0 +1 @@ +export const HEADER_CLASSNAME = "av-header"; diff --git a/packages/ui-components/src/components/Header/Header.tsx b/packages/ui-header/src/components/Header/Header.tsx similarity index 100% rename from packages/ui-components/src/components/Header/Header.tsx rename to packages/ui-header/src/components/Header/Header.tsx diff --git a/packages/ui-components/src/components/Header/HeaderTypes.d.ts b/packages/ui-header/src/components/Header/HeaderTypes.d.ts similarity index 100% rename from packages/ui-components/src/components/Header/HeaderTypes.d.ts rename to packages/ui-header/src/components/Header/HeaderTypes.d.ts diff --git a/packages/ui-components/src/components/Header/__tests__/Header.test.tsx b/packages/ui-header/src/components/Header/__tests__/Header.test.tsx similarity index 100% rename from packages/ui-components/src/components/Header/__tests__/Header.test.tsx rename to packages/ui-header/src/components/Header/__tests__/Header.test.tsx diff --git a/packages/ui-header/src/components/index.ts b/packages/ui-header/src/components/index.ts new file mode 100644 index 00000000..96f05b53 --- /dev/null +++ b/packages/ui-header/src/components/index.ts @@ -0,0 +1,2 @@ +export * from "../common/constants"; +export * from "./Header/Header"; diff --git a/packages/ui-header/src/index.css b/packages/ui-header/src/index.css new file mode 100644 index 00000000..b5c61c95 --- /dev/null +++ b/packages/ui-header/src/index.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/packages/ui-header/src/style.ts b/packages/ui-header/src/style.ts new file mode 100644 index 00000000..3a29aed1 --- /dev/null +++ b/packages/ui-header/src/style.ts @@ -0,0 +1 @@ +import "./index.css"; diff --git a/packages/ui-header/src/vite-env.d.ts b/packages/ui-header/src/vite-env.d.ts new file mode 100644 index 00000000..11f02fe2 --- /dev/null +++ b/packages/ui-header/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/packages/ui-header/tailwind.config.js b/packages/ui-header/tailwind.config.js new file mode 100644 index 00000000..42ba260d --- /dev/null +++ b/packages/ui-header/tailwind.config.js @@ -0,0 +1,2 @@ +import { commonTailwindConfigForComponent } from "../../configuration/tailwind.common"; +export default commonTailwindConfigForComponent(); diff --git a/packages/ui-header/tsconfig.json b/packages/ui-header/tsconfig.json new file mode 100644 index 00000000..652d144c --- /dev/null +++ b/packages/ui-header/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../configuration/tsconfig.common.json", + "include": ["src"] +} diff --git a/packages/ui-header/tsup.config.ts b/packages/ui-header/tsup.config.ts new file mode 100644 index 00000000..7490cbb5 --- /dev/null +++ b/packages/ui-header/tsup.config.ts @@ -0,0 +1,2 @@ +import { commonTsupConfig } from "../../configuration/tsup.common"; +export default commonTsupConfig; diff --git a/packages/ui-header/vite.config.ts b/packages/ui-header/vite.config.ts new file mode 100644 index 00000000..f23a2b78 --- /dev/null +++ b/packages/ui-header/vite.config.ts @@ -0,0 +1,2 @@ +import { commonViteConfigForComponent } from "../../configuration/vite.common"; +export default commonViteConfigForComponent(); diff --git a/packages/ui-header/vitest.config.js b/packages/ui-header/vitest.config.js new file mode 100644 index 00000000..028e7ef7 --- /dev/null +++ b/packages/ui-header/vitest.config.js @@ -0,0 +1,4 @@ +import { commonVitestConfig } from "../../configuration/vitestconfig.common"; +import viteConfig from "./vite.config"; + +export default commonVitestConfig(viteConfig); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8e480c68..0fe13163 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -318,6 +318,9 @@ importers: '@versini/ui-footer': specifier: workspace:../ui-footer version: link:../ui-footer + '@versini/ui-header': + specifier: workspace:../ui-header + version: link:../ui-header '@versini/ui-hooks': specifier: workspace:../ui-hooks version: link:../ui-hooks @@ -396,6 +399,31 @@ importers: specifier: workspace:../ui-styles version: link:../ui-styles + packages/ui-header: + dependencies: + '@tailwindcss/typography': + specifier: 0.5.15 + version: 0.5.15(tailwindcss@3.4.11) + '@versini/ui-private': + specifier: workspace:../ui-private + version: link:../ui-private + clsx: + specifier: 2.1.1 + version: 2.1.1 + react: + specifier: ^18.3.1 + version: 18.3.1 + react-dom: + specifier: ^18.3.1 + version: 18.3.1(react@18.3.1) + tailwindcss: + specifier: 3.4.11 + version: 3.4.11 + devDependencies: + '@versini/ui-styles': + specifier: workspace:../ui-styles + version: link:../ui-styles + packages/ui-hooks: devDependencies: react: diff --git a/release-please-config.json b/release-please-config.json index d8113735..060f8f64 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -12,7 +12,8 @@ "packages/ui-anchor": {}, "packages/ui-bubble": {}, "packages/ui-card": {}, - "packages/ui-footer": {} + "packages/ui-footer": {}, + "packages/ui-header": {} }, "plugins": ["node-workspace"], "pull-request-header": ":rocket: Automated Release"