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

feat(docs): add --dryRun option #454

Merged
merged 5 commits into from
Mar 1, 2022
Merged

Conversation

kanadgupta
Copy link
Member

@kanadgupta kanadgupta commented Feb 26, 2022

🧰 Changes

Realized while working on the docs syncing workflow in #439 that this would be a super easy win and extremely useful to have.

  • Adds --dryRun option to docs command
  • Adds --dryRun tests
  • If someone runs the docs command successfully, the output an enormous, mostly unreadable JS array of objects (example). Since this tool now supports debugging, this isn't really necessary and isn't particularly user-friendly. So this PR reformats the docs command outputs so it always returns formatted success messages doc objects
  • Backfilled some test TODOs and updated tests to reflect new command outputs

🧬 QA & Testing

If tests pass, we should be good to go! You can also try this out yourself on any project by checking out this branch and running the following command:

bin/rdme docs --dryRun --key=API_KEY __tests__/__fixtures__/new-docs

This won't make any changes in your project and instead will return a command output that looks like this:

🎭 dry run! This will create 'new-doc' with contents from __tests__/__fixtures__/new-docs/new-doc.md with the following metadata: {"category":"5ae122e10fdf4e39bb34db6f","title":"This is the document title"}

We're going to consistently return strings here instead of the total raw dump of the doc objects. it's not very intuitive nor readable, and by being able to consistently return strings that we can format, it'll set up the dry run functionality quite nicely.
@kanadgupta kanadgupta changed the title feat(docs): add dryRun option feat(docs): add --dryRun option Feb 26, 2022
@kanadgupta kanadgupta added the enhancement New feature or request label Feb 26, 2022
@kanadgupta kanadgupta added this to the v7 milestone Feb 27, 2022
@kanadgupta kanadgupta marked this pull request as ready for review February 27, 2022 01:41
@@ -160,6 +181,6 @@ module.exports = class DocsCommand {
})
);

return updatedDocs;
return chalk.green(updatedDocs.join('\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.

The command output has changed which is why I'm including this in the v7 milestone, but I can be convinced otherwise.

@kanadgupta kanadgupta requested a review from erunion February 27, 2022 01:48
Copy link
Member

@erunion erunion left a comment

Choose a reason for hiding this comment

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

Im good to keep this only in v7

src/cmds/docs/index.js Outdated Show resolved Hide resolved
@kanadgupta kanadgupta merged commit f86b5c6 into main Mar 1, 2022
@kanadgupta kanadgupta deleted the add---dry-run-option-rm-3539 branch March 1, 2022 17:15
@kanadgupta
Copy link
Member Author

Added some docs here: e6b946a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants