Also I recommend using the new luvit-loader.lua shim instead of the luvit/require module for implementing luvit style package resolution. luvit-loader uses lua's native require instead of creating a fake environment and injecting globals into each module.
Of the 4 examples all but luvit/luvit now use luvit-loader. I havn't updated luvit itself since it would be a breaking change in some subtle ways that I'm not ready to deal with. -Tim On Thu, Mar 17, 2016 at 1:11 PM, Tim Caswell <[email protected]> wrote: > Looks like you're doing things right with the old luvi sandwich way. One > suggestion is use the lit assisted way. > > - Declare your dependencies in a package.lua file. If you want all of > luvit then simply add "luvit/luvit" to your deps. > - You'll also need "luvi" and "files" sections in your package.lua to have > finer control of which files are included and what version of luvi is > embedded. > > Once you have your app with `main.lua` and `package.lua` in the root, use > lit to build it. > > lit make path/to/app path/to/target/binary > > You don't even need to `lit install` to create the local deps folder, `lit > make ...` will fetch any missing dependencies and include them in the > generated luvi+zip file. > > See some examples of luvi apps that use the lit workflow: > > - luvit - https://github.com/luvit/luvit > - lit - https://github.com/luvit/lit > - wscat - https://github.com/creationix/wscat > - simple-http-server - https://github.com/creationix/simple-http-server > > Also note that these are all published to lit as applications as well, so > if you want to just use them, the `lit make ...` command takes lit urls: > > lit make lit://creationix/wscat /usr/local/bin/wscat > lit make lit://creationix/simple-http-server > /usr/local/bin/simple-http-server > > > If you can't use lit for some reason, then it looks like you're doing it > right, feel free to file a github issue against luvi. There may have been > a regression since this style isn't used much anymore. > > On Tue, Mar 15, 2016 at 11:33 AM, develephant <[email protected]> > wrote: > >> Hi, >> >> Hopefully this will be a simple one. I'm using Luvi with a Luvit layer >> and a "MyLib" layer (for example purposes). >> >> When I'm building apps using straight Luvi and an "app" directory, I have >> access to the main.lua entrypoint. >> >> But I'm not sure how to work with the "main.lua" doing the >> Luvi/Luvit/"MyLib" way. >> >> I tried creating main.lua in a 'deps' folder in the MyLib directory/layer >> but it didn't seem to respond to that. >> >> I used this code on the Luvi GitHub as a reference: >> >> # Run an app that layers on top of luvit >> luvi path/to/app path/to/luvit -o /path/to/target >> >> Obviously I've also added the output flag. >> >> Out of curiosity, do these paths need to be full paths, or can they be >> relative? >> >> Thanks in advance for any tips. >> >> Cheers. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "luvit" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "luvit" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
