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

starbase-react

v4.1.0

Published

an offline-first React 16, redux, redux-saga & styled-components boilerplate

Downloads

32

Readme

starbase-react

npm version dependencies status FOSSA Status

starbase-react is an offline-first React 16, redux, redux-saga & styled-components boilerplate. Get up and running in minutes using some of the most powerful front-end tools available in 2020:

starbase-react is a spin on starbase, and intended to be relatively small in scope so that it may be easily extended and customized, or used as a learning tool for folks who are trying to become familiar with React 16, redux, redux-saga, style-components, webpack 4 and/or ES6.

license

starbase-react is open source and free software, so you may to do whatever you wish with it -- commercially or personally. You can buy me a beer next time you're in Boston, star the project and tell a friend, or you can erase all signs of origin and tell your coworkers that you made it yourself. It's all good!

getting started

After completing the steps below, you will be ready to begin using starbase-react:

  1. Install Node.js (latest LTS recommended)
  2. (Optional) Install Yarn
  3. Clone starbase-react into your project root directory
  4. Install dependencies by running npm install in your project root directory (or yarn if you performed Step 2)

building, watching & developing

local development

starbase-react uses webpack-dev-server to serve up your project at http://localhost:3000 for streamlined and convenient development.

After running npm run start in the project root, your /src code will be served at the url above and watched for changes. As you modify code in /src, the project will be recompiled and your browser will refresh to show the latest changes.

cd /path/to/starbase-react
npm run start

building for production

Use npm run build in your project root to run a production build.

Production builds compile & minify your assets into /dist for distribution and/or integration into whatever codebase you'll be using these assets in.

cd /path/to/starbase-react
npm run build

features you may want to remove

asset hashing

The assets generated by starbase-react are hashed (strings injected into the filenames) as a cache-busting mechanism. JS and CSS assets will receive a new filename for each production build, but other assets (fonts, images, etc) will only be updated when they are modified.

This feature ships with webpack (and the loaders we use), so removing it is pretty straightforward. Simply open up the webpack config files and remove the hashes from the filenames, which should look something like this: .[hash:8].

Removing hashing for production builds is not recommended.

build-time cleanup

starbase-react is setup to clear all contents of /dist (where compiled assets are piped into) during each npm run build. If you'd like to remove this part of the build process, perform the following steps:

  1. remove CleanWebpackPlugin from the plugins array in /internalsinternals/webpack.config.prod.js
  2. remove CleanWebpackPlugin as a requirement at the top of /internalsinternals/webpack.config.prod.js
  3. remove the CleanWebpackPlugin dependency from /package.json

Removing the cleanup process means that deleted assets in /src will not be deleted in /dist until you manually do so. I recommend keeping the cleanup process intact unless you have a specific reason not to, such as having un-managed assets in /dist.

features you may want to customize

javascript & css linting

starbase-react uses ESLint for Javascript (ES6) linting and stylelint for CSS linting. The configs (/.eslintrc.js and /.stylelintrc.js respectively) included out of the box contain some basic common rules. Modify them to your liking to encourage consistent code throughout your project.

airbnb eslint config

starbase-react enforces the Airbnb JavaScript Style Guide with ESLint via eslint-config-airbnb. These rules are basically the industry standard in 2017 so I'd recommend adhering to them, but you can override individual rules via the project /.eslintrc.js file. I've included a couple basic overrides (in /.eslintrc.js) to demonstrate usage.

to remove the airbnb eslint config:
  1. in /.eslintrc.js, remove the line that says extends
  2. in /package.json, remove the eslint-config-airbnb dependency
  3. run npm updated (or yarn)

After completing the steps above, the only rules that eslint will enforce are the ones you define in the rules object in /.eslintrc.js.

prettier js formatting

starbase uses Prettier to enforce and simplify code consistency. If you use VS Code, check out the Prettier VS Code extension which will allow you to easily format your code to the project specifications with a hotkey.

service worker caching

starbase-react uses offline-plugin to cache your project assets for offline use. This means that if someone visits your website on a device that supports service workers, they will be able to view your project again, even if their device is offline.

Out of the box, starbase-react caches everything, because the project is less than 50kb total. If you will be making a larger app, be considerate of your users and limit what you cache-- perhaps avoid caching large images, custom fonts, etc. Check out the options docs for offline-plugin to learn more.

Service workers, by design, only function on secure (https) environments. There is no issue with running starbase-react on an http environment-- the service worker will simply not be utilized.

You may see an info log entry in your console from offline-plugin while using the start command, feel free to ignore this. offline-plugin is not utilized on the dev server because it doesn't always play nice with webpack-dev-server. It is intentionally only utilized in production builds.

to remove offline-plugin:

  1. in /package.json, remove the offline-plugin dependency
  2. in /internals/webpack/webpack.config.base.js, remove all references to OfflinePlugin and/or offline-plugin
  3. in /src/app.js, remove the import statement that references offline-plugin

There is no consequence to removing this feature, besides limiting offline access to your project.

to disable (but not delete) offline-plugin:

You can disable offline-plugin without deleting it from your codebase, so that it's not included in your production code (reduces filesize) but is ready to be re-enabled if you ever want it back.

  1. in /src/app.js, comment-out the import statement that references offline-plugin

features you may want to know about

html webpack plugin

starbase-react uses HTML Webpack Plugin to generate HTML assets. The reason for this is to allow webpack to manage other assets, such as favicons and embedded images, as part of the build process. Adding new templates (pages) is very easy, but you'll need to read the official plugin docs for the latest info.