jakejs / jake

JavaScript build tool, similar to Make or Rake. Built to work with Node.js.
http://jakejs.com
Apache License 2.0
1.97k stars 190 forks source link

'flow-node --use_strict <path>/jake/bin/cli.js' fails because of 'utilities' #347

Open GezzMC opened 6 years ago

GezzMC commented 6 years ago

This is only a problem if you want it to be. Instead of --use_strict, I put "use strict"; in my jakefiles.

I explain what I'm doing, so you know some of what people are doing with Jake.

I'm using flow check to check my typing in Jakefiles, so that's how this comes about. Instead of running jakefiles with your .bin/jake.cmd, I use a command like this:

flow-node "<path to jake>/jake/bin/cli.js" -f foo_jakefile.js

Since I'm running things direct, I go ahead and try:

flow-node --use_strict <path to jake>/jake/bin/cli.js -f foo_jakefile.js

Errors start to crop up do to the utilities package. I started to hunt them down and make changes, but one problem is that there's more than one node_modules/utilities folder. So, I quit trying to fix things that way.

With flow check, it wants to resolve the use of functions desc and task in a Jakefile, so I import, like const jake = require("jake"), and then use jake.desc and jake.task.

That makes flow happy, but I still end up having to make exceptions for Jake, rather than run it like a normal Node module.

For example, I have a simple JS file that imports 20 or so modules, to test that they're in the right path. In that file, I can't do a const jake = require("jake") because my general node command is node --use_strict.

There's not a problem. But I have big plans for Jake, to do a lot of JavaScript in a Jake file, thus the reason for using Flow with Jake.

Thanks.

mde commented 6 years ago

Is this an issue with the utilities module? Might be worth updating utilities to work better with strict mode.

GezzMC commented 6 years ago

Thanks for the reply.

I suppose utilities is one of the culprits that prevents the use of --use_strict, but I don't do global installs of modules, or tweak the default downloads of dependencies. I let different packages download whatever packages they specify.

My general mode of operation is to figure out how to use a package as is without doing any mods, such as fixing dependencies. There could be other packages that also don't work with --use_strict.

How it is is okay with me.