prismicio / prismic-ts-codegen

A Prismic model-to-TypeScript-type generator.
Apache License 2.0
18 stars 6 forks source link

fix(cli): support custom configs via `--config/-c` with a default export #32

Closed angeloashmore closed 2 years ago

angeloashmore commented 2 years ago

Types of changes

Description

This PR fixes a bug in the prismic-ts-codegen CLI where custom configuration files specified with the --config/-c option were loaded incorrectly.

As of this PR, custom configuration files are loaded using the same logic as the default configuration file.

// custom-config.ts
import type { Config } from "prismic-ts-codegen";

const config: Config = {
  repositoryName: "qwerty",
  // ...etc.
};

// `export default` is now supported (recommended)
export default config;

// `module.exports` is also supported (not recommended)
module.exports = config;

Fixes #31

Checklist:

🐤

github-actions[bot] commented 2 years ago

size-limit report 📦

Path Size
dist/index.js 1.07 MB (0%)
dist/index.cjs 1.08 MB (0%)
codecov-commenter commented 2 years ago

Codecov Report

Merging #32 (67220ba) into main (15e882f) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main      #32   +/-   ##
=======================================
  Coverage   90.56%   90.56%           
=======================================
  Files          22       22           
  Lines         339      339           
  Branches       80       80           
=======================================
  Hits          307      307           
  Misses          4        4           
  Partials       28       28           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.