npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-data-extensions

v1.0.0-beta.7

Published

Mixins for Adapters and Serializers

Downloads

6

Readme

Extensions for Ember Data

Build Status

Using Bower

For info: bower info ember-data-extensions

To install the repo in your projects 'bower_components' directory:

bower install ember-data-extensions

Use the files in the 'dist' directory.

Add to your project's bower.json as a dependency:

{
  "name": "your project",
  "dependencies": {
    "jquery": "~1.10.2",
    "handlebars": "~1.3.0",
    "ember": "~1.3.1",
    "ember-data": "~1.0.0-beta.6",
    "ember-data-extensions": "~1.0.0-beta.6"
  }
}

Online Docs

Ember Data compatability

The releases (tags) will follow Ember Data's versions, see the releases page

Packages

The goal of this repository is to share packages as extensions to the Ember Data project. Specifically: adapters, serializers, mixins for supporting various backend data storage systems.

See the /dist directory for built files (ready to download/use).

embedded-adapter

An fork of activemodel-adapter with support for embedded hasMany and belongsTo relationships embedded in JSON payloads. The ActiveModelAdapter and ActiveModelSerializer were converted to mixins (and extended for supporting embedded belongsTo relationships).

The ActiveModelAdapter is a subclass of the RESTAdapter designed to integrate with a JSON API that uses an underscored naming convention instead of camelCasing. It has been designed to work out of the box with the active_model_serializers Ruby gem

Mongoid supports using embeds_many and embeds_one in (Rails) models. Also has_one and has_many can be used with ActiveModel::Serializers. There are various embedded options, ids or objects.

Like the ActiveModelAdapter/Serializer the EmbeddedAdapter/Serializer extends the RESTAdapter/Serializer using mixins for supporting embedded records. See proposal on discuss.

Builds:

Note: EmbeddedMixin, UnderscoredAdapterMixin and UnderscoredSerializer are included in the build, along with an application initializer (name: embeddedAdapter). Thanks to Bradley Priest (and the Ember.js community) for the ActiveModelAdapter, which provides a large portion of support for embedded records in JSON payloads. The embedded-json-adapter and embedded-json-mixin are forks of the activemodel-adapter package.

mixins

The mixins can be used independently from the EmbeddedSerializer.

Builds:

See the embedded-adapter/initializer.js file as an example implemenation for a custom adapter/serializer based on using mixins for supporting an API that uses snake_case properties and embedded related objects in arrays or as plain objects.

Contributing

Below are notes for using this repository to developing extensions for Ember Data.

Install

make install or...

  1. Clone this repo
  2. npm install installs brunch and testem
  3. Fetch dependencies - bower install

Build

make or...

Build command: brunch b creates a file for distribution in the /dist directory.

  • See brunch docs, commands
  • The 'config.js' file is used for the (brunch) build.

Production Build

make prod or...

Build command to create an optimized file: brunch build --optimize

Test

make test or... Run tests with command testem (dev) or testem ci (uses for Travis build)

Dependencies

Ember.js, jQuery, Handlebars, Ember Data

See the package.json

Bower

  • Bower is used to fetch Ember.js with the command: bower install
  • Update Ember with command: bower update

Code Quality

make lint or...

  • jshint packages/mixins/lib/*
  • jshint packages/mixins/tests/*

Uses JSHint, when using commands to build or test, i.e. make, make prod or make test the jshint check is performed first.

Code Coverage Report

Blanket.js with grunt a task is used for running code coverage reports during continuous integration tooling w/ Travis.

To execute reports locally, use make coverage or...

open http://localhost:8080/tests/coverage.html?coverage=true
python -m SimpleHTTPServer 8080

the open command above works on mac, use to quit

The coverage report (Blanket.js results) shows a list of files. Click a file to inspect code, red lines are not reached when tests execute.

See:

Continuous Integration (CI)

See Travis CI report

Use command: make ci to execute build and execute tests locally.

Options for CI: testem ci or grunt blanket_qunit --verbose

Grunt

The Gruntfile.js default task is blanket_qunit which exectutes the QUnit and Blanket.js test reports. The blanket_qunit task has an option for threshold which is the acceptable percentage of code coverage (e.g. 97%).

Documentation

make doc or...

  • yuidoc ./packages/activemodel-adapter/lib/* -c yuidoc.json --server (you can append a port number e.g. --server 8888, the default port is 3000)

Docs are generated from source using yuidoc.

make docfiles is used to generante files for the gh-pages branch of this repo, generated docs

See the wiki for notes on usage.

Development

A recent/current version of Node.js is required for using the build and test tools.

PhantomJS

Headless testing is done with phantomjs.

NPM can install phantomjs, execute sudo npm install phantomjs -g

Or, To install with brew, execute brew install phantomjs.

Be sure your executable path resolves to the version of phanomjs you expect to use.

Troubleshooting

If you have trouble using the default make install command perhaps try the following:

You may need to use sudo for the following:

  1. npm install -g bower
  2. npm install -g testem
  3. npm install -g brunch
  4. npm install -g jshint
  5. npm install -g grunt
  6. npm install -g grunt-cli
  7. npm install -g grunt-blanket-qunit --save-dev

Then try:

  1. npm install
  2. bower install

Makefile

Various tasks (targets) for building, testing and continuous integration.

  • make lint: lints all files in the 'packages' directory w/ jshint
  • make test: starts testem and watches packages for changes to re-run test suites
  • make coverage: starts python server with code coverage report, http://localhost:8080/tests/coverage.html?coverage=true
  • make ci: Run all tests in w/ output for continuous integration (uses phantomjs)
  • make: builds packages to '/dist' directory
  • make prod: builds optimized packages to '/dist' directory
  • make dist: Build all packages for distribution in '/dist' directory
  • make clean: empties '/dist' directory
  • make doc: browse documentation from source code http://localhost:3333
  • make docfiles: generate (html) documentation from source code, use w/ gh-pages branch

See the 'Troubleshooting' section above if you are unable to execute make ci

Config files