Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Read rest of options from custom configuration file #391

Merged
merged 4 commits into from
Jan 12, 2024

Conversation

Djontleman
Copy link
Contributor

@Djontleman Djontleman commented Dec 31, 2023

Problem

Not all of the options that can be set through CLI flags are able to be read in from the custom config file. These being:

  • useMaintainers
  • useRootMaintainers
  • preserveBlockPosition

It would improve dev experience to also set these in the custom config and have them be respected like the other options.

Changes

  • Update generate to read in the options mentioned above from custom config
  • Connect the CustomConfig, GlobalOptions and Options types
  • Small refactors

export type CustomConfig = {
includes?: string[];
output?: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-ordering in some places so the options are in the same order as in the documentation for consistency and readability.

@Djontleman Djontleman marked this pull request as ready for review December 31, 2023 16:15
@Djontleman Djontleman changed the title Read rest of options from custom configuration file feat: Read rest of options from custom configuration file Dec 31, 2023
@@ -97,39 +97,34 @@ export const generate: Generate = async ({ rootDir, includes, useMaintainers = f
}
};

interface Options {
output?: string;
interface Options extends GlobalOptions {
verifyPaths?: boolean;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite related, but is verifyPaths still needed? Only exists in this file, so can it be removed?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can see, looking at the commit history, verifyPaths has never been used. So, it can safely be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have removed in 53ecf24


const { output = globalOptions.output || OUTPUT } = options;
const output = options.output || globalOptions.output || OUTPUT;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this syntax more readable as it only uses one technique

@Djontleman
Copy link
Contributor Author

Hi @gagoar and @gustavkj, would I be able to get a review for this?

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 7475666855

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 6989677130: 0.0%
Covered Lines: 266
Relevant Lines: 266

💛 - Coveralls

Copy link

codecov bot commented Jan 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (91bab21) 100.00% compared to head (53ecf24) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #391   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           11        11           
  Lines          284       287    +3     
  Branches        64        67    +3     
=========================================
+ Hits           284       287    +3     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gagoar gagoar requested a review from gustavkj January 10, 2024 18:54
Copy link
Owner

@gagoar gagoar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will wait today to merge it so @gustavkj can swing by review again. If not, I will release it on Friday. Thank you

@gagoar gagoar merged commit 80756fe into gagoar:master Jan 12, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants