How to use @kosko/config - 2 common examples

To help you get started, we’ve selected a few @kosko/config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tommy351 / kosko / packages / cli / src / commands / generate.ts View on Github external
export async function generateHandler(
  args: BaseGenerateArguments & Context
): Promise {
  // Load config
  const globalConfig = await searchConfig(args.cwd);
  const config = {
    ...globalConfig,
    ...resolveConfig(globalConfig, args)
  };

  if (!config.components.length) {
    throw new CLIError("No components are given", {
      output:
        "No components are given. Set components in a config file or in arguments."
    });
  }

  // Set env
  if (args.env) {
    const env = await importEnv(args.cwd);
github tommy351 / kosko / packages / cli / src / commands / generate.ts View on Github external
function resolveConfig(
  base: Config,
  args: BaseGenerateArguments
): Required {
  const { components = [], require = [] } = args.env
    ? getConfig(base, args.env)
    : base;

  return {
    components:
      args.components && args.components.length ? args.components : components,
    require: [...require, ...(args.require || [])]
  };
}

@kosko/config

Load kosko configuration.

MIT
Latest version published 15 days ago

Package Health Score

75 / 100
Full package analysis