zenparsing / es6now

ECMAScript 6 to 5 Compiler and Runtime Environment
MIT License
29 stars 2 forks source link

Doesn't work on windows #19

Closed Bartvds closed 10 years ago

Bartvds commented 10 years ago

Looks like something is off when using on windows: the global install doesn't work. If I look at the content then iy looks a bit odd.

But I have a fix that works here, but then I cannot rebuild it properly:

I can make it work by manually taking a file from the npm install and paste in in my working directory, then setup my fix and then use npm install . -g to get a working global.

With this I can rebuild esparse too and run its test. But I cannot rebuild es6now, because I miss dependencies, see #18.

zenparsing commented 10 years ago

Thanks for looking into this. I haven't tested on Windows in some time. I'll take a look and correct the issue.

zenparsing commented 10 years ago

We need to rewrite bin/es6now so that NPM can create the correct wrapper on Windows.

http://stackoverflow.com/questions/10396305/npm-package-bin-script-for-windows

Task should be completed with 24 hours.

Bartvds commented 10 years ago

Cool, thanks for looking into it.

For your info: I used this script:

#!/usr/bin/env node

var path = require("path");
var args = [
    "--harmony",
    path.relative(process.cwd(), path.resolve(__dirname, "..", "build", "es6now.js"))
].concat(process.argv.slice(2));

require("child_process").spawn("node", args, { stdio: "inherit"});

I put it in the /bin directory as es6now (no extension), and linked that as bin from package.json. I moved it because it is the convention to have these bin command in the /bin folder.

Then I removed the old ./build/es6now and ./build/es6now.cmd (npm will create it).

Then I got rid of the ./buiild/main.js and instead put that command in a npm script element in in package.json (so you'd do like npm run build).

Also the es6now.js bin command can't work on windows (because the dot), so I removed that too, only use the es6now.

zenparsing commented 10 years ago

This is going to be slightly more tricky, since I still want to run node with the --harmony flag, but I don't want to have to spawn off a new Node process. Should have an update by tomorrow.

Bartvds commented 10 years ago

Cool.

Not exactly sure what you're trying to do, but you can also look into using process.execArgv to check if the current node context doesn't have --harmony, and only spawn if it doesn't:

http://nodejs.org/api/process.html#process_process_execargv

zenparsing commented 10 years ago

Just published a new version (0.7.9) and tested "install -g" on Mac, Ubuntu, and Win7. Can you please give it a try and let me know how it goes?

zenparsing commented 10 years ago

I'm going to close this. Please reopen the issue if you see any problems with installation.