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

Add filter for Windowe #174

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

Michael-RealT
Copy link

when we run nprr or nprr Something, we get the error: "Error: No scripts available"
this is caused by the "parse-cmd.js" script which in the "params" variable contains in my case 2 system links:
C:\Program Files\nodejs\node.exe
C:\Users\USERNAME\AppData\Roaming\npm\node_modules\nprr\src\bin.js

when the script looks in the script names of the pakage.json it looks for the first element here C:\Program Files\nodejs\node.exe which results in the error.

So I added a filter that checks if the elements of "params" start with "[a-zA-Z]:", to remove them.

the modification has no impact on other OS than Windwos, I test if it is Windows if not it is to be ignored

when we run nprr or nprr Something, we get the error: "Error: No scripts available"
this is caused by the "parse-cmd.js" script which in the "params" variable contains in my case 2 system links:
C:\\Program Files\\nodejs\\node.exe
C:\\Users\\USERNAME\\AppData\\Roaming\\npm\\node_modules\\nprr\\src\\bin.js

when the script looks in the script names of the pakage.json it looks for the first element here C:\\Program Files\\nodejs\\node.exe which results in the error.

So I added a filter that checks if the elements of "params" start with "[a-zA-Z]:\", to remove them.

the modification has no impact on other OS than Windwos, I test if it is Windows if not it is to be ignored
@NoriSte
Copy link
Owner

NoriSte commented May 25, 2022

Hey @Michael-RealT !! Thank you for the PR!! It's all nice, could you please enrich the comment left in the code? Essentially, moving most of the description of the PR to the parse-cmd file. I think it would be easier to read the motivations straight in the file, rather than jumping on this PR.

What do you think?

@Michael-RealT
Copy link
Author

Hello, not sure to understand how and what you want to put in the script as a comment.

I suggest that you add what you think is useful, English is not a language that I master, the text will therefore be clearer from you, what do you think?

@NoriSte
Copy link
Owner

NoriSte commented Jul 8, 2022

Hello, not sure to understand how and what you want to put in the script as a comment.

I suggest that you add what you think is useful, English is not a language that I master, the text will therefore be clearer from you, what do you think?

Hey Michael! Sorry for taking so long!! Sure, I'll do that! Just one question, so be completely sure I can add the correct tests: params in your case contains also C:\Program Files\nodejs\node.exe and C:\Users\USERNAME\AppData\Roaming\npm\node_modules\nprr\src\bin.js at which position? Before everything? I'd like to punctually remove them, from the correct position because something like C:\Users\... could also be an option voluntarily passed by the developer.

@Michael-RealT
Copy link
Author

here is the output with my commented and functional code.

image
image

Do not hesitate if you need any further information

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

Successfully merging this pull request may close these issues.

2 participants