-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Hotfix/scoped package support #3453
Hotfix/scoped package support #3453
Conversation
…otfix/scoped-package-support # Conflicts: # package.json
Hi @daankets, I'm waiting for your feedback about my comments, I think tests will passed after some changes. Thank you for your contribution ! |
@wallet77 Where can I find these comments?? I didn't get any notification nor can I find anything in this thread... |
@@ -18,7 +18,7 @@ describe('Utility', function() { | |||
assert(Utility.getCanonicModuleName('ma-zal/pm2-slack') === 'pm2-slack'); | |||
assert(Utility.getCanonicModuleName('ma-zal/pm2-slack#own-branch') === 'pm2-slack'); | |||
assert(Utility.getCanonicModuleName('pm2-slack') === 'pm2-slack'); | |||
assert(Utility.getCanonicModuleName('@org/pm2-slack') === 'pm2-slack'); | |||
assert(Utility.getCanonicModuleName('@org/pm2-slack') === '@org/pm2-slack'); |
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.
Could you just add a test with multiple @.
Like @org/[email protected]
Just to ensure we test all cases.
lib/Utility.js
Outdated
if(canonic_module_name.indexOf('@') !== -1) { | ||
canonic_module_name = canonic_module_name.split('@')[0]; | ||
//pm2 install @somescope/[email protected] | ||
if(canonic_module_name.lastIndexOf('@') !== 0) { |
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 we need to have > 0 instead of !==0.
Otherwise if you have a simple module name (without @, / etc) condition will be evaluated as true because lastIndexOf('@') will return -1.
This is why tests are failing.
Sorry my mistake, review wasn't submitted ;) |
- Additional test case for @scope/module@tag - Fixed a bug for checking the position of the last @ in the module name, that could trigger on -1.
@wallet77 I've updated the pull after your remarks (agree with both, but I did test the case with @scope/module@additionalTag though ;-)) |
lib/Utility.js
Outdated
@@ -223,12 +223,14 @@ var Utility = module.exports = { | |||
|
|||
//pm2 install username/module | |||
else if(canonic_module_name.indexOf('/') !== -1) { | |||
canonic_module_name = canonic_module_name.split('/')[1]; | |||
if (!canonic_module_name.startsWith("@")){ |
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.
Tests on 0.12 failed cause startsWidth is not supported :(
I think we should write test just like this :
if (canonic_module_name[0] !== "@"){
Yep, I got that. Didn’t immediately look at the Node versions. Will fix this.
… On 8 Feb 2018, at 11:56, Vincent Vallet ***@***.***> wrote:
@wallet77 commented on this pull request.
In lib/Utility.js <#3453 (comment)>:
> @@ -223,12 +223,14 @@ var Utility = module.exports = {
//pm2 install username/module
else if(canonic_module_name.indexOf('/') !== -1) {
- canonic_module_name = canonic_module_name.split('/')[1];
+ if (!canonic_module_name.startsWith("@")){
Tests on 0.12 failed cause startsWidth is not supported :(
I think we should write test just like this :
if (canonic_module_name[0] !== "@"){
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#3453 (review)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ACLKMQq-rFd6jZfw8CW8zYkQS_GxX5Xdks5tStLagaJpZM4R8Q1D>.
--
*Disclaimer*
This message is *confidential* and only intended for the originally
intended recipient(s). It may also be privileged or otherwise protected by
work product immunity or other legal rules. *If you think you have received
this message by mistake*, please let us know by e-mail reply and delete it
from your system; you must not copy this message or disclose its contents
to anyone other than the intended recipients.
|
@wallet77 The build now fails on Node 6 only, but I don't know the code base enough to understand why (without a hint). It's in the aggregator mocha tests. They rune fine on other node versions though. |
@wallet77 Just noticed they don't ALWAYS fail. If I rerun the tests on node 6, they succeed more than they fail. |
This test failed on the CI with node 6. However, it runs fine here (90% of the time)
|
@daankets if they passed one time then it's ok. |
@wallet77 Thanks. Any idea when the next release is planned? I can't wait to start using this feature ;-) |
No precise date for now but during February I think. |
…e-support Hotfix/scoped package support
Please always submit pull requests on the development branch.
This fix ensures that you can install scoped modules correctly. It's mainly a fix for the canonicalisation of the module name, when it has a form of
@scope/name
. Before, the routine that separated the module name separated at the last slash. Secondly, the module name was incorrectly split (assuming the@
was the start of a tag).Note: Never mind the 2nd commit. It was reverted during the merge. I originally tested locally with an increased hotfix version.