Skip to content

Commit 25c00db

Browse files
authored
Merge pull request #103 from BBVAEngineering/feature-house-keeping
Resolving some issues
2 parents 6043d7f + ed60cb4 commit 25c00db

24 files changed

Lines changed: 15285 additions & 36559 deletions

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ tab_width = 4
1414
[*.hbs]
1515
insert_final_newline = false
1616

17-
[*.md]
17+
[*.{diff,md}]
1818
trim_trailing_whitespace = false

.eslintrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
module.exports = {
24
root: true,
35
parser: 'babel-eslint',

.huskyrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
module.exports = {
44
hooks: {
55
'commit-msg': 'commitlint -E HUSKY_GIT_PARAMS',
6-
'pre-push': 'npm run lint:js && npm run lint:hbs && npm test'
6+
'pre-push': 'yarn test'
77
}
88
};

.template-lintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
'deprecated-each-syntax': true,
1111
'link-rel-noopener': true,
1212
'no-invalid-interactive': true,
13-
'img-alt-attributes': true,
13+
'require-valid-alt-text': true,
1414
'style-concatenation': true,
1515
'deprecated-inline-view-helper': true,
1616
'no-unused-block-params': true,

.travis.yml

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,62 +7,50 @@ dist: trusty
77
addons:
88
chrome: stable
99

10-
cache:
11-
directories:
12-
- $HOME/.npm
10+
cache: yarn
1311

1412
env:
1513
global:
1614
- JOBS=1
1715

1816
jobs:
19-
fail_fast: true
17+
fast_finish: true
2018
allow_failures:
2119
- env: EMBER_TRY_SCENARIO=ember-canary
2220

2321
include:
2422
- stage: "Tests"
2523
before_install:
26-
- npm config set spin false
27-
- npm install -g npm@6
2824
- npm install -g codecov
29-
- npm install -g greenkeeper-lockfile@1
3025
- npm install -g @commitlint/travis-cli
31-
- npm --version
32-
install:
33-
- if [[ $TRAVIS_BRANCH =~ greenkeeper || $TRAVIS_PULL_REQUEST_BRANCH =~ greenkeeper ]]; then npm install; else npm ci; fi
34-
before_script:
35-
- greenkeeper-lockfile-update
26+
- yarn --version
3627
script:
3728
- commitlint-travis
38-
- npm run lint
39-
- npm test
40-
after_script:
41-
- greenkeeper-lockfile-upload
29+
- yarn lint
30+
- yarn test
31+
- yarn semantic-release --dry-run --branches=$TRAVIS_BRANCH
4232
after_success:
4333
- codecov --file=coverage/node/lcov.info
4434
- codecov --file=coverage/ember/lcov.info
4535

4636
- stage: "Regression Tests"
47-
env: EMBER_TRY_SCENARIO=ember-release
37+
env: EMBER_TRY_SCENARIO=ember-lts-3.16
38+
- env: EMBER_TRY_SCENARIO=ember-lts-3.20
39+
- env: EMBER_TRY_SCENARIO=ember-release
4840
- env: EMBER_TRY_SCENARIO=ember-beta
4941
- env: EMBER_TRY_SCENARIO=ember-canary
5042
- env: EMBER_TRY_SCENARIO=ember-default-with-jquery
43+
- env: EMBER_TRY_SCENARIO=ember-classic
5144

5245
- stage: "Release"
5346
script: skip
5447
deploy:
5548
provider: script
5649
skip_cleanup: true
57-
before_script:
58-
- npm uninstall husky
59-
script:
60-
- npx semantic-release
50+
script: yarn semantic-release
6151

6252
before_install:
63-
- npm config set spin false
64-
- npm install -g npm@6
65-
- npm --version
53+
- yarn --version
6654

6755
script:
6856
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO

README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,29 @@ Installation
3434
If you need to customize **ember-cli-workbox configuration** you can do it like this:
3535

3636
```javascript
37-
//app/config/environment.js
37+
// app/config/environment.js
3838

3939
ENV['ember-cli-workbox'] = {
4040
enabled: environment !== 'test',
41-
4241
debug: true,
43-
4442
autoRegister: true,
45-
46-
importScriptsTransform(importScripts) {
47-
return importScripts.map((importScript) => `https://example-cdn.com/${importScript}`);
48-
},
49-
5043
importScriptsGlobPatterns: [
5144
'assets/service-workers/*.js'
5245
]
5346
};
5447
```
5548

49+
```javascript
50+
// ember-cli-build.js
51+
const app = new EmberAddon(defaults, {
52+
'ember-cli-workbox': {
53+
importScriptsTransform(importScripts) {
54+
return importScripts.map((importScript) => `https://example-cdn.com/${importScript}`);
55+
}
56+
}
57+
});
58+
```
59+
5660
| Property | Type | Description |
5761
|:---------------------------:|:----------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
5862
| `enabled` | `Boolean` | Addon is enabled. Defaults `true` for production builds |
@@ -61,7 +65,9 @@ ENV['ember-cli-workbox'] = {
6165
| `importScriptsTransform` | `Function` | Allows for transformation of array sent to workbox [importScripts](https://developers.google.com/web/tools/workbox/modules/workbox-build#generateSW-importScripts) |
6266
| `importScriptsGlobPatterns` | `Array` | Define files that are going to be imported using [importScripts](https://developers.google.com/web/tools/workbox/modules/workbox-build#generateSW-importScripts) |
6367

64-
You can further customize ember-cli-workbox by setting **workbox configurations** in your `config/environment.js`:
68+
You can further customize ember-cli-workbox by setting **workbox configurations** in your `config/environment.js` on in your `ember-cli-build.js`
69+
70+
*Note*: `importScriptsTransform` must be defined in your `ember-cli-build.js`.
6571

6672
```javascript
6773
//app/config/environment.js

