Coder Social home page Coder Social logo

organization-exploration's Introduction

Crema App - Web ๐ŸŒ

Build Status codecov License: MIT

This project includes configuration and tooling that conforms to Crema's baseline best-practices for a Web Application.

๐Ÿงฐ Tools Used

๐Ÿ— Setup

  1. Install Node/NPM
  2. Install NVM (Node Version Manager)
  3. nvm install 'lts/*' && nvm use
  4. npm i (install project dependencies)
  5. Install the ESLint plugin for your editor VS Code
  6. Enable "Auto-Fix on Save" in settings.json:
{
  "eslint.autoFixOnSave": true,
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    { "language": "typescript", "autoFix": true },
    { "language": "typescriptreact", "autoFix": true }
  ]
}

๐Ÿ‘Ÿ Run

Run the following scripts with npm run <SCRIPT_HERE>:

  • start - start app
  • new:component - generate a new component
  • new:util - generate a new util(ity)
  • test:analyze - run bundle analyzer
  • test:e2e - run end-to-end tests
  • test:lint:fix - run linter and fix if possible
  • test:lint - run linter
  • test:playground - run component playground (storybook)
  • test:unit:coverage - run unit tests with coverage
  • test:unit - run unit tests
  • test:visual:approve - approve visual changes
  • test:visual:update - update or create visual references
  • test:visual - run visual tests (loki)

These scripts are located in package.json and do not represent the entirety of available scripts, but are the most commonly used.

๐Ÿ› Structure

The src directory is where the meat of your app is located. Below is a printout of its file-tree with a description for each part.

src
โ”œโ”€โ”€ assets // Fonts, Images, Etc.
โ”‚ย ย  โ””โ”€โ”€ logo.svg
โ”œโ”€โ”€ components // Create a new one with `npm run new:component`
โ”‚ย ย  โ””โ”€โ”€ App
โ”‚ย ย      โ”œโ”€โ”€ __snapshots__ // Generated by Jest from `test.tsx`
โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ test.tsx.snap
โ”‚ย ย      โ”œโ”€โ”€ README.md // Documentation
โ”‚ย ย      โ”œโ”€โ”€ index.css // Styles
โ”‚ย ย      โ”œโ”€โ”€ index.tsx // Main Module Code
โ”‚ย ย      โ”œโ”€โ”€ stories.tsx // Playground stories (npm run test:playground)
โ”‚ย ย      โ””โ”€โ”€ test.tsx // Unit Tests (Jest)
โ”œโ”€โ”€ types // Centralize Type Definitions
โ”‚ย ย  โ”œโ”€โ”€ Entity.ts // Base Type
โ”‚ย ย  โ”œโ”€โ”€ EntityThing.ts // A Sub-Type
โ”‚ย ย  โ”œโ”€โ”€ Id.ts // A Type Alias of `string`
โ”‚ย ย  โ”œโ”€โ”€ MapStateToProps.ts // Includes our `State`
โ”‚ย ย  โ”œโ”€โ”€ State.ts // Redux state interface
โ”‚ย ย  โ””โ”€โ”€ Thing.ts // Silly example used by `EntityThing`
โ”œโ”€โ”€ utils // Create a new one with `npm run new:util`
โ”‚ย ย  โ”œโ”€โ”€ mySpecialUtil
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ __snapshots__ // Generated by Jest from `test.ts`
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ test.tsx.snap
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ README.md // Documentation
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ index.tsx // Main Module Code
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ test.tsx // Unit Tests (Jest)
โ”‚ย ย  โ”œโ”€โ”€ decoratorCentered // Used in stories.tsx
โ”‚ย ย  โ””โ”€โ”€ shallowRender // Used to render components in test.tsx
โ”œโ”€โ”€ index.css // Root Styles
โ”œโ”€โ”€ index.tsx // Root Module
โ”œโ”€โ”€ react-app-env.d.ts // Definitions from create-react-app
โ””โ”€โ”€ serviceWorker.ts // Documentation

๐Ÿฅ‡ Best Practices

  • Use the code generators:
    • npm run new:component
    • npm run new:util
    • When prompted for a name, prefer camelCase for utils and CamelCase for components
  • Fill out the README.md to describe what your code does
  • Run your unit tests npm run test:unit while working to see immediate feedback
  • If you get stuck at any point, just log an issue and we'll figure it out together ๐Ÿ‘ญ.

organization-exploration's People

Contributors

bvarberg avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.