Skip to content

Configuration

Raphael Kieling edited this page Oct 22, 2023 · 1 revision

Configuration:

There are 2 ways to create your config:

  • Returning an array
  • Returning a function

Check the examples in the root folder

Returning an array

// doctorenv.config.js
module.exports = [
    {
      title: 'NPM',
      task: async ({ bash }) => {
        await bash`npm --version`
      },
    }
]

Returning a function

This function is to facilitate the usage of the builder or other context parameters. Obviusly, you can return a function that returns an array:

// doctorenv.config.js
module.exports = () => [
    {
      title: 'NPM',
      task: async ({ bash }) => {
        await bash`npm --version`
      },
    }
]

But the recommended way would be:

// doctorenv.config.js
module.exports = ({ builder }) => {
  return builder
    .task('check package manager')
    .subTask('has npm', ({ bash }) => bash`npm --version`)
    .subTask('has yarn', ({ bash }) => bash`yarn --version`)
    .build()
}
Clone this wiki locally