addon/instance-initializers/sw.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
import { getWithDefault } from '@ember/object';
21
import { debug } from '@ember/debug';
2+
import { get } from '@ember/object';
3+
4+
function getWithDefault(obj, path, def) {
5+
const value = get(obj, path);
6+
7+
return typeof value !== 'undefined' ? value : def;
8+
}
39

410
export function getConfig(appInstance) {
511
const config = appInstance.resolveRegistration('config:environment');

addon/services/service-worker.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import Service from '@ember/service';
22
import Evented from '@ember/object/evented';
33
import { debug } from '@ember/debug';
4+
import { getOwner } from '@ember/application';
5+
6+
const EventedService = Service.extend(Evented);
47

58
/*
69
*
@@ -18,7 +21,11 @@ import { debug } from '@ember/debug';
1821
* "registrationComplete" - sw successfully registered
1922
* "unregistrationComplete" - all sw are unregistered
2023
*/
21-
export default class ServiceWorker extends Service.extend(Evented) {
24+
export default class ServiceWorker extends EventedService {
25+
get config() {
26+
return getOwner(this).resolveRegistration('config:environment');
27+
}
28+
2229
constructor() {
2330
super(...arguments);
2431

@@ -44,7 +51,7 @@ export default class ServiceWorker extends Service.extend(Evented) {
4451

4552
async register(swFile) {
4653
try {
47-
const registration = await this.sw.register(swFile);
54+
const registration = await this.sw.register(`${this.config.rootURL}${swFile}`);
4855

4956
return this._onRegistration(registration);
5057
} catch (error) {

config/ember-cli-update.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"schemaVersion": "1.0.0",
3+
"packages": [
4+
{
5+
"name": "ember-cli",
6+
"version": "3.21.0",
7+
"blueprints": [
8+
{
9+
"name": "addon",
10+
"outputRepo": "https://github.com/ember-cli/ember-addon-output",
11+
"codemodsSource": "ember-addon-codemods-manifest@1",
12+
"isBaseBlueprint": true,
13+
"options": [
14+
"--yarn",
15+
"--no-welcome"
16+
]
17+
}
18+
]
19+
}
20+
]
21+
}

config/ember-try.js

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@ const getChannelURL = require('ember-source-channel-url');
44

55
module.exports = async function() {
66
return {
7+
useYarn: true,
78
scenarios: [
89
{
9-
name: 'ember-lts-3.8',
10+
name: 'ember-lts-3.16',
1011
npm: {
1112
devDependencies: {
12-
'ember-source': '~3.8.0'
13+
'ember-source': '~3.16.0'
1314
}
1415
}
1516
},
1617
{
17-
name: 'ember-lts-3.12',
18+
name: 'ember-lts-3.20',
1819
npm: {
1920
devDependencies: {
20-
'ember-source': '~3.12.0'
21+
'ember-source': '~3.20.5'
2122
}
2223
}
2324
},
@@ -45,16 +46,6 @@ module.exports = async function() {
4546
}
4647
}
4748
},
48-
// The default `.travis.yml` runs this scenario via `npm test`,
49-
// not via `ember try`. It's still included here so that running
50-
// `ember try:each` manually or from a customized CI config will run it
51-
// along with all the other scenarios.
52-
{
53-
name: 'ember-default',
54-
npm: {
55-
devDependencies: {}
56-
}
57-
},
5849
{
5950
name: 'ember-default-with-jquery',
6051
env: {
@@ -64,7 +55,7 @@ module.exports = async function() {
6455
},
6556
npm: {
6657
devDependencies: {
67-
'@ember/jquery': '^0.5.1'
58+
'@ember/jquery': '^1.1.0'
6859
}
6960
}
7061
},

0 commit comments

Comments
 (0)