Skip to content

Commit f96582c

Browse files
authored
Merge pull request #73 from chancancode/upgrades
2 parents 6316330 + 21fb885 commit f96582c

26 files changed

Lines changed: 5650 additions & 1976 deletions

.editorconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
root = true
66

7-
87
[*]
98
end_of_line = lf
109
charset = utf-8

.eslintrc.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
'use strict';
2+
13
module.exports = {
24
root: true,
5+
parser: 'babel-eslint',
36
parserOptions: {
4-
ecmaVersion: 2017,
5-
sourceType: 'module'
7+
ecmaVersion: 2018,
8+
sourceType: 'module',
9+
ecmaFeatures: {
10+
legacyDecorators: true
11+
}
612
},
713
plugins: [
814
'ember'
@@ -15,6 +21,7 @@ module.exports = {
1521
browser: true
1622
},
1723
rules: {
24+
'ember/no-jquery': 'error'
1825
},
1926
overrides: [
2027
// node files
@@ -36,8 +43,7 @@ module.exports = {
3643
'tests/dummy/app/**'
3744
],
3845
parserOptions: {
39-
sourceType: 'script',
40-
ecmaVersion: 2015
46+
sourceType: 'script'
4147
},
4248
env: {
4349
browser: false,

.github/workflows/build.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build
2+
on:
3+
pull_request: {}
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- v*
9+
schedule:
10+
- cron: '0 0 * * *'
11+
12+
jobs:
13+
test:
14+
name: Test (${{ matrix.scenario }})
15+
runs-on: ubuntu-latest
16+
env:
17+
CI: 'true'
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
scenario:
22+
- default
23+
- default-with-lockfile
24+
- default-with-jquery
25+
- release
26+
- beta
27+
- canary
28+
- lts-3.16
29+
- lts-3.12
30+
- lts-3.8
31+
- lts-3.4
32+
- lts-2.18
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v1
36+
- name: Set up Volta
37+
uses: volta-cli/action@v1
38+
- name: Install dependencies (yarn)
39+
if: matrix.scenario == 'default-with-lockfile'
40+
run: yarn install --non-interactive --frozen-lockfile
41+
- name: Install dependencies (yarn)
42+
if: matrix.scenario != 'default-with-lockfile'
43+
run: yarn install --non-interactive --no-lockfile
44+
- name: Setup ember-try scenario
45+
if: matrix.scenario != 'default' && matrix.scenario != 'default-with-lockfile'
46+
run: >-
47+
yarn ember try:one ember-${{ matrix.scenario }} --skip-cleanup ---
48+
'[ -z "$EMBER_OPTIONAL_FEATURES" ] || echo "::set-env name=EMBER_OPTIONAL_FEATURES::$EMBER_OPTIONAL_FEATURES"'
49+
- name: Lint (hbs)
50+
run: yarn lint:hbs
51+
- name: Lint (js)
52+
run: yarn lint:js
53+
- name: Build
54+
run: yarn ember build --environment test
55+
- name: Run test
56+
# Due to a bug in ember-cli, running `ember test` with `--path` doesn't set `EMBER_ENV=test`
57+
# See https://github.com/ember-cli/ember-cli/issues/8922
58+
run: EMBER_ENV=test yarn test --path dist

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
# misc
1212
/.env*
13+
/.pnp*
1314
/.sass-cache
1415
/connect.lock
1516
/coverage/

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
/.env*
1313
/.eslintignore
1414
/.eslintrc.js
15+
/.git/
1516
/.gitignore
1617
/.template-lintrc.js
1718
/.travis.yml

.travis.yml

Lines changed: 0 additions & 68 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
* `ember serve`
2424
* Visit the dummy application at [http://localhost:4200](http://localhost:4200).
2525

26-
For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).
26+
For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ember-cli-head [![Build Status](https://travis-ci.org/ronco/ember-cli-head.svg?branch=master)](https://travis-ci.org/ronco/ember-cli-head)
1+
# ember-cli-head [![Build Status](https://github.com/ronco/ember-cli-head/workflows/Build/badge.svg?branch=master)](https://github.com/ronco/ember-cli-head/actions?query=branch%3Amaster+workflow%3A%22Build%22)
22

33
This addon adds easy population of head tags from your Ember code
44
without any direct hacky DOM manipulation. This addon also provides
@@ -9,6 +9,12 @@ The hope is that Ember itself will provide a mechanism for populating
99
head tags from your app at some time in the future. Until then this
1010
addon provides that functionality.
1111

12+
## Compatibility
13+
14+
* Ember.js v2.18 or above
15+
* Ember CLI v2.13 or above
16+
* Node.js v10 or above
17+
1218
## Installation
1319

1420
Install by running
@@ -128,3 +134,11 @@ If you care to read more about the details of render please see the PR that intr
128134
But for now, if you are upgrading to 0.4.x, you simply need to add `{{head-layout}}` component to your application wide template.
129135

130136
If you make use of this mode the content of `<head>` will be the static FastBoot rendered content through the life of your App.
137+
138+
## Contributing
139+
140+
See the [Contributing](CONTRIBUTING.md) guide for details.
141+
142+
## License
143+
144+
This project is licensed under the [MIT License](LICENSE.md).

addon/components/head-layout.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import Component from '@ember/component';
2-
import { get, computed } from '@ember/object';
3-
import { getOwner } from '@ember/application';
2+
import { inject as service } from '@ember/service';
43
import layout from '../templates/components/head-layout';
54

65
export default Component.extend({
76
tagName: '',
87
layout,
8+
document: service('-document'),
99

1010
/**
1111
* If true, this will tear down any existing head on init of this component.
@@ -15,15 +15,20 @@ export default Component.extend({
1515
*/
1616
shouldTearDownOnInit: true,
1717

18-
headElement: computed(function() {
19-
let documentService = getOwner(this).lookup('service:-document');
20-
return documentService.head;
21-
}),
18+
/**
19+
* The element to render into. Defaults to <head> in `init`, overridable for our own tests only.
20+
* @private
21+
*/
22+
headElement: null,
2223

2324
init() {
2425
this._super(...arguments);
2526

26-
if (get(this, 'shouldTearDownOnInit')) {
27+
if (this.get('headElement') === null) {
28+
this.set('headElement', this.get('document.head'));
29+
}
30+
31+
if (this.get('shouldTearDownOnInit')) {
2732
this._tearDownHead();
2833
}
2934
},
@@ -38,6 +43,7 @@ export default Component.extend({
3843
}
3944

4045
// clear fast booted head (if any)
46+
let document = this.get('document');
4147
let startMeta = document.querySelector('meta[name="ember-cli-head-start"]');
4248
let endMeta = document.querySelector('meta[name="ember-cli-head-end"]');
4349
if (startMeta && endMeta) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
{{#-in-element headElement}}
1+
{{#-in-element this.headElement}}
22
<meta name="ember-cli-head-start" content="">{{head-content}}<meta name="ember-cli-head-end" content="">
33
{{/-in-element}}

0 commit comments

Comments
 (0)