2.1.2 • Published 8 days ago
@simple-release/config v2.1.2
@simple-release/config
A simple-release config loader.
Install
# pnpm
pnpm add @simple-release/config
# yarn
yarn add @simple-release/config
# npm
npm i @simple-release/config
Usage
This package provides a function to find and load js config file for simple-release. Possible config file names are:
.simple-release.js
.simple-release.cjs
.simple-release.mjs
import { load } from '@simple-release/config'
await load() // Returns config object or null
await load({ config: true }) // Returns config object or throws an error if config is not found
await load({ [propertyName]: true }) // Returns config object with desired property or null or throws an error if property is not set in config
Also loader has a feature to load and instantiate addon's classes. For example, if you have a config like this:
export const project = [
'@simple-release/pnpm#PnpmWorkspacesProject',
{
mode: 'independent'
}
]
You can load it like this:
import { load } from '@simple-release/config'
const config = await load()
config.project // Will be an instance of PnpmWorkspacesProject
You can pass your own loader and use queries with version:
export const project = [
'@simple-release/pnpm@1.0.0#PnpmWorkspacesProject',
{
mode: 'independent'
}
]
import { load } from '@simple-release/config'
const config = await load({}, async (name, version) => {
await install(name, version) // For example you can implement lazy install here
return import(name)
})