npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@barcelonadev/connect4-game

v1.1.2

Published

Una librería de componentes React para el juego Connect Four (connect4).

Readme

connect4 Game - React Component Library

Una librería de componentes React para el juego Connect Four (connect4).

Instalación

npm install @barcelonadev/puzzle-game
# o
yarn add @barcelonadev/puzzle-game

Compatibilidad de Versiones

Esta librería está diseñada para ser compatible con cualquier versión de React desde la 16.8.0 en adelante (que incluye React Hooks). Las dependencias de React están configuradas como peerDependencies, lo que significa que:

  • No se incluye React en el bundle de la librería
  • Usa la versión de React del proyecto padre
  • Evita conflictos de versiones y duplicación de código
  • Reduce el tamaño final de tu aplicación

Si tu proyecto usa React 16.8+, 17.x, 18.x, o 19.x, esta librería funcionará sin problemas.

Uso

Importación básica

import { connect4Game } from '@barcelonadev/puzzle-game';
import '@barcelonadev/puzzle-game/style.css';

function App() {
  return (
    <div>
      <h1>Mi Juego de Connect Four</h1>
      <connect4Game />
    </div>
  );
}

Con configuración personalizada

import { connect4Game } from '@barcelonadev/puzzle-game';
import '@barcelonadev/puzzle-game/style.css';

function App() {
  const handleGameEnd = (winner: string | null) => {
    if (winner) {
      console.log(`¡Ganador: ${winner}!`);
    } else {
      console.log('¡Empate!');
    }
  };

  return (
    <connect4Game
      onGameEnd={handleGameEnd}
      boardSize={{ rows: 6, cols: 7 }}
    />
  );
}

Formatos Soportados

Esta librería está construida con múltiples formatos para máxima compatibilidad:

  • ES Modules (ESM): Para bundlers modernos (Vite, Webpack 5+, Rollup)
  • CommonJS (CJS): Para Node.js y bundlers antiguos
  • UMD: Para uso directo en navegador

Desarrollo

Instalación de dependencias

npm install

Desarrollo local

npm run dev

Construcción

# Construir solo la librería
npm run build

# Construir librería + tipos TypeScript
npm run build:all

# Limpiar dist
npm run clean

Publicación

npm version patch  # o minor/major
npm publish

Estructura del Proyecto

src/
├── connect4/
│   ├── components/     # Componentes React
│   ├── hooks/         # Custom hooks
│   ├── dto/           # Data Transfer Objects
│   ├── provider.tsx   # Context provider
│   └── index.tsx      # Punto de entrada
├── app.tsx            # App de desarrollo
└── main.tsx           # Entry point de desarrollo

Tecnologías

  • React 16.8+ (compatible con 16.8, 17.x, 18.x, 19.x)
  • TypeScript
  • Vite
  • CSS Modules
  • ESLint + Prettier

Troubleshooting

Error de versión de React

Si encuentras errores relacionados con versiones de React, asegúrate de que:

  1. Tu proyecto tenga React instalado (versión 16.8.0 o superior)
  2. No haya conflictos de versiones en tu package.json
  3. Si usas npm, ejecuta npm ls react para verificar que solo hay una versión

Error de módulos

Si tienes problemas con la importación, verifica que tu bundler soporte ES modules. Para proyectos más antiguos, puedes usar la versión CommonJS:

const { connect4Game } = require('@barcelonadev/puzzle-game');

Licencia

MIT