angelozerr / tern.jsduck

Tern Plugin for ExtJS, CKEditor
MIT License
9 stars 3 forks source link

Publishing tern-extjs ? #4

Open fflorent opened 8 years ago

fflorent commented 8 years ago

It would be nice to offer a module named tern-extjs in npm. This module could offer an option to specify the version for which we could offer completion. Something like :

{
  "plugins": {
    "extjs": {
      "version": "5.1.1"
    }
  }
}

Also maybe for CKEditor too.

Florent

angelozerr commented 8 years ago

At first ternjs doesn't support version. See https://github.com/ternjs/tern/issues/441

The easy mean is to create a tern-extjs which provides the last version of Ext.js only. If you wish to support we need to dispatch to the well version of Ext.js but never done that and is it working easy with browser?

fflorent commented 8 years ago

Actually, I had in mind what Marijn explained:

Or, probably better, create a single plugin and allow an option to be passed to it to specify which version of the library to use.

So the code would look like this:

// assumed we extracted the version from the preferences specified in the JSON file.
version = version || DEFAULT_VERSION; // default: 5.1.2
if (['4.2.1', '5.0.0', '5.1.2'].indexOf(version) === -1) {
  throw new Error('unsupported version');
}
var plugin = require('./ext/extjs_' + version);
...
angelozerr commented 8 years ago

Yes I see but it will work only for node context and not for browser context.

fflorent commented 8 years ago

Indeed. Also I wonder what would be the main use case of the plugin, as they weigh 11.5Mb.

(I just realized how big these files are. I have contributed to the increasing of the weigh with the addition of the !definition's :S, which are copied from the class prototype definitions... I am opening an issue to see if there are cleverer things to do for that)