qooxdoo-compiler icon indicating copy to clipboard operation
qooxdoo-compiler copied to clipboard

Add (npm) scripts to a qooxdoo app

Open cboulanger opened this issue 7 years ago • 2 comments

@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:

  1. 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 the externalResources in Manifest.json)
  2. 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)...

cboulanger avatar Jan 16 '18 16:01 cboulanger

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.

derrell avatar Jan 16 '18 16:01 derrell

Great idea. Would make adding npm packages much more easy Needs an option to update the Version in some kind

hkollmann avatar Jan 16 '18 18:01 hkollmann