3
votes

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!

2

2 Answers

3
votes

You can use a symlink to your local version of a bower and/or npm dependency.

Go to your local (forked) version of ember-data and

npm link
bower link

This will make a global symlink to your local version.

Then go to where you're using the dependency and

npm link ember-data
bower link ember-data

This will make node_modules/ember-data and bower_components/ember-data a symlink to your local version.

See https://docs.npmjs.com/cli/link and http://bower.io/docs/api/#link for more details on how these work.

0
votes

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.