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

pretty-typed-react-starter

v0.2.27

Published

Configuration and template for React with Router, Prettier, MobX and TypeScript

Downloads

67

Readme

pretty-typed-react-starter

downloads npm version

Create React apps (with Typescript) with no build configuration.

Do you know react and want to try out typescript? Or do you know typescript and want to try out react? Get all the benefits from create-react-app but you use typescript! 🚀

How to start

npm install -g create-react-app

create-react-app my-app --scripts-version pretty-typed-react-starter
cd my-app/
npm start or yarn start

About

This is a variation of the 'create react app' with custom scripts and template. Full Progressive Web App (PWA) integration is implemented in this project with offline-first strategy, custom splash screen, icons, configurable service worker and full support for Web Push Notification API.

note about Lighthouse results:

To make the result a 5x 100 you need to try server-side rendering for the main component, enable HTTPS and use 'cache-control' header for the serviceWorker file on your server

Features:

  • TypeScript
  • Prettier - note: replaced ES/TSlint. To make it work you need to install it in your editor (for more info check out the official documentation)
  • MobX - Easier than Redux yet equally powerfull and fun to use.
  • React Loadable - Code-splitting made easy. Works great with current webpack configuration from create react app. Example included in the template.
  • Sass - CSS preprocessor with node-sass-chokidar package
  • React Router - basic routing with PWA support (HashRouter)
  • Workbox - with workbox i replaced standard approach to PWA that was shipped with default create-react-app config. The service worker is now fully configurable in /src/serviceWorker. It is pre-configured in Webpack to include .js .html and .css files in the precache manifest but exclude any images.

Project structure

my-app
├── README.md
├── node_modules
├── tsconfig.json
├── images.d.ts
├── package.json
├── .gitignore
├── public
│   └── favicon.ico
│   └── index.html
│   └── manifest.json
└── src
    └── index.tsx
    └── registerServiceWorker.ts
    └── Components
        └── Content
            └── dynamic.tsx
            └── index.tsx
            └── types.ts
            └── styles.scss
        └── ...
    └── Containers
        └── ContentContainer
            └── dynamic.tsx
            └── index.tsx
            └── types.ts
            └── styles.scss
        └── ...
    └── Utils
        └── colors.scss
        └── constants.ts
        └── helpers.ts
        └── store.ts

Concept

The project structure is created with separation of logic from view and code-splitting in mind. Ideally you keep your logic in the Containers and view in Components. Typical structure for a Container/Component would be :

Container/Component
    └── index.tsx (main file)
    └── dynamic.tsx (dynamically loaded export made from react-loadable
    └── types.ts (exported types)
    └── styles.scss (styles for that specific Container/Component)

Changelog

0.2.27

  • added custom handlers for service worker to be more reliable
  • added conditional logging in for service worker activities
  • added skipWaiting() and clientsClaim() to workbox

0.2.20

  • added support for Push Notification API
  • added basic functions for managing permission and sending notifications
  • added new store instance for permissions
  • added simplifacions to registerServiceWorker.js

0.2.14

  • added meta tag with description in index.html
  • added baseUrl in tsconfig.json

0.2.13

  • removed dynamically loaded chunks from the precache manifest

0.2.10

  • added runtime routing for workbox

0.2.7

  • added splash screen images

0.2.6

  • change from BrowserRouterto HashRouter
  • user can now refresh page with route applied in offline mode (everything now properly points to index.html)

0.2.0

  • added basic support for Workbox
  • removed old files