qooxdoo-compiler
qooxdoo-compiler copied to clipboard
Add (npm) scripts to a qooxdoo app
@derrell and I have talked about how to most efficiently add external non-qooxdoo libraries to qooxdoo applications. Here is what we came up with. We add two commands:
-
qx add script path/to/script.js [--path=<resource path, defaults to source/resource/js>]
: adds a script to the application setup (copying it into resources, adapting theexternalResources
in Manifest.json) -
qx add npm-package <npm package name> [—entry=<entry script, defaults to browser.js>]
, which does the following:
- npm install
- look for the entry script (default:browser.js)
- calls webpack with the option to create a bundle named as the npm package, which will be exposed as a global variable with the name of the npm package (dashes converted to underscores)
- calls
qx add script <bundle file>
for example, if you need a JsonRpc client (that was the initial question), you could do qx add npm-package raptor-client
to install https://github.com/LinusU/raptor-client and then, in your qooxdoo code, you can do let raptor = window.raptor_client; let client = new raptor(url)...
The idea here is that any browserify-able or webpack-able NPM package can be trivially added to a desktop qx app, and used. That would greatly expand the available capabilities for a qx app.
Great idea. Would make adding npm packages much more easy Needs an option to update the Version in some kind