Skip to content

Commit 2dc6fc6

Browse files
authored
feat(dart): Modify README.md to match our agreed-upon wording (#2503)
1. Change the active development warning to match the Dart standard warning 2. Replace the existing "Quickstart" section with either nothing (the default) or customizable text
1 parent 645e42a commit 2dc6fc6

File tree

3 files changed

+34
-26
lines changed

3 files changed

+34
-26
lines changed

internal/sidekick/internal/dart/annotate.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type modelAnnotations struct {
5454
DoNotPublish bool
5555
RepositoryURL string
5656
ReadMeAfterTitleText string
57+
ReadMeQuickstartText string
5758
}
5859

5960
// HasServices returns true if the model has services.
@@ -223,6 +224,7 @@ func (annotate *annotateModel) annotateModel(options map[string]string) error {
223224
devDependencies = []string{}
224225
repositoryURL string
225226
readMeAfterTitleText string
227+
readMeQuickstartText string
226228
)
227229

228230
for key, definition := range options {
@@ -250,6 +252,11 @@ func (annotate *annotateModel) annotateModel(options map[string]string) error {
250252
case key == "readme-after-title-text":
251253
// Markdown that will be inserted into the README.md after the title section.
252254
readMeAfterTitleText = definition
255+
case key == "readme-quickstart-text":
256+
// Markdown that will appear as a "Quickstart" section of README.md. Does not include
257+
// the section title, i.e., you probably want it to start with "## Getting Started"`
258+
// or similar.
259+
readMeQuickstartText = definition
253260
case key == "repository-url":
254261
repositoryURL = definition
255262
case strings.HasPrefix(key, "proto:"):
@@ -337,6 +344,7 @@ func (annotate *annotateModel) annotateModel(options map[string]string) error {
337344
DoNotPublish: doNotPublish,
338345
RepositoryURL: repositoryURL,
339346
ReadMeAfterTitleText: readMeAfterTitleText,
347+
ReadMeQuickstartText: readMeQuickstartText,
340348
}
341349

342350
model.Codec = ann

internal/sidekick/internal/dart/annotate_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@ func TestAnnotateModel_Options(t *testing.T) {
100100
}
101101
},
102102
},
103+
{
104+
map[string]string{"readme-quickstart-text": "## Getting Started\n..."},
105+
func(t *testing.T, am *annotateModel) {
106+
codec := model.Codec.(*modelAnnotations)
107+
if diff := cmp.Diff("## Getting Started\n...", codec.ReadMeQuickstartText); diff != "" {
108+
t.Errorf("mismatch in Codec.ReadMeQuickstartText (-want, +got)\n:%s", diff)
109+
}
110+
},
111+
},
103112
{
104113
map[string]string{"repository-url": "http://example.com/repo"},
105114
func(t *testing.T, am *annotateModel) {

internal/sidekick/internal/dart/templates/README.md.mustache

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,39 +19,30 @@ The Google Cloud client library for the {{{Title}}}.
1919

2020
<!-- Code generated by sidekick. DO NOT EDIT. -->
2121

22-
> [!CAUTION]
23-
> This package is under active development! We expect multiple breaking changes
24-
> in upcoming releases. Testing is also incomplete; we do **not** recommend that
25-
> you use this package in production.
26-
27-
We welcome feedback about the APIs, documentation, missing features, bugs, etc.
28-
2922
{{#Codec.ReadMeAfterTitleText}}
3023
{{{Codec.ReadMeAfterTitleText}}}
3124

3225
{{/Codec.ReadMeAfterTitleText}}
26+
> [!NOTE]
27+
> This package is currently experimental and published under the
28+
> [labs.dart.dev](https://dart.dev/dart-team-packages) pub publisher in order
29+
> to solicit feedback.
30+
>
31+
> For packages in the labs.dart.dev publisher we generally plan to either
32+
> graduate the package into a supported publisher (dart.dev, tools.dart.dev)
33+
> after a period of feedback and iteration, or discontinue the package.
34+
> These packages have a much higher expected rate of API and breaking changes.
35+
>
36+
> Your feedback is valuable and will help us evolve this package. For general
37+
> feedback, suggestions, and comments, please file an issue in the
38+
> [bug tracker]({{Codec.RepositoryURL}}/issues).
39+
3340
## What's this?
3441

3542
The Google Cloud client library for the {{{Title}}}.
3643

3744
{{Description}}
45+
{{#Codec.ReadMeQuickstartText}}
3846

39-
## Quickstart
40-
41-
{{#Codec.HasServices}}
42-
The main clients for this package are:
43-
44-
{{#Services}}
45-
- `{{Codec.Name}}`
46-
{{/Services}}
47-
{{/Codec.HasServices}}
48-
{{^Codec.HasServices}}
49-
The main types for this package are:
50-
51-
{{#Messages}}
52-
- `{{Codec.Name}}`
53-
{{/Messages}}
54-
{{#Enums}}
55-
- `{{Codec.Name}}`
56-
{{/Enums}}
57-
{{/Codec.HasServices}}
47+
{{{Codec.ReadMeQuickstartText}}}
48+
{{/Codec.ReadMeQuickstartText}}

0 commit comments

Comments
 (0)