Skip to content
This repository has been archived by the owner on May 20, 2021. It is now read-only.

Commit

Permalink
Merge pull request #78 from CodedInternet/remove-bower
Browse files Browse the repository at this point in the history
Tested locally. Filed #80 to setup travis and homu so local testing isn't absolutely necessary.
  • Loading branch information
GCheung55 authored Jul 31, 2017
2 parents 88b5292 + 5c4dc48 commit 785fec8
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 63 deletions.
4 changes: 0 additions & 4 deletions .bowerrc

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

# dependencies
/node_modules
/bower_components

# misc
/.sass-cache
Expand Down
2 changes: 0 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
/bower_components
/config/ember-try.js
/dist
/tests
/tmp
**/.gitkeep
.bowerrc
.editorconfig
.ember-cli
.gitignore
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ To run the sample, clone this repo and run:

```bash
npm install
bower install
ember serve
```

Expand Down
19 changes: 14 additions & 5 deletions blueprints/ember-cli-foundation-6-sass/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,33 @@

var fs = require('fs');
var path = require('path');
var bower = require(path.resolve(__dirname, '../../bower.json'));
var VersionChecker = require('ember-cli-version-checker');

module.exports = {
description: 'install ember-cli-foundation-6-sass into a typical project',
normalizeEntityName: function() {},

beforeInstall: function () {
return this.addBowerPackageToProject('foundation-sites', bower.dependencies['foundation-sites']);
return this.addPackageToProject('foundation-sites', "^6.3.1");
},

afterInstall: function () {
// determine what version we are using
var checker = new VersionChecker(this);
var isGTE6_3_0 = checker.for('foundation-sites', 'npm').satisfies('>=6.3.0');

// Copy the _settings.scss file
var stylePath = path.join(process.cwd(), 'app', 'styles');
var foundationPath = path.join(process.cwd(), 'bower_components', 'foundation-sites', 'scss');
// Calculate the path using require.resolve which checks the whole path.
// This gives us a specific file in dist/js/npm.js hence the need to path.resolve our way back up.
var foundationPath = path.resolve(require.resolve('foundation-sites'), '../../scss/');

// some thats changed in
if (isGTE6_3_0) {
foundationPath = path.resolve(require.resolve('foundation-sites'), '../../../scss/');
}

var settingsPath = path.join(foundationPath, 'settings', '_settings.scss');
var checker = new VersionChecker(this);
var isGTE6_3_0 = checker.for('foundation-sites', 'bower').satisfies('>=6.3.0');
var settingsFile = fs.readFileSync(settingsPath);
var settingsFilePath = path.join(stylePath, '_settings.scss');
var appFile, appFilePath;
Expand Down
6 changes: 0 additions & 6 deletions bower.json

This file was deleted.

36 changes: 12 additions & 24 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ module.exports = {
npm: {
devDependencies: {
'ember-source': null
},
dependencies: {
'ember': 'components/ember#lts-2-4'
}
}
},
Expand All @@ -35,49 +38,34 @@ module.exports = {
},
{
name: 'ember-release',
bower: {
dependencies: {
'ember': 'components/ember#release'
},
resolutions: {
'ember': 'release'
}
},
npm: {
devDependencies: {
'ember-source': null
},
dependencies: {
'ember': 'components/ember#release'
}
}
},
{
name: 'ember-beta',
bower: {
dependencies: {
'ember': 'components/ember#beta'
},
resolutions: {
'ember': 'beta'
}
},
npm: {
devDependencies: {
'ember-source': null
},
dependencies: {
'ember': 'components/ember#beta'
}
}
},
{
name: 'ember-canary',
bower: {
dependencies: {
'ember': 'components/ember#canary'
},
resolutions: {
'ember': 'canary'
}
},
npm: {
devDependencies: {
'ember-source': null
},
dependencies: {
'ember': 'components/ember#canary'
}
}
},
Expand Down
19 changes: 12 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,28 @@ module.exports = {
this._super.included(app);
var options = app.options['ember-cli-foundation-6-sass'];

var foundationPath = path.join(app.bowerDirectory, 'foundation-sites');
var checker = new VersionChecker(this);
var isGTE6_3_0 = checker.for('foundation-sites', 'bower').satisfies('>=6.3.0');
var isGTE6_3_0 = checker.for('foundation-sites', 'npm').satisfies('>=6.3.0');

app.options.sassOptions = app.options.sassOptions || {};
app.options.sassOptions.includePaths = app.options.sassOptions.includePaths || [];

// Calculate the path using require.resolve which checks the whole path.
// This gives us a specific file in dist/js/npm.js hence the need to path.resolve our way back up.
var foundationPath = path.resolve(require.resolve('foundation-sites'), '../..');

// >=6.3.0 changed some paths.
if (isGTE6_3_0) {
foundationPath = mergeTrees([new Funnel(foundationPath, {
foundationPath = path.resolve(require.resolve('foundation-sites'), '../../..'); // go deeper
var foundationFunnel = mergeTrees([new Funnel(foundationPath, {
include: ['_vendor/**/*']
}), new Funnel(path.join(foundationPath, 'scss'), {
destDir: 'foundation-sites',
include: ['**/*']
})]);
}

app.options.sassOptions.includePaths.push(foundationFunnel);
}
app.options.sassOptions.includePaths.push(foundationPath);

// Include the js paths
Expand All @@ -41,15 +46,15 @@ module.exports = {

// >=6.3.0 changed some paths.
if (isGTE6_3_0) {
app.import(path.join(app.bowerDirectory, 'foundation-sites', 'dist', 'js', 'foundation.js'));
app.import(path.join(foundationPath, 'dist', 'js', 'foundation.js'));
} else {
app.import(path.join(app.bowerDirectory, 'foundation-sites', 'js', 'foundation.js'));
app.import(path.join(foundationPath, 'foundation-sites', 'js', 'foundation.js'));
}
}
}
else if (options.foundationJs instanceof Array) {
options.foundationJs.forEach(function(componentName) {
var foundationJsPath = path.join(app.bowerDirectory, 'foundation-sites', 'js');
var foundationJsPath = path.join(foundationPath, 'js');
var es5code = babel.transformFileSync(path.join(foundationJsPath, 'foundation.' + componentName + '.js'), {
'plugins': [
require.resolve('babel-plugin-transform-es2015-arrow-functions'),
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
"ember-cli-htmlbars": "^1.0.2",
"ember-cli-sass": "^6.1.3",
"ember-cli-version-checker": "^1.3.1",
"ember-cli-htmlbars-inline-precompile": "^0.4.2"
"ember-cli-htmlbars-inline-precompile": "^0.4.2",
"foundation-sites": "^6.3.1"
},
"ember-addon": {
"configPath": "tests/dummy/config"
Expand Down
7 changes: 7 additions & 0 deletions tests/dummy/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "dummy",
"version": "0.0.0",
"dependencies": {

}
}
2 changes: 1 addition & 1 deletion tests/integration/components/zf-dropdown-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test('it renders', function(assert) {
// Template block usage:" + EOL +
this.render(hbs`
<button class="button" data-toggle="example-dropdown">Toggle Dropdown</button>
{{#zf-dropdown id="example-dropdown"}}
{{#zf-dropdown id="example-dropdown" positionClass="bottom"}}
Example form in a dropdown.
<form>
<div class="row">
Expand Down
21 changes: 10 additions & 11 deletions tests/integration/components/zf-reveal-test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Ember from 'ember';
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

Expand Down Expand Up @@ -27,21 +28,19 @@ test('it renders', function(assert) {
});

test('it destroys the reveal-overlay', function(assert) {
assert.expect(1);

this.set('enableReveal', true);
assert.expect(2);

this.render(hbs`
{{#if enableReveal}}
{{#zf-reveal}}
template block text
{{/zf-reveal}}
{{/if}}
{{#zf-reveal}}
template block text
{{/zf-reveal}}
`);

//assert.equal(this.$('.reveal').length, 1);
assert.equal(Ember.$('.reveal-overlay').length, 1);

this.set('enableReveal', false);
this.render(hbs`
Hello World
`);

assert.ok(this.$());
assert.equal(Ember.$('.reveal-overlay').length, 0);
});

0 comments on commit 785fec8

Please sign in to comment.