From 13fca38966267472353eefc8d3eff16811719fd8 Mon Sep 17 00:00:00 2001 From: Martin Broerse Date: Tue, 28 Mar 2017 11:38:02 +0200 Subject: [PATCH] Upgrade to ember-cli 2.12.0 --- .editorconfig | 14 --------- .eslintrc.js | 13 +++++++++ .gitignore | 4 +-- .jshintrc | 32 --------------------- .travis.yml | 13 +++++---- .watchmanconfig | 2 +- app/app.js | 8 +++--- app/index.html | 16 +++++------ app/resolver.js | 3 ++ app/router.js | 5 ++-- app/templates/application.hbs | 5 ++++ bower.json | 11 ------- config/environment.js | 20 ++++--------- ember-cli-build.js | 5 ++-- package.json | 40 +++++++++++++++----------- testem.js | 12 ++++++++ tests/helpers/destroy-app.js | 5 ++++ tests/helpers/module-for-acceptance.js | 23 +++++++++++++++ tests/helpers/resolver.js | 4 +-- tests/helpers/start-app.js | 12 +++----- tests/index.html | 32 ++++++++++----------- 21 files changed, 139 insertions(+), 140 deletions(-) create mode 100644 .eslintrc.js delete mode 100644 .jshintrc create mode 100644 app/resolver.js create mode 100644 app/templates/application.hbs create mode 100644 testem.js create mode 100644 tests/helpers/destroy-app.js create mode 100644 tests/helpers/module-for-acceptance.js diff --git a/.editorconfig b/.editorconfig index 47c5438..219985c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,22 +13,8 @@ insert_final_newline = true indent_style = space indent_size = 2 -[*.js] -indent_style = space -indent_size = 2 - [*.hbs] insert_final_newline = false -indent_style = space -indent_size = 2 - -[*.css] -indent_style = space -indent_size = 2 - -[*.html] -indent_style = space -indent_size = 2 [*.{diff,md}] trim_trailing_whitespace = false diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..fbfc364 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,13 @@ +module.exports = { + root: true, + parserOptions: { + ecmaVersion: 6, + sourceType: 'module' + }, + extends: 'eslint:recommended', + env: { + browser: true + }, + rules: { + } +}; diff --git a/.gitignore b/.gitignore index 86fceae..5ad14dd 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,5 @@ /connect.lock /coverage/* /libpeerconnection.log -npm-debug.log +npm-debug.log* testem.log diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 08096ef..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, - "esnext": true, - "unused": true -} diff --git a/.travis.yml b/.travis.yml index 66dd107..640f5e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,22 @@ --- language: node_js node_js: - - "0.12" + - "6" sudo: false cache: directories: - - node_modules + - $HOME/.npm + - $HOME/.cache # includes bowers cache before_install: - - export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH - - "npm config set spin false" - - "npm install -g npm@^2" + - npm config set spin false + - npm install -g bower phantomjs-prebuilt + - bower --version + - phantomjs --version install: - - npm install -g bower - npm install - bower install diff --git a/.watchmanconfig b/.watchmanconfig index 5e9462c..e7834e3 100644 --- a/.watchmanconfig +++ b/.watchmanconfig @@ -1,3 +1,3 @@ { - "ignore_dirs": ["tmp"] + "ignore_dirs": ["tmp", "dist"] } diff --git a/app/app.js b/app/app.js index 8d66b95..831ad61 100755 --- a/app/app.js +++ b/app/app.js @@ -1,16 +1,16 @@ import Ember from 'ember'; -import Resolver from 'ember/resolver'; -import loadInitializers from 'ember/load-initializers'; +import Resolver from './resolver'; +import loadInitializers from 'ember-load-initializers'; import config from './config/environment'; -var App; +let App; Ember.MODEL_FACTORY_INJECTIONS = true; App = Ember.Application.extend({ modulePrefix: config.modulePrefix, podModulePrefix: config.podModulePrefix, - Resolver: Resolver + Resolver }); loadInitializers(App, config.modulePrefix); diff --git a/app/index.html b/app/index.html index b81be2c..506785c 100644 --- a/app/index.html +++ b/app/index.html @@ -7,19 +7,19 @@ - {{content-for 'head'}} + {{content-for "head"}} - - + + - {{content-for 'head-footer'}} + {{content-for "head-footer"}} - {{content-for 'body'}} + {{content-for "body"}} - - + + - {{content-for 'body-footer'}} + {{content-for "body-footer"}} diff --git a/app/resolver.js b/app/resolver.js new file mode 100644 index 0000000..2fb563d --- /dev/null +++ b/app/resolver.js @@ -0,0 +1,3 @@ +import Resolver from 'ember-resolver'; + +export default Resolver; diff --git a/app/router.js b/app/router.js index cef554b..cdc2578 100755 --- a/app/router.js +++ b/app/router.js @@ -1,8 +1,9 @@ import Ember from 'ember'; import config from './config/environment'; -var Router = Ember.Router.extend({ - location: config.locationType +const Router = Ember.Router.extend({ + location: config.locationType, + rootURL: config.rootURL }); Router.map(function() { diff --git a/app/templates/application.hbs b/app/templates/application.hbs new file mode 100644 index 0000000..372fe27 --- /dev/null +++ b/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}} diff --git a/bower.json b/bower.json index 630ecc3..84a3993 100644 --- a/bower.json +++ b/bower.json @@ -1,16 +1,5 @@ { "name": "todos", "dependencies": { - "ember": "^2.1.0", - "ember-cli-shims": "ember-cli/ember-cli-shims#0.1.0", - "ember-cli-test-loader": "ember-cli-test-loader#0.2.0", - "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.6", - "ember-qunit": "0.4.10", - "ember-qunit-notifications": "0.0.7", - "ember-resolver": "~0.1.18", - "jquery": "^1.11.3", - "loader.js": "ember-cli/loader.js#3.2.1", - "qunit": "~1.18.0", - "moment": "^2.14.1" } } diff --git a/config/environment.js b/config/environment.js index db05809..b2f5941 100644 --- a/config/environment.js +++ b/config/environment.js @@ -1,15 +1,19 @@ -/* jshint node: true */ +/* eslint-env node */ module.exports = function(environment) { var ENV = { modulePrefix: 'todos', environment: environment, - baseURL: '/', + 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 } }, @@ -25,22 +29,10 @@ module.exports = function(environment) { // ENV.APP.LOG_TRANSITIONS = true; // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; // ENV.APP.LOG_VIEW_LOOKUPS = true; - - // alter the content security policy for dev - ENV.contentSecurityPolicy = { - 'default-src': "'none'", - 'script-src': "'self' 'unsafe-inline'", - 'font-src': "'self'", - 'connect-src': "'self'", - 'img-src': "'self' data:", - 'style-src': "'self' 'unsafe-inline'", - 'media-src': "'self'" - } } if (environment === 'test') { // Testem prefers this... - ENV.baseURL = '/'; ENV.locationType = 'none'; // keep test console output quieter diff --git a/ember-cli-build.js b/ember-cli-build.js index 1b57c78..c9be049 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -1,5 +1,5 @@ -/* global require, module */ -var EmberApp = require('ember-cli/lib/broccoli/ember-app'); +/* eslint-env node */ +const EmberApp = require('ember-cli/lib/broccoli/ember-app'); module.exports = function(defaults) { var app = new EmberApp(defaults, { @@ -18,7 +18,6 @@ module.exports = function(defaults) { // modules that you would like to import into your application // please specify an object with the list of modules as keys // along with the exports of each module as its value. - app.import('bower_components/moment/moment.js'); return app.toTree(); }; diff --git a/package.json b/package.json index 5c25987..12bbe48 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "todos", - "version": "1.13.0", + "version": "2.12.0", "description": "This is an example of the todo-mvc app, it aims to trail ember-cli and ember.js's latest stable conventions.", "private": true, "directories": { @@ -14,28 +14,34 @@ }, "repository": "https://github.com/ember-cli/ember-cli-todos.git", "engines": { - "node": ">= 0.10.0" + "node": ">= 4" }, "author": "", "license": "MIT", "devDependencies": { - "broccoli-asset-rev": "^2.2.0", - "ember-cli": "1.13.8", - "ember-cli-app-version": "1.0.0", - "ember-cli-babel": "^5.1.5", - "ember-cli-content-security-policy": "0.4.0", - "ember-cli-dependency-checker": "^1.0.1", - "ember-cli-htmlbars": "^1.0.0", - "ember-cli-htmlbars-inline-precompile": "^0.3.0", - "ember-cli-ic-ajax": "0.2.1", - "ember-cli-inject-live-reload": "^1.3.1", - "ember-cli-qunit": "^1.0.0", - "ember-cli-release": "0.2.6", - "ember-cli-sri": "^1.0.4", + "broccoli-asset-rev": "^2.4.5", + "ember-ajax": "^2.4.1", + "ember-cli": "2.12.0", + "ember-cli-app-version": "^2.0.0", + "ember-cli-babel": "^5.1.7", + "ember-cli-dependency-checker": "^1.3.0", + "ember-cli-eslint": "^3.0.0", + "ember-cli-htmlbars": "^1.1.1", + "ember-cli-htmlbars-inline-precompile": "^0.3.6", + "ember-cli-inject-live-reload": "^1.4.1", + "ember-cli-qunit": "^3.1.0", + "ember-cli-shims": "^1.0.2", + "ember-cli-sri": "^2.1.0", "ember-cli-uglify": "^1.2.0", - "ember-data": "^2.1.0", + "ember-data": "^2.12.0", + "ember-export-application-global": "^1.0.5", + "ember-load-initializers": "^0.6.0", + "ember-resolver": "^2.0.3", + "ember-source": "~2.12.0", + "loader.js": "^4.2.3", "ember-data-fixture-adapter": "1.13.0", "ember-disable-proxy-controllers": "^1.0.0", - "ember-export-application-global": "^1.0.4" + "ember-export-application-global": "^1.0.4", + "ember-cli-moment-shim": "3.0.0" } } diff --git a/testem.js b/testem.js new file mode 100644 index 0000000..b234048 --- /dev/null +++ b/testem.js @@ -0,0 +1,12 @@ +/* eslint-env node */ +module.exports = { + "test_page": "tests/index.html?hidepassed", + "disable_watching": true, + "launch_in_ci": [ + "PhantomJS" + ], + "launch_in_dev": [ + "PhantomJS", + "Chrome" + ] +}; diff --git a/tests/helpers/destroy-app.js b/tests/helpers/destroy-app.js new file mode 100644 index 0000000..c3d4d1a --- /dev/null +++ b/tests/helpers/destroy-app.js @@ -0,0 +1,5 @@ +import Ember from 'ember'; + +export default function destroyApp(application) { + Ember.run(application, 'destroy'); +} diff --git a/tests/helpers/module-for-acceptance.js b/tests/helpers/module-for-acceptance.js new file mode 100644 index 0000000..76996fd --- /dev/null +++ b/tests/helpers/module-for-acceptance.js @@ -0,0 +1,23 @@ +import { module } from 'qunit'; +import Ember from 'ember'; +import startApp from '../helpers/start-app'; +import destroyApp from '../helpers/destroy-app'; + +const { RSVP: { Promise } } = Ember; + +export default function(name, options = {}) { + module(name, { + beforeEach() { + this.application = startApp(); + + if (options.beforeEach) { + return options.beforeEach.apply(this, arguments); + } + }, + + afterEach() { + let afterEach = options.afterEach && options.afterEach.apply(this, arguments); + return Promise.resolve(afterEach).then(() => destroyApp(this.application)); + } + }); +} diff --git a/tests/helpers/resolver.js b/tests/helpers/resolver.js index 28f4ece..b208d38 100644 --- a/tests/helpers/resolver.js +++ b/tests/helpers/resolver.js @@ -1,7 +1,7 @@ -import Resolver from 'ember/resolver'; +import Resolver from '../../resolver'; import config from '../../config/environment'; -var resolver = Resolver.create(); +const resolver = Resolver.create(); resolver.namespace = { modulePrefix: config.modulePrefix, diff --git a/tests/helpers/start-app.js b/tests/helpers/start-app.js index 16cc7c3..9a605eb 100644 --- a/tests/helpers/start-app.js +++ b/tests/helpers/start-app.js @@ -1,19 +1,15 @@ import Ember from 'ember'; import Application from '../../app'; -import Router from '../../router'; import config from '../../config/environment'; export default function startApp(attrs) { - var application; - - var attributes = Ember.merge({}, config.APP); + let attributes = Ember.merge({}, config.APP); attributes = Ember.merge(attributes, attrs); // use defaults, but you can override; - Ember.run(function() { - 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 a886534..0e117fb 100644 --- a/tests/index.html +++ b/tests/index.html @@ -7,27 +7,27 @@ - {{content-for 'head'}} - {{content-for 'test-head'}} + {{content-for "head"}} + {{content-for "test-head"}} - - - + + + - {{content-for 'head-footer'}} - {{content-for 'test-head-footer'}} + {{content-for "head-footer"}} + {{content-for "test-head-footer"}} + {{content-for "body"}} + {{content-for "test-body"}} - {{content-for 'body'}} - {{content-for 'test-body'}} - - - - - + + + + + - {{content-for 'body-footer'}} - {{content-for 'test-body-footer'}} + {{content-for "body-footer"}} + {{content-for "test-body-footer"}}