diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..2873e2f --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,13 @@ +module.exports = { + root: true, + parserOptions: { + ecmaVersion: 2017, + sourceType: 'module' + }, + extends: 'eslint:recommended', + env: { + browser: true + }, + rules: { + } +}; diff --git a/.gitignore b/.gitignore index 5ad14dd..8fa39a6 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,10 @@ /coverage/* /libpeerconnection.log npm-debug.log* +yarn-error.log testem.log + +# ember-try +.node_modules.ember-try/ +bower.json.ember-try +package.json.ember-try diff --git a/.npmignore b/.npmignore index fa8b147..889b2bf 100644 --- a/.npmignore +++ b/.npmignore @@ -8,7 +8,7 @@ .editorconfig .ember-cli .gitignore -.jshintrc +.eslintrc.js .watchmanconfig .travis.yml bower.json diff --git a/.travis.yml b/.travis.yml index 939753c..6e3a42f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,24 @@ --- language: node_js node_js: - - "stable" + # we recommend testing addons with the same minimum supported node version as Ember CLI + # so that your addon works for all apps + - "4" sudo: false cache: - directories: - - $HOME/.npm - - $HOME/.cache # includes bowers cache + yarn: true env: - - EMBER_TRY_SCENARIO=ember-lts-2.4 + # we recommend new addons test the current and previous LTS + # as well as latest stable release (bonus points to beta/canary) - EMBER_TRY_SCENARIO=ember-lts-2.8 + - EMBER_TRY_SCENARIO=ember-lts-2.12 - EMBER_TRY_SCENARIO=ember-release - EMBER_TRY_SCENARIO=ember-beta - EMBER_TRY_SCENARIO=ember-canary + - EMBER_TRY_SCENARIO=ember-default matrix: fast_finish: true @@ -23,14 +26,15 @@ matrix: - env: EMBER_TRY_SCENARIO=ember-canary before_install: - - npm config set spin false - - npm install -g bower phantomjs-prebuilt - - bower --version + - curl -o- -L https://yarnpkg.com/install.sh | bash + - export PATH=$HOME/.yarn/bin:$PATH + - yarn global add phantomjs-prebuilt - phantomjs --version install: - - npm install - - bower install + - yarn install --no-lockfile --non-interactive script: - - node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO test --skip-cleanup + # Usually, it's ok to finish the test scenario without reverting + # to the addon's original dependency state, skipping "cleanup". + - node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO --skip-cleanup diff --git a/bower.json b/bower.json deleted file mode 100644 index ae7cc00..0000000 --- a/bower.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "ember-cli-swiper", - "dependencies": { - "ember": "~2.10.0", - "ember-cli-shims": "0.1.3", - "ember-qunit-notifications": "0.1.0" - } -} diff --git a/config/ember-try.js b/config/ember-try.js index c58516b..21f6079 100644 --- a/config/ember-try.js +++ b/config/ember-try.js @@ -1,25 +1,27 @@ -/*jshint node:true*/ +/* eslint-env node */ module.exports = { scenarios: [ { - name: 'ember-lts-2.4', + name: 'ember-lts-2.8', bower: { dependencies: { - 'ember': 'components/ember#lts-2-4' + 'ember': 'components/ember#lts-2-8' }, resolutions: { - 'ember': 'lts-2-4' + 'ember': 'lts-2-8' + } + }, + npm: { + devDependencies: { + 'ember-source': null } } }, { - name: 'ember-lts-2.8', - bower: { - dependencies: { - 'ember': 'components/ember#lts-2-8' - }, - resolutions: { - 'ember': 'lts-2-8' + name: 'ember-lts-2.12', + npm: { + devDependencies: { + 'ember-source': '~2.12.0' } } }, @@ -32,6 +34,11 @@ module.exports = { resolutions: { 'ember': 'release' } + }, + npm: { + devDependencies: { + 'ember-source': null + } } }, { @@ -43,6 +50,11 @@ module.exports = { resolutions: { 'ember': 'beta' } + }, + npm: { + devDependencies: { + 'ember-source': null + } } }, { @@ -54,6 +66,17 @@ module.exports = { resolutions: { 'ember': 'canary' } + }, + npm: { + devDependencies: { + 'ember-source': null + } + } + }, + { + name: 'ember-default', + npm: { + devDependencies: {} } } ] diff --git a/config/environment.js b/config/environment.js index 28a787b..012a412 100644 --- a/config/environment.js +++ b/config/environment.js @@ -1,4 +1,4 @@ -/*jshint node:true*/ +/* eslint-env node */ 'use strict'; module.exports = function(/* environment, appConfig */) { diff --git a/ember-cli-build.js b/ember-cli-build.js index 4ac3913..156e23f 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -1,9 +1,10 @@ -/*jshint node:true*/ -/* global require, module */ -var EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); +/* eslint-env node */ +'use strict'; + +const EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); module.exports = function(defaults) { - var app = new EmberAddon(defaults, { + let app = new EmberAddon(defaults, { // Add options here }); diff --git a/package.json b/package.json index 97b222d..c37f1b4 100644 --- a/package.json +++ b/package.json @@ -16,32 +16,30 @@ "url": "https://github.com/Suven/ember-cli-swiper" }, "engines": { - "node": ">= 0.12.0" + "node": "^4.5 || 6.* || >= 7.*" }, "author": "", "license": "MIT", "devDependencies": { "broccoli-asset-rev": "^2.4.5", - "ember-ajax": "^2.4.1", - "ember-cli": "2.10.1", - "ember-cli-app-version": "^2.0.0", + "ember-ajax": "^3.0.0", + "ember-cli": "~2.14.2", "ember-cli-dependency-checker": "^1.3.0", - "ember-cli-htmlbars-inline-precompile": "^0.3.3", + "ember-cli-eslint": "^3.0.0", + "ember-cli-htmlbars-inline-precompile": "^0.4.3", "ember-cli-inject-live-reload": "^1.4.1", - "ember-cli-jshint": "^2.0.1", - "ember-cli-qunit": "^3.0.1", - "ember-cli-release": "^0.2.9", + "ember-cli-qunit": "^4.0.0", + "ember-cli-shims": "^1.1.0", "ember-cli-sri": "^2.1.0", - "ember-cli-test-loader": "^1.1.0", "ember-cli-uglify": "^1.2.0", - "ember-data": "^2.10.0", - "ember-disable-prototype-extensions": "^1.1.0", - "ember-export-application-global": "^1.0.5", - "ember-load-initializers": "^0.5.1", - "ember-resolver": "^2.0.3", + "ember-disable-prototype-extensions": "^1.1.2", + "ember-export-application-global": "^2.0.0", + "ember-load-initializers": "^1.0.0", + "ember-resolver": "^4.0.0", "ember-sinon": "0.7.0", "ember-suave": "4.0.1", - "loader.js": "^4.0.10" + "ember-source": "~2.14.1", + "loader.js": "^4.2.3" }, "keywords": [ "ember-addon", @@ -50,13 +48,13 @@ "carousel" ], "dependencies": { - "ember-cli-babel": "^5.1.7", - "ember-cli-htmlbars": "1.1.1", + "ember-cli-babel": "^6.3.0", + "ember-cli-htmlbars": "^2.0.1", "swiper": "^3.4.2" }, "ember-addon": { - "configPath": "tests/dummy/config", "demoURL": "http://suven.github.io/ember-cli-swiper/", - "before": "ember-cli-sri" + "before": "ember-cli-sri", + "configPath": "tests/dummy/config" } } diff --git a/testem.js b/testem.js index 26044b2..f413516 100644 --- a/testem.js +++ b/testem.js @@ -1,13 +1,12 @@ -/*jshint node:true*/ +/* eslint-env node */ module.exports = { - "framework": "qunit", - "test_page": "tests/index.html?hidepassed", - "disable_watching": true, - "launch_in_ci": [ - "PhantomJS" + test_page: 'tests/index.html?hidepassed', + disable_watching: true, + launch_in_ci: [ + 'PhantomJS' ], - "launch_in_dev": [ - "PhantomJS", - "Chrome" + launch_in_dev: [ + 'PhantomJS', + 'Chrome' ] }; diff --git a/tests/.eslintrc.js b/tests/.eslintrc.js new file mode 100644 index 0000000..fbf2555 --- /dev/null +++ b/tests/.eslintrc.js @@ -0,0 +1,5 @@ +module.exports = { + env: { + embertest: true + } +}; diff --git a/tests/dummy/app/app.js b/tests/dummy/app/app.js index 3ab4e9f..23b9ad0 100644 --- a/tests/dummy/app/app.js +++ b/tests/dummy/app/app.js @@ -3,13 +3,11 @@ import Resolver from './resolver'; import loadInitializers from 'ember-load-initializers'; import config from './config/environment'; -let App; +const { Application } = Ember; Ember.MODEL_FACTORY_INJECTIONS = true; -const { Application } = Ember; - -App = Application.extend({ +const App = Application.extend({ modulePrefix: config.modulePrefix, podModulePrefix: config.podModulePrefix, Resolver diff --git a/tests/dummy/app/index.html b/tests/dummy/app/index.html index d5158f4..feba24e 100644 --- a/tests/dummy/app/index.html +++ b/tests/dummy/app/index.html @@ -9,17 +9,17 @@ {{content-for "head"}} - - + + {{content-for "head-footer"}}
{{content-for "body"}} - - + + {{content-for "body-footer"}} diff --git a/tests/dummy/app/router.js b/tests/dummy/app/router.js index 09b15f7..4e66555 100644 --- a/tests/dummy/app/router.js +++ b/tests/dummy/app/router.js @@ -1,14 +1,14 @@ import Ember from 'ember'; import config from './config/environment'; -const { Router: ERouter } = Ember; +const { Router } = Ember; -const Router = ERouter.extend({ +const router = Router.extend({ location: config.locationType, rootURL: config.rootURL }); -Router.map(function() { +router.map(function() { }); -export default Router; +export default router; diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index 703c472..251bdcb 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -1,9 +1,10 @@ -/* jshint node: true */ +/* eslint-env node */ +'use strict'; module.exports = function(environment) { - var ENV = { + let ENV = { modulePrefix: 'dummy', - environment: environment, + environment, rootURL: '/', locationType: 'auto', EmberENV: { diff --git a/tests/dummy/config/targets.js b/tests/dummy/config/targets.js new file mode 100644 index 0000000..df7664c --- /dev/null +++ b/tests/dummy/config/targets.js @@ -0,0 +1,9 @@ +/* eslint-env node */ +module.exports = { + browsers: [ + 'ie 9', + 'last 1 Chrome versions', + 'last 1 Firefox versions', + 'last 1 Safari versions' + ] +}; diff --git a/tests/helpers/module-for-acceptance.js b/tests/helpers/module-for-acceptance.js index 13ab70c..73b4c6f 100644 --- a/tests/helpers/module-for-acceptance.js +++ b/tests/helpers/module-for-acceptance.js @@ -3,7 +3,7 @@ import Ember from 'ember'; import startApp from '../helpers/start-app'; import destroyApp from '../helpers/destroy-app'; -const { RSVP: { Promise } } = Ember; +const { RSVP: { resolve } } = Ember; export default function(name, options = {}) { module(name, { @@ -18,7 +18,7 @@ export default function(name, options = {}) { afterEach() { let afterEach = options.afterEach && options.afterEach.apply(this, arguments); - return Promise.resolve(afterEach).then(() => destroyApp(this.application)); + return resolve(afterEach).then(() => destroyApp(this.application)); } }); } diff --git a/tests/helpers/start-app.js b/tests/helpers/start-app.js index a178638..9905e24 100644 --- a/tests/helpers/start-app.js +++ b/tests/helpers/start-app.js @@ -3,8 +3,6 @@ import Application from '../../app'; import config from '../../config/environment'; export default function startApp(attrs) { - let application; - // jscs:disable disallowDirectPropertyAccess let attributes = Ember.merge({}, config.APP); @@ -12,11 +10,10 @@ export default function startApp(attrs) { attributes = Ember.merge(attributes, attrs); // use defaults, but you can override; // jscs:disable disallowDirectPropertyAccess - Ember.run(() => { - application = Application.create(attributes); + return Ember.run(() => { + let application = Application.create(attributes); application.setupForTesting(); application.injectTestHelpers(); + return application; }); - - return application; } diff --git a/tests/index.html b/tests/index.html index 479d242..5209b85 100644 --- a/tests/index.html +++ b/tests/index.html @@ -21,7 +21,7 @@ {{content-for "body"}} {{content-for "test-body"}} - + @@ -30,3 +30,4 @@ {{content-for "body-footer"}} {{content-for "test-body-footer"}}