Publish ui-select on NPM registry
Hello,
Would it possible to publish ui-select on NPM registry?
Best.
+1 please!
+1
+1
+1
+1
+1
+1
Yes please, This would make life easier for those of us using webpack.
:+1:
It is published on NPM here : https://www.npmjs.com/package/ui-select but it is not up to date…
It would be really great if we could use ui-select's last version (0.12.0) with NPM. Could you update it on NPM registry please?
Note for folks about to install this via npm -- it's up there, but it may not turn out like you expect. It currently has a bower dependency and uses postinstall for 'bower install'.
cf https://github.com/angular-ui/ui-select/pull/982
@vperron: It's sort of like inviting someone into your home, and they come in, but they walk right by you without speaking and start moving furniture in your living room. Their movements are very efficient. They're building something. You’re like "wait, what are y--" but they're really fast and they don't even seem to notice you’re there. In no time, they've built a miniature house inside your house. Finished, they step inside, lock the little door behind them, and just stare at you from a little window with a cold, alien expression that somehow tells you it isn't safe to step any nearer.
Your daughter has started crying.
"What does it want daddy?"
"I don't know, honey. I don't know..."
+1
+1 for supporting CommonJS package management!
Motivation
We are in the process of refactoring an app to support modern JS tooling like NPM, Webpack & ES6.
Code Change
A small change is needed to support CommonJS:
/* commonjs package manager support (eg componentjs) */
if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports) {
module.exports = "ui.select";
}
- Source: ui-router release
- Or: UMD (Universal Module Definition)
I tried modifying UI-Select's gulpfile.js:
.pipe(header(
'/* commonjs package manager support (eg componentjs) */\n'+
'if (typeof module !== "undefined" && typeof exports !== "undefined" && module.exports === exports) {\n'+
' module.exports = "ui.select";\n'+
'}\n' +
'(function (angular) { \n"use strict";\n'))
.pipe(footer('\n}(angular));'))
but test are throwing this error:
Chrome 44.0.2403 (Windows 7 0.0.0) ERROR
Uncaught Error: [$injector:nomod] Module 'ui.select' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.4.3/$injector/nomod?p0=ui.select
at c:/Users/benoror/Dropbox/github/ui-select/bower_components/angular/angular.js:1958
I'm not sure how to proceed, any help would be appreciated in order to make a PR :smile:
Precedents
I have done other PRs for some of my dependencies:
- https://github.com/wix/angular-tree-control/pull/152
- https://github.com/gdi2290/angular-md5/issues/8
- https://github.com/gdi2290/angular-md5/pull/9
- https://github.com/muratcorlu/angular-urlify/pull/1
- https://github.com/tarkanlar/Angular-Urlify/pull/1
Sources
Just as a note, I was able to include it in Webpack + ES6 with:
import ngSanitize from 'angular-sanitize';
import uiselect from 'ui-select';
import 'ui-select/dist/select.css';
/** ... **/
export default angular.module('app.module.xyz', [
/** ... **/
ngSanitize,
'ui.select'
/** ... **/
])
.name
Either way, should it not be called angular-ui-select on npm as well? Because this could become a name conflict, one cannot ES6-import both ui-select and angular-ui-select using the same import statement. Unless we all leave bower behind and start using jspm/systemjs/npm, of course. (btw, jspm is quite great).
But in my case, I am developing a component is, currently, equally likely to have its dependencies satisfied via bower and npm. In which case, well, problems arise.
@benoror You were able to use the existing ui-select npm project and import it into a webpack/Angular project? Sounds like you were able to, but could you share more? When I import it, it just results in an empty object (which is typical of things that are CommonJS ready).
Jus as I mentioned before. I updated the example to include 'angular-sanitize'.