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(cli): accept https.* options #93

Merged
merged 5 commits into from
Aug 12, 2023
Merged

Conversation

Mastercuber
Copy link
Contributor

@Mastercuber Mastercuber commented Aug 12, 2023

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

In the file cli.ts was a TODO. This PR extends the CLI Options, to be able to provide a certificate and key file in PEM format from the command line. The certificate and key file can be provided directly (--tlsCert cert.pem --tlsKey key.pem) or as a keystore (--keystore keystore.p12. A passphrase can be passed (--passphrase pw) and with --validity 10 and --domains "localhost, 127.0.0.1 domain names and IPs can be provided for autogeneration of certificates - while no cert and key is provided.

Additionally domains is renamed to alternativeNames since it's not only domains but also IPs what can be provided. The CLI options is called domains since it's a bit smaller. Everything in the help will be moved a bit right otherwise. If it's --better to call it alternativeNames feel free to change it.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@codecov
Copy link

codecov bot commented Aug 12, 2023

Codecov Report

Merging #93 (55770c7) into main (4169f50) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main      #93   +/-   ##
=======================================
  Coverage   49.93%   49.93%           
=======================================
  Files          10       10           
  Lines        1568     1568           
  Branches      108      108           
=======================================
  Hits          783      783           
  Misses        785      785           

@Mastercuber Mastercuber changed the title feat(https): CLI Options for https WIP | feat(https): CLI Options for https Aug 12, 2023
@Mastercuber Mastercuber changed the title WIP | feat(https): CLI Options for https feat(https): CLI Options for https Aug 12, 2023
src/_cert.ts Outdated
@@ -23,7 +23,7 @@ export interface CommonCertificateOptions {
organization?: string;
organizationalUnit?: string;
emailAddress?: string;
domains?: string[];
alternativeNames?: string[];
Copy link
Member

Choose a reason for hiding this comment

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

Since we already released this, we cannot rename an option in non breaking versions. Let's keep domains (we might also deprecate and support both)

Copy link
Member

Choose a reason for hiding this comment

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

Also genrally, please try to split your pull requests into smaller ones. Like one for CLI arg, one for option rename / tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The renaming is removed. When I split the PR into CLI args and CLI args test, then code coverage check shows a lesser coverage. Should I keep them split anyway?

@Mastercuber Mastercuber force-pushed the https-cli-options branch 3 times, most recently from 4ae9b74 to 7b4b8e8 Compare August 12, 2023 17:25
@Mastercuber Mastercuber force-pushed the https-cli-options branch 2 times, most recently from 22a1e94 to a541d74 Compare August 12, 2023 18:35
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

Thanks for yet another nice PR! I have simplified your code a little bit, merged util into main cli, and used simple http.* notation to map options directly. This way later we might make it even an automated feature of citty to keep code simple and expandable.

@pi0 pi0 changed the title feat(https): CLI Options for https feat(cli): accept https.* options Aug 12, 2023
@pi0 pi0 merged commit bc00884 into unjs:main Aug 12, 2023
4 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.

None yet

2 participants