Skip to content

Commit

Permalink
Update to Ember 3.9 (#69)
Browse files Browse the repository at this point in the history
* Update packages

* Fix tests

* Fix deprecations

* Add template lint
  • Loading branch information
Exelord committed Apr 23, 2019
1 parent b9fc6b4 commit 4b229e1
Show file tree
Hide file tree
Showing 33 changed files with 13,923 additions and 9,691 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ module.exports = {
// node files
{
files: [
'.eslintrc.js',
'.template-lintrc.js',
'ember-cli-build.js',
'index.js',
'testem.js',
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
/node_modules/

# misc
/.env*
/.pnp*
/.sass-cache
/connect.lock
/coverage/
Expand Down
47 changes: 28 additions & 19 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
/bower_components
# compiled output
/dist/
/tmp/

# dependencies
/bower_components/

# misc
/.bowerrc
/.editorconfig
/.ember-cli
/.env*
/.eslintignore
/.eslintrc.js
/.gitignore
/.template-lintrc.js
/.travis.yml
/.watchmanconfig
/bower.json
/config/ember-try.js
/dist
/tests
/tmp
**/.gitkeep
.bowerrc
.editorconfig
.ember-cli
.eslintrc.js
.gitignore
.watchmanconfig
.travis.yml
bower.json
ember-cli-build.js
testem.js
yarn.lock
/CONTRIBUTING.md
/ember-cli-build.js
/testem.js
/tests/
/yarn.lock
.gitkeep

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
6 changes: 6 additions & 0 deletions .template-lintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';

module.exports = {
extends: 'recommended',
ignore: ['tests/**']
};
45 changes: 29 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,42 @@ env:
global:
# See https://git.io/vdao3 for details.
- JOBS=1
matrix:

branches:
only:
- master
# npm version tags
- /^v\d+\.\d+\.\d+/

jobs:
fail_fast: true
allow_failures:
- env: EMBER_TRY_SCENARIO=ember-canary

include:
# runs linting and tests with current locked deps

- stage: "Tests"
name: "Tests"
script:
- npm run lint:hbs
- npm run lint:js
- npm test

# 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
allow_failures:
- stage: "Additional Tests"
env: EMBER_TRY_SCENARIO=ember-lts-2.18
- env: EMBER_TRY_SCENARIO=ember-lts-3.4
- env: EMBER_TRY_SCENARIO=ember-release
- env: EMBER_TRY_SCENARIO=ember-beta
- env: EMBER_TRY_SCENARIO=ember-canary
- env: EMBER_TRY_SCENARIO=ember-default-with-jquery

before_install:
- npm config set spin false
- 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:one $EMBER_TRY_SCENARIO --skip-cleanup
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO
26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# How To Contribute

## Installation

* `git clone <repository-url>`
* `cd my-addon`
* `npm install`

## Linting

* `npm run lint:hbs`
* `npm run lint:js`
* `npm run lint:js -- --fix`

## Running tests

* `ember test` – Runs the test suite on the current Ember version
* `ember test --server` – Runs the test suite in "watch mode"
* `ember try:each` – Runs the test suite against multiple Ember versions

## Running the dummy application

* `ember serve`
* Visit the dummy application at [http://localhost:4200](http://localhost:4200).

For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Exelord
Copyright (c) 2019

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ Demo app with interactive examples you can find at [http://exelord.github.io/emb

[9225812a]: http://exelord.github.io/ember-initials/ "Ember Initials Demo App"

## Compatibility

* Ember.js v2.18 or above
* Ember CLI v2.13 or above

This addon has been tested on:
- IE 10 and UP including EDGE
- Firefox 44 and UP
- Chrome 48 and UP
- Opera 35 and UP

## Install
`ember install ember-initials`

Expand Down Expand Up @@ -138,11 +149,3 @@ or
- `email` - Email which will be used to generating unique adorable avatar

- `size` - size of the avatar in pixels (set `null` if you do not want to use elements attributes like `width` and `height`)

## Browser compatibility

This addon has been checked on:
- IE 10 and UP including EDGE
- Firefox 44 and UP
- Chrome 48 and UP
- Opera 35 and UP
4 changes: 2 additions & 2 deletions addon/mixins/adorable.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { computed } from '@ember/object';
import Mixin from '@ember/object/mixin';
import Avatar from 'ember-initials/mixins/avatar';
import { computed } from '@ember/object';

export default Mixin.create(Avatar, {
email: '',
image: '',

src: computed('image', 'email', 'size', function() {
return this.get('image') || this._adorableSrc(this.get('email'), this.get('size'));
}),
}).readOnly(),

_adorableSrc(email, size) {
return `https://api.adorable.io/avatars/${size}/${email}`;
Expand Down
14 changes: 7 additions & 7 deletions addon/mixins/avatar.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import Mixin from '@ember/object/mixin';
import { reads } from '@ember/object/computed';
import { getOwner } from '@ember/application';
import { computed } from '@ember/object';
import { reads } from '@ember/object/computed';
import Mixin from '@ember/object/mixin';
import { inject as service } from '@ember/service';

export default Mixin.create({
fastboot: service(),
isFastBoot: reads('fastboot.isFastBoot'),

tagName: 'img',
attributeBindings: ['width', 'height', 'src', 'alt', 'title', 'onError'],

Expand All @@ -17,11 +21,7 @@ export default Mixin.create({

config: computed(function() {
return getOwner(this).resolveRegistration('config:environment').emberInitials;
}),

fastboot: computed(function() {
return getOwner(this).lookup('service:fastboot');
}),
}).readOnly(),

onError() {}
});
11 changes: 5 additions & 6 deletions addon/mixins/gravatar.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import { computed } from '@ember/object';
import { reads } from '@ember/object/computed';
import Mixin from '@ember/object/mixin';
import md5 from 'blueimp-md5';
import Avatar from 'ember-initials/mixins/avatar';
import { computed } from '@ember/object';
import md5 from 'md5';

export default Mixin.create(Avatar, {
email: null,
image: null,
relativeUrl: false,

defaultImage: computed(function() {
return this.get('config.gravatar.defaultImage');
}),
defaultImage: reads('config.gravatar.defaultImageUrl'),

src: computed('email', 'size', 'image', 'defaultImage', function() {
return this.get('image') ? this.get('image') : this.generateGravatarUrl();
}),
}).readOnly(),

generateGravatarUrl() {
let hash = md5(this.get('email'));
Expand Down
Loading

0 comments on commit 4b229e1

Please sign in to comment.