Skip to content

Commit

Permalink
chore(docs): improve READMEs for individual providers (#369)
Browse files Browse the repository at this point in the history
Couple of minor but IMO powerful improvements to the provider READMEs:

- Puts the true underlying version number in the title instead of the
tracked version (I have never ever found the tracked version to be
helpful in practice)
- Includes a link to the Registry page earlier on in the document (I
look for this often and hate having to scroll so far down to find it)
- Removes text about "This links to the minimum version being tracked"
which is no longer relevant as a result of Mark's changes merged in #342

It's worth noting that in the snapshot tests,
`underlyingTerraformVersion` is always unset, but in the actual provider
repos in practice, it is always set. See here for an example:
https://github.com/cdktf/cdktf-provider-aws/blob/main/README.md
  • Loading branch information
xiehan authored Dec 12, 2023
1 parent 3757b95 commit 5f67384
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 70 deletions.
37 changes: 19 additions & 18 deletions src/readme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,17 @@ export class ReadmeFile extends FileBase {
: "";

return `
# Terraform CDK ${providerName} Provider tracks ${providerVersion}
This repo builds and publishes the Terraform ${providerName} Provider bindings for [CDK for Terraform](https://cdk.tf).
# CDKTF prebuilt bindings for ${fqpnURL} provider version ${
underlyingTerraformVersion !== "<unknown>"
? `${underlyingTerraformVersion}`
: `${providerVersion}`
}
${
underlyingTerraformVersion !== "<unknown>"
? `Is based directly on ${providerName} ${underlyingTerraformVersion}`
: ""
}
This repo builds and publishes the [Terraform ${providerName} provider](https://registry.terraform.io/providers/${fqpnURL}/${
underlyingTerraformVersion !== "<unknown>"
? underlyingTerraformVersion
: versionURL
}/docs) bindings for [CDK for Terraform](https://cdk.tf).
## Available Packages
Expand Down Expand Up @@ -118,45 +120,44 @@ You can also visit a hosted version of the documentation on [constructs.dev](htt
## Versioning
This project is explicitly not tracking the Terraform ${providerName} Provider version 1:1. In fact, it always tracks \`latest\` of \`${providerVersion}\` with every release. If there are scenarios where you explicitly have to pin your provider version, you can do so by generating the [provider constructs manually](https://cdk.tf/imports).
This project is explicitly not tracking the Terraform ${providerName} provider version 1:1. In fact, it always tracks \`latest\` of \`${providerVersion}\` with every release. If there are scenarios where you explicitly have to pin your provider version, you can do so by [generating the provider constructs manually](https://cdk.tf/imports).
These are the upstream dependencies:
- [Terraform CDK](https://cdk.tf)
- [Terraform ${providerName} Provider](https://registry.terraform.io/providers/${fqpnURL}/${
- [CDK for Terraform](https://cdk.tf)
- [Terraform ${providerName} provider](https://registry.terraform.io/providers/${fqpnURL}/${
underlyingTerraformVersion !== "<unknown>"
? underlyingTerraformVersion
: versionURL
})
- This links to the minimum version being tracked, you can find the latest released version [in our releases](https://github.com/cdktf/cdktf-provider-${providerName}/releases)
- [Terraform Engine](https://terraform.io)
If there are breaking changes (backward incompatible) in any of the above, the major version of this project will be bumped.
## Features / Issues / Bugs
Please report bugs and issues to the [terraform cdk](https://cdk.tf) project:
Please report bugs and issues to the [CDK for Terraform](https://cdk.tf) project:
- [Create bug report](https://cdk.tf/bug)
- [Create feature request](https://cdk.tf/feature)
## Contributing
### projen
### Projen
This is mostly based on [projen](https://github.com/eladb/projen), which takes care of generating the entire repository.
This is mostly based on [Projen](https://github.com/projen/projen), which takes care of generating the entire repository.
### cdktf-provider-project based on projen
### cdktf-provider-project based on Projen
There's a custom [project builder](https://github.com/hashicorp/cdktf-provider-project) which encapsulate the common settings for all \`cdktf\` providers.
There's a custom [project builder](https://github.com/cdktf/cdktf-provider-project) which encapsulate the common settings for all \`cdktf\` prebuilt providers.
### Provider Version
The provider version can be adjusted in [./.projenrc.js](./.projenrc.js).
### Repository Management
The repository is managed by [Repository Manager](https://github.com/hashicorp/cdktf-repository-manager/)
The repository is managed by [CDKTF Repository Manager](https://github.com/cdktf/cdktf-repository-manager/).
`;
}
}
75 changes: 33 additions & 42 deletions test/__snapshots__/index.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 4 additions & 10 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,14 @@ test("README contains provided Namespace", () => {

expect(snapshotWithVersion["README.md"]).toEqual(
expect.stringContaining(
"- [Terraform random Provider](https://registry.terraform.io/providers/hashicorp/random/3.1.0)"
) &&
expect.stringContaining(
"- This links to the minimum version being tracked, you can find the latest released version [in our releases](https://github.com/cdktf/cdktf-provider-random/releases)"
)
"- [Terraform random provider](https://registry.terraform.io/providers/hashicorp/random/3.1.0)"
)
);

expect(snapshotWithoutVersion["README.md"]).toEqual(
expect.stringContaining(
"- [Terraform random Provider](https://registry.terraform.io/providers/hashicorp/random/)"
) &&
expect.stringContaining(
"- This links to the minimum version being tracked, you can find the latest released version [in our releases](https://github.com/cdktf/cdktf-provider-random/releases)"
)
"- [Terraform random provider](https://registry.terraform.io/providers/hashicorp/random/)"
)
);
});

Expand Down

0 comments on commit 5f67384

Please sign in to comment.