diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 43b193f5..12d72d89 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -1,15 +1,19 @@
## Context (Environment)
+
## Expected Behavior
+
## Current Behavior
+
## Steps to Reproduce or Reproduction Link
+
@@ -21,6 +25,7 @@
## Video, Screenshot or other visual aids
## Possible Solution
+
## Acceptance criteria
@@ -33,4 +38,4 @@
**Then** the outcome of the action in “When”
-**And** used to continue any of three previous statements
\ No newline at end of file
+**And** used to continue any of three previous statements
diff --git a/.github/ISSUE_TEMPLATE/user_story.md b/.github/ISSUE_TEMPLATE/user_story.md
index 05db3e57..ded86d6e 100644
--- a/.github/ISSUE_TEMPLATE/user_story.md
+++ b/.github/ISSUE_TEMPLATE/user_story.md
@@ -26,4 +26,4 @@ Some recommendations regarding project and implementation details
2. - [ ] Team understands acceptance criteria
3. - [ ] Team has defined solution / steps to satisfy acceptance criteria
4. - [ ] Acceptance criteria is verifiable / testable
-5. - [ ] External / 3rd Party dependencies identified
\ No newline at end of file
+5. - [ ] External / 3rd Party dependencies identified
diff --git a/.github/actions/node-setup-and-install/action.yml b/.github/actions/node-setup-and-install/action.yml
index a1962c8c..73526ef2 100644
--- a/.github/actions/node-setup-and-install/action.yml
+++ b/.github/actions/node-setup-and-install/action.yml
@@ -16,7 +16,7 @@ runs:
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: ".nvmrc"
- cache: 'pnpm' # Caches pnpm store globally — shared across all jobs
+ cache: "pnpm" # Caches pnpm store globally — shared across all jobs
# Cache node_modules keyed on OS + lockfile — the only cache needed.
# No restore-keys: a partially wrong node_modules is worse than a miss.
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index 0632bbfd..219b7cd3 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -31,4 +31,4 @@ Based on: [example implementation](gistUrl)
- [ ] New feature (a non-breaking change that adds functionality)
- [ ] Performance (a non-breaking change that reduces time or space complexity of a flow)
- [ ] Refactor (a non-breaking change that restructures existing code)
-- [ ] Test (added or updated existing tests without implementation changes)
\ No newline at end of file
+- [ ] Test (added or updated existing tests without implementation changes)
diff --git a/.github/workflows/commit-lint.yaml b/.github/workflows/commit-lint.yaml
index 4e7c948b..3793e196 100644
--- a/.github/workflows/commit-lint.yaml
+++ b/.github/workflows/commit-lint.yaml
@@ -2,7 +2,7 @@ name: Conventional Commit (PR title)
on:
pull_request:
- types: [opened, synchronize, reopened, edited]
+ types: [ opened, synchronize, reopened, edited ]
concurrency:
group: commit-lint-${{ github.event.pull_request.number }}
diff --git a/AGENTS.md b/AGENTS.md
index 65f2db3a..6545ee89 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -6,15 +6,15 @@ Personal open-source monorepo for publishable npm packages under the `@tutods` s
## Stack
-| Piece | Version / tool | Notes |
-|-------|---------------|-------|
-| Workspace | Nx 23 + pnpm 11 (`pnpm-workspace.yaml`: `packages/*`, `configs/*`) | Nx runs/caches builds; pnpm is the only package manager |
-| Bundler | Rslib (`@rslib/core`) per package | ESM only, `dts: true` — no CJS output |
-| Language | TypeScript 7.x (native TS compiler — bleeding edge) | |
-| UI | React 19 as **peerDependency** (`>=19.2.7`) | Never move React to `dependencies` |
-| Lint/format | Biome (config from `@tutods/biome-config`, workspace package) | Tabs, double quotes — Biome enforces, don't hand-format |
-| Hooks | lefthook (`.lefthook.yml`): pre-commit Biome on staged, commit-msg commitlint | |
-| Releases | `nx release` — independent versioning, conventional commits drive bumps | |
+| Piece | Version / tool | Notes |
+| ----------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------- |
+| Workspace | Nx 23 + pnpm 11 (`pnpm-workspace.yaml`: `packages/*`, `configs/*`) | Nx runs/caches builds; pnpm is the only package manager |
+| Bundler | Rslib (`@rslib/core`) per package | ESM only, `dts: true` — no CJS output |
+| Language | TypeScript 7.x (native TS compiler — bleeding edge) | |
+| UI | React 19 as **peerDependency** (`>=19.2.7`) | Never move React to `dependencies` |
+| Lint/format | Biome (config from `@tutods/biome-config`, workspace package) | 2 spaces, single quotes — Biome enforces, don't hand-format |
+| Hooks | lefthook (`.lefthook.yml`): pre-commit Biome on staged, commit-msg commitlint | |
+| Releases | `nx release` — independent versioning, conventional commits drive bumps | |
Layout:
@@ -27,14 +27,14 @@ configs/ @tutods/{biome,typescript,renovate}-config — published
Run from repo root with pnpm (never npm/yarn — `packageManager` pins pnpm):
-| Command | What |
-|---------|------|
-| `pnpm build` | `nx run-many -t build` — builds all packages |
-| `pnpm lint` | `biome check .` |
-| `pnpm lint:fix` | Biome with `--write` |
-| `pnpm lint:ci` | CI variant |
-| `pnpm --filter @tutods/components dev` | Rslib watch mode for the components package |
-| `pnpm release` | `nx release` — only when explicitly asked; it creates a version commit (no tag/push) |
+| Command | What |
+| -------------------------------------- | ------------------------------------------------------------------------------------ |
+| `pnpm build` | `nx run-many -t build` — builds all packages |
+| `pnpm lint` | `biome check .` |
+| `pnpm lint:fix` | Biome with `--write` |
+| `pnpm lint:ci` | CI variant |
+| `pnpm --filter @tutods/components dev` | Rslib watch mode for the components package |
+| `pnpm release` | `nx release` — only when explicitly asked; it creates a version commit (no tag/push) |
There is no `test` or `typecheck` script. Type errors surface via `pnpm build` (Rslib emits d.ts). If you need a standalone type check, run `pnpm exec tsc --noEmit -p packages/components/tsconfig.json`.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index dba62f6d..48d2d442 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -206,19 +206,24 @@ Include:
```markdown
## What
+
Brief description of what this PR does.
## Why
+
Reason for these changes.
## How
+
Technical approach (if needed).
## Related
+
- Closes #123
- Related to #456
## Checklist
+
- [ ] Code follows project standards
- [ ] Tests pass
- [ ] Documentation updated
diff --git a/README.md b/README.md
index 2da90418..220f8ae0 100644
--- a/README.md
+++ b/README.md
@@ -11,8 +11,10 @@
> A collection of reusable packages, configurations, and components for web development projects.
---
+
## Table of Contents
+
- [📄 Goal](#-goal)
- [What you will find](#what-you-will-find)
- [📦 Packages](#-packages)
diff --git a/biome.json b/biome.json
index 15d4aee9..bdbfcba6 100644
--- a/biome.json
+++ b/biome.json
@@ -1,5 +1,6 @@
{
"$schema": "https://biomejs.dev/schemas/2.6.3/schema.json",
"root": true,
- "extends": ["@tutods/biome-config"]
+ "extends": ["@tutods/biome-config"],
+ "files": { "includes": ["!.agents"] }
}
diff --git a/configs/renovate-config/README.md b/configs/renovate-config/README.md
index e41e3ad2..caa1c5c5 100644
--- a/configs/renovate-config/README.md
+++ b/configs/renovate-config/README.md
@@ -6,6 +6,7 @@
---
## Table of Contents
+
- [📄 Goal](#-goal)
- [💡 What you get](#-what-you-get)
- [✨ Features](#-features)
@@ -25,17 +26,17 @@ This is a **shared Renovate preset**: a single source of truth for dependency up
### 💡 What you get
-| Area | Behavior |
-|------|----------|
-| **Minor & patch** | Auto-merged via PR |
-| **Major** | Requires dashboard approval |
-| **Security advisories** | Instantly processed, auto-merged (minor/patch), grouped with `fix(deps):` prefix |
-| **GitHub Actions** | Digest-pinned, minor/patch auto-merged |
-| **Docker images** | Digest-pinned, minor/patch auto-merged |
-| **devDependencies** | Grouped by minor/patch and major |
-| **TypeScript, Biome, Testing, Build tools** | Dedicated groups with appropriate commit prefixes |
-| **pnpm** | Runs `pnpm dedupe` post-update |
-| **Lockfile** | Monthly maintenance PR |
+| Area | Behavior |
+| ------------------------------------------- | -------------------------------------------------------------------------------- |
+| **Minor & patch** | Auto-merged via PR |
+| **Major** | Requires dashboard approval |
+| **Security advisories** | Instantly processed, auto-merged (minor/patch), grouped with `fix(deps):` prefix |
+| **GitHub Actions** | Digest-pinned, minor/patch auto-merged |
+| **Docker images** | Digest-pinned, minor/patch auto-merged |
+| **devDependencies** | Grouped by minor/patch and major |
+| **TypeScript, Biome, Testing, Build tools** | Dedicated groups with appropriate commit prefixes |
+| **pnpm** | Runs `pnpm dedupe` post-update |
+| **Lockfile** | Monthly maintenance PR |
## ✨ Features
@@ -137,51 +138,51 @@ Any key you set in your local `renovate.json` overrides the inherited value. For
### Core settings
-| Setting | Value | Why |
-|---------|-------|-----|
-| `schedule` | `before 3am every weekday` | Runs outside working hours |
-| `timezone` | `Europe/Lisbon` | Consistent timezone reference |
-| `prHourlyLimit` | `2` | Prevents PR floods |
-| `prConcurrentLimit` | `10` | Keeps the PR list manageable |
-| `branchConcurrentLimit` | `5` | Limits parallel branch noise |
-| `minimumReleaseAge` | `3 days` | Avoids broken releases |
-| `rebaseWhen` | `conflicted` | Only force-push when needed |
-| `rangeStrategy` | `bump` | Bumps ranges to the new version |
-| `separateMinorPatch` | `true` | Separate PRs for minor and patch |
-| `separateMultipleMajor` | `true` | Separate PRs per major dependency |
-| `dependencyDashboardApproval` | `true` | Major updates require explicit approval |
-| `dependencyDashboardAutoclose` | `true` | Auto-closes dashboard when clean |
-| `stopUpdatingLabel` | `renovate:stop` | Emergency brake for vulnerable deps |
-| `osvVulnerabilityAlerts` | `true` | OSV/GHSA vulnerability scanning |
-| `fetchChangeLogs` | `"pr"` | Embeds changelogs in PR body |
-| `rollbackPrs` | `true` | Creates rollback PRs for pulled releases |
-| `configMigration` | `true` | Auto-migrates config on breaking Renovate changes |
-| `postUpdateOptions` | `["pnpmDedupe"]` | Dedupes pnpm lockfile after updates |
-| `lockFileMaintenance` | Monthly, auto-merged | Keeps the lockfile healthy |
+| Setting | Value | Why |
+| ------------------------------ | -------------------------- | ------------------------------------------------- |
+| `schedule` | `before 3am every weekday` | Runs outside working hours |
+| `timezone` | `Europe/Lisbon` | Consistent timezone reference |
+| `prHourlyLimit` | `2` | Prevents PR floods |
+| `prConcurrentLimit` | `10` | Keeps the PR list manageable |
+| `branchConcurrentLimit` | `5` | Limits parallel branch noise |
+| `minimumReleaseAge` | `3 days` | Avoids broken releases |
+| `rebaseWhen` | `conflicted` | Only force-push when needed |
+| `rangeStrategy` | `bump` | Bumps ranges to the new version |
+| `separateMinorPatch` | `true` | Separate PRs for minor and patch |
+| `separateMultipleMajor` | `true` | Separate PRs per major dependency |
+| `dependencyDashboardApproval` | `true` | Major updates require explicit approval |
+| `dependencyDashboardAutoclose` | `true` | Auto-closes dashboard when clean |
+| `stopUpdatingLabel` | `renovate:stop` | Emergency brake for vulnerable deps |
+| `osvVulnerabilityAlerts` | `true` | OSV/GHSA vulnerability scanning |
+| `fetchChangeLogs` | `"pr"` | Embeds changelogs in PR body |
+| `rollbackPrs` | `true` | Creates rollback PRs for pulled releases |
+| `configMigration` | `true` | Auto-migrates config on breaking Renovate changes |
+| `postUpdateOptions` | `["pnpmDedupe"]` | Dedupes pnpm lockfile after updates |
+| `lockFileMaintenance` | Monthly, auto-merged | Keeps the lockfile healthy |
### Package rules
-| Rule | Scope | Automerge |
-|------|-------|-----------|
-| Major updates | All ecosystems | No (dashboard approval required) |
-| Minor & patch updates | All ecosystems | Yes |
-| Security advisories (minor/patch) | All ecosystems | Yes |
-| Security advisories (major) | All ecosystems | No |
-| devDep security (minor/patch) | devDependencies | Yes |
-| devDep security (major) | devDependencies | No |
-| devDep minor & patch | devDependencies | Yes (grouped) |
-| devDep major | devDependencies | No (grouped) |
-| GitHub Actions (minor/patch) | `github-tags` | Yes, digest-pinned |
-| GitHub Actions (major) | `github-tags` | No, digest-pinned |
-| Pin digest updates | All | Yes |
-| Digest updates | All | Yes |
-| Docker (minor/patch) | `docker` | Yes, digest-pinned |
-| Docker (major) | `docker` | No, digest-pinned |
-| TypeScript packages | TS ecosystem | Grouped |
-| Biome packages | Biome ecosystem | Grouped |
-| Testing packages | Jest, Vitest, Testing Library | Grouped |
-| Build tools | Webpack, Vite, Rollup, esbuild | Grouped |
-| Node engine | Node.js | Disabled (ignored) |
+| Rule | Scope | Automerge |
+| --------------------------------- | ------------------------------ | -------------------------------- |
+| Major updates | All ecosystems | No (dashboard approval required) |
+| Minor & patch updates | All ecosystems | Yes |
+| Security advisories (minor/patch) | All ecosystems | Yes |
+| Security advisories (major) | All ecosystems | No |
+| devDep security (minor/patch) | devDependencies | Yes |
+| devDep security (major) | devDependencies | No |
+| devDep minor & patch | devDependencies | Yes (grouped) |
+| devDep major | devDependencies | No (grouped) |
+| GitHub Actions (minor/patch) | `github-tags` | Yes, digest-pinned |
+| GitHub Actions (major) | `github-tags` | No, digest-pinned |
+| Pin digest updates | All | Yes |
+| Digest updates | All | Yes |
+| Docker (minor/patch) | `docker` | Yes, digest-pinned |
+| Docker (major) | `docker` | No, digest-pinned |
+| TypeScript packages | TS ecosystem | Grouped |
+| Biome packages | Biome ecosystem | Grouped |
+| Testing packages | Jest, Vitest, Testing Library | Grouped |
+| Build tools | Webpack, Vite, Rollup, esbuild | Grouped |
+| Node engine | Node.js | Disabled (ignored) |
## 📋 Compatibility
@@ -192,4 +193,4 @@ Any key you set in your local `renovate.json` overrides the inherited value. For
---
-*Last updated: Renovate v43+ — repository-hosted preset usage, digest pinning, config migration, rollback PRs*
+_Last updated: Renovate v43+ — repository-hosted preset usage, digest pinning, config migration, rollback PRs_
diff --git a/configs/typescript-config/README.md b/configs/typescript-config/README.md
index 7b397658..60b22479 100644
--- a/configs/typescript-config/README.md
+++ b/configs/typescript-config/README.md
@@ -6,6 +6,7 @@
---
## Table of Contents
+
- [📄 Goal](#-goal)
- [What you will find](#what-you-will-find)
- [✨ Features](#-features)
@@ -109,9 +110,9 @@ Create a `tsconfig.json` file in your project root and extend the configuration
## 📋 Available configurations
-| Config | Use for |
-|--------|---------|
-| `@tutods/typescript-config/base.json` | Shared strict defaults for any TypeScript project |
-| `@tutods/typescript-config/react.json` | React applications and libraries |
-| `@tutods/typescript-config/node.json` | Node.js applications and packages |
-| `@tutods/typescript-config/nestjs.json` | NestJS backend applications |
+| Config | Use for |
+| --------------------------------------- | ------------------------------------------------- |
+| `@tutods/typescript-config/base.json` | Shared strict defaults for any TypeScript project |
+| `@tutods/typescript-config/react.json` | React applications and libraries |
+| `@tutods/typescript-config/node.json` | Node.js applications and packages |
+| `@tutods/typescript-config/nestjs.json` | NestJS backend applications |
diff --git a/docs/ADDING_PACKAGES.md b/docs/ADDING_PACKAGES.md
index 5660e1d5..1fff07ce 100644
--- a/docs/ADDING_PACKAGES.md
+++ b/docs/ADDING_PACKAGES.md
@@ -15,9 +15,9 @@ This guide covers the steps to add a new publishable package to this monorepo
## Directory Conventions
-| Path | Purpose |
-|------|---------|
-| `configs/
Welcome, {currentUser.name}.
} - /> +Welcome, {currentUser.name}.
} /> ); } ``` @@ -101,9 +97,9 @@ function SmartAction({ href, children }: SmartActionProps) { ## Available Components -| Component | Purpose | -|-----------|---------| -| `Show` | Conditional rendering with optional fallback and render-prop support | +| Component | Purpose | +| ---------------------- | ------------------------------------------------------------------------- | +| `Show` | Conditional rendering with optional fallback and render-prop support | | `ConditionalContainer` | Switches the rendered wrapper element/component while preserving children | ## 🏗️ Development diff --git a/packages/components/biome.json b/packages/components/biome.json index 38de98fd..08fc7fc1 100644 --- a/packages/components/biome.json +++ b/packages/components/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/2.6.3/schema.json", - "root": false, - "extends": ["../../biome.json", "@tutods/biome-config/react"] + "$schema": "https://biomejs.dev/schemas/2.6.3/schema.json", + "root": false, + "extends": ["../../biome.json", "@tutods/biome-config/react"] } diff --git a/packages/components/package.json b/packages/components/package.json index 93a6ed07..9af37709 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,54 +1,54 @@ { - "name": "@tutods/components", - "version": "0.9.7", - "description": "React generic components that can be used in any scenario", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "author": { - "name": "Daniel Sousa @TutoDS", - "url": "https://github.com/tutods" - }, - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/tutods/lib.git", - "directory": "packages/components" - }, - "homepage": "https://github.com/tutods/lib/blob/main/packages/components/README.md", - "type": "module", - "keywords": [ - "react", - "components", - "typescript", - "jsx", - "tsx" - ], - "files": [ - "dist" - ], - "exports": { - ".": { - "import": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" - } - } - }, - "main": "./dist/index.js", - "types": "./dist/index.d.ts", - "module": "./dist/index.js", - "scripts": { - "dev": "rslib build --watch", - "build": "rslib build" - }, - "devDependencies": { - "@rsbuild/plugin-react": "^2.1.1", - "@rslib/core": "^1.0.4", - "@tutods/typescript-config": "0.7.1" - }, - "peerDependencies": { - "react": ">=19.3.1", - "react-dom": ">=19.3.1" - } + "name": "@tutods/components", + "version": "0.9.7", + "description": "React generic components that can be used in any scenario", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "author": { + "name": "Daniel Sousa @TutoDS", + "url": "https://github.com/tutods" + }, + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/tutods/lib.git", + "directory": "packages/components" + }, + "homepage": "https://github.com/tutods/lib/blob/main/packages/components/README.md", + "type": "module", + "keywords": [ + "react", + "components", + "typescript", + "jsx", + "tsx" + ], + "files": [ + "dist" + ], + "exports": { + ".": { + "import": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + } + } + }, + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "module": "./dist/index.js", + "scripts": { + "dev": "rslib build --watch", + "build": "rslib build" + }, + "devDependencies": { + "@rsbuild/plugin-react": "^2.1.1", + "@rslib/core": "^1.0.4", + "@tutods/typescript-config": "0.7.1" + }, + "peerDependencies": { + "react": ">=19.3.1", + "react-dom": ">=19.3.1" + } } diff --git a/packages/components/rslib.config.ts b/packages/components/rslib.config.ts index ef382df0..4517b1c2 100644 --- a/packages/components/rslib.config.ts +++ b/packages/components/rslib.config.ts @@ -1,46 +1,46 @@ -import { pluginReact } from "@rsbuild/plugin-react"; -import { defineConfig } from "@rslib/core"; +import { pluginReact } from '@rsbuild/plugin-react'; +import { defineConfig } from '@rslib/core'; export default defineConfig(({ env }) => { - const isDev = env === "development"; + const isDev = env === 'development'; - return { - source: { - entry: { - index: "./src/index.ts", - }, - }, - lib: [ - { - format: "esm", - dts: true, - autoExtension: false, - }, - ], - output: { - target: "web", - cleanDistPath: true, - injectStyles: true, - emitCss: true, - minify: !isDev, - sourceMap: isDev, - cssModules: { - auto: true, - }, - }, - plugins: [ - pluginReact(), - /** - * If in the future needs to have SVGs in this package, use `@rsbuild/plugin-svgr` with the following configuration: - * ```ts - * pluginSvgr({ - * mixedImport: true, - * svgrOptions: { - * exportType: 'named', - * }, - * }), - * ``` - */ - ], - }; + return { + source: { + entry: { + index: './src/index.ts', + }, + }, + lib: [ + { + format: 'esm', + dts: true, + autoExtension: false, + }, + ], + output: { + target: 'web', + cleanDistPath: true, + injectStyles: true, + emitCss: true, + minify: !isDev, + sourceMap: isDev, + cssModules: { + auto: true, + }, + }, + plugins: [ + pluginReact(), + /** + * If in the future needs to have SVGs in this package, use `@rsbuild/plugin-svgr` with the following configuration: + * ```ts + * pluginSvgr({ + * mixedImport: true, + * svgrOptions: { + * exportType: 'named', + * }, + * }), + * ``` + */ + ], + }; }); diff --git a/packages/components/src/components/conditional-contianer/index.tsx b/packages/components/src/components/conditional-contianer/index.tsx index 28058cad..18f7f2c2 100644 --- a/packages/components/src/components/conditional-contianer/index.tsx +++ b/packages/components/src/components/conditional-contianer/index.tsx @@ -1,6 +1,6 @@ -import { createElement } from "react"; +import { createElement } from 'react'; -import type { ConditionalContainerProps, RenderElement } from "./types"; +import type { ConditionalContainerProps, RenderElement } from './types'; /** * Component to render a specific element or component according a condition @@ -23,33 +23,28 @@ import type { ConditionalContainerProps, RenderElement } from "./types"; * * ``` */ -const ConditionalContainer = < - TRender extends RenderElement, - TFallback extends RenderElement, ->({ - children, - fallback, - render, - when, +const ConditionalContainer =