Search code examples
ember.jsember-dataember-cli

How do I use my fork of ember-data in ember-cli?


I'm working on a pull-request for ember-data, and I'd like to be able to test these changes in my ember-cli app.

It doesn't work to follow the directions for using canary here or here, as my fork does not get built my components.

I've tried referencing my fork and branch in packages.json as well as bower.json; then I get this error:

Path or pattern "bower_components/ember-data/ember-data.js" did not match any files

I can then build ember-data manually and copy the file to bower_components/ember-data/ember-data.js. However, I would like a streamlined way to use a fork of ember-data so I can use and test my pull-request without a lengthy install process.

Is there a better way?

Thanks!


Solution

  • You are getting that error because you are trying to use the NPM package of ember-data with Bower, and Bower needs ember-data to be precompiled. You were correct to fork emberjs/data and reference your fork in package.json. Here is how I compiled my fork for bower:

    In your forked repo, run npm install and npm run build:production to compile your fork in the dist directory.

    Then fork the ember-data shim for bower: components/ember-data. Copy the following files from your ember-data fork's dist directory into the shim's directory:

    • bower.json
    • component.json
    • composer.json
    • ember-data.js
    • ember-data.js.map
    • ember-data.min.js
    • ember-data.prod.js
    • package.json

    Edit the bower/package files if you want to add your own version tag. Commit the shim repo to a branch or master, and then reference that commit in your ember-cli app's bower.json file. Then run npm install and bower install in your ember-cli app.