Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Nether OneScript - Deploying a JS package from ...

Nether OneScript - Deploying a JS package from Composer

This will step through how to deploy Javascript installed via Composer with oneScript.

Bob Majdak Jr

July 20, 2015
Tweet

More Decks by Bob Majdak Jr

Other Decks in Programming

Transcript

  1. I wanted to be able to install my Javascript assets

    with Composer for PHP. It is the only package manager outside of apt-get that I like. I do not like bolting bunches of different package manager and build systems together, either, which means bower and npm are out of the question here. The problem is obviously Composer wasn’t designed to handle this, it deals with things like PHP autoloaders to keep the private package files private in the vendor directory. But, everything about Composer is good enough to handle this just fine. Lets go ahead and install the only truely managable Javascript package existing in Packagist (at the time of this writing) with Composer and deploy it with OneScript.
  2.  $ composer install netherjs/nui  This will automatically bring

    in the NUI toolkit as well as Nether OneScript. Lets pretend our project is /opt/website with the public root of /opt/website/www, and we want to deploy NUI into /opt/website/www/share/nui  $ php vendor/bin/nether-onescript build vendor/netherjs/nui --deploy=www/share/nui  Any time NUI updates you can just re-deploy it with that OneScript command.  This provides the accessible /share/nui/nui.js for your frontend.
  3. This worked because netherjs/nui provided a onescript.json file. There is

    actually nothing special about this particular onescript.json, it is almost all default. { "Directories": [ "plugins“ ], "DistDir": "dist", "Extensions": [ "js“ ], "Files": [ "nui-main.js", "nui-traits.js", "nui-util.js“ ], "OutputFile": "nui.js", } It builds, then brings the dist directory of the build into the public space. The package already had the CSS and any image resources in the dist directory prior to building, so everything it needs is found in /share/nui afterwards. (With the exception of jQuery: https://t.co/LILo01MgVF)
  4. about  site: http://nether.io  repository: http://github.com/netherphp/onescript http://github.com/netherjs/nui  developer:

    bob majdak jr <[email protected]> @bobmajdakjr all components of the nether framework are released under the bsd 3-clause licence.