Skip to content
Daniel Bischoff edited this page Apr 7, 2018 · 13 revisions

The problem

Are you also fed up with copying the same build config over and over to every new project that you create?

Wouldn't it be nice, to have a single place for your configs where you can change/add things and all projects will use this config automatically?

So here is a solution for you! This repo is all about creating a single, shareable project that contains all your build, dev and test logic.

The idea isn't new, as it is based on create-react-app but I noticed that devs want to use their own build configs and the information is missing how to create a shareable build project with their configs.

Basic idea

The basic idea is to create a project that exposes an executable file that is installed into the PATH. This project only contains files that are mandatory for building, developing and testing your application. So every new project that you create can add this project as a dependency and call its script. This script will then decide depending on the parameter what to do.

program flow

In this example, we have our app project, that has a depedency to the build-config project. It calls the script shared-config.js by invoking the command shared-config build. The script then decides depending on our parameter, what file to load and runs this file in a subprocess.

  • To build our project, we call it with the param build: shared-config build
  • To run the dev mode, we call this script with the param dev: shared-config dev
  • And to run our tests, we call this script with the param test: shared-config test