Pinging this thread, because I don't think any conclusions have been made
yet.
I don't personally care a whole lot which the conventions end up being,
it's fine with me to do whatever. But, some other core team folks do need
to OK the approach so that this can be done, or decide that it's not worth
doing at all.
The iffy pieces:
- Default npm packages vs alternative package or tagged release
- Export whole module object vs export module name vs some other
alternative (it's inconsistent no matter what if require('angular') returns
the angular module).
- What to do about files which export multiple modules
Some feedback to close this thread would be great.
On Tuesday, 13 January 2015 21:51:20 UTC-5, Ben Clinkinbeard wrote:
>
> Summary
>
> Change the publish script to support idiomatic CommonJS usage when
> installed from npm.
>
> Motivation
>
> Now that the Angular modules are available on npm, supporting proper
> CommonJS use via require() is the next logical step. This use case is
> widely expected by developers using npm for dependency management.
>
>
> Without this change, developers still have to use a script tag to include
> Angular modules from within the node_modules folder. This is extremely
> uncommon with npm packages, and does nothing to enable Browserify and
> webpack support.
>
> Compatibility Risk
>
> Little to no risk as only the publish shell script needs to be changed.
>
> Ongoing Technical Constraints
>
> There should be virtually no ongoing maintenance needed since it's just a
> publish script.
>
> Plans for Implementation
>
> Simple changes to the publish script will be made to remove the main field
> from the package.json files and generate an index.js file for each package
> so that it is used when requiring by name. The index.js file will require()
> the standard built file and export a value(s) appropriate for the module.
>
>
> The core angular module will export the angular object.
>
>
> The supporting modules will export their module name (ngAnimate, ngRoute,
> etc.) with the exception of angular-mocks, which exports 3 values: ngMock,
> ngMockE2E, ngAnimateMock
>
>
> This would enable code akin to the following:
>
>
> var angular = require('angular');
>
> angular.module('app', [
>
> require('angular-animate'),
>
> require('angular-route'),
>
> require('angular-mocks').ngMock
>
> ]);
>
> Prior Art
> The overwhelming expectation, when a developer installs a package from
> npm, is that they can then use require('package-name') to load it. This
> change will bring Angular in line with the rest of the npm ecosystem.
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.