Skip to content

Commit

Permalink
Merge pull request #111 from html-next/chore/upgrade-3-1
Browse files Browse the repository at this point in the history
Upgrade for ember 3.x; remove babel warning; remove bower;
  • Loading branch information
eriktrom authored Apr 21, 2018
2 parents 0021c72 + a815da7 commit 1e91271
Show file tree
Hide file tree
Showing 43 changed files with 2,129 additions and 1,554 deletions.
4 changes: 0 additions & 4 deletions .bowerrc

This file was deleted.

43 changes: 41 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,49 @@ module.exports = {
ecmaVersion: 2017,
sourceType: 'module'
},
extends: 'eslint:recommended',
plugins: [
'ember'
],
extends: [
'eslint:recommended',
'plugin:ember/recommended'
],
env: {
browser: true
},
rules: {
}
},
globals: {
"Hammer": true
},
overrides: [
// node files
{
files: [
'ember-cli-build.js',
'index.js',
'testem.js',
'config/**/*.js',
'tests/dummy/config/**/*.js'
],
excludedFiles: [
'addon/**',
'addon-test-support/**',
'app/**',
'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
})
}
]
};
7 changes: 6 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@
.bowerrc
.editorconfig
.ember-cli
.gitignore
.eslintrc.js
.gitignore
.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
25 changes: 14 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@ cache:
yarn: true

env:
# 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
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-lts-2.18
- EMBER_TRY_SCENARIO=ember-release
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary
- EMBER_TRY_SCENARIO=ember-default

matrix:
fast_finish: true
Expand All @@ -33,14 +38,12 @@ matrix:
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH
- yarn global add bower
- bower --version

install:
- yarn install --no-lockfile --non-interactive
- bower install

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:one $EMBER_TRY_SCENARIO --skip-cleanup
8 changes: 1 addition & 7 deletions addon/components/async-element.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import Ember from 'ember';
import { get, observer, computed } from '@ember/object';
import GestureArea from './gesture-element';

const {
computed,
observer,
get: get
} = Ember;


/**!
*
Expand Down
11 changes: 5 additions & 6 deletions addon/components/fast-action.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import Ember from 'ember';
import Component from '@ember/component';
import layout from '../templates/components/fast-action';
import { htmlSafe } from "@ember/string";

const { SafeString } = Ember.Handlebars;
export default Ember.Component.extend({
export default Component.extend({
layout: layout,

tagName: 'button',
attributeBindings: ['style', 'type'],
style: new SafeString('touch-action: manipulation; -ms-touch-action: manipulation;'),
style: htmlSafe('touch-action: manipulation; -ms-touch-action: manipulation;'),
type: 'button',
text: '',
action: '',
context: '',

click: function() {
this.sendAction('action', this.get('context'));
this.sendAction('action', this.get('context')); // eslint-disable-line
}

});
8 changes: 2 additions & 6 deletions addon/components/fast-async.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import Ember from 'ember';
import layout from '../templates/components/fast-async';
import asyncAction from './async-element';

const { SafeString } = Ember.Handlebars;
import { htmlSafe } from "@ember/string";

export default asyncAction.extend({

layout: layout,
tagName: 'button',
attributeBindings: ['style', 'disabled', 'type'],
style: new SafeString('touch-action: manipulation; -ms-touch-action: manipulation;'),
style: htmlSafe('touch-action: manipulation; -ms-touch-action: manipulation;'),
type: 'button',
text: '',
context: null

});

11 changes: 4 additions & 7 deletions addon/components/gesture-element.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import Ember from 'ember';
import { typeOf } from '@ember/utils';
import Component from '@ember/component';
import layout from '../templates/components/gesture-element';
import RecognizerMixin from '../mixins/recognizers';
import toCamel from '../utils/string/dasherized-to-camel';

const {
Component,
} = Ember;


function makeActionHandler(event, action) {

Expand All @@ -20,7 +17,7 @@ function makeActionHandler(event, action) {
target.send.apply(this, args);
} else {
args = this._getParams(event + 'Action');
this.sendAction.apply(this, args);
this.sendAction.apply(this, args); // eslint-disable-line
}

};
Expand Down Expand Up @@ -57,7 +54,7 @@ export default Component.extend(RecognizerMixin, {
if (v === 'toString') {
continue;
} // ignore useless items
if (Ember.typeOf(v) === 'function') {
if (typeOf(v) === 'function') {
continue;
}

Expand Down
16 changes: 6 additions & 10 deletions addon/components/slide-toggle.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import Ember from 'ember';
import { alias } from '@ember/object/computed';
import { run } from '@ember/runloop';
import { copy } from '@ember/object/internals';
import Component from '@ember/component';
import VelocityMixin from 'ember-velocity-mixin';
import RecognizerMixin from '../mixins/recognizers';
import layout from '../templates/components/slide-toggle';

const {
run,
copy,
computed,
Component
} = Ember;

const {
throttle,
debounce
Expand Down Expand Up @@ -64,7 +60,7 @@ export default Component.extend(RecognizerMixin, VelocityMixin, {
target.send(action, context);
} else {
action = action ? 'on-toggle' : defaultAction;
this.sendAction(action, context);
this.sendAction(action, context); // eslint-disable-line
}

}
Expand Down Expand Up @@ -113,7 +109,7 @@ export default Component.extend(RecognizerMixin, VelocityMixin, {

// setup unidirection flow if desired
if (!this.get('unidirectional')) {
this.set('_value', computed.alias('value'));
this.set('_value', alias('value'));
} else {
this.set('_value', copy(value, true));
}
Expand Down
24 changes: 12 additions & 12 deletions addon/event_dispatcher.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import { assert } from '@ember/debug';
import { getOwner } from '@ember/application';
import { merge, assign as _assign } from '@ember/polyfills';
import { isNone } from '@ember/utils';
import { get, set } from '@ember/object';
import Ember from 'ember';
import defaultHammerEvents from './hammer-events';
import dasherizedToCamel from './utils/string/dasherized-to-camel';
import jQuery from 'jquery';
import mobileDetection from './utils/is-mobile';

const {
EventDispatcher,
} = Ember;


let ROOT_ELEMENT_CLASS = 'ember-application';
let ROOT_ELEMENT_SELECTOR = '.' + ROOT_ELEMENT_CLASS;

Expand All @@ -16,17 +26,7 @@ const eventEndings = {
tap: []
};

const {
assert,
EventDispatcher,
getOwner,
merge,
isNone,
set,
get
} = Ember;

const assign = Ember.assign || merge;
const assign = _assign || merge;

export default EventDispatcher.extend({

Expand All @@ -39,7 +39,7 @@ export default EventDispatcher.extend({
*/
useFastPaths: false,
useCapture: false,

