luvit / lit

Toolkit for developing, sharing, and running luvit/lua programs and libraries.
http://lit.luvit.io/
Apache License 2.0
245 stars 58 forks source link

How to update a package to a newer version with lit #132

Closed cyrilis closed 8 years ago

cyrilis commented 8 years ago

Hi there,

I want to update my dependency packages to newer versions, so I edited the package.lua from:

dependencies = {
    "cyrilis/luvit-mongodb@0.0.3",
    -- ...
}

to:

dependencies = {
    "cyrilis/luvit-mongodb@0.0.4",
    -- ...
}

Then I run lit install under project directory, it outputs:

lit version: 2.2.13
luvi version: v2.3.5
command: install
load config: /Users/Cyril/.litconfig
version conflict: luvit-mongodb 0.0.3 ~= 0.0.4
including dependency: luvit-mongodb (/Users/Cyril/Code/hurricane/deps/luvit-mongodb/)
including dependency: mooncake (/Users/Cyril/Code/hurricane/deps/mooncake/)
done: success

And it seems not installed version 0.0.4.

So, how should I update package with lit, I have to remove deps/<packageName> manually before lit install ?

Thanks.

creationix commented 8 years ago

Yes, the recommended practice is to manually remove the local dep and run lit install again.

cyrilis commented 8 years ago

@creationix Thanks for your reply.

creationix commented 8 years ago

The reason for this is because lit has a policy of never overwriting code in the deps and libs folders (this was set before they were split into two folders). Now that we have deps and libs, it would make sense to allow changing-in-place for deps/* and only honor libs/* as special and higher priority. Thus deps/* would be owned by lit and libs/* would be owned by the app author. To do this I need to migrate luvit's and lit's own deps to some other home or their workflows will be wrecked, but I think it's worth it in the long run so people can have in-place upgrades without having to rm -rf deps first.

creationix commented 8 years ago

That said, it's really not that hard to rm -rf deps when you want to update, we could even add a new command that does this for you. I just remembered that moving the modules out of deps in lit and luvit would break their workflows since they assume the packages are in the place that lit installs them. (insert joke about breaking obscure workflows)

squeek502 commented 8 years ago

Would prompting for overwriting during lit install be a good compromise solution?

Something like:

lit version: 2.2.13
luvi version: v2.3.5
command: install
load config: /Users/Cyril/.litconfig
version conflict: luvit-mongodb 0.0.3 ~= 0.0.4
overwrite luvit-mongodb 0.0.3 with luvit-mongodb 0.0.4? y/n: 
creationix commented 8 years ago

@squeek502 that might work, I think that same code path is also used for things that wouldn't want the prompt, but I suppose we could add yet another flag.

squeek502 commented 8 years ago

Could also keep the default functionality the same and add an --overwrite flag.