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 to Bourbon 5.0 and Ember CLI 2.18 #21

Merged
merged 12 commits into from
Feb 8, 2018
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
14 changes: 0 additions & 14 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,8 @@ insert_final_newline = true
indent_style = space
indent_size = 2

[*.js]
indent_style = space
indent_size = 2

[*.hbs]
insert_final_newline = false
indent_style = space
indent_size = 2

[*.css]
indent_style = space
indent_size = 2

[*.html]
indent_style = space
indent_size = 2

[*.{diff,md}]
trim_trailing_whitespace = false
51 changes: 51 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module'
},
plugins: ['ember'],
extends: ['eslint:recommended', 'plugin:ember/recommended'],
env: {
browser: true
},
rules: {},
overrides: [
// node files
{
files: [
'index.js',
'testem.js',
'ember-cli-build.js',
'config/**/*.js',
'tests/dummy/config/**/*.js'
],
excludedFiles: ['app/**', 'addon/**', '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
}
)
},

// test files
{
files: ['tests/**/*.js'],
excludedFiles: ['tests/dummy/**/*.js'],
env: {
embertest: true
}
}
]
}
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
Expand All @@ -13,5 +13,11 @@
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
npm-debug.log*
yarn-error.log
testem.log

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
25 changes: 16 additions & 9 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
bower_components/
tests/
tmp/
dist/

/bower_components
/config/ember-try.js
/dist
/tests
/tmp
**/.gitkeep
.bowerrc
.editorconfig
.ember-cli
.eslintrc.js
.gitignore
.watchmanconfig
.travis.yml
.npmignore
**/.gitkeep
bower.json
Brocfile.js
testem.json
ember-cli-build.js
testem.js

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
40 changes: 25 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,47 @@
---
language: node_js
node_js:
- "4"
# we recommend testing addons with the same minimum supported node version as Ember CLI
# so that your addon works for all apps
- "8"

sudo: false
dist: trusty

addons:
chrome: stable

cache:
directories:
- $HOME/.npm
yarn: true

env:
# we recommend testing LTS's and latest stable release (bonus points to beta/canary)
- EMBER_TRY_SCENARIO=ember-lts-2.4
- EMBER_TRY_SCENARIO=ember-lts-2.8
- 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-release
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary
- EMBER_TRY_SCENARIO=ember-default

matrix:
fast_finish: true
allow_failures:
- env: EMBER_TRY_SCENARIO=ember-canary

before_install:
- npm config set spin false
- npm install -g phantomjs-prebuilt
- phantomjs --version
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH

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

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
26 changes: 5 additions & 21 deletions config/ember-try.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,19 @@
/*jshint node:true*/
module.exports = {
useYarn: true,
scenarios: [
{
name: 'ember-lts-2.4',
bower: {
dependencies: {
'ember': 'components/ember#lts-2-4'
},
resolutions: {
'ember': 'lts-2-4'
}
},
name: 'ember-lts-2.12',
npm: {
devDependencies: {
'ember-source': null
'ember-source': '~2.12.0'
}
}
},
{
name: 'ember-lts-2.8',
bower: {
dependencies: {
'ember': 'components/ember#lts-2-8'
},
resolutions: {
'ember': 'lts-2-8'
}
},
name: 'ember-lts-2.16',
npm: {
devDependencies: {
'ember-source': null
'ember-source': '~2.16.0'
}
}
},
Expand Down
1 change: 0 additions & 1 deletion config/environment.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/*jshint node:true*/
'use strict';

module.exports = function(/* environment, appConfig */) {
Expand Down
20 changes: 9 additions & 11 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
/* global require, module */
var EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
'use strict'

const EmberAddon = require('ember-cli/lib/broccoli/ember-addon')

module.exports = function(defaults) {
var app = new EmberAddon(defaults, {
// See https://github.com/ember-cli/ember-cli/issues/4084
sassOptions: {
extension: 'scss'
}
});
let app = new EmberAddon(defaults, {
// Add options here
})

/*
This build file specifes the options for the dummy test app of this
This build file specifies the options for the dummy test app of this
addon, located in `/tests/dummy`
This build file does *not* influence how the addon or the app using it
behave. You most likely want to be modifying `./index.js` or app's build file
*/

return app.toTree();
};
return app.toTree()
}
65 changes: 47 additions & 18 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,62 @@
/* jshint node: true */
'use strict';
'use strict'

var path = require('path');
var Funnel = require('broccoli-funnel');
const path = require('path')
const Funnel = require('broccoli-funnel')
const resolveSync = require('resolve').sync // eslint-disable-line

module.exports = {
name: 'ember-cli-bourbon',

blueprintsPath: function() {
return path.join(__dirname, 'blueprints');
blueprintsPath() {
return path.join(__dirname, 'blueprints')
},

included: function(app) {
this._super.included.apply(this, arguments);
included(app) {
this._super.included.apply(this, arguments)

// see: https://github.com/ember-cli/ember-cli/issues/3718
while (typeof app.import !== 'function' && app.app) {
app = app.app;
}
let target = findTargetHost(this, app)

this.bourbonPath = path.dirname(require.resolve('bourbon'));
return app;
try {
this.bourbonPath = path.dirname(
resolveSync('bourbon', {
basedir: target.project.root
})
)
} catch (err) {
this.writeError(err)
}
},

treeForStyles: function() {
treeForStyles() {
return new Funnel(this.bourbonPath, {
srcDir: 'app/assets/stylesheets',
srcDir: 'core',
destDir: 'app/styles',
annotation: 'Funnel (bourbon)'
});
})
}
}

function findTargetHost(addon, app) {
let target = app

if (typeof addon.import === 'function') {
target = addon
} else {
// If the addon has the _findHost() method (in ember-cli >= 2.7.0), we'll just
// use that.
if (typeof addon._findHost === 'function') {
target = addon._findHost()
}

// Otherwise, we'll use this implementation borrowed from the _findHost()
// method in ember-cli.
// Keep iterating upward until we don't have a grandparent.
// Has to do this grandparent check because at some point we hit the project.
let current = addon
do {
target = current.app || app
} while (current.parent.parent && (current = current.parent))
}
};

return target
}
1 change: 1 addition & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"compilerOptions":{"target":"es6","experimentalDecorators":true},"exclude":["node_modules","bower_components","tmp","vendor",".git","dist"]}
Loading