-
Notifications
You must be signed in to change notification settings - Fork 8
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
Fix: update db utils script to reflect new architecture #289
Fix: update db utils script to reflect new architecture #289
Conversation
f1468ca
to
dbdce2c
Compare
I was planning to change the JS script into typescript, but apparently, it's a bit more complex to have a CLI in typescript, so I'll do that in another PR. Update: there's also |
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'm wondering if /src is really the best place... maybe add a directory /src/scripts to make it clear that it's not part of the application code?
apart from that LGTM
@PascalinDe since it's a small script, I was thinking about renaming it to What do you think? |
sounds great! |
web/backend/src/dbUtils.js
Outdated
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.
To add to @PascalinDe 's comments and your suggestion to rename this cli.js
, I'd like to bring up the NPM convention of having a bin/
folder and defining it in the bin
key in the package.json, with a shebang at the top. This would allow the usage of npx
, which is always nice.
For references:
https://docs.npmjs.com/cli/v9/configuring-npm/package-json#bin
https://blog.shahednasser.com/how-to-create-a-npx-tool/
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.
Obviously this could be in a follow up PR and not now :-)
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.
Check it out.. now it's npx cli addAdmin --sciper 123
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.
now that it is merged, can you update README.docker as well? thanks!
This makes it easier to identify this script as part of the source code. Also, it's easier to make the src folder as a volume for docker compose for realtime update of the contents while the container is running.
the script is not executing properly in the Docker image:
I'm not very familiar with JavaScript, maybe it's not meant to be run like this? can you please clarify? |
7cbb9cf
to
ac4a3c7
Compare
@PascalinDe @pierluca I rebased the PR to include the docker changes made by @PascalinDe, and I'm now using a CLI library called CommanderJS to build a CLI. along with npx and node bin, it's a great combination to have a cli tool example: I hope you like it :) |
Pull Request Test Coverage Report for Build 5829454076
💛 - Coveralls |
ac4a3c7
to
8e94ea6
Compare
8e94ea6
to
33da8d3
Compare
Kudos, SonarCloud Quality Gate passed! |
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.
can you please update the README.docker as well?
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.
Very nice ! LGTM
Pull Request Test Coverage Report for Build 5829454076Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
The dbUtils script is outdated, and doesn't work with the current backend. I've adjusted the script, and tested it.
Currently, there's no tests, but it might be a good idea later to add some.
Reviewing each commit separately should provide a better idea of the logical sequence of changes.
ToDo:
cli.ts
closes #300