From e8278bf2a507f67169ae7a26a37e60f883d720b5 Mon Sep 17 00:00:00 2001 From: Richard Machielse Date: Mon, 14 May 2018 19:21:40 +0200 Subject: [PATCH] Upgrade packages --- .bowerrc | 4 -- .eslintrc.js | 58 ++++++++++++++++ .gitignore | 10 ++- .jshintrc | 32 --------- .npmignore | 7 +- .travis.yml | 38 +++++++--- addon/services/ember-cordova/splash.js | 8 +-- bower.json | 9 --- config/ember-try.js | 41 ++++++++--- config/environment.js | 1 - ember-cli-build.js | 8 +-- index.js | 1 - package.json | 84 +++++++++++++---------- testem.js | 31 ++++++--- tests/.jshintrc | 52 -------------- tests/dummy/app/app.js | 8 +-- tests/dummy/app/index.html | 4 +- tests/dummy/app/router.js | 4 +- tests/dummy/app/templates/application.hbs | 5 ++ tests/dummy/config/environment.js | 13 ++-- tests/dummy/config/targets.js | 8 +++ tests/helpers/destroy-app.js | 4 +- tests/helpers/module-for-acceptance.js | 6 +- tests/helpers/start-app.js | 17 +++-- tests/index.html | 2 +- tests/test-helper.js | 12 ++-- 26 files changed, 251 insertions(+), 216 deletions(-) delete mode 100644 .bowerrc create mode 100644 .eslintrc.js delete mode 100644 .jshintrc delete mode 100644 bower.json delete mode 100644 tests/.jshintrc create mode 100644 tests/dummy/app/templates/application.hbs create mode 100644 tests/dummy/config/targets.js diff --git a/.bowerrc b/.bowerrc deleted file mode 100644 index 959e169..0000000 --- a/.bowerrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "directory": "bower_components", - "analytics": false -} diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..64ad54d --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,58 @@ +module.exports = { + root: true, + parserOptions: { + ecmaVersion: 2017, + sourceType: 'module' + }, + plugins: [ + 'ember' + ], + extends: [ + 'eslint:recommended', + 'plugin:ember/recommended' + ], + env: { + browser: true + }, + rules: { + 'no-console': 'off' + }, + overrides: [ + // node files + { + files: [ + 'index.js', + 'testem.js', + 'ember-cli-build.js', + 'config/**/*.js', + 'tests/dummy/config/**/*.js' + ], + excludedFiles: [ + 'app/**', + 'addon/**', + 'tests/dummy/app/**' + ], + parserOptions: { + sourceType: 'script', + ecmaVersion: 2015 + }, + env: { + browser: false, + node: true + }, + plugins: ['node'], + rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, { + // add your custom rules and overrides for node files here + }) + }, + + // test files + { + files: ['tests/**/*.js'], + excludedFiles: ['tests/dummy/**/*.js'], + env: { + embertest: true + } + } + ] +}; diff --git a/.gitignore b/.gitignore index 86fceae..8fa39a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -# See http://help.github.com/ignore-files/ for more about ignoring files. +# See https://help.github.com/ignore-files/ for more about ignoring files. # compiled output /dist @@ -13,5 +13,11 @@ /connect.lock /coverage/* /libpeerconnection.log -npm-debug.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/.jshintrc b/.jshintrc deleted file mode 100644 index d421faa..0000000 --- a/.jshintrc +++ /dev/null @@ -1,32 +0,0 @@ -{ - "predef": [ - "document", - "window", - "-Promise" - ], - "browser": true, - "boss": true, - "curly": true, - "debug": false, - "devel": true, - "eqeqeq": true, - "evil": true, - "forin": false, - "immed": false, - "laxbreak": false, - "newcap": true, - "noarg": true, - "noempty": false, - "nonew": false, - "nomen": false, - "onevar": false, - "plusplus": false, - "regexp": false, - "undef": true, - "sub": true, - "strict": false, - "white": false, - "eqnull": true, - "esversion": 6, - "unused": true -} diff --git a/.npmignore b/.npmignore index fa8b147..135c7b1 100644 --- a/.npmignore +++ b/.npmignore @@ -7,10 +7,15 @@ .bowerrc .editorconfig .ember-cli +.eslintrc.js .gitignore -.jshintrc .watchmanconfig .travis.yml bower.json ember-cli-build.js testem.js + +# ember-try +.node_modules.ember-try/ +bower.json.ember-try +package.json.ember-try diff --git a/.travis.yml b/.travis.yml index a661550..5b24d5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,30 +1,46 @@ --- language: node_js node_js: + # we recommend testing addons with the same minimum supported node version as Ember CLI + # so that your addon works for all apps - "4" - - "6" - - "7" sudo: false +dist: trusty + +addons: + chrome: stable cache: directories: - - node_modules + - $HOME/.npm + +env: + global: + # See https://git.io/vdao3 for details. + - JOBS=1 + matrix: + # 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.12 + - EMBER_TRY_SCENARIO=ember-lts-2.16 + - EMBER_TRY_SCENARIO=ember-release + - EMBER_TRY_SCENARIO=ember-beta + - EMBER_TRY_SCENARIO=ember-canary + - EMBER_TRY_SCENARIO=ember-default matrix: fast_finish: true + allow_failures: + - env: EMBER_TRY_SCENARIO=ember-canary before_install: - npm config set spin false - - npm install -g bower phantomjs-prebuilt - - bower --version - - phantomjs --version - -install: - - npm install - - bower install + - npm install -g npm@4 + - npm --version script: + - npm run lint:js # 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:each --skip-cleanup + - node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO --skip-cleanup diff --git a/addon/services/ember-cordova/splash.js b/addon/services/ember-cordova/splash.js index 4dad261..04a2620 100644 --- a/addon/services/ember-cordova/splash.js +++ b/addon/services/ember-cordova/splash.js @@ -1,9 +1,5 @@ -import Ember from 'ember'; - -const { - Service, - isPresent -} = Ember; +import Service from '@ember/service'; +import { isPresent } from '@ember/utils'; export default Service.extend({ hide() { diff --git a/bower.json b/bower.json deleted file mode 100644 index 73dad3a..0000000 --- a/bower.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "ember-cordova-splash", - "dependencies": { - "ember": "~2.7.0", - "ember-cli-shims": "0.1.1", - "ember-qunit-notifications": "0.1.0", - "testdouble": "testdouble/testdouble.js#^1.4.2" - } -} diff --git a/config/ember-try.js b/config/ember-try.js index 014f603..1c31c54 100644 --- a/config/ember-try.js +++ b/config/ember-try.js @@ -1,20 +1,18 @@ -/*jshint node:true*/ module.exports = { scenarios: [ { - name: 'default', - bower: { - dependencies: { } + name: 'ember-lts-2.12', + npm: { + devDependencies: { + 'ember-source': '~2.12.0' + } } }, { - name: 'ember-1.13', - bower: { - dependencies: { - 'ember': '~1.13.0' - }, - resolutions: { - 'ember': '~1.13.0' + name: 'ember-lts-2.16', + npm: { + devDependencies: { + 'ember-source': '~2.16.0' } } }, @@ -27,6 +25,11 @@ module.exports = { resolutions: { 'ember': 'release' } + }, + npm: { + devDependencies: { + 'ember-source': null + } } }, { @@ -38,6 +41,11 @@ module.exports = { resolutions: { 'ember': 'beta' } + }, + npm: { + devDependencies: { + 'ember-source': null + } } }, { @@ -49,6 +57,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..0dfaed4 100644 --- a/config/environment.js +++ b/config/environment.js @@ -1,4 +1,3 @@ -/*jshint node:true*/ 'use strict'; module.exports = function(/* environment, appConfig */) { diff --git a/ember-cli-build.js b/ember-cli-build.js index 4ac3913..dc5a39e 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -1,9 +1,9 @@ -/*jshint node:true*/ -/* global require, module */ -var EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); +'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/index.js b/index.js index 0ec62e2..684c150 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,3 @@ -/* jshint node: true */ 'use strict'; module.exports = { diff --git a/package.json b/package.json index f503233..c549137 100644 --- a/package.json +++ b/package.json @@ -2,14 +2,18 @@ "name": "ember-cordova-splash", "version": "0.1.6", "description": "ember-cordova splash addon", - "homepage": "https://github.com/isleofcode/ember-cordova-splash", - "directories": { - "test": "tests" - }, + "keywords": [ + "ember-addon", + "cordova", + "crosswalk", + "phonegap", + "splash", + "splashscreen", + "ember cordova", + "ember-cordova", + "ember-cordova-splash" + ], "license": "MIT", - "engines": { - "node": ">= 0.10.0" - }, "author": { "name": "Alex Blom", "email": "alex@isleofcode.com", @@ -27,46 +31,52 @@ "url": "https://isleofcode.com" } ], + "homepage": "https://github.com/isleofcode/ember-cordova-splash", + "directories": { + "doc": "doc", + "test": "tests" + }, "repository": { "type": "git", "url": "git+https://github.com/isleofcode/ember-cordova-splash.git" }, - "keywords": [ - "ember-addon", - "cordova", - "crosswalk", - "phonegap", - "splash", - "splashscreen", - "ember cordova", - "ember-cordova", - "ember-cordova-splash" - ], "scripts": { + "build": "ember build", + "lint:js": "eslint ./*.js addon addon-test-support app config lib server test-support tests", + "start": "ember serve", "test": "ember try:each" }, + "dependencies": { + "ember-cli-babel": "^6.6.0", + "ember-cordova-installer": "^0.0.4" + }, "devDependencies": { - "broccoli-asset-rev": "^2.4.2", - "ember-cli": "2.11.1", - "ember-cli-app-version": "^2.0.0", - "ember-cli-dependency-checker": "^1.3.0", - "ember-cli-htmlbars": "^1.1.1", - "ember-cli-jshint": "^1.0.0", - "ember-cli-qunit": "^2.0.0", - "ember-cli-release": "^0.2.9", + "broccoli-asset-rev": "^2.4.5", + "ember-ajax": "^3.0.0", + "ember-cli": "~2.18.2", + "ember-cli-dependency-checker": "^2.0.0", + "ember-cli-eslint": "^4.2.1", + "ember-cli-htmlbars": "^2.0.1", + "ember-cli-htmlbars-inline-precompile": "^1.0.0", + "ember-cli-inject-live-reload": "^1.4.1", + "ember-cli-qunit": "^4.1.1", + "ember-cli-shims": "^1.2.0", "ember-cli-sri": "^2.1.0", - "ember-cli-test-loader": "^1.1.0", - "ember-cli-testdouble": "0.1.0", - "ember-cli-uglify": "^1.2.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", - "loader.js": "^4.0.1" + "ember-cli-testdouble": "^0.1.3", + "ember-cli-uglify": "^2.0.0", + "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-source": "~2.18.0", + "ember-welcome-page": "^3.0.0", + "eslint-plugin-ember": "^5.0.0", + "eslint-plugin-node": "^5.2.1", + "loader.js": "^4.2.3", + "testdouble": "^2.0.0" }, - "dependencies": { - "ember-cli-babel": "^5.1.6", - "ember-cordova-installer": "^0.0.4" + "engines": { + "node": "^4.5 || 6.* || >= 7.*" }, "ember-addon": { "configPath": "tests/dummy/config" diff --git a/testem.js b/testem.js index 26044b2..d1755a4 100644 --- a/testem.js +++ b/testem.js @@ -1,13 +1,24 @@ -/*jshint node:true*/ 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: [ + 'Chrome' ], - "launch_in_dev": [ - "PhantomJS", - "Chrome" - ] + launch_in_dev: [ + 'Chrome' + ], + browser_args: { + Chrome: { + mode: 'ci', + args: [ + // --no-sandbox is needed when running Chrome inside a container + process.env.TRAVIS ? '--no-sandbox' : null, + + '--disable-gpu', + '--headless', + '--remote-debugging-port=0', + '--window-size=1440,900' + ].filter(Boolean) + } + } }; diff --git a/tests/.jshintrc b/tests/.jshintrc deleted file mode 100644 index d2bd113..0000000 --- a/tests/.jshintrc +++ /dev/null @@ -1,52 +0,0 @@ -{ - "predef": [ - "document", - "window", - "location", - "setTimeout", - "$", - "-Promise", - "define", - "console", - "visit", - "exists", - "fillIn", - "click", - "keyEvent", - "triggerEvent", - "find", - "findWithAssert", - "wait", - "DS", - "andThen", - "currentURL", - "currentPath", - "currentRouteName" - ], - "node": false, - "browser": false, - "boss": true, - "curly": true, - "debug": false, - "devel": false, - "eqeqeq": true, - "evil": true, - "forin": false, - "immed": false, - "laxbreak": false, - "newcap": true, - "noarg": true, - "noempty": false, - "nonew": false, - "nomen": false, - "onevar": false, - "plusplus": false, - "regexp": false, - "undef": true, - "sub": true, - "strict": false, - "white": false, - "eqnull": true, - "esversion": 6, - "unused": true -} diff --git a/tests/dummy/app/app.js b/tests/dummy/app/app.js index 831ad61..b3b2bd6 100644 --- a/tests/dummy/app/app.js +++ b/tests/dummy/app/app.js @@ -1,13 +1,9 @@ -import Ember from 'ember'; +import Application from '@ember/application'; import Resolver from './resolver'; import loadInitializers from 'ember-load-initializers'; import config from './config/environment'; -let App; - -Ember.MODEL_FACTORY_INJECTIONS = true; - -App = Ember.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 5120bd7..61400b2 100644 --- a/tests/dummy/app/index.html +++ b/tests/dummy/app/index.html @@ -9,8 +9,8 @@ {{content-for "head"}} - - + + {{content-for "head-footer"}} diff --git a/tests/dummy/app/router.js b/tests/dummy/app/router.js index cdc2578..d0bb009 100644 --- a/tests/dummy/app/router.js +++ b/tests/dummy/app/router.js @@ -1,7 +1,7 @@ -import Ember from 'ember'; +import EmberRouter from '@ember/routing/router'; import config from './config/environment'; -const Router = Ember.Router.extend({ +const Router = EmberRouter.extend({ location: config.locationType, rootURL: config.rootURL }); diff --git a/tests/dummy/app/templates/application.hbs b/tests/dummy/app/templates/application.hbs new file mode 100644 index 0000000..1eac0a2 --- /dev/null +++ b/tests/dummy/app/templates/application.hbs @@ -0,0 +1,5 @@ +{{!-- The following component displays Ember's default welcome message. --}} +{{welcome-page}} +{{!-- Feel free to remove this! --}} + +{{outlet}} \ No newline at end of file diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index 2529939..182d3fc 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -1,15 +1,19 @@ -/* jshint node: true */ +'use strict'; module.exports = function(environment) { - var ENV = { + let ENV = { modulePrefix: 'dummy', - environment: environment, + environment, rootURL: '/', locationType: 'auto', EmberENV: { FEATURES: { // Here you can enable experimental features on an ember canary build // e.g. 'with-controller': true + }, + EXTEND_PROTOTYPES: { + // Prevent Ember Data from overriding Date.parse. + Date: false } }, @@ -36,10 +40,11 @@ module.exports = function(environment) { ENV.APP.LOG_VIEW_LOOKUPS = false; ENV.APP.rootElement = '#ember-testing'; + ENV.APP.autoboot = false; } if (environment === 'production') { - + // here you can enable a production-specific feature } return ENV; diff --git a/tests/dummy/config/targets.js b/tests/dummy/config/targets.js new file mode 100644 index 0000000..082e68b --- /dev/null +++ b/tests/dummy/config/targets.js @@ -0,0 +1,8 @@ +module.exports = { + browsers: [ + 'ie 9', + 'last 1 Chrome versions', + 'last 1 Firefox versions', + 'last 1 Safari versions' + ] +}; diff --git a/tests/helpers/destroy-app.js b/tests/helpers/destroy-app.js index c3d4d1a..e7f983b 100644 --- a/tests/helpers/destroy-app.js +++ b/tests/helpers/destroy-app.js @@ -1,5 +1,5 @@ -import Ember from 'ember'; +import { run } from '@ember/runloop'; export default function destroyApp(application) { - Ember.run(application, 'destroy'); + run(application, 'destroy'); } diff --git a/tests/helpers/module-for-acceptance.js b/tests/helpers/module-for-acceptance.js index 76996fd..90a93ba 100644 --- a/tests/helpers/module-for-acceptance.js +++ b/tests/helpers/module-for-acceptance.js @@ -1,10 +1,8 @@ import { module } from 'qunit'; -import Ember from 'ember'; +import { resolve } from 'rsvp'; import startApp from '../helpers/start-app'; import destroyApp from '../helpers/destroy-app'; -const { RSVP: { Promise } } = Ember; - export default function(name, options = {}) { module(name, { beforeEach() { @@ -17,7 +15,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 e098f1d..99d35dc 100644 --- a/tests/helpers/start-app.js +++ b/tests/helpers/start-app.js @@ -1,18 +1,17 @@ -import Ember from 'ember'; import Application from '../../app'; import config from '../../config/environment'; +import { merge } from '@ember/polyfills'; +import { run } from '@ember/runloop'; export default function startApp(attrs) { - let application; + let attributes = merge({}, config.APP); + attributes.autoboot = true; + attributes = merge(attributes, attrs); // use defaults, but you can override; - let attributes = Ember.merge({}, config.APP); - attributes = Ember.merge(attributes, attrs); // use defaults, but you can override; - - Ember.run(() => { - application = Application.create(attributes); + return 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 f7ff652..5209b85 100644 --- a/tests/index.html +++ b/tests/index.html @@ -21,7 +21,7 @@ {{content-for "body"}} {{content-for "test-body"}} - + diff --git a/tests/test-helper.js b/tests/test-helper.js index e6cfb70..0382a84 100644 --- a/tests/test-helper.js +++ b/tests/test-helper.js @@ -1,6 +1,8 @@ -import resolver from './helpers/resolver'; -import { - setResolver -} from 'ember-qunit'; +import Application from '../app'; +import config from '../config/environment'; +import { setApplication } from '@ember/test-helpers'; +import { start } from 'ember-qunit'; -setResolver(resolver); +setApplication(Application.create(config.APP)); + +start();