Files

MetaGame Design System User Guide

This was bootstrapped using TSDX. Modified README for MetaGame usage below:

Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Lets get you oriented with whats here and how to use it.

This TSDX setup is meant for developing React components (not apps!) that can be published to NPM. If youre looking to build an app, you should use create-react-app, razzle, nextjs, gatsby, or react-static.

If youre new to TypeScript and React, checkout this handy cheatsheet

Commands

TSDX scaffolds your new library inside /src.

The recommended workflow is to run TSDX in one terminal:

yarn start

This builds to /dist and runs the project in watch mode so any edits you save inside src causes a rebuild to /dist.

Jest

Jest tests are set up to run with npm test or yarn test. This runs the test watcher (Jest) in an interactive mode. By default, runs tests related to files changed since the last commit.

Folder Structure

/__tests__        # Test Files
  foo.test.tsx
/src
  index.tsx       # Entry Point
  theme/index.ts        # Default Theme
package.json
tsconfig.json

Rollup

TSDX uses Rollup v1.x as a bundler and generates multiple rollup configs for various module formats and build settings. See Optimizations for details.

Optimizations

Please see the main tsdx optimizations docs. In particular, know that you can take advantage of development-only optimizations:

// ./types/index.d.ts
declare var __DEV__: boolean;

// inside your code...
if (__DEV__) {
  console.log('foo');
}

You can also choose to install and use invariant and warning functions.

Module Formats

CJS, ESModules, and UMD module formats are supported.

The appropriate paths are configured in package.json and dist/index.js accordingly. Please report if any issues are found.

Named Exports

Per Palmer Group guidelines, always use named exports. Code split inside your React app instead of your React library.