Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm package - client version possible? #526

Closed
kmalakoff opened this issue Jun 15, 2012 · 1 comment
Closed

npm package - client version possible? #526

kmalakoff opened this issue Jun 15, 2012 · 1 comment

Comments

@kmalakoff
Copy link

I have started to use npm with TravisCI to automatically test my libraries (including CommonJS-compliant packaging both on the server and client).

What I do in TravisCI is get the latest package from npm, copy the javascript library to my vendor folder, and then run my tests in a client (for example, brunch which uses stitch) and simulated nodejs server environment. This way, when a new version of a dependent library is released, my tests run against the latest version in all use cases (raw and required for client and server).

But of course, this is assuming npm has the latest version and that the version it has is compatible both in client and server CommonJS-compliant environments...

Rather than have the knockout npm package always require jsdom, could you publish a version of knockout in npm that is hybrid client/server? For example:

// on the server
if (typeof window === 'undefined') {
  var jsdom = require('jsdom').jsdom,
    document = jsdom('<html><head></head><body></body></html>'),
    window = document.createWindow(),
    navigator = window.navigator = {},
    DEBUG = false; 
  navigator.userAgent = 'NodeJs JsDom';
}

In the meantime, I have created an npm package for knockout-client (http://search.npmjs.org/#/knockout-client), but would prefer to delete it if you can provide a merged client/server version.

Please let me know what you think...

Kevin

@rniemeyer
Copy link
Member

This is being addressed in #866.

@paglias paglias mentioned this issue Mar 6, 2013
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants