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

widget-starter-kit

v1.0.0

Published

[![Build Status](https://travis-ci.org/davezuko/react-redux-starter-kit.svg?branch=master)](https://travis-ci.org/davezuko/react-redux-starter-kit?branch=master) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](h

Downloads

3

Readme

React component boilerplate

Build Status js-standard-style

This is simple boilerplate project for building React component library for NPM. It is suitable for building of any type of UI component or library. The project/source code contains two separated phases for development. A one of live development and other for lib-based code.

How it is structured

As is described above the code is structured in two separated phases:

  • The first is responsible to build component lib (production-ready) code for NPM
  • The second phase is responsible to build development (Demo) app with HMR.

Getting started

Follow these steps to get started developing component library.

$ git clone [email protected]:sportal-media-platform/widget-starter-kit.git <my-project-name>
$ cd <my-project-name>

When that's done, install the project dependencies. It is recommended that you use Yarn for deterministic dependency management, but npm install will suffice.

$ yarn  # Install project dependencies (or `npm install`)

After completing that you are ready to do that

  • $ rm -rf .git
  • $ git init
  • $ git add .
  • $ git commit -m "Init project"

When you completed development

  • $ npm publish --access restricted

Project Structure

The project structure presented in this boilerplate is fractal, where functionality is grouped primarily by feature rather than file type. This structure is only meant to serve as a guide, it is by no means prescriptive. That said, it aims to represent generally accepted guidelines and patterns for building scalable applications. If you wish to read more about this pattern, please check out this awesome writeup by Justin Greenberg.

.
├── build                            # All build-related code
├── dist                             # The all production-ready code 
├── lib                              # The library source code localization
├── design                           # Static folder where is stored the design (not imported anywhere in source code)
├── src                              # Application source code
│   ├── dev                          # Application bootstrap and rendering
│       ├── Main.jsx                 # The entry point of App (bootstraping component)
│       ├── Index.html               # Static HTML template (It is using only in dev mode ) 
│   ├── lib                          # Application widget where will live
|       ├── components               # The all components where will be stored
|       ├── design                   # The all design mock-ups where will be stored
|       ├── index.jsx                # The entry point of widget
|       ├── package-lib.json         # The schema of package.json for the component 
|       ├── README.md                # Description about how to use it
|       ├── LICENSE.md               # The license requirements
│   ├── styles                       # Application styles where will live
│   ├── locales                      # The all translation keys will live there
│       ├── locales.js                 # An entry point of the all locales
└── tests                            # Unit tests

Additional configuration information

    1. webpack.lib.config.js 
    -- npm command  - npm run build:lib
    -- yarn command - yarn run build:lib
    
    Contains configuration connected with the library build process of the widget
    it requires the given files/folders to exist under this path: widget-starter-kit/src/lib
    
    - README.md, LICENSE.md, design, package-lib.json
    
    2. webpack.prod.config.js
    -- npm run command  - npm run build:prod
    -- yarn run command - yarn run build:prod
    
    Contains configration connected with the production build process of the widget and also
    configuration required for the local run of the project.
    
    3. project.config.js
    - Contains configuration variables used by the webpack.lib.config.js and webpack.prod.config.js.
    IMPORTANT VARIABLES:
    selector - This should be setup when creating a new widget, example: 
    
    [data-widgetId="widget-<Widget Name>"]
    
    Delimeter used for the widget name: '-'

    portDEV - The default port used is 8000, this can be changed to whatever you want. 
    NB! If the port was changed from the default one (8000) always put the default value back before pushing any changes.

Creating different components

    When creating components please follow the given rules.
    1. There should be one MAIN component that (if required) will be making the NETWORK REQUESTS towards the respected API.
    2. The MAIN component can call other components by passing the needed data (if required) for those components to be able
    to create the representation.
    
    The idea behid these two simple rules is to keep the components creating the view, logically separated from the 
    data generating/NETWORK REQUESTING MAIN component. This way unit tests can be easily created for all of the sub-components

Bind the widget to HTML DOM

You can bind the widget to the HTML DOM by two ways:

  • Bind the widget without initial options. The required attribute here is "data-widgetId"
    <div data-widgetId="widget-name"></div>
  • Bind the widget with initial options. The all available options can be seen below
    <div data-widgetId="widget-name" data-options='{...}'></div>
  • The optional "data-options" attribute:
    {
        int playerId: 1,      // Unique identifier of the resource.
        strin lang: 'en',    // the language in format like: en, bg, ru and etc.
        string theme: '',    // Brand theme 
        string expand: null, // Specifies additional information to include with the Team response
    }

Running the Project

After completing the installation step, you're ready to start the project!

$ yarn run start:dev  # Start the development server (or `npm run start:dev`)

While developing, you will probably rely mostly on yarn run start:dev; however, there are additional scripts at your disposal:

|yarn <script> |Description| |-------------------|-----------| |start:dev |Serves your app with HMR at http://localhost:8000| |build:lib |Builds library widget component to ./lib folder| |build:stage |TBD: Builds completely production-ready ReactJS application to ./dist folder| |build:prod |Builds completely production-ready ReactJS application to ./dist folder| |test |Not ready yet. See testing| |test:watch |Runs test in watch mode to re-run tests when changed| |test:prod |Runs production-ready application to ./dist folder at: http://localhost:8080|

Testing

To add a unit test, create a .spec.js file anywhere inside of ./tests. // TBD

Building for Production

Out of the box, this widget is deployable by serving the ./dist folder generated by yarn build:prod.