Coder Social home page Coder Social logo

Comments (8)

kentcdodds avatar kentcdodds commented on June 13, 2024 1

🎉 This issue has been resolved in version 1.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

from kcd-scripts.

adamdharrington avatar adamdharrington commented on June 13, 2024 1

nice one @kentcdodds !

from kcd-scripts.

rossipedia avatar rossipedia commented on June 13, 2024

Ok I'm not sure I understand what the problem is. The executable for Windows is the *.cmd file, which is a thin wrapper around invoking node.exe with pkg.bin.

For example, the contents of node_modules\.bin\webpack.cmd is:

@IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe"  "%~dp0\..\webpack\bin\webpack.js" %*
) ELSE (
  @SETLOCAL
  @SET PATHEXT=%PATHEXT:;.JS;=;%
  node  "%~dp0\..\webpack\bin\webpack.js" %*
)

and likewise, the contents of which.cmd is:

@IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe"  "%~dp0\..\which\bin\which" %*
) ELSE (
  @SETLOCAL
  @SET PATHEXT=%PATHEXT:;.JS;=;%
  node  "%~dp0\..\which\bin\which" %*
)

As you can see, they follow the same general format, the only thing differing is the path to the *.js file that node will execute.

This is required because in Windows, executable files are determined by file extension rather than a permissions bit as they are in *nix land.

The *.cmd file can be treated as the executable, and can be started via child_process.exec or child_process.spawn and it should just do the right thing.

from kcd-scripts.

rossipedia avatar rossipedia commented on June 13, 2024

Ok, I see what the issue is (I cloned the repo and ran the test suite). You might have to rethink the tests here, since the way Windows handles command lines / dir separators / executables is so different from *nix. Gotta run to the store, but I might take a crack at it later tonight.

from kcd-scripts.

kentcdodds avatar kentcdodds commented on June 13, 2024

Thanks for looking into it! If you have another suggestion let me know! I'm thinking that with the serializers I add we can normalize the paths so it's not an issue for tests, but I definitely want it to work the same as far as the implementation goes. I'd really love it to not have the full path to the executable if the executable exists in the PATH by its name already.

from kcd-scripts.

alexandernanberg avatar alexandernanberg commented on June 13, 2024

I might be missing something, but why not use npx to run the scripts instead? From what I've seen that should remove the need for the resolveBin util altogether.

from kcd-scripts.

kentcdodds avatar kentcdodds commented on June 13, 2024

Hmmm... Interesting thought. That might work! Would you like to give it a try?

from kcd-scripts.

alexandernanberg avatar alexandernanberg commented on June 13, 2024

Sure, I'll give it a go!

from kcd-scripts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.