Skip to content

Dev - #16

Merged
TheVolpeDev merged 66 commits into
mainfrom
dev
May 26, 2026
Merged

Dev#16
TheVolpeDev merged 66 commits into
mainfrom
dev

Conversation

@TheVolpeDev

Copy link
Copy Markdown
Owner

This pull request sets up a new React utility component library with a strong focus on developer experience, code quality, and testing. It introduces foundational components (For, Show, Match, Switch), adds comprehensive tests, and configures formatting, build, and CI workflows. The most important changes are:

Component Implementation:

  • Added generic utility components: For, Show, Match, and Switch in the src/components directory, and re-exported them from src/index.ts. These provide declarative control flow utilities for React. [1] [2] [3] [4] [5]

Testing Infrastructure:

  • Introduced comprehensive test suites for all components using Vitest and Testing Library, including a smoke test and test setup for jest-dom matchers. [1] [2] [3] [4] [5]

Build and Tooling Configuration:

  • Added tsup.config.ts for TypeScript bundling and type declarations, and updated package.json with scripts for build, format, and test, as well as relevant dev dependencies. [1] [2]

Code Quality and Editor Setup:

  • Configured Prettier with .prettierrc and .prettierignore, and set up VSCode recommendations and settings for consistent formatting and import management. [1] [2] [3] [4]

Continuous Integration:

  • Added a GitHub Actions workflow for CI that runs formatting, build, and tests on pull requests.

TheVolpeDev and others added 30 commits May 26, 2026 09:47
- Updated package name from "@fabidev/jsx-utils" to "@fabi-dev/jsx-utils"
- Create a new workflow for basic integrity checks on pull requests
- Set up Node.js environment and install dependencies
- Run build and test commands as part of the CI process
- Changed test script to exit with code 0 instead of 1
- Added a build script placeholder
…egrity

Ci/add basic GitHub ci for integrity
- Correct package name format in package-lock.json and package.json
- Add devDependencies for @types/react and react
- Ensure peerDependencies for react are properly defined
- Added @testing-library/jest-dom and @testing-library/react for testing.
- Included jsdom, publint, tsup, and vitest for improved development tools.
- Updated TypeScript version to ^6.0.3.
- Added Prettier version 3.8.3 to package.json and package-lock.json
- Set print width to 80 characters
- Use 2 spaces for indentation
- Enable semicolons and disable single quotes
- Configure trailing commas for ES5
- Require parentheses for arrow functions
- Set line endings to LF
- Exclude node_modules, dist, and package-lock.json from Prettier formatting
- Created a new file for placeholder functionality.
- Added "format:check" script to check code formatting with Prettier.
- Added "format:write" script to automatically format code with Prettier.
Added format:check step in integrity ci workflow
- Exclude .vscode/settings.json and .vscode/extensions.json from .gitignore
- Added a new extensions.json file with recommended VSCode extensions.
- Includes Prettier, ESLint, and TypeScript support.
- Enable format on save
- Set default formatter to Prettier
- Configure code actions to fix all issues on save
- Set importModuleSpecifier to "non-relative"
- Set importModuleSpecifierEnding to "minimal"
- Set compiler options for TypeScript project
- Include paths and module resolution settings
- Enable strict type checking and declaration generation
- Set up entry point for TypeScript compilation
- Specify output formats: ESM and CJS
- Enable TypeScript declaration files and source maps
- Clean output directory before build
- Mark 'react' as an external dependency
- Changed the build script from a placeholder to use tsup for building the project.
- Added "ignoreDeprecations": "6.0" to compilerOptions in tsconfig.json
chore(tsup): add initial tsup configuration file
- Set "test" script to run Vitest
- Updated "test:run" script to execute Vitest in run mode
- Set up Vitest with jsdom environment
- Enable global variables and specify setup files
- Import "@testing-library/jest-dom" to enhance testing capabilities.
TheVolpeDev and others added 20 commits May 26, 2026 14:44
- Implement tests to verify rendering of items in For component.
- Ensure that both "a" and "b" are correctly displayed.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Added tests for rendering items, including handling empty arrays.
- Verified index passing to the render function.
- Included tests for rendering single items, objects, and numbers.
- Added tests for rendering children with truthy values (non-boolean).
- Included tests for rendering fallback with falsy values (0, empty string, null, undefined).
- Added tests for rendering complex JSX children and fallback.
- Verified behavior when no fallback is provided and condition is false.
…component

test(Show): add additional tests for Show component behavior
- Introduced Match component to render children based on a condition.
- Defined MatchProps type for component props.
feat(Match): add Match component for conditional rendering
- Removed unused paths configuration
- Ensured "test" directory is included in the compilation
chore(tsconfig): clean up tsconfig configuration
- Implemented the Switch component to render children based on Match conditions.
- Utilizes React's Children API to process child elements.
- Updated import statement for Match and MatchProps to use relative path.
- Implement tests for rendering behavior of Switch and Match components.
- Verify that no matches render when conditions are falsy.
- Ensure the first truthy match is displayed correctly.
- Check that non-Match children are ignored.
- Test rendering of complex JSX from the first truthy match.
- Import useState and fireEvent for testing state changes.
- Implement a test to verify that the For component updates when the items state changes.
- Import fireEvent and useState for testing state changes.
- Implement a new test to verify the Show component updates when the condition state changes.
- Introduced a new test to verify the behavior of the Switch component when state changes.
- Added a Harness component to manage state and simulate button clicks.
- Ensured that the correct Match component is rendered based on the current state.
…-tests

Chore/finalize components and tests
- Export For, Match, Show, and Switch components from index file.
feat(index): add entry point exports for components
Copilot AI review requested due to automatic review settings May 26, 2026 14:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Sets up the initial jsx-utils React component utility library, including core control-flow components, build/test tooling, and CI to support a publishable, well-tested package.

Changes:

  • Added foundational React utility components: For, Show, Match, Switch, and exported them from src/index.ts.
  • Introduced Vitest + Testing Library setup with component test suites and a smoke test.
  • Added bundling (tsup), TypeScript configuration, Prettier configuration, VSCode workspace settings, and a basic GitHub Actions CI workflow.

Reviewed changes

Copilot reviewed 18 out of 21 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
vitest.config.ts Configures Vitest to run in jsdom with globals and a setup file.
tsup.config.ts Adds tsup bundling config (ESM+CJS, dts, sourcemaps, externals).
tsconfig.json Defines TS compilation options (strict, react-jsx, declarations).
src/index.ts Re-exports public components from the library entrypoint.
src/components/For.tsx Adds For list-render utility component.
src/components/Show.tsx Adds Show conditional-render utility component.
src/components/Match.tsx Adds Match branch component used by Switch.
src/components/Switch.tsx Adds Switch first-truthy-match control-flow component.
test/For.test.tsx Adds unit tests for For.
test/Show.test.tsx Adds unit tests for Show.
test/Switch.test.tsx Adds unit tests for Switch (and indirectly Match).
test/smoke.test.ts Adds smoke tests for vitest + jsdom availability.
test/setup.ts Loads @testing-library/jest-dom matchers.
package.json Adds scripts and devDependencies for build/format/test; updates package name.
package-lock.json Captures dependency lock for the new toolchain.
.prettierrc Adds Prettier formatting rules.
.prettierignore Excludes build artifacts and lockfile from Prettier.
.vscode/settings.json Adds editor formatting/import preferences.
.vscode/extensions.json Recommends editor extensions for the project.
.gitignore Updates ignore rules and attempts to include VSCode settings files.
.github/workflows/integrity-ci.yml Adds CI workflow to run format check, build, and tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package.json
Comment thread package.json Outdated
Comment thread package.json
Comment on lines +10 to +11
"format:check": "prettier src/ --check",
"format:write": "prettier src/ --write"
Comment thread tsup.config.ts Outdated
Comment thread .github/workflows/integrity-ci.yml Outdated
Comment thread test/Show.test.tsx Outdated
Comment thread src/components/Match.tsx
TheVolpeDev and others added 6 commits May 26, 2026 16:36
- Verify rendering of children when 'when' prop is truthy
- Ensure nothing is rendered when 'when' prop is falsy
- Test updates to rendering based on state changes
…onent

test(Match): add tests for Match component behavior
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@TheVolpeDev
TheVolpeDev merged commit a34f5eb into main May 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants