laoban-dev

laoban.json

This is a file that configures laoban. The key variable values can be seen by laoban config

The existence of the file marks that this is the root of a ‘big project’ which is composed of one or more sub projects

Further documentation

Parents

It is rare to just have ‘a single laoban.json with all the stuff’. That would probably violate the principle of ‘separation of concerns’.

Instead, we have the ability to ‘merge together’ lots of parents. A typical laoban.json file might look like this:

{
  "parents":        [
    "https://raw.githubusercontent.com/phil-rice/laoban/master/common/laoban.json/core.laoban.json",
    "https://raw.githubusercontent.com/phil-rice/laoban/master/common/laoban.json/typescript.laoban.json",
    "https://raw.githubusercontent.com/phil-rice/laoban/master/common/laoban.json/typescript.publish.laoban.json"
  ]
}

Important values in laoban,json

Note that most of these have defaults if you include the core in parents.

</div

Environment variable defaults

Let me start with some strong advice. DO NOT STORE SECRETS IN laoban.json Here is why. laoban.json goes into git, and it is a bad idea to have secrets in git. Instead, use environment variables.

A lot of scripts that use secrets need an environment variable, and because of the nature of (other) configuration tools will often crash if the environment variable is not set. So, we have a mechanism for setting the DEFAULT value of environment variables. i.e. the value if not set in the environment.

A good example of this is in the ‘.npmrc’ files in the typescript templates. Their content is

//registry.npmjs.org/:_authToken=${NPM_TOKEN}

This is needed if you want to publish code. BUT it will break many npm/yarn commands if the environment variable is not set. To solve this we add a section to laoban.json. This stops the crash. PLEASE DO NOT USE THIS FOR SETTING THE SECRET

{
  "defaultEnv": {
    "NPM_TOKEN": ""
  }
}