Skip to content
This repository was archived by the owner on Mar 17, 2026. It is now read-only.

refactor(samples): move into separate files, and update to the latest sample style standard#844

Merged
feywind merged 29 commits intogoogleapis:masterfrom
feywind:refactor-samples
Jan 10, 2020
Merged

refactor(samples): move into separate files, and update to the latest sample style standard#844
feywind merged 29 commits intogoogleapis:masterfrom
feywind:refactor-samples

Conversation

@feywind
Copy link
Copy Markdown
Collaborator

@feywind feywind commented Jan 3, 2020

Fixes #733

Refactor the topics and subscriptions samples so that they aren't single files, and so they have the new GCP sample style. I've worked to keep the same command line format for the original sample runners so we don't have to update docs immediately or confuse existing users. This involved a new test common piece to paper over the differences between running from the big sample runner vs as an individual sample.

There's still one TODO in here, which is that one of the samples was missing document tags. I think that needs to be added to the docs for full coverage. I think it goes here:

https://cloud.google.com/pubsub/docs/admin

…on samples runnable from subscriptions.js, and also individually
…amples outside the main sample text so it can persist across multiple calls (for system-test)
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jan 3, 2020
@feywind feywind changed the title Refactor samples into separate files, and update to the latest sample style standards refactor(samples): move into separate files, and update to the latest sample style standard Jan 3, 2020
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 3, 2020

Codecov Report

Merging #844 into master will decrease coverage by 15.21%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master     #844       +/-   ##
===========================================
- Coverage   98.69%   83.48%   -15.22%     
===========================================
  Files          20       30       +10     
  Lines        9443    11177     +1734     
  Branches      326      327        +1     
===========================================
+ Hits         9320     9331       +11     
- Misses        122     1845     +1723     
  Partials        1        1
Impacted Files Coverage Δ
src/subscriber.ts 99.35% <100%> (+0.01%) ⬆️
src/pubsub.ts 99.56% <100%> (ø) ⬆️
src/v1/doc/google/protobuf/doc_empty.js 0% <0%> (ø)
src/v1/doc/google/protobuf/doc_timestamp.js 0% <0%> (ø)
src/v1/doc/google/protobuf/doc_field_mask.js 0% <0%> (ø)
src/v1/doc/google/protobuf/doc_duration.js 0% <0%> (ø)
src/v1/doc/google/type/doc_expr.js 0% <0%> (ø)
src/v1/doc/google/iam/v1/doc_iam_policy.js 0% <0%> (ø)
src/v1/doc/google/iam/v1/doc_policy.js 0% <0%> (ø)
bin/benchwrapper.js 0% <0%> (ø)
... and 2 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 cfad953...e03f465. Read the comment docs.

@feywind
Copy link
Copy Markdown
Collaborator Author

feywind commented Jan 6, 2020

This is still marked as draft because I need to update the docs to include the sample that was missing doc tags, but it's otherwise pretty much done.

@feywind
Copy link
Copy Markdown
Collaborator Author

feywind commented Jan 6, 2020

It looks like the missing doc tags is a larger problem. e.g. the C# samples are also missing tags for that sample.

https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob/master/pubsub/api/PubsubSample/Program.cs
(search for GetSubscription)

So I'm just going to call this ready, but I'll leave the TODO in there if that's okay. I do think we will want to fix that not-quite-a-sample, but it's going to require work across multiple repos.

@feywind feywind marked this pull request as ready for review January 6, 2020 21:56
Comment thread samples/subscriptions/createPushSubscription.js Outdated
Comment thread samples/common/common.js Outdated
Copy link
Copy Markdown

@bcoe bcoe left a comment

Choose a reason for hiding this comment

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

I'm not opposed to keeping yargs in the mix for the refactor (potentially with the goal of removing it eventually? and tracking issue).

I think you can avoid the need for the common.js helper with some of yargs' power features, I included an example in review (please feel free to reach out in chat though).

Comment thread samples/common/index.js Outdated
Comment thread samples/subscriptions/createSubscription.js Outdated
Copy link
Copy Markdown
Contributor

@JustinBeckwith JustinBeckwith left a comment

Choose a reason for hiding this comment

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

LGTM w/ nits

Comment thread README.md
Comment thread samples/subscriptions/createPushSubscription.js
@JustinBeckwith
Copy link
Copy Markdown
Contributor

This is looking great!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Samples style refresh

6 participants