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

@pota/react-template

v1.3.4

Published

## Setup ๐Ÿš€

Downloads

2

Readme

react-template downloads

Setup ๐Ÿš€

You can create a new project using @pota/create.

npm init @pota -- --template react

or use the react combination, for the recommended setup

npm init @pota react

Security ๐Ÿ‘ฎโ€

Ignore scripts

In order to mitigate NPM supply chain attacks by best effort the NPM ignore-scripts setting is enabled by default. This project comes with a preconfigured set of dependencies that are allowed to run installation scripts.

After running npm install it is required to run npm run postinstall to run required installation scripts from dependent packages.

When adding a new dependency that requires an installation script to run make sure to add that package to the project package.json in the postinstall property.

Important: After running npm install or npm ci always run npm run postinstall afterwards before running other scripts.

Standards ๐Ÿ“’

This project follows the MediaMonks Frontend Coding Standards

Project Structure โ›ฉ๏ธ

source

src/components

The components folder follows atomic design guidelines, with a few additions:

| Folder | Description | Example | | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------- | | /atoms | The smallest unit, must be self contained and not dependant on any external modules. (types and configuration being the exception) | Icon, Paragraph, Heading | | /molecules | Must be restrained to only use atoms and minimal internal state. | Toggle | | /organisms | Generally reserved for complex state uses and must use atoms or molecules. | Form | | /layout | Components whose only function is taking in children and presenting them in a specific layout. Must not use atoms, molecules or organisms. | Carousel, Modal, Tabs | | /pages | Components which are used as pages. | Home, About | | /unlisted | Components which do not fall into any of the above categories. | App, global context providers |

src/config

The config folder is to be used to define any sort of configuration for styles, components or logic.

hidden TODOs

Features ๐Ÿ”‹

Pota Commands

build - builds the source using webpack.

npm run build # or npx pota build

| Option | Type | Default | Description | | ----------------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | | analyze | {Boolean} | false | When enabled, will open a bundle report after bundling. | | cache | {Boolean} | true | Toggles webpack's caching behavior. | | image-compression | {Boolean} | true | Toggles image compression. | | debug | {Boolean} | false | Sets NODE_ENV to 'development'. | | watch | {Boolean} | false | Run build and watch for changes. | | output | {String} | ./dist | The build output directory. | | source-map | {false\|devtool} | source-map (production), eval-source-map (development) | Sets the style of source-map, for enhanced debugging. Disable or use faster options in you are having out of memory or other performance issues. | | public-path | {String} | / | The location of static assets on your production server. | | typecheck | {Boolean} | true | When disabled, will ignore type related errors. | | versioning | {Boolean} | false | When enabled, will copy assets in ./static to a versioned directory in the output (e.g. build/version/v2/static/...). | | profile | {Boolean} | false | Toggles support for the React Devtools in production. |

dev - starts the development service using webpack-dev-server.

npm run dev # or npx pota dev

| Option | Type | Default | Description | | ----------------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | | cache | {Boolean} | true | Toggle webpack's caching behavior. | | https | {Boolean} | false | Run the development server with HTTPS. | | open | {Boolean} | true | Allows to configure dev server to open the browser after the server has been started. | | port | {Number} | 2001 | Allows configuring the port. | | image-compression | {Boolean} | true | Toggles image compression. | | prod | {Boolean} | false | Sets NODE_ENV to 'production'. | | source-map | {false\|devtool} | source-map (production), eval-source-map (development) | Sets the style of source-map, for enhanced debugging. Disable or use faster options in you are having out of memory or other performance issues. | | typecheck | {Boolean} | true | Toggles checking for type related errors. |

hidden TODOs

Scripts

Non-Pota scripts defined in "scripts" of package.json and are runnable using npm run {script}

| Script | Description | | --------------------- | ----------------------------------------------------------------------------- | | postinstall | Run patch-package to patch faulty packages. | | build-storybook | Bundle stories for deployment. | | start-storybook | Start storybook's development server. | | plop | Generate a new component's source files. | | test | Run unit tests. | | typecheck | Synchronously runs typecheck:main and typecheck:tools. | | typecheck:main | Checks for type errors and unused variables/types in the source directory. | | typecheck:tools | Checks for type errors and unused variables/types of the various local tools. | | fix | Executes all fix:* and format commands in sequence. | | **fix:eslint** | Executes eslint:lint and fixes fixable errors. | | **format** | Formats the source files using prettier. | | **lint** | Executes all lint:* commands in sequence. | | **lint:eslint** | Lints the source files using eslint. | | **rsync** | Synchronizes (uploads) dist/` files to a remote server. |

JavaScript / TypeScript

hidden TODOs

CSS

hidden TODOs

Images

hidden TODOs

Misc. Assets

hidden TODOs

Linting & Formatting

hidden TODOs

Service Worker

The skeleton has opt-in support for service workers through the help of workbox.

To get started, you can create /src/service-worker.ts file to customize workbox and its many modules .

This is how an example service worker file could look like:

/// <reference lib="webworker" />

import { clientsClaim } from 'workbox-core';
import { precacheAndRoute } from 'workbox-precaching';

declare const self: ServiceWorkerGlobalScope;

clientsClaim();

// eslint-disable-next-line no-underscore-dangle
precacheAndRoute(self.__WB_MANIFEST);

Now, whenever you bundle your application for production, a service-worker.js file will be generated.

As a last step, you need to make sure to register the service worker using the serviceWorkerRegistration.ts module, see the comment in main.ts for more details.

Deployment

Remote Sync

For simple deployments, when you just want to upload your files to a remote server, you can use the rsync script.

Note: before using the rsync script, make sure to configure a host in in the "package.json"

npm pkg set config.host="github.com"

Git

hidden TODOs

Storybook

hidden TODOs

Testing

hidden TODOs

Web Vitals

hidden TODOs

Routing

hidden TODOs

State Management

hidden TODOs

Continuous Integration / Continuous Deployment

Bitbucket

webpack-skeleton comes with bitbucket-pipelines.yml, pre-configured to run check-types, lint and test scripts.

hidden TODOs