Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Please publish AngularJS as an NPM module #2877

Closed
dankohn opened this issue Jun 5, 2013 · 78 comments · Fixed by #9376
Closed

Please publish AngularJS as an NPM module #2877

dankohn opened this issue Jun 5, 2013 · 78 comments · Fixed by #9376

Comments

@dankohn
Copy link
Contributor

dankohn commented Jun 5, 2013

It just takes a few minutes to publish an npm module of the existing AngularJS project, but it would accomplish the following:

  • Enable deployment from the standard infrastructure being used for both server and client Javascript code
  • Enable browserify users like me to package up client side libraries I fetch with npm (though in production, I reference a copy on the CDN)
  • Find new Angular releases using npm outdated.
  • Jump ahead of jQuery, which is in the process of taking over the npm management of their library: Publish the updates to NPM & Setup Travis HorseAJ86/node-jquery#56

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!

@darvin
Copy link

darvin commented Jun 5, 2013

+1 im using https://github.com/darvin/angular-browserify currently

@vizo
Copy link

vizo commented Jul 29, 2013

+1

@RWOverdijk
Copy link

+1.

Or use napa. Works well for me:
npm i napa --save-dev

and add to package.json:

{
  "scripts": {
    "install": "napa angular/bower-angular:angular"
  }
}

@bpierre
Copy link

bpierre commented Sep 26, 2013

The name angularjs, defined in the package.json, has been taken on npm by this module: https://github.com/eugeneware/angularjs

  • @eugeneware, would it be possible to change the name of your module, since it could be mistaken for the official Angular project?
  • AngularJS people, would it be possible to publish Angular on npm?

@eugeneware
Copy link

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.

@NickHeiner
Copy link
Contributor

👍

2 similar comments
@seanhess
Copy link

seanhess commented Oct 9, 2013

+1

@aderuwe
Copy link

aderuwe commented Oct 15, 2013

👍

@bclinkinbeard
Copy link
Contributor

In the meantime you can use https://npmjs.org/package/angular. It allows you to use Angular from both Browserify and Node directly.

@vilmosioo
Copy link

+1

1 similar comment
@steffenmllr
Copy link

+1

@psi-4ward
Copy link

+1
something official would be nice

@dcartertwo
Copy link

+1. would be great to have something official for angular and its core modules.

@xseignard
Copy link

i would say +1 too!

@dylang
Copy link

dylang commented Jan 21, 2014

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:

  • Create an npm account for angular.
  • Put the credentials on the Jenkins slave (or wherever they need to go).
  • Decide if it should be this repo (with an .npmignore file) or a new repo that is published to npm. Bower uses separate repos for the built code, so to continue with that pattern there could be npm-angular.
  • Create the npm-angular repo or make changes to the current repo.
  • @bclinkinbeard: transfer or share access to your angular module on npm with the angular user, and/or @eugeneware and your angularjs module.
  • Possibly as a separate issue: Add Browserify examples to the documentation.
  • Promote benefits of using Angular with Browserify on our favorite social mediums.

What else is missing and who wants to help?

@caitp
Copy link
Contributor

caitp commented Jan 21, 2014

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.

@bclinkinbeard
Copy link
Contributor

@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 package.json that specifies "browser": "index-browserify.js" is all you need to make Angular work with Browserify.

@caitp I'm not entirely sure I understand what you mean, but as long as the dependency versions are specified correctly in package.json, npm should handle the dependency management entirely without issue. Are you just referring to things like angular-resource? I will admit I am not entirely up to speed on how those things are broken out and managed, but coordinating those versions should be fairly straightforward.

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.

@caitp
Copy link
Contributor

caitp commented Jan 21, 2014

@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.

@bclinkinbeard
Copy link
Contributor

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.

@caitp
Copy link
Contributor

caitp commented Jan 21, 2014

@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.

@bclinkinbeard
Copy link
Contributor

@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!

@kevin-smets
Copy link

👍

@cburgdorf
Copy link
Contributor

+1

Lots of browser targeted frameworks use npm for as their package manager of choice. For instance topcoat the pure css framework by Adobe has chosen npm over bower for various reasons. @kristoferjoseph shared some insights about the reasoning behind the decision on twitter recently.

Quite interesting read: Don't let anyone tell you npm is not for the client side

@eugeneware
Copy link

I've got the angularjs module in npm and would gladly donate it for the cause.

@eugeneware
Copy link

@dylang If you need any help with the PR, let me know. I'm happy to help.

@dylang
Copy link

dylang commented Jan 22, 2014

@eugeneware Please do! I'm just trying to help coordinate what has to get done to get this ticket closed.

@bclinkinbeard
Copy link
Contributor

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 angular-browserify.js, that can have a reference to the actual built version of Angular. The contents of that file simply need to be

require('./path/to/angular.js');

module.exports = angular;

Then add a browser property to package.json that points to angular-browserify.js. That is it from a functional perspective. Now somebody just needs to figure out how to integrate that (and publishing to npm) into the build. :)

@bpierre
Copy link

bpierre commented Jan 25, 2014

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…

@jamesmorgan
Copy link

+1

2 similar comments
@johnwook
Copy link

johnwook commented Sep 4, 2014

+1

@fdelbos
Copy link

fdelbos commented Sep 10, 2014

+1

@tanx
Copy link

tanx commented Sep 12, 2014

+1 also for the 1.2.x branch

@fmal
Copy link

fmal commented Sep 17, 2014

+1

1 similar comment
@deitch
Copy link

deitch commented Sep 28, 2014

+1

@IgorMinar IgorMinar modified the milestones: 1.3.0-rc.5, 1.3.0 Oct 1, 2014
@fineswap
Copy link

fineswap commented Oct 1, 2014

+1

@mljsimone
Copy link

Yay! +1

@jblaise
Copy link

jblaise commented Oct 3, 2014

nice 👍

@mgol
Copy link
Member

mgol commented Oct 4, 2014

Note for the future: before a final version is released I guess the publishing command should be like:

npm publish --tag=beta

Otherwise it'll get tagged as latest and all people doing npm install angular will install the unstable one.

This may not be important here since this will be the first official publish anyway.

btford added a commit to btford/angular.js that referenced this issue Oct 6, 2014
@btford btford removed the In Progress label Oct 6, 2014
@btford
Copy link
Contributor

btford commented Oct 6, 2014

Landed the change to the script, but we'll need to do another release to get the artifacts up.

@addyosmani
Copy link

Yay. Nice work @btford!

@RichardLitt
Copy link
Contributor

👍 Thanks man!

@aderuwe
Copy link

aderuwe commented Oct 7, 2014

👍 Awesome!

@tanx
Copy link

tanx commented Oct 7, 2014

Thanks!

@jblaise
Copy link

jblaise commented Oct 9, 2014

👍 thanks

bullgare pushed a commit to bullgare/angular.js that referenced this issue Oct 9, 2014
@seadb
Copy link

seadb commented Oct 19, 2015

thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.