linjoey / cyto-chromosome-vis

D3/Angular chromosome visual representation
http://linjoey.github.io/cyto-chromosome-vis
Apache License 2.0
19 stars 5 forks source link

provide example snippets for biojs.io #2

Closed wilzbach closed 9 years ago

wilzbach commented 9 years ago

Hey these changes should allow you to publish your lovely component to biojs.io ;-)

You can test this locally by installing the biojs-sniper (either locally or globally)

npm install -g biojs-sniper

and then running the sniper with

biojs-sniper

The output http://localhost:9090/examples

wilzbach commented 9 years ago

Hi, before you ask the error is due to the problem that the CDN server only installs packages specified in dependencies and thus can't find biojs-events. Solution: move biojs-events to the dependencies object ;-)

Error: "browserify exited with code 1"

code: 1
stderr: Error: Cannot find module 'biojs-events' from '/tmp/cyto-chromosome-vis11513-16162-1ttv90n/node_modules/cyto-chromosome-vis/src'
    at /home/admin/browserify-cdn/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:50:17
    at process (/home/admin/browserify-cdn/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:119:43)
    at /home/admin/browserify-cdn/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:128:21
    at load (/home/admin/browserify-cdn/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:60:43)
    at /home/admin/browserify-cdn/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:66:22
    at /home/admin/browserify-cdn/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:21:47
    at Object.oncomplete (fs.js:107:15)

The full msg: https://wzrd.in/bundle/cyto-chromosome-vis@1.0.0

wilzbach commented 9 years ago

Ah I saw that in the examples you use

var Chromosome = require('Chromosome');

I changed the name on purpose as the CDN-"browserified" version is only mapped to the name of your component. Unfortunately at the moment we don't support alias names for components... (changes at the examples will be reflected immediately without the need to republish-)

A workaround for you could be

browserify -r ./:Chromosome -r ./:cyto-chromosome-vis -o ./dist/build/chr.js

Cheers,

linjoey commented 9 years ago

Thanks for the help and tips!