dillonkearns / elm-typescript-interop

Generate TypeScript declaration files for your elm ports!
BSD 3-Clause "New" or "Revised" License
165 stars 13 forks source link

error message when called without --output is missing #1

Closed muelli closed 6 years ago

muelli commented 6 years ago

It seems that --output is mandatory.

Currently, the program fails like this:

➜ webapp git:(elm) ✗>~/yarn-v1.3.2/bin/yarn run elm-typescript-interop assets/elm/Main.elm 
yarn run v1.3.2
$ /tmp/webapp-elts/webapp/node_modules/.bin/elm-typescript-interop assets/elm/Main.elm
fs.js:642
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

TypeError: path must be a string or Buffer
    at TypeError (native)
    at Object.fs.openSync (fs.js:642:18)
    at Object.fs.writeFileSync (fs.js:1348:33)
    at Array.<anonymous> (/tmp/webapp-elts/webapp/node_modules/elm-typescript-interop/dist/bundle.js:86:12)
    at Function.onEffects [as func] (/tmp/webapp-elts/webapp/node_modules/elm-typescript-interop/dist/bundle.js:2830:19)
    at A3 (/tmp/webapp-elts/webapp/node_modules/elm-typescript-interop/dist/bundle.js:201:11)
    at onMessage (/tmp/webapp-elts/webapp/node_modules/elm-typescript-interop/dist/bundle.js:2613:12)
    at Object.callback (/tmp/webapp-elts/webapp/node_modules/elm-typescript-interop/dist/bundle.js:2655:11)
    at step (/tmp/webapp-elts/webapp/node_modules/elm-typescript-interop/dist/bundle.js:3192:32)
    at Timeout.work [as _onTimeout] (/tmp/webapp-elts/webapp/node_modules/elm-typescript-interop/dist/bundle.js:3234:15)
error Command failed with exit code 1.

Calling with --output makes it work.

It'd be nicer if it said that it requires the flag.

dillonkearns commented 6 years ago

Thanks for pointing this out @muelli, this feedback is super helpful. That is a confusing message and should be a pretty easy fix.

dillonkearns commented 6 years ago

This is resolved now! See the changelog for npm version 0.0.5.

Thank you!

pnaylor commented 4 years ago

--output flag doesn't even seem available in the latest version. Can we still specify the target for the definition file? Much appreciated!