You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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:
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
The text was updated successfully, but these errors were encountered: