react-scripts-ts-multi-app

2.17.2 • Public • Published

IMPORTANT NOTE: This is a fork of create-react-app-typescript that allows for multiple apps to have shared build configuration and shared code.

  1. Each "child app" should have a folder as an immediate descendent of the frontend root, each with its own /src folder and tsconfig files. E.g.
create-react-app root
├── app1
│   ├── src
│   ├── tsconfig.json
│   └── tsconfig.test.json
├── app2
│   ├── src
│   ├── tsconfig.json
│   └── tsconfig.test.json
└── shared
    ├── src
    └── tsconfig.test.json
  1. The test, build, and start tasks accept an --appRoot command line argument in order to specify which app you want to test/build/start. E.g. react-scripts-ts test --appRoot=app1 --env=jsdom.

  2. Two additional jest options are allowed to be specified via package.json since you'll most likely be using paths in the tsconfig files (modulePaths and moduleNameMapper).

app1/tsconfig.json

{
  "compilerOptions": {
    "baseUrl": "..",
    "paths": {
      "shared/*": [ "shared/src/*" ],
      "*": [ "app1/src/*" ]
    }
  }
}

package.json

  "jest"{
    "modulePaths": [
      "<rootDir>/src"
    ],
    "moduleNameMapper": {
      "shared/(.*)": "<rootDir>/../shared/src/$1"
    },
    "collectCoverageFrom": [
      ...

react-scripts

This package includes scripts and configuration used by Create React App.
Please refer to its documentation:

Readme

Keywords

none

Package Sidebar

Install

npm i react-scripts-ts-multi-app

Weekly Downloads

3

Version

2.17.2

License

BSD-3-Clause

Unpacked Size

219 kB

Total Files

36

Last publish

Collaborators

  • bpander