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

@cuttlas8/create-web-app

v1.0.0-a.5

Published

A complete fullstack boilerplate for React/Graphql/AppSync web applications which extends the amazing [Create-React-App](https://github.com/facebook/create-react-app) with Apollo2, Reach Router, code splitting, aws s3 deploy and much more.

Downloads

2

Readme

Create Web App

A complete fullstack boilerplate for React/Graphql/AppSync web applications which extends the amazing Create-React-App with Apollo2, Reach Router, code splitting, aws s3 deploy and much more.

Table of Contents

Create an App

There are two ways to create a new app.

npm (global package)

sudo npm install -g @cuttlas8/create-web-app
create-web-app my-web-app

npx

npx @cuttlas8/create-web-app my-web-app

(npx comes with npm 5.2+ and higher)

Folder Structure

Available Scripts

Importing Modules

Styling

To style the application the styled-components library is used. Every component that needs styling must have a styles.js file next to components' index.js file where all its styled components are defined and exported. The styled components are then imported in the index.js file using the desconstructing syntax.

//styles.js

import styled from "styled-components";

export const Wrapper = styled.div`
  padding-top: 50px;
  background-color: blue;
`;
//index.js

import { Wrapper } from "./styles";

const myComponent = () => {
  return <Wrapper>Hello World!</Wrapper>;
};

Responsive Design

The application follows a mobile-first approach.

Global Styles

Global syles (ex. styles for the body tag, CSS resets..) are defined at the index.css file found in the project root.

Testing

Unit Testing

Jest & react-testing-library

Integration Testing

Cypress

Code Splitting

The application supports code splitting through ES6 dynamic imports and React.lazy. It's encouraged to dynamically load all route components plus any other hidden expensive component (ex. a map inside a tab). To dynamically load a component, use the lazy function from React:

import React, { lazy, Suspense } from "react";

const MyComponent = lazy(() => import("main/MyComponent"));

//use MyComponent as a normal component.

The component (and the sub-components it requires) won't be included in the initial bundle and only will be loaded when the component is rendered.

Internationalization

Environment Variables

Environment variables are defined in the following files in the project root:

  • .env: Default.
  • .env.development, .env.test, .env.production: Environment-specific settings.
  • .env.development.local, .env.test.local, .env.production.local: Local overrides of environment-specific settings.

Files on the left have more priority than files on the right:

  • npm start: .env.development.local, .env.development, .env
  • npm run build: .env.production.local, .env.production, .env
  • npm test: .env.test.local, .env.test, .env

Note that the .local files shouldn't be commited to the version control repository and are already in the .gitignore file.

IMPORTANT: For security reasons, all custom variables must be prefixed with REACT_APP_

In .js files, environment variables are accessible through the process.env variable:

const apiUrl = process.env.REACT_APP_API_URL;

In the public/index.html file, environment variables are accessible as follows:

<title>%REACT_APP_WEBSITE_NAME%</title>

There is also a special built-in environment variable called NODE_ENV. You can read it from process.env.NODE_ENV. When you run npm start, it is always equal to 'development', when you run npm test it is always equal to 'test', and when you run npm run build to make a production bundle, it is always equal to 'production'. You cannot override NODE_ENV manually. This prevents developers from accidentally deploying a slow development build to production.

Error Tracking

Sentry & LogRocket

Analytics

AWS Pinpoint

Continous Integration

CycleCI