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

cra-template-typescript-router-scss-test-suite

v1.0.0

Published

A quick start Create React App template with React Router, TypeScript, Enzyme and other testing libraries

Downloads

2

Readme

Reference the env var in code

Prefix the environmental variable name with process.env.

e.g. process.env.REACT_APP_API_URL

The react script will resolve the variable name according whichever environment is being used.

All custom var names must start with REACT_APP

e.g. REACT_APP_API_URL

They are also env vars provided by the create-react-app script which do not have to follow this rule as listed here: https://create-react-app.dev/docs/advanced-configuration/

Environments:

Local:

npm run start npm run build

File: .env.local

(.env.local will be chosen automatically. Please go to this site to see how .env files are chosen https://create-react-app.dev/docs/adding-custom-environment-variables/)

Test

npm test

There is only one set of test env vars.

File: .env.test

It's equivalant to .env.local but "npm test" does not use .env.local.

Fog

npm run build:fog

File: .env.fog

Omaha Non-prod

npm run build:omaha-non-prod

File: .env.omaha-non-prod

Omaha Prod

npm run build:omaha-prod

File: .env.omaha-prod

Create a build script for a custom environment

To do that, create a file named .env.myEnvironment Add a script command to package.json (build:myEnvironment)

For more info, please go to these sites:
https://create-react-app.dev/docs/adding-custom-environment-variables/ https://dev.to/jam3/managing-env-variables-for-provisional-builds-h37

Misc

Setting --env=jsdom in the command to run the test script

It allows access to window, localStorage, document in the test env. https://stackoverflow.com/questions/51953713/what-is-env-jsdom

CI -- env var of the create-react-app script

Used in CI/CD environments.
Described here: https://create-react-app.dev/docs/advanced-configuration/

Staticfile

In order to make routing of this client side app working correctly in cloud foundry, there's a file called "Staticfile" with the following content: "pushstate=enabled"

"Staticfile" has to be copied to build folder.

Otherwise, in PCF, the urls for the client side app will be sent to the nginx server and return a 404.