1.11.1 • Published 5 years ago

@joelcox22/boilerplate v1.11.1

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

Boilerplate Boilerplate

This package abstracts away boilerplate code for common patterns.

Design goals:

  • Dependent repos should use convention with as little configuration as possible.
  • As little code as possible should be saved to dependent repos.
  • If code is stored in dependent repositores, a yarn upgrade should automate any required changes.
  • Provide dev tooling without config - linting, semantic release, etc.
  • Automatic reloading / HMR for everything.

Supported Abstractions

React Application

src/client/index.tsx

import { css } from '@emotion/core';

const style = {
  container: css`
    text-align: center;
    padding-top: 30vh;
  `,
}

export default function App() {
  return (
    <div css={style.container}>
      <h1>Boilerplate Application!</h1>
    </div>
  );
}

Style using Emotion, includes Destyle.css.

Recommended to use @joelcox22/ui for a base component library.

Express Server

src/server/index.tsx

import type { Express } from 'express';

export default function server(app: Express) {
  app.get('/test', (req, res) => {
    res.send({
      hello: 'world',
    });
  });
}

Component Fixtures

test/fixtures/whatever.tsx

import * as React from 'react';
import MyComponent from '../../src/components/whatever.tsx';

export default function MyComponent() {
  return (<MyComponent testProp={123} />);
}
  • Add any files you want to the fixtures directory.
  • All jsx or tsx files with a default export of a React Component will automatically be rendered in the fixtures environment at http://localhost:3000/fixtures/ when in development mode.
  • If you don't have a client application (just components and fixtures), then http://localhost:3000/ will redirect to your fixtures automatically.
  • The fixtures environment supports HMR. As such, it's very important to not have side effects in your fixtures, or in files that they import.
    • If you absolutely require side effects, be sure to clean them up in a module.hot.dispose callback.
1.11.1

5 years ago

1.11.0

5 years ago

1.10.3

5 years ago

1.10.2

5 years ago

1.10.1

5 years ago

1.9.29

5 years ago

1.9.30

5 years ago

1.10.0

5 years ago

1.9.28

5 years ago

1.9.27

5 years ago

1.9.26

5 years ago

1.9.25

5 years ago

1.9.24

5 years ago

1.9.23

5 years ago

1.9.22

5 years ago

1.9.21

5 years ago

1.9.20

5 years ago

1.9.19

5 years ago

1.9.18

5 years ago

1.9.17

5 years ago

1.9.16

5 years ago

1.9.15

5 years ago

1.9.14

5 years ago

1.9.13

5 years ago

1.9.12

5 years ago

1.9.11

5 years ago

1.9.10

5 years ago

1.9.9

5 years ago

1.9.8

5 years ago

1.9.7

5 years ago

1.9.6

5 years ago

1.9.5

5 years ago

1.9.4

5 years ago

1.9.3

5 years ago

1.9.2

5 years ago

1.9.1

5 years ago

1.9.0

5 years ago

1.8.10

5 years ago

1.8.9

5 years ago

1.8.2

5 years ago

1.8.8

5 years ago

1.8.7

5 years ago

1.8.6

5 years ago

1.8.5

5 years ago

1.8.4

5 years ago

1.8.3

5 years ago

1.8.1

5 years ago

1.8.0

5 years ago

1.7.4

5 years ago

1.7.3

5 years ago

1.7.2

5 years ago

1.7.1

5 years ago

1.7.0

5 years ago

1.5.2

5 years ago

1.6.0

5 years ago

1.5.1

5 years ago

1.5.0

5 years ago

1.4.14

5 years ago

1.4.13

5 years ago

1.4.12

5 years ago

1.4.11

5 years ago

1.4.10

5 years ago