-
Notifications
You must be signed in to change notification settings - Fork 12
format and test scripts generate SyntaxErrors #5
Comments
This seems to be a Windows-only problem. This is odd since Could you provide more information on your set up? |
Your right it's the windows shell lacking shebang support. Is it that problem where yarn/npm ends up treating/running the shell script as javascript? It looks like create-react-app and create-react-app-typescript are utilizing node-cross-spawn to handle this issue, but that's just a quick look. I'd have to look deeper into what they're doing. Pretty standard Windows 10 latest build, lots of ram, fast SSDs, on this Spectre x360 laptop. Specific environment I'm using...
|
Ah, mimssing shebang support makes lots of sense. I'll work on a fix, give me a few minutes 👍 |
Sure thing. Just reading the code/docs for node-cross-spawn. Specifically mentions node problems when using spawn on Windows: "Has an issue with command shims (files in node_modules/.bin/), where arguments with quotes and parenthesis would result in invalid syntax error". Looks promising. |
Waiting for tests to pass then publishing as v0.4.4. |
Published as v0.4.4, thank you for the report and the library suggestion! |
I tried out 0.4.5 this afternoon (nice work) and can confirm all scripts work without any issues on linux systems for me.
Some typo maybe in the format script? I'll take a quick look...
|
Reopening this issue. Does this also happen on the test script? |
Related issues:
Can you try running (from your base directory) |
Sure. I checked and prettier works fine...
In another noderize generated app, I'm using a quick work around. I've added a script to the noderize generated app's
It's manual, |
The
|
Anyway, I've started investigating the ways people have modified react-scripts for Typescript and I have time the next couple of days for learning more about this area and cross-platform issues in general. I've also been looking at some clever code in the typescript-starter project for handling command-line configuration pre-generation, and importantly, like this one, the option of using TypeScript or not. But I'm not crazy about question answers instead of options on the command-line when configuring for the output project generation (like yeoman generators do) so I still like the approach of react-scripts like in this project. I'm looking at customized versions like custom-react-scripts-ts as well. |
This specific bug is pretty weird. I'm not very well versed in Windows, so would need to re-setup my Windows workstation to try to debug this. If anyone has any experience with this, please let me know, and we can work together on fixing this! |
I have time today and tomorrow to look into it. and can let you know if I find a resolution. |
The core issue seems to come down to Since And in order to use this cross platform (i.e. Linux, Mac and Windows), you need to change the path from the form:
to the full location and adding the .js file extension:
At least that's my current understanding of the issue. |
Yeah, that was my thinking too. I choose the .bin directory because it's a more generalized way to get the bins, and is package-agonistic. I think I'll have to force the use of each, or use there APIs (easy with Jest, less so with Prettier last time I checked).
If you wanna code up a solution, let me know, else I'll have a fix working within a day or two (busy with some other stuff right now, sorry!)
…-------- Original Message --------
On Mar 24, 2018, 13:20, Scott Wade wrote:
The core issue seems to come down to npm assuming the command passed to it is a JS file--somewhere in the complicated script calling script decomposition into commands and args at work here--this is however not true on Windows where npm wraps bin files in a .cmd file.
Since npm can not parse .cmd files--where our SyntaxError: issue is coming from--you need to reference the bin file manually in the package.json scripts section as part of a script.
And in order to use this cross platform (i.e. Linux, Mac and Windows), you need to change the path from the form:
node_modules/.bin/<some_name>
to the full location and adding the .js file extension:
node_modules/<some_name>/bin/<some_name>.js
At least that's my current understanding of the issue.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, [view it on GitHub](#5 (comment)), or [mute the thread](https://github.com/notifications/unsubscribe-auth/ACjHd7-QlWEu0jfRo0FO3UUTCZaU5_15ks5thoBSgaJpZM4SxHfM).
|
What setup do you recommend for running a development version of Noderize locally to work with? I'm having a problem with setting up a good debug workflow. Currently, I'm jumping through too many hoops and manual operations. And then how do you get |
I would say clone this main repo, go in To recap:
I definitely need to make a CONTRIBUTING.md file. Will do soon! |
Thanks! I'll be able to look into this again tonight. |
The |
My bad, try |
@sc0ttwad3 if you are still working on this, I've created a |
@Cretezy Thanks. Havent had as much time for anything past work, but with |
Seems reproducible with any new noderize app create, even after successful build/watch, initially running...
yarn format
generates a SyntaxError via@noderize\scripts\node_modules\.bin\prettier
and args handling?yarn test
generates a SyntaxError via@noderize\scripts\node_modules\.bin\jest
and args handling?The text was updated successfully, but these errors were encountered: