-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Please publish AngularJS as an NPM module #2877
Comments
+1 im using https://github.com/darvin/angular-browserify currently |
+1 |
+1. Or use napa. Works well for me: and add to package.json: {
"scripts": {
"install": "napa angular/bower-angular:angular"
}
} |
The name
|
The intention was to have a browserify friendly way to include angularjs, so very happy to give up the name for an officially supported version. |
👍 |
2 similar comments
+1 |
👍 |
In the meantime you can use https://npmjs.org/package/angular. It allows you to use Angular from both Browserify and Node directly. |
+1 |
1 similar comment
+1 |
+1 |
+1. would be great to have something official for angular and its core modules. |
i would say +1 too! |
I asked @bradlygreen about publishing npmjs at #ng-conf and he said they haven't done it yet because it's not necessary for the way Angular is used within Google, but suggested that adding a pull request to the build scripts could help this happen. I think these are the tasks required, but there could be more:
What else is missing and who wants to help? |
There was some talk about this last night, and the main issue with NPM and Bower (held by certain individuals) seems to be the handling of dependencies, where NPM will let every package have its own isolate dependencies which don't need to work together nicely, and Bower which does need packages to agree on a version of a dependency (but doesn't necessarily do a totally good job of it). Having said that, it probably wouldn't be the end of the world to publish stuff on npm (since we're already publishing on bower), but it sounds like there is a bit more faith in alternative and new package managers that solve these problems better. I think that to play nicely with browserify we'll probably want to publish on npm, but given what I've said above, it's probably at the users risk to make sure that the pieces fit together properly. |
@dylang I would be more than happy to share or give up the npm module if/when an official version becomes available. Regarding the separate or same repo question, I don't think a separate one is necessary. You can see the way I am currently exposing the existing code at https://github.com/bclinkinbeard/angular/blob/master/index-browserify.js, which, when combined with a @caitp I'm not entirely sure I understand what you mean, but as long as the dependency versions are specified correctly in I will take a look at the build scripts to try and get an idea of how difficult automating this would be. My guess is not very, but those are often famous last words. |
@bclinkinbeard yes, having a very carefully written package.json would probably be workable for people, it's mostly an issue with how the package manager works, it's not totally well-suited for a browser. |
We might be getting off topic but I'd love to know what you mean by that. :) It's just a package/dependency manager that installs the dependencies you specify at the versions you specify. I don't find any aspect of it relevant to browsers or not-browsers. |
@bclinkinbeard for instance, in a browser you can't really have 6 versions of jQuery at a time because 6 of your packages depend on a different version of it. I mean theoretically you could, but it's not desirable and wouldn't be helpful. A package manager for browsers should get all packages to agree with each other. My understanding is that there are ways around this with npm, and if you're very careful it shouldn't be an issue anyways, but this is the main complaint about npm as a package manager for browsers. |
@caitp Ah, right. I have seen a few discussions of that issue before but don't remember where/if they settled. Either way, we shouldn't need to worry about it for the issue at hand. Thanks! |
👍 |
+1 Lots of browser targeted frameworks use Quite interesting read: Don't let anyone tell you npm is not for the client side |
I've got the |
@dylang If you need any help with the PR, let me know. I'm happy to help. |
@eugeneware Please do! I'm just trying to help coordinate what has to get done to get this ticket closed. |
I don't know the build setup well enough (holy crap it's big and complex) to know exactly how to integrate this, but I wanted to document how simple it is to actually make Angular Browserify-able. All that needs to be done is to create a file, perhaps called
Then add a |
Also it would be cool if Angular could be removed from the global scope, something like this: require('./path/to/angular.js');
module.exports = window.angular;
delete window.angular; But I guess it’s the only way to communicate with other modules… |
+1 |
2 similar comments
+1 |
+1 |
+1 also for the 1.2.x branch |
+1 |
1 similar comment
+1 |
+1 |
Yay! +1 |
nice 👍 |
Note for the future: before a final version is released I guess the publishing command should be like:
Otherwise it'll get tagged as This may not be important here since this will be the first official publish anyway. |
Landed the change to the script, but we'll need to do another release to get the artifacts up. |
Yay. Nice work @btford! |
👍 Thanks man! |
👍 Awesome! |
Thanks! |
👍 thanks |
thank you! |
It just takes a few minutes to publish an npm module of the existing AngularJS project, but it would accomplish the following:
The npm name angularjs remains available. I recommend mapping it to git://github.com/angular/angular.js.git#v1.0.x and perhaps also creating an angularjs-unstable which pulls from master.
Thanks!
The text was updated successfully, but these errors were encountered: