snowkit / flow

flow
MIT License
63 stars 13 forks source link

Doesn't work with haxelib newrepo #64

Open kevinresol opened 7 years ago

kevinresol commented 7 years ago

Because it list haxelibs from the flow script folder not the project root. So it will the global haxelib instead of the local .haxelib folder.

https://github.com/snowkit/flow/blob/e8104275dbe994c147ec039494e2f7fd144c55bd/src/flow/project/prepare/depends.js#L60

ruby0x1 commented 7 years ago

If you can find documentation on the newrepo command I would take a look.

kevinresol commented 7 years ago

Here it is, but it doesn't tell much.

Basically the command itself does nothing more than creating a .haxelib folder at cwd.

The really interesting part is that when haxelib runs, it will search for .haxelib folder in cwd and, if it exists, use that as the haxelib path. The same applies on the haxe compiler (which uses haxelib to resolve paths I believe).

The tricky part is that the search for .haxelib only happens at cwd and will not "go up" the directory tree. So if flow runs haxelib-related things not at project root (where my .haxelib folder resides), it will be using the global haxelib path.

You can see how I used this to check-in the haxelib dependencies of an app as submodules. So people doing a git clone --recursive will get the exact version of dependencies: https://github.com/haxe-react/haxe-react-native-sample