GithubHelp home page GithubHelp logo

joelroxell / memo Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 4.77 MB

Everything you need to develop a smooth high-end react application, in less than a week. The project's primary focus is to allow us, developers, to quickly realize new ideas without interference.

CSS 15.63% TypeScript 73.13% HTML 0.34% JavaScript 9.22% Dockerfile 1.68%

memo's Introduction

Memo

-> TLDR

Everything you need to develop a smooth high-end react application, in less than a week. The project's primary focus is to allow us, developers, to quickly realize new ideas without interference.

img

All modules in the project follow the same structure, the typical module patter, all files regarding a specific module (in this case a component) exist in the same folder. Like this example, generic components are placed in a shared folder named common.

src/components/common/Button/
├── Button.scss
├── Button.scss.d.ts
├── Button.test.tsx
├── Button.tsx
├── __snapshots__
│   └── Button.test.tsx.snap
└── index.tsx

A more extensive example may be seen here

All in all, the project counters most (if not all) problematic parts one usually encounters during the development of new applications (or old).

Includes

  • Typescript
  • React (>16.8)
  • Jest
  • Webpack (>4)
  • Scss (CSS-modules)
  • Autoprefixer
  • An easy way to work with custom SVGs
  • Code splitting
  • Alias imports.

img

Folders Purpose

API

All external communication should be placed inside this folder and exposed via a singular object, which components, later on, may destruct for ease of use. Hence, this folder will contain all integration interfaces.

Assets

Include all types of media, more concretely bitmaps, svgs, or anything similar.

Components

  • App - Essentially, the root of your application.
  • Common - Components that are used in at least two places.
  • Contexts - The folder contains global states and actions that tie together application-logic and API integrations. It is either via contexts or hooks which your API is exposed to your components.
  • Hooks - Reusable hooks of any kind.
  • Utils - This module includes all type of reusable functions or objects.

Usage

The setup currently uses mockoon, to mock API endpoints. Download it, import the API definition in ./mockoon/api.json and start the mock-server.

Development:

  1. Start the mock-server-api.
  2. Generate a local ssl-cert. (optional)
  3. npm start or npm run start:no-ssl

Coverage

npm t -- --coverage.

Build

To create a production ready build run:npm run build. The build ill be outputted to ./dist/

Add new path resolutions

tsconfig.json

"paths": {
  "components/*": ["components/*"]
}

weboack.config.js

resolve: {
  extensions: ['.ts', '.tsx', '.js', '.json'],
  alias: {
    components: path.join(srcPath, 'components')
  }
},

For even help see this or read about module resolution here

SSL

openssl req -x509 -out localhost.crt -keyout localhost.key \
 -newkey rsa:2048 -nodes -sha256 \
 -subj '/CN=localhost' -extensions EXT -config <( \
 printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
 ```bash

Chrome SSL localhost

chrome://flags/#allow-insecure-localhost

Appendix

Nested Components

src/components/App/subs/Account/
├── Account.scss
├── Account.scss.d.ts
├── Account.test.tsx
├── Account.tsx
├── __snapshots__
│   └── Account.test.tsx.snap
├── index.tsx
└── subs
    ├── Dashboard
    │   ├── Dashboard.scss
    │   ├── Dashboard.scss.d.ts
    │   ├── Dashboard.tsx
    │   ├── index.tsx
    │   └── subs
    │       └── Status
    │           ├── Status.scss
    │           ├── Status.scss.d.ts
    │           ├── Status.test.tsx
    │           ├── Status.tsx
    │           ├── __snapshots__
    │           │   └── Status.test.tsx.snap
    │           └── index.tsx
    ├── Navigation
    │   ├── Navigation.scss
    │   ├── Navigation.scss.d.ts
    │   ├── Navigation.tsx
    │   ├── index.tsx
    │   └── subs
    │       └── Item
    │           ├── Item.scss
    │           ├── Item.scss.d.ts
    │           ├── Item.tsx
    │           └── index.tsx
    └── StatusBar
        ├── StatusBar.scss
        ├── StatusBar.scss.d.ts
        ├── StatusBar.test.tsx
        ├── StatusBar.tsx
        ├── __snapshots__
        └── index.tsx

Project layout

src/
├── api
│   ├── index.tsx
│   └── modules
│       ├── auth
│       │   └── index.ts
│       └── db
│           └── index.ts
├── assets
│   ├── img
│   │   └── leaf.jpg
│   └── svg
│       ├── bell.svg
│       ├── density.svg
│       ├── eye-with-line.svg
│       ├── grow-zone.svg
│       ├── home.svg
│       ├── led.svg
│       ├── loader.svg
│       ├── logo.svg
│       ├── logout.svg
│       ├── sensor.svg
│       ├── settings.svg
│       ├── system.svg
│       └── user.svg
├── components
│   ├── App
│   │   ├── App.scss
│   │   ├── App.scss.d.ts
│   │   ├── App.test.tsx
│   │   ├── App.tsx
│   │   ├── __snapshots__
│   │   │   └── App.test.tsx.snap
│   │   ├── index.tsx
│   │   └── subs
│   │       ├── About
│   │       │   ├── About.scss
│   │       │   ├── About.scss.d.ts
│   │       │   ├── About.test.tsx
│   │       │   ├── About.tsx
│   │       │   ├── __snapshots__
│   │       │   │   └── About.test.tsx.snap
│   │       │   └── index.tsx
│   │       ├── Account
│   │       │   ├── Account.scss
│   │       │   ├── Account.scss.d.ts
│   │       │   ├── Account.test.tsx
│   │       │   ├── Account.tsx
│   │       │   ├── __snapshots__
│   │       │   │   └── Account.test.tsx.snap
│   │       │   ├── index.tsx
│   │       │   └── subs
│   |       ...
│   └── common
│       ├── Button
│       │   ├── Button.scss
│       │   ├── Button.scss.d.ts
│       │   ├── Button.test.tsx
│       │   ├── Button.tsx
│       │   ├── __snapshots__
│       │   │   └── Button.test.tsx.snap
│       │   └── index.tsx
│       ...
├── contexts
│   ├── __snapshots__
│   ├── user-context.test.tsx
│   └── user-context.tsx
├── hooks
│   └── useDidMount.tsx
├── index.html
├── index.tsx
├── project-config.ts
├── react-env.d.ts
├── setupEnzyme.ts
└── utils
    ├── env
    │   ├── env.test.ts
    │   ├── env.ts
    │   └── index.ts
    ├── functions.scss
    ├── source
    │   ├── source.test.ts
    │   └── source.ts
    ├── time
    │   ├── index.ts
    │   └── now.ts
    └── variables.scss

memo's People

Watchers

 avatar  avatar

memo's Issues

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.