Skip to content

Update readme for client and other packages#1457

Merged
dOrgJelli merged 32 commits intoorigin-devfrom
update-client-readme
Jan 20, 2023
Merged

Update readme for client and other packages#1457
dOrgJelli merged 32 commits intoorigin-devfrom
update-client-readme

Conversation

@krisbitney
Copy link
Copy Markdown
Contributor

@krisbitney krisbitney commented Dec 20, 2022

This is a draft PR for the purpose of preparing readme documents for the 0.10.0 release. The readme docs will be used for reference documentation on our docs site.

Steps to update a typical readme with reference documentation:

  1. If a readme does not exist, create one with an introduction, some usage examples, etc.
  2. Add doc comments to exported methods and types.
  3. Add doc-snippets tokens around the comments and types or method signatures.
  4. Use the doc-snippets CLI tool to inject the snippets into the readme doc.

You can copy the doc-snippets setup and configuration from repos where this has been done.

The aforementioned steps won't make sense for every package. Feel free to adapt as necessary!

TODO:

  • @polywrap/client-js
  • @polywrap/core-client-js
  • @polywrap/client-config-builder-js
  • @polywrap/core-js
  • polywrap (CLI)
  • @polywrap/test-env-js
  • @polywrap/uri-resolvers-js
  • @polywrap/uri-resolver-extensions-js
  • @polywrap/package-validation
  • @polywrap/wasm-js
  • @polywrap/plugin-js
  • @polywrap/tracing-js
  • @polywrap/result
  • @polywrap/msgpack-js
  • @polywrap/wrap-manifest-types-js
  • @polywrap/polywrap-manifest-types-js
  • @polywrap/logging-js
  • @polywrap/asyncify-js
  • @polywrap/os-js

@krisbitney krisbitney marked this pull request as draft December 20, 2022 15:59
pileks
pileks previously approved these changes Dec 20, 2022
Copy link
Copy Markdown
Contributor

@pileks pileks left a comment

Choose a reason for hiding this comment

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

Overall LGTM! Comment is non-blocking.

Comment thread packages/js/client/README.md Outdated
resolvers: [
new RecursiveResolver(
new PackageToWrapperCacheResolver(wrapperCache, [
new ExtendableUriResolver(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we have any docs that explain the various resolvers, at least the ones that come with Polywrap by default?

This might help developers set up their own resolution logic.

I'm thinking we could add this to packages/js/uri-resolver-extensions/README.md and reference it here? @nerfZael thoughts?

Copy link
Copy Markdown
Contributor Author

@krisbitney krisbitney Dec 20, 2022

Choose a reason for hiding this comment

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

Imo that's a good idea. I can work on it soon. I was also thinking to write more detailed reference documentation (in the readme) for the client config builder since it's becoming so important.

It would be cool to create good reference docs (as readmes) for wasm-js and plugin-js, and really every package.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ideally we'd have the package creators also write up documentation, or at least a basic outline of it (with functional details), and have someone else (e.g. me, you, any volunteer) fix it up to spec.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, 100%

Comment thread packages/js/core-client/README.md Outdated
Comment thread packages/js/client/README.md Outdated
Comment thread packages/js/client/README.md Outdated
…ption of polywrap client in readme to core client; replaced "queries" word with "invocations"
@pileks
Copy link
Copy Markdown
Contributor

pileks commented Jan 6, 2023

Should we consider merging this and opening documentation issues for the remaining packages?

…eadme

# Conflicts:
#	packages/js/client-config-builder/src/bundles/getDefaultConfig.ts
#	packages/js/core-client/src/PolywrapCoreClient.ts
#	packages/js/core/src/interfaces/uri-resolver.ts
#	packages/js/test-env/src/index.ts
@krisbitney
Copy link
Copy Markdown
Contributor Author

Should we consider merging this and opening documentation issues for the remaining packages?

Yeah, I think that's a good idea. It will prevent later work fixing merge conflicts.

pileks
pileks previously approved these changes Jan 10, 2023
@krisbitney krisbitney marked this pull request as ready for review January 10, 2023 17:52
@krisbitney krisbitney requested a review from cbrzn January 10, 2023 17:53
…eadme

# Conflicts:
#	packages/js/client-config-builder/package.json
#	packages/js/client/package.json
#	packages/js/core-client/package.json
pileks
pileks previously approved these changes Jan 11, 2023
Copy link
Copy Markdown
Contributor

@dOrgJelli dOrgJelli left a comment

Choose a reason for hiding this comment

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

This all looks great! Just a few improvements I think are needed before merging.


### Constructor
```ts
* Instantiate a ClientConfigBuilder
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This section doesn't appear to be rendering correctly, it's missing the starting /*

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed!

```

## Methods
## Types
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Above this line, in the introduction section, I think it could use some work. A few thoughts:

  • I don't think "DSL" is properly used here.
  • Ideally all code snippets should be from-source so that they remain up-to-date, so this one that's not a snippet worries me as it can become out-of-date.
  • I think should start with introducing the main concepts a user must understand to get started. We can introduce the intended usage pattern of init -> configure -> build, and we can point to sub-sections for each. "Initialization" shows the constructor signature. "Configure" shows the different "add..." methods. etc
  • Lastly, in this intro section, having an e2e example snippet (taken from a buildable source file) would be great to have.

So in summary:

  • Brief Description
  • Intro Concepts (linking to reference sections further down)
  • E2E Example Snippet

Apologies if this is overly verbose :P

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i reworked this intro and used snippets as suggested in your other comment

}
```

## ClientConfigBuilder
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we group the ClientConfigBuilder and ClientConfig sections underneath a Reference section?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done!

Comment thread packages/js/client-config-builder/package.json
"inline": false
},
{
"pattern": "/* $: {SNIPPET_NAME} */",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we have {SNIPPET_NAME} here, but not in the above start token?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh nvm, I think I figured it out, it's because this one is "inline" so it can't know where to extract the snippet name from like it can in the pattern above. Is that correct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

right, that's correct. The {SNIPPET_NAME} helps define a regex pattern.

Comment thread packages/js/client/readme/README.md Outdated
### Invoke a wrapper

```ts
await client.invoke({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should convert this to a code snippet so we make sure it runs. Maybe extract it from the tests folder or something.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also it seems like we have this problem with the other READMEs I'm seeing here, all the example code snippets aren't being extracted from source. Might I suggest us adding an examples/ folder next to the src/ folder where we keep these examples? They would be built so we can make sure they are correct, but their artifacts will not make it into the build/ folder so they do not get published with the built src/ files.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Another option is to create a src/__snippets__ folder, that lives alongside the src/__tests__ folder.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added examples/ folders and set up snippets in client, core-client, client-config-builder, and test-env.

…dded "build:readme" to build scripts and added "build:fast" options; added "Reference" section headers to readmes
@krisbitney
Copy link
Copy Markdown
Contributor Author

krisbitney commented Jan 14, 2023

@dOrgJelli Your suggestions were really good. Thanks for looking at this!

I think I addressed all of your comments: I updated the client config builder readme. All code examples now use snippets that build with yarn build. We can use yarn build:fast to just build the source code.

I think it's in much better shape and ready for a new review!

dOrgJelli
dOrgJelli previously approved these changes Jan 17, 2023
Copy link
Copy Markdown
Contributor

@dOrgJelli dOrgJelli left a comment

Choose a reason for hiding this comment

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

👏 🔥 ✔️

…eadme

# Conflicts:
#	packages/js/client-config-builder/src/ClientConfigBuilder.ts
#	packages/js/core/src/uri-resolution/UriResolutionContext.ts
#	packages/js/test-env/src/index.ts
#	yarn.lock
@dOrgJelli dOrgJelli merged commit 52fec66 into origin-dev Jan 20, 2023
@dOrgJelli dOrgJelli deleted the update-client-readme branch April 10, 2023 16:59
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.

4 participants