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

[BD-46] feat: help command for Paragon CLI #2603

Merged
merged 4 commits into from
Sep 20, 2023

Conversation

monteri
Copy link
Contributor

@monteri monteri commented Sep 7, 2023

Description

PR includes:

  • new help command
  • new structure for COMMANDS object with commented example
  • documentation in the README.md
  • new support for paragon install-theme <theme> that can receive <theme> parameter

Merge Checklist

  • If your update includes visual changes, have they been reviewed by a designer? Send them a link to the Netlify deploy preview, if applicable.
  • Does your change adhere to the documented style conventions?
  • Do any prop types have missing descriptions in the Props API tables in the documentation site (check deploy preview)?
  • Were your changes tested using all available themes (see theme switcher in the header of the deploy preview, under the "Settings" icon)?
  • Were your changes tested in the example app?
  • Is there adequate test coverage for your changes?
  • Consider whether this change needs to reviewed/QA'ed for accessibility (a11y). If so, please add wittjeff and adamstankiewicz as reviewers on this PR.

Post-merge Checklist

  • Verify your changes were released to NPM at the expected version.
  • If you'd like, share your contribution in #show-and-tell.
  • 🎉 🙌 Celebrate! Thanks for your contribution.

@openedx-webhooks openedx-webhooks added the blended PR is managed through 2U's blended developmnt program label Sep 7, 2023
@openedx-webhooks
Copy link

Thanks for the pull request, @monteri!

When this pull request is ready, tag your edX technical lead.

@netlify
Copy link

netlify bot commented Sep 7, 2023

Deploy Preview for paragon-openedx ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 3d463de
🔍 Latest deploy log https://app.netlify.com/sites/paragon-openedx/deploys/65083d9e74715300083cad64
😎 Deploy Preview https://deploy-preview-2603--paragon-openedx.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Comment on lines 39 to 41
if (process.argv.length === 4) {
const providedTheme = process.argv[3];
installTheme(providedTheme);
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 decided to add it in this PR since it is small and I could use newly created help command functionality to describe it straight away.

@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.12% 🎉

Comparison is base (4fee4cc) 91.69% compared to head (3d463de) 91.81%.
Report is 21 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2603      +/-   ##
==========================================
+ Coverage   91.69%   91.81%   +0.12%     
==========================================
  Files         235      235              
  Lines        4214     4217       +3     
  Branches     1021     1020       -1     
==========================================
+ Hits         3864     3872       +8     
+ Misses        346      341       -5     
  Partials        4        4              
Files Changed Coverage Δ
src/SearchField/SearchFieldAdvanced.jsx 90.47% <ø> (ø)

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

// ...
// ],
// ********** Block for help command end **********
// },
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to use the syntax to describe JSDocs?

@@ -1,26 +1,68 @@
#!/usr/bin/env node
/* eslint-disable no-console */
Copy link
Contributor

Choose a reason for hiding this comment

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

You turned off the linter for the entire page, even though you're only using console.log in one place. Should I turn off the linter rule only in one place?

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 is used twice there but I agree for two cases it is good idea.

bin/paragon-scripts.js Show resolved Hide resolved
return;
}

if (command === 'help') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary to move the word help into a constant with a meaningful name?

const answers = await promptUserForTheme();
installTheme(answers.theme);
// Check if the user passed a theme parameter as a command-line argument
if (process.argv.length === 4) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we give a meaningful name for this expression? This way you can remove the redundant comment

*/
function padLeft(description, offsetString) {
// Calculate the necessary padding based on the offsetString length
const padding = ' '.repeat(Math.max(0, DESCRIPTION_PAD - offsetString.length));
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we give a meaningful name for this constant? This way you can remove the redundant comment

Copy link
Contributor Author

@monteri monteri Sep 8, 2023

Choose a reason for hiding this comment

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

I think it is descriptive right now. Meaningful variable name would be very long

lib/install-theme.js Outdated Show resolved Hide resolved
bin/paragon-scripts.js Show resolved Hide resolved
lib/help.js Outdated Show resolved Hide resolved
@viktorrusakov viktorrusakov merged commit c778061 into openedx:master Sep 20, 2023
9 checks passed
@openedx-webhooks
Copy link

@monteri 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@edx-semantic-release
Copy link
Contributor

🎉 This PR is included in version 21.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@viktorrusakov viktorrusakov linked an issue Sep 21, 2023 that may be closed by this pull request
@edx-semantic-release
Copy link
Contributor

🎉 This PR is included in version 22.0.0-alpha.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blended PR is managed through 2U's blended developmnt program released on @alpha released
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[CLI improvements] Help command
5 participants