_gestures: null,
_initializeGestures() {
const list = getModuleList();
Expand Down
16 changes: 6 additions & 10 deletions addon/mixins/recognizers.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import Ember from 'ember';

const {
computed,
getOwner,
inject,
Mixin,
on
} = Ember;
import { inject as service } from '@ember/service';
import { computed } from '@ember/object';
import { getOwner } from '@ember/application';
import Mixin from '@ember/object/mixin';
import { on } from '@ember/object/evented';

export default Mixin.create({

'-gestures': inject.service('-gestures'),
'-gestures': service('-gestures'),

__fastboot: computed(function() {
let owner = getOwner(this);
Expand Down
2 changes: 1 addition & 1 deletion addon/registry-walker.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function ViewWalker(registry) {
if (closest.hasAttribute('data-ember-action')) {
return ['action', closest];
}
} while (closest = closest.parentNode);
} while (closest = closest.parentNode); // eslint-disable-line

return null;
};
Expand Down
12 changes: 4 additions & 8 deletions addon/services/-gestures.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import Ember from 'ember';
import { computed } from '@ember/object';
import { getOwner } from '@ember/application';
import Service from '@ember/service';
import RSVP from 'rsvp';
import camelize from '../utils/string/dasherized-to-camel';
import capitalize from '../utils/string/capitalize-word';

const {
computed,
getOwner,
Service,
RSVP
} = Ember;

const {
Promise, // jshint ignore:line
defer // jshint ignore:line
Expand Down
10 changes: 6 additions & 4 deletions app/event_dispatcher.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import Ember from 'ember';
import { merge, assign as _assign } from '@ember/polyfills';


import EventDispatcher from 'ember-gestures/event_dispatcher';
import config from './config/environment';

const merge = Ember.assign || Ember.merge;
const assign = _assign || merge;

let gestures = merge({}, {
let gestures = assign({}, {
emberUseCapture: false,
removeTracking: false,
useFastPaths: false
});
gestures = merge(gestures, config.gestures);
gestures = assign(gestures, config.gestures);

export default EventDispatcher.extend({
useCapture: gestures.emberUseCapture,
Expand Down
4 changes: 1 addition & 3 deletions app/instance-initializers/ember-gestures.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import Ember from 'ember';

const { getOwner } = Ember;
import { getOwner } from '@ember/application';

export default {
name: 'ember-gestures',
Expand Down
8 changes: 4 additions & 4 deletions app/services/-gestures.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Ember from 'ember';
import { merge, assign as _assign } from '@ember/polyfills';
import config from '../config/environment';
import Service from 'ember-gestures/services/-gestures';

const merge = Ember.assign || Ember.merge;
const assign = _assign || merge;

let gestures = merge({}, {
let gestures = assign({}, {
useCapture: false
});
gestures = merge(gestures, config.gestures);
gestures = assign(gestures, config.gestures);

export default Service.extend({
useCapture: gestures.useCapture
Expand Down
Loading

0 comments on commit 1e91271

Please sign in to comment.