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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nadirss14/component-library

v0.1.1

Published

Example of react component library

Downloads

8

Readme

Libreria de componentes de React

Requisitos

  1. Tener una cuenta en NPM. Sino tienes una podes crearla aqui.
  2. Tener instalado npm en tu equipo.
  3. Git.
  4. Visual Studio Code.
  5. Una terminal.
  6. Acceso a internet.

Dependencias

  • Babel para poder transpilar el codigo

    npm i --save-dev @babel/cli @babel/core @babel/preset-env
    npm i @babel/polyfill

Estructura del proyecto

  1. Dentro de src debemos crear la carpeta lib. Dentro de lib creamos la carpeta components la cual contendra los componentes que exportaremos.
  2. Cada componente tendra su propia carpeta con sus estilos correspondientes, en este ejemplo estamos utilizando CSS Modules.
  3. En la raiz de la carpeta lib creamos un archivo llamado index.js el cual sera nuestro punto de entrada a los componente, basicamente vamos a importar los componetes desde la carpeta components y los vamos a exportar.
  4. En la raiz del proyecto debemos agregar el archivo babel.config.json con la siguiente configuracion basica.
{
    "presets": [
        [
            "@babel/env",
            {
                "targets": {
                    "edge": "17",
                    "firefox": "60",
                    "chrome": "67",
                    "safari": "11.1"
                },
                "useBuiltIns": "usage",
                "corejs": "3.6.5"
            }
        ],
        "@babel/preset-react"
    ]
}

package.json

{
  "name": "@nadirss14/component-library",
  "description": "Example of react component library",
  "version": "0.1.0",
  "main": "dist/index.js",
  "module": "dist/index.js",
  "files": [
    "dist",
    "README.md"
  ],
  "scripts": {
    "build:npm": "rm -rf dist && NODE_ENV=production babel src/lib --out-dir dist --copy-files"
  }
}
  1. description: descripcion corta de los que es el paquete. Package name guidelines
  2. version: controla las versiones del paquete. Semantic versioning
  3. main: Especifica el punto de estrada a la aplicacion.
  4. files: Listado de archivos que debemos incluir en el paquete.
  5. scripts: Listado de scripts que ejecutaremos sobre el proyecto.
    • El script build:npm se encarga que de hacer el transpilado de los archivos de la carpeta lib y generar los nuevos archivos copilados dentro de la carpeta dist para ser publicados en NPM.

Publish NPM

  1. Login with npm
npm login
  1. Por defecto npm viene configurado para publicar unicamente paquetes privados, para cambiar esto ejecutamos el siguiente comando en la terminal.
npm config set access public
  1. Publicar el paquete.
npm publish