Page 1 of 1

Package Management: node-resolve-lua

Posted: Sat Dec 26, 2015 6:15 pm
by TechnoCat
Image
Image
Image

I made a way to manage dependencies and libraries with npm. It is decently cool.

Here are some reasons this is particularly cool:
  • npm will manage your modules locally per project. No more global modules!
  • Modules use semantically versioned so you can get the latest compatible version
  • npm is heavily maintained and tested
In the root of your project folder, install a module such as luadash with:

Code: Select all

$ npm install luadash
Then to use it:

Code: Select all

local __ = require("luadash")
 
function double (value)
  return value * 2
end
 
__.map(double, {1, 2, 3}) -- => {2, 4, 6}
Now here are some reasons this is not particularly cool:
  • There aren't really any Lua modules hosted on npm right now
  • npm isn't really a place to store Lua modules
  • Not particularly battle-tested
  • Requires Node.js to be installed to manage dependencies. Does not need to be installed to run your project