Skip to content

Commit

Permalink
Update emebr
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanvanderbyl committed Feb 1, 2018
1 parent 13729b3 commit b9dc6aa
Show file tree
Hide file tree
Showing 14 changed files with 14,785 additions and 409 deletions.
52 changes: 27 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

This addon does one thing: load `d3@4.x.x` into your app or addon, so you can use D3 as you please on its own or as part of a visualisation addon.


```
ember install ember-d3
```

**Important:** You must be using NPM >= 3.0 and Node >= 6.0 for this to work,
**Important:** You must be using NPM >= 3.0 and Node >= 6.0 for this to work,
or you'll get errors when you start your app. Check by running `npm version`.

You can upgrade NPM by running:
Expand All @@ -28,74 +27,77 @@ npm install --save-dev d3@4.9.0

## Usage:

There's two ways to use this library in your project, you can either load just
There's two ways to use this library in your project, you can either load just
the APIs you desire, or you can import the entire D3 object (similar to version 3).

Option 1:

```js
import { line } from 'd3-shape';
import { scaleOrdinal } from 'd3-scale';
import { extent } from 'd3-array';
import { line } from 'd3-shape'
import { scaleOrdinal } from 'd3-scale'
import { extent } from 'd3-array'
```

Option 2:

```js
import D3 from 'd3';
import D3 from 'd3'
```

We've put together a [complete demo component](https://github.com/brzpegasus/ember-d3/blob/master/tests/dummy/app/components/simple-circles.js)
We've put together a [complete demo component](https://github.com/brzpegasus/ember-d3/blob/master/tests/dummy/app/components/simple-circles.js)
which you can use to really get a feel for how to use the different packages provided by this addon.

## Tree Shaking
Under the hood we use Rollup to compile all the dependencies for D3, and Rollup supports basic tree-shaking. If you want to avoid loading packages you don't need, you can exclude them in your project's config.

Under the hood we use Rollup to compile all the dependencies for D3, and Rollup supports basic tree-shaking. If you want to avoid loading packages you don't need, you can exclude them in your project's config.

**Note:** If you exclude a package which
a dependency of another package, it will be loaded regardless to fulfil that dependency.

**Note 2:** The global import of `d3` requires all packages, and must be on the exclusion list for this to have any effect.

#### Dependency whitelist/blacklist
In case you do not want to include *all* of d3's dependencies, you may whitelist

In case you do not want to include _all_ of d3's dependencies, you may whitelist
the packages that you want to include in your project's `config/environment.js` file.

For example, if you only wanted to use `d3-scale`, you would do:

```js
// config/environment.js
module.exports = function() {
return {
'ember-d3': {
only: ['d3-scale']
}
};
};
return {
'ember-d3': {
only: ['d3-scale']
}
}
}
```

Or if you want to exclude a package:

```js
// config/environment.js
module.exports = function() {
return {
'ember-d3': {
except: ['d3-scale']
}
};
};
return {
'ember-d3': {
except: ['d3-scale']
}
}
}
```

**Note**: Even though you only add `d3-scale`, it has a few transitive d3 dependencies.
These are added to your project automatically.

## Running Tests

* `npm test` (Runs `ember try:testall` to test your addon against multiple Ember versions)
* `yarn test` (Runs `ember try:each` to test your addon against multiple Ember versions)
* `ember test`
* `ember test --server`

# Contributing
This addon is developed by the community and is maintained by [Ivan Vanderbyl](https://github.com/ivanvanderbyl).

All contributions are welcome by opening an issue or Pull Request.
This addon is developed by the community and is maintained by [Ivan Vanderbyl](https://github.com/ivanvanderbyl).

All contributions are welcome by opening an issue or Pull Request.
18 changes: 8 additions & 10 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
/* eslint-disable */
'use strict';

'use strict'

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

module.exports = function(defaults) {
let app = new EmberAddon(defaults, {
// Add options here
})
let app = new EmberAddon(defaults, {
// Add options here
});

/*
/*
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();
};
Loading

0 comments on commit b9dc6aa

Please sign in to comment.