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

Docs #119

Merged
merged 45 commits into from
Jan 16, 2025
Merged

Docs #119

merged 45 commits into from
Jan 16, 2025

Conversation

jamesopstad
Copy link
Contributor

resolves #87

This adds documentation to the readme. I've tried to keep the tutorial as succinct as possible but think it's a nice way to introduce the key concepts.

Copy link

pkg-pr-new bot commented Dec 18, 2024

Open in Stackblitz

npm i https://pkg.pr.new/flarelabs-net/vite-plugin-cloudflare/@flarelabs-net/vite-plugin-cloudflare@119

commit: 886873f

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changes in this file are just to make the naming more consistent with the docs.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Copy link

@IgorMinar IgorMinar left a comment

Choose a reason for hiding this comment

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

Overall this looks really good and comprehensive to me. I left a few notes here and there with clarifications, but I think overall this make sense to me.

I'm approving this assuming that we resolve all the comments via edits an agreement to take no action.

Thank you @jamesopstad!

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
- Supports Workers Assets, enabling you to build static sites, SPAs and full-stack applications
- Leverages Vite's hot-module reloading for consistently fast updates
- Supports `vite preview` for previewing your build output in the Workers runtime prior to deployment

Choose a reason for hiding this comment

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

This would also be a good place to mention that this plugin doesn't fully replace the need to have Wrangler installed as well and that wrangler is needed to read the config from wrangler.toml/json and deploy the final application.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It might be a bit wordy to include this here before the Quick Start. Is it not clear that it's included as a dependency to install?

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
packages/vite-plugin-cloudflare/src/plugin-config.ts Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

LGTM once Igor and Dario's comments have been addressed

README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" },
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the Vite React creation tool generate the tsconfig.app.json and tsconfig.node.json?
If so, how come it doesn't already include the TypeScript dependency?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does generate those files and includes the TypeScript dependency. Not quite sure what you mean?

@dario-piotrowicz
Copy link
Contributor

A minor comment that just occurred to me, given the recent push for wrangler.json (cloudflare/workers-sdk#7676, etc...) should we maybe switch our wrangler files into jsons? and also refer to the json format in the docs?

I think that'd make sense, it also doesn't need to be addressed in this PR (since it would probably be good to also update the config files in the various playground apps)

One concern I have docs wise is that now we get a bit of a stronger distinction between the userland/input wrangler.toml and the output wrangler.json, if we had wrangler.json both as the input and output that could potentially confuse some people if not conveyed very clearly 🤔

Copy link
Contributor

@ToriLindsay ToriLindsay left a comment

Choose a reason for hiding this comment

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

Just left a bunch of grammar/clarity suggestions. Feel free to ignore any that don't make sense for the context.
Note: We always use the oxford comma.
Also, I noticed that it was jumping between the first, second, and third person a lot, so I removed the "we", "us", "let's", etc. to keep a little more consistent.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
jamesopstad and others added 19 commits January 16, 2025 08:00
Co-authored-by: ToriLindsay <[email protected]>
Co-authored-by: ToriLindsay <[email protected]>
Co-authored-by: ToriLindsay <[email protected]>
Co-authored-by: ToriLindsay <[email protected]>
Co-authored-by: ToriLindsay <[email protected]>
Co-authored-by: ToriLindsay <[email protected]>
Co-authored-by: ToriLindsay <[email protected]>
Co-authored-by: ToriLindsay <[email protected]>
Co-authored-by: ToriLindsay <[email protected]>
Co-authored-by: ToriLindsay <[email protected]>
Co-authored-by: ToriLindsay <[email protected]>
Co-authored-by: ToriLindsay <[email protected]>
Co-authored-by: ToriLindsay <[email protected]>
Co-authored-by: ToriLindsay <[email protected]>
Co-authored-by: ToriLindsay <[email protected]>
Co-authored-by: ToriLindsay <[email protected]>
Co-authored-by: ToriLindsay <[email protected]>
@@ -26,6 +26,10 @@ import { getWarningForWorkersConfigs } from './workers-configs';
import type { PluginConfig, ResolvedPluginConfig } from './plugin-config';
import type { Unstable_RawConfig } from 'wrangler';

/**
* Cloudflare Vite plugin.
* Accepts an optional {@link PluginConfig} object.
Copy link
Contributor

@dario-piotrowicz dario-piotrowicz Jan 16, 2025

Choose a reason for hiding this comment

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

Should we have a more detailed description? (briefly mentioning what the plugin does/what it can be used for etc...)

For the parameter, why not a standard @param tag? 😮

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be honest, I just followed Vite's example here - https://github.com/vitejs/vite/blob/4f5845a3182fc950eb9cd76d7161698383113b18/packages/vite/src/node/config.ts#L137-L141.

Feel free to make a suggestion.

Copy link
Contributor

Choose a reason for hiding this comment

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

What about something along these lines?
Screenshot 2025-01-16 at 11 08 20

This is how something like that would get rendered in vscode:
Screenshot 2025-01-16 at 11 08 30

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Let's add the JSDoc once the readme is in workers-sdk so it points to the right place.

README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

Added some thoughts about the environments section.

README.md Outdated

## Worker environments

A Worker config file may contain configuration for multiple [environments](https://developers.cloudflare.com/workers/wrangler/environments/).
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
A Worker config file may contain configuration for multiple [environments](https://developers.cloudflare.com/workers/wrangler/environments/).
A Worker config file may contain configuration for multiple [Wrangler environments](https://developers.cloudflare.com/workers/wrangler/environments/).

Copy link
Contributor

Choose a reason for hiding this comment

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

or possibly

Suggested change
A Worker config file may contain configuration for multiple [environments](https://developers.cloudflare.com/workers/wrangler/environments/).
A Worker config file may contain configuration for multiple [Cloudflare environments](https://developers.cloudflare.com/workers/wrangler/environments/).

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see below that you use the term "Worker environment" - so perhaps that would be best here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've called the section 'Worker environments`. I don't think there's any option here that isn't a little confusing because the word 'environments' is used for so many things. I do think that calling them 'Wrangler environments' would potentially be even more confusing though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated it to 'Worker environments'. Let me know if you would rather I use the term 'Cloudflare environments' throughout the readme though. I'm not sure which is better.

README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@jamesopstad jamesopstad merged commit e79319d into main Jan 16, 2025
5 checks passed
@jamesopstad jamesopstad deleted the james/docs branch January 16, 2025 14:30
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.

Add documentation
5 participants