Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrades, Tests #46

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/

# misc
/coverage/

# ember-try
/.node_modules.ember-try/
41 changes: 39 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,47 @@ module.exports = {
ecmaVersion: 2017,
sourceType: 'module'
},
extends: 'eslint:recommended',
plugins: [
'ember'
],
extends: [
'eslint:recommended',
'plugin:ember/recommended'
],
env: {
browser: true
},
rules: {
}
},
overrides: [
// node files
{
files: [
'ember-cli-build.js',
'index.js',
'testem.js',
'blueprints/*/index.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
})
}
]
};
18 changes: 9 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/dist/
/tmp/

# dependencies
/node_modules
Expand All @@ -11,13 +11,13 @@
# misc
/.sass-cache
/connect.lock
/coverage/*
/coverage/
/libpeerconnection.log
npm-debug.log*
yarn-error.log
testem.log
/npm-debug.log*
/testem.log
/yarn-error.log

# 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
8 changes: 7 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@
.bowerrc
.editorconfig
.ember-cli
.gitignore
.eslintrc.js
.gitignore
.watchmanconfig
.travis.yml
bower.json
ember-cli-build.js
testem.js
yarn.lock

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
31 changes: 20 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,31 @@ language: node_js
node_js:
# we recommend testing addons with the same minimum supported node version as Ember CLI
# so that your addon works for all apps
- "4"
- "6"

sudo: false
dist: trusty

addons:
chrome: stable
chrome: stable

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 @@ -35,8 +40,12 @@ before_install:

install:
- yarn install --no-lockfile
- npm config set spin false
- npm install -g npm@4
- npm --version

script:
- yarn 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 test --skip-cleanup
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO --skip-cleanup
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) 2017
Copyright (c) 2018

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
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,42 @@
# ember-router-helpers
NullVoxPopuli marked this conversation as resolved.
Show resolved Hide resolved

This README outlines the details of collaborating on this Ember addon.
## Installation

```
ember install ember-router-helpers
```

## Usage

* `route-params`

```hbs
{{#with (route-params 'parent.child') as |routeParams|}}
<a href="{{routeParams.url}}" class="{{if routeParams.isActive 'active' 'inactive'}}">Blah</a>
{{/with}}
```

* `transition-to`

```hbs
<button onclick={{transition-to 'parent.child'}}></button>
```

* `is-active`

```hbs
{{is-active '/parent/child'}}
```

* `url-for`
```hbs
{{url-for 'parent.child'}}
```

---------------------------------------


This rest of this README outlines the details of collaborating on this Ember addon.

## Installation

Expand Down
12 changes: 9 additions & 3 deletions addon/helpers/is-active.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import Helper from '@ember/component/helper';
import handleQueryParams from '../utils/handle-query-params';

export default Ember.Helper.extend({
router: Ember.inject.service(),
export default Helper.extend({
router: service(),

init() {
this._super(...arguments);
this.addObserver('router.currentURL', this, 'recompute');
},

compute(_params) {
let params = handleQueryParams(_params);
Expand Down
12 changes: 9 additions & 3 deletions addon/helpers/route-params.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import Helper from '@ember/component/helper';
import _RouteParams from '../utils/route-params';

let RouteParams = _RouteParams;
export function setRouteParamsClass(klass) {
RouteParams = klass;
}

export default Ember.Helper.extend({
router: Ember.inject.service(),
export default Helper.extend({
router: service(),

init() {
this._super(...arguments);
this.addObserver('router.currentURL', this, 'recompute');
},

compute(params) {
return new RouteParams(this.get('router'), params);
Expand Down
7 changes: 4 additions & 3 deletions addon/helpers/transition-to.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import Helper from '@ember/component/helper';
import handleQueryParams from '../utils/handle-query-params';

export default Ember.Helper.extend({
router: Ember.inject.service(),
export default Helper.extend({
router: service(),

compute(_params) {
return (maybeEvent) => {
Expand Down
7 changes: 4 additions & 3 deletions addon/helpers/url-for.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import Helper from '@ember/component/helper';
import handleQueryParams from '../utils/handle-query-params';

export default Ember.Helper.extend({
router: Ember.inject.service(),
export default Helper.extend({
router: service(),

compute(_params) {
let params = handleQueryParams(_params);
Expand Down
Loading