-
Notifications
You must be signed in to change notification settings - Fork 748
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add a meaningful error warning when KDS path is not provided when running yarn run devserver-with-kds #11657
Add a meaningful error warning when KDS path is not provided when running yarn run devserver-with-kds #11657
Conversation
Build Artifacts
|
@MisRob I had to use the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love the introduction of an error message here. This will make things much easier to work out why something has gone awry when it inevitably does. Thank you for your work on this!
Each of my review comments is merge-blocking. Please let me know if you have any questions!
package.json
Outdated
@@ -26,7 +26,7 @@ | |||
"app-devserver": "concurrently --passthrough-arguments --kill-others \"yarn:watch --watchonly {1}\" yarn:app-python-devserver yarn:hashi-dev --", | |||
"devserver": "concurrently --passthrough-arguments --kill-others \"yarn:watch --watchonly {1}\" yarn:python-devserver yarn:hashi-dev --", | |||
"devserver-hot": "concurrently --passthrough-arguments --kill-others \"yarn:watch-hot --watchonly {1}\" yarn:python-devserver yarn:hashi-dev --", | |||
"devserver-with-kds": "concurrently --passthrough-arguments --kill-others \"yarn:watch --watchonly --kds-path={1}\" yarn:python-devserver yarn:hashi-dev --", | |||
"devserver-with-kds": "concurrently --passthrough-arguments --kill-others \"yarn:watch --watchonly --kds --kds-path={1}\" yarn:python-devserver yarn:hashi-dev --", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing that I think might be an issue here is that this seems like it will disallow the use of the baked-in --watchonly
call which can be passed a comma-separated list of plugins like so IIRC:
yarn devserver learn,coach
which will restrict the build process to those Kolibri plugins.
The --kds-path
is swallowing the entirety of what is passes in as the --watchonly
option will never receive any user input.
So we cannot call yarn devserver-with-kds learn,coach
to only build those plugins because the resulting call will be
kolibri-tools build dev --file ./build_tools/build_plugins.txt --cache --watchonly --kds-path=learn,coach
Perhaps we can maintain the functionality by changing this line to:
"devserver-with-kds": "concurrently --passthrough-arguments --kill-others \"yarn:watch --watchonly={2} --kds --kds-path={1}\" yarn:python-devserver yarn:hashi-dev --"
(note the ={2}
added after --watchonly
)
In this case, we can call: yarn devserver-with-kds ../path/to/kds learn,coach
which would result in this call:
kolibri-tools build dev --file ./build_tools/build_plugins.txt --cache --watchonly=learn,coach --kds-path=../path/to/kds
And this should fix the issue here.
packages/kolibri-tools/lib/cli.js
Outdated
@@ -226,8 +227,15 @@ program | |||
list, | |||
[] | |||
) | |||
.option('--kds', 'Flag to use local kds', false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that maybe the description here isn't entirely true. You don't need this flag to run with local KDS but rather you just need this flag if you want to get errors related to your attempts to use local KDS.
It might be better to call this something like --require-kds-path
to better indicate what it is really doing.
packages/kolibri-tools/lib/cli.js
Outdated
.option('--kds-path <kdsPath>', 'Full path to local kds directory', String, '') | ||
.action(function(mode, options) { | ||
if (options.kds) { | ||
if (!options.kdsPath) { | ||
cliLogging.error('Path to the local KDS directory not specified.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think updating this to indicate why the error was received will help here. Like "The --require-kds-path flag was given but no --kds-path value was given. Please provide the local KDS directory" (or something like that).
Hi @nucleogenesis. Thanks for your suggestions. I've made all the required changes as requested. Can you please go through them once and check if there are any more changes needed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @KshitijThareja !
I've tested the failed state and got the error as expected.
I also tested by updating KTextbox
in my and the files were being watched and rebuilt when I saved the file then I saw my changes:
I'll be drafting a follow-up issue re: the --watchonly
flag separately. I'm not super sure how best to begin addressing that issue at the moment.
@@ -26,7 +26,7 @@ | |||
"app-devserver": "concurrently --passthrough-arguments --kill-others \"yarn:watch --watchonly {1}\" yarn:app-python-devserver yarn:hashi-dev --", | |||
"devserver": "concurrently --passthrough-arguments --kill-others \"yarn:watch --watchonly {1}\" yarn:python-devserver yarn:hashi-dev --", | |||
"devserver-hot": "concurrently --passthrough-arguments --kill-others \"yarn:watch-hot --watchonly {1}\" yarn:python-devserver yarn:hashi-dev --", | |||
"devserver-with-kds": "concurrently --passthrough-arguments --kill-others \"yarn:watch --watchonly --kds-path={1}\" yarn:python-devserver yarn:hashi-dev --", | |||
"devserver-with-kds": "concurrently --passthrough-arguments --kill-others \"yarn:watch --watchonly={2} --require-kds-path --kds-path={1}\" yarn:python-devserver yarn:hashi-dev --", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking as I think this is probably out of scope of the issue you're trying to resolve here, so I'll make a follow-up issue after merging this.
But - I think that we'll need to do some tweaking because when I use the --watchonly
flag here with:
yarn devserver-with-kds path/to/kds user_auth
then the build system doesn't recognize whenever I make a change in KDS.
But when I don't pass in any plugins for the --watchonly
then the front-end rebuilds reactively to changes I make within KDS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that. And yes, it'd be better to have a follow-up for this issue so that it can be focussed on separately. I too am not sure how to move forward with it. I believe this is one important feature to have and requires separate attention.
e612388
into
learningequality:release-v0.16.x
Summary
This PR aims to make the
yarn run devserver-with-kds
command throw an error warning when KDS path is not provided while running it in the cli.References
#11632
Reviewer guidance
yarn run devserver-with-kds
command in the cli without specifying the path to the local kds.exit code 1
.Screenshot
Testing checklist
PR process
Reviewer checklist
yarn
andpip
)