Skip to content

Add readme.txt and related update script #72

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

Merged
merged 4 commits into from
Jan 15, 2022
Merged

Conversation

felixarntz
Copy link
Member

Fixes #40

This PR is a starting point for the plugin's readme.txt file. It is a first content proposal for the readme itself, but in addition to that the PR includes a new related script callable via npm run readme that will help automate readme.txt updates in the future. Here's what that script does:

  • Since the readme should contain an up-to-date list of all the available modules in the plugin description, the script automatically parses all module names and descriptions from the codebase and updates that bulleted list in the readme accordingly. This way we can easily always keep the readme up to date without double-maintaining these descriptions.
    • Of course we can always add more detailed information about a module somewhere else in the readme, but IMO having a quick overview list somewhere in the beginning of the plugin description is helpful, and for that purpose this script simplifies maintenance.
  • The script also optionally updates the changelog for a given milestone within the readme, relying on the npm run changelog logic that was previously implemented in Add changelog generator script #51.

Here's how to use the script:

  • npm run readme: This way it'll only update the module list. Try changing it to something else in the readme.txt file and then run this command, to see how it will always update the content to the names and descriptions of all modules within the codebase.
  • npm run readme -- -m "1.0.0-beta.1": This way it'll also (in addition to the module list, see above) update the changelog section for the given milestone (right now we only have 1.0.0-beta.1). If that changelog section doesn't exist yet, it'll add it right below == Changelog ==, otherwise it'll replace the existing section with the latest content. Try changing the content for that release to something else or add some dummy changelogs for other (non-existing) versions and then run the script to see how it always puts the latest changelog into readme.txt.

This PR needs two types of reviews: On the one hand, it needs engineering review and testing for the new npm run readme script. On the other hand, it needs content review for the initial proposal for the readme itself. Let's keep in mind that this doesn't need to be perfect or the final state of the readme (we can always add more details later), but it should at least be good for a start and a minimum foundation with which we could potentially release a first version of the plugin.

@felixarntz felixarntz added [Type] Documentation Documentation to be added or enhanced Infrastructure Issues for the overall performance plugin infrastructure labels Dec 30, 2021
@felixarntz felixarntz added this to the 1.0.0-beta.1 milestone Dec 30, 2021
@felixarntz
Copy link
Member Author

To anybody reviewing the content here, I specifically want to encourage you to update this PR directly to iterate on the content. People often shy away from updating someone else's PR, but the readme.txt content I've added so far is an initial proposal - so don't just make review suggestions, feel free to update and rewrite it as you please!

*
* @return {Promise<[]WPModuleDescription>} Promise resolving to module description list.
*/
exports.getModuleDescriptions = async ( modulesDir ) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is now in here since pretty much the same code was needed to extract the module header translations (npm run translations command) as it was needed to update the list of modules within the readme (the new npm run readme command).

const readmeFile = path.join( '.', 'readme.txt' );
const fileContent = fs.readFileSync( readmeFile, 'utf8' );
const newContent = fileContent.replace(
/(the following performance modules:\s+)((\*.*\n)+)/,
Copy link
Member Author

Choose a reason for hiding this comment

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

Note that this must always match the exact wording preceding the module bulleted list in the readme.txt file. So if you update that bit in the readme.txt, make sure to update it here as well.

Copy link
Member

@mitogh mitogh left a comment

Choose a reason for hiding this comment

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

Nothing major, just minor stuff, overall looks great 👍

* @property {string=} milestone Optional milestone title, to update the changelog in the readme.
* @property {string=} token Optional personal GitHub access token, only relevant for changelog updates.
*/

Copy link
Member

Choose a reason for hiding this comment

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

Maybe missing the object defined above?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, can you clarify what you mean by this?

Copy link
Member

Choose a reason for hiding this comment

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

Sure, I see a definition for an object WPReadmeCommandOptions and properties in this case milestone and token but I don't see the object itself in the doc, is this maybe document as part of the command ?

Copy link
Member

@ThierryA ThierryA left a comment

Choose a reason for hiding this comment

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

I only reviewed the readme wording and took a quick pass a the code + current review by @mitogh. Minor comment, other than that LGTM.


**Features**

* Images: Add WebP for uploads module. ([32](https://github.com/WordPress/performance/pull/32))
Copy link
Member

Choose a reason for hiding this comment

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

The description could be a bit more user friendly, "add WebP for uploads module" probably doesn't speak much to many folks

Copy link
Member

Choose a reason for hiding this comment

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

I think these are generated from the PR themselves. Should we update the PR then @felixarntz?

Copy link
Member Author

Choose a reason for hiding this comment

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

@JustinyAhin Correct, in that case we should change the PR title.

@ThierryA Do you have a suggestion on what it could be while still being concise? I'm personally okay with it, maybe we can clarify what the module does, but I also think we should keep it short.

@felixarntz
Copy link
Member Author

@mitogh Updated based on your feedback! Also replied to your other comments (cc @ThierryA @JustinyAhin).

@felixarntz felixarntz requested a review from mitogh January 14, 2022 14:42
@felixarntz felixarntz merged commit d12d57b into trunk Jan 15, 2022
@tillkruss tillkruss deleted the add/40-readmetxt branch March 7, 2022 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Issues for the overall performance plugin infrastructure [Type] Documentation Documentation to be added or enhanced
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add plugin readme.txt
4 participants