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

Config Validation + Command Defaults #998

Merged
merged 37 commits into from
Mar 1, 2020
Merged

Config Validation + Command Defaults #998

merged 37 commits into from
Mar 1, 2020

Conversation

hipstersmoothie
Copy link
Collaborator

@hipstersmoothie hipstersmoothie commented Feb 29, 2020

What Changed

Used io-ts to validate the .autorc and plugin configurations.

Release Notes

Configs are now fully validated including plugins 🎉

Screen Shot 2020-02-29 at 10 19 01 PM

🚀 Command Configuration 🚀

With the inclusion of configuration validation we decided to restrict valid root level keys to only options that are shared between commands. All of these options are called out in the .autorc docs.

But for some commands it still makes sense to configure flag permanently in the .autorc. For those commands you can now supply defaults for flags using the following format.

Example: Adding the following to you .autorc will make auto only release pre-releases to GitHub.

{
  "release": {
    "prerelease": true
  }
}

Please refer to each command's documentation to see which options are configurable.

New Hook

For plugins configuration validation a new hook validateConfiguration was added for plugins to tap into and report configuration errors. Read more

Why

closes #143
closes #999

I originally marked this as a major but after looking at the code it seems like you couldn't really set any arg in the autorc. just the few global args. most commands only use their options arg and do not refer to the base config.

Todo:

  • Add tests
  • Add docs
📦 Published PR as canary version: under canary scope @auto-canary@10.0.0-canary.998.13000.0

✨ Test out this PR locally via:

npm install @auto-canary/auto@10.0.0-canary.998.13000.0
npm install @auto-canary/core@10.0.0-canary.998.13000.0
npm install @auto-canary/all-contributors@10.0.0-canary.998.13000.0
npm install @auto-canary/chrome@10.0.0-canary.998.13000.0
npm install @auto-canary/conventional-commits@10.0.0-canary.998.13000.0
npm install @auto-canary/crates@10.0.0-canary.998.13000.0
npm install @auto-canary/first-time-contributor@10.0.0-canary.998.13000.0
npm install @auto-canary/git-tag@10.0.0-canary.998.13000.0
npm install @auto-canary/gradle@10.0.0-canary.998.13000.0
npm install @auto-canary/jira@10.0.0-canary.998.13000.0
npm install @auto-canary/maven@10.0.0-canary.998.13000.0
npm install @auto-canary/npm@10.0.0-canary.998.13000.0
npm install @auto-canary/omit-commits@10.0.0-canary.998.13000.0
npm install @auto-canary/omit-release-notes@10.0.0-canary.998.13000.0
npm install @auto-canary/released@10.0.0-canary.998.13000.0
npm install @auto-canary/s3@10.0.0-canary.998.13000.0
npm install @auto-canary/slack@10.0.0-canary.998.13000.0
npm install @auto-canary/twitter@10.0.0-canary.998.13000.0
npm install @auto-canary/upload-assets@10.0.0-canary.998.13000.0
# or 
yarn add @auto-canary/auto@10.0.0-canary.998.13000.0
yarn add @auto-canary/core@10.0.0-canary.998.13000.0
yarn add @auto-canary/all-contributors@10.0.0-canary.998.13000.0
yarn add @auto-canary/chrome@10.0.0-canary.998.13000.0
yarn add @auto-canary/conventional-commits@10.0.0-canary.998.13000.0
yarn add @auto-canary/crates@10.0.0-canary.998.13000.0
yarn add @auto-canary/first-time-contributor@10.0.0-canary.998.13000.0
yarn add @auto-canary/git-tag@10.0.0-canary.998.13000.0
yarn add @auto-canary/gradle@10.0.0-canary.998.13000.0
yarn add @auto-canary/jira@10.0.0-canary.998.13000.0
yarn add @auto-canary/maven@10.0.0-canary.998.13000.0
yarn add @auto-canary/npm@10.0.0-canary.998.13000.0
yarn add @auto-canary/omit-commits@10.0.0-canary.998.13000.0
yarn add @auto-canary/omit-release-notes@10.0.0-canary.998.13000.0
yarn add @auto-canary/released@10.0.0-canary.998.13000.0
yarn add @auto-canary/s3@10.0.0-canary.998.13000.0
yarn add @auto-canary/slack@10.0.0-canary.998.13000.0
yarn add @auto-canary/twitter@10.0.0-canary.998.13000.0
yarn add @auto-canary/upload-assets@10.0.0-canary.998.13000.0

@hipstersmoothie hipstersmoothie added the minor Increment the minor version when merged label Feb 29, 2020
@codecov
Copy link

codecov bot commented Mar 1, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@81a2fb2). Click here to learn what that means.
The diff coverage is 83.55%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #998   +/-   ##
=========================================
  Coverage          ?   80.67%           
=========================================
  Files             ?       44           
  Lines             ?     3311           
  Branches          ?      666           
=========================================
  Hits              ?     2671           
  Misses            ?      470           
  Partials          ?      170
Impacted Files Coverage Δ
packages/core/src/utils/make-hooks.ts 100% <ø> (ø)
packages/core/src/init.ts 20.86% <ø> (ø)
packages/core/src/types.ts 100% <100%> (ø)
plugins/crates/src/index.ts 96.72% <100%> (ø)
plugins/conventional-commits/src/index.ts 83.33% <100%> (ø)
plugins/git-tag/src/index.ts 85.36% <100%> (ø)
packages/cli/src/parse-args.ts 96.66% <100%> (ø)
packages/core/src/config.ts 88.75% <100%> (ø)
packages/core/src/utils/omit.ts 100% <100%> (ø)
plugins/gradle/src/index.ts 74.41% <100%> (ø)
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 81a2fb2...2b4c663. Read the comment docs.

@hipstersmoothie hipstersmoothie requested a review from zephraph March 1, 2020 02:34
@hipstersmoothie hipstersmoothie added major Increment the major version when merged and removed minor Increment the minor version when merged labels Mar 1, 2020
@hipstersmoothie hipstersmoothie added minor Increment the minor version when merged and removed major Increment the major version when merged labels Mar 1, 2020
@hipstersmoothie hipstersmoothie changed the title Config Validation Config Validation + Command Defaults Mar 1, 2020
@hipstersmoothie hipstersmoothie merged commit d1ade25 into master Mar 1, 2020
@hipstersmoothie hipstersmoothie deleted the config branch March 1, 2020 21:19
@adierkens
Copy link
Collaborator

🚀 PR was released in v9.15.0 🚀

@adierkens adierkens added the released This issue/pull request has been released. label Mar 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow command flags to be configured from autorc Strictly validate autorc config before any release
2 participants