diff --git a/README.md b/README.md index 0d796b8..7051d84 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,11 @@ ember-jquery ============================================================================== Ember has been historically coupled to jQuery. As part of -[RFC294](https://github.com/emberjs/rfcs/blob/master/text/0294-optional-jquery.md#introduce-emberjquery-package) -jQuery has been made optional and this addon will explicitly add the jQuery integration functionality. +[RFC294](https://github.com/emberjs/rfcs/blob/master/text/0294-optional-jquery.md#introduce-emberjquery-package), +jQuery has been made optional. + +This addon makes jQuery available in an Ember project. It also provides the mechanism that implements jQuery +integration when that feature is enabled. Compatibility @@ -21,7 +24,7 @@ Installation ember install @ember/jquery ``` -You should also explicitly tell Ember to enable its jQuery integration: +If you also wish to enable Ember's jQuery integration, you must do so explicitly: ```bash ember install @ember/optional-features diff --git a/config/ember-try.js b/config/ember-try.js index e8be8c2..23b057c 100644 --- a/config/ember-try.js +++ b/config/ember-try.js @@ -41,6 +41,22 @@ module.exports = function() { } } }, + { + name: 'ember-lts-3.8', + npm: { + devDependencies: { + 'ember-source': '~3.8.0' + } + } + }, + { + name: 'ember-lts-3.12', + npm: { + devDependencies: { + 'ember-source': '~3.12.0' + } + } + }, { name: 'ember-release', npm: { diff --git a/index.js b/index.js index 4f203c7..8609ec3 100644 --- a/index.js +++ b/index.js @@ -10,24 +10,23 @@ module.exports = { const VersionChecker = require('ember-cli-version-checker'); let app = this._findHost(); - let optionalFeatures = app.project.findAddonByName("@ember/optional-features"); - + if (!app.vendorFiles || !app.vendorFiles['jquery.js']) { app.import('vendor/jquery/jquery.js', { prepend: true }); } app.import('vendor/shims/jquery.js'); + let optionalFeatures = app.project.findAddonByName("@ember/optional-features"); + let integrationTurnedOff = optionalFeatures && !optionalFeatures.isFeatureEnabled('jquery-integration'); + let checker = new VersionChecker(this); let ember = checker.forEmber(); - - if (ember.gte(EMBER_VERSION_WITH_JQUERY_DEPRECATION)) { + + if (ember.gte(EMBER_VERSION_WITH_JQUERY_DEPRECATION) && !integrationTurnedOff) { app.import('vendor/jquery/component.dollar.js'); } - if (optionalFeatures && !optionalFeatures.isFeatureEnabled('jquery-integration')) { - app.project.ui.writeDeprecateLine('You have disabled the `jquery-integration` optional feature. You now have to delete `@ember/jquery` from your package.json'); - } }, treeForVendor: function(tree) {