stormpath / stormpath-sdk-angularjs

User Management for AngularJS (1.x) applications
http://docs.stormpath.com/angularjs/sdk/
Apache License 2.0
165 stars 58 forks source link

NPM? #24

Closed nandanrao closed 8 years ago

nandanrao commented 9 years ago

Would love to be have the angular sdk on NPM (to install via Browserify or other browser npm package manager). Thoughts?

drpalaric commented 9 years ago

Might want to check out stormpath-sdk-express which is in Beta on NPM. They talk about integrating it with Angular.

robertjd commented 9 years ago

Hi @nandanrao

I created an NPM package for this module, so you'll see it in NPM now. However I haven't put much thought into how this library will work with Browserify etc, so please share your thoughts as you give it a try!

Thanks :)

voor commented 9 years ago

I notice you're not deploying the build artifacts in the npm deployment.

robertjd commented 9 years ago

Are you referring to what's in /dist? If so then no, at the moment I'm using those for the Bower package. Would these files be useful for Node / Browserify?

voor commented 9 years ago

Yes.

The best way to think of Webpack / Browserify is that it's exactly like Bower, except instead of inserting a script tag at the top of a page (or concat'ing all your files together) you simply refer to the module with a require("") just like a Node.js module.

It's more in-line with what you'll see happening in future iterations of JavaScript. It's also neato.

robertjd commented 9 years ago

Ah I see, thanks for the heads up! I'm going to leave this issue open, I'll address this soon!

celsomarques commented 9 years ago

@robertjd Could you remove dist folder from .npmignore, please? I wanna use only with NPM.

Example of browserify (package.json):

(...)
"browser": {
    (...)
    "angular": "./node_modules/angular/angular.js",
    "stormpath": "./node_modules/stormpath-sdk-angularjs/dist/stormpath-sdk-angularjs.js"
  },
  "browserify": {
    "transform": [
      "browserify-shim"
    ]
  },
  "browserify-shim": {
    (...)
    "stormpath": {
      "exports": "stormpath",
      "depends": [
        "angular"
      ]
    },
    "angular": "angular",
   (...)
  }
(...)

Thanks

rbickham11 commented 9 years ago

@robertjd We'd like to use this with browserify as well. Removing the dist folder from npmignore as suggested would be great!

robertjd commented 9 years ago

If the source code in src/ were using node-style requires, would you still prefer the dist/ files? Or would you require the source js instead?

shprink commented 8 years ago

When I DL the lastest version 0.7.2 via npm or via github I do not have the dist folder

image

and in the index.js (the main defined in package.json) those files are required.

image

I end up having the webpack build broken:

image

shprink commented 8 years ago

If you guys want a version that work with webpack you can install:

npm install shprink/stormpath-sdk-angularjs#patch-1 --save

Till the owner merges #71

drpalaric commented 8 years ago

@shprink

I really like the webpack idea for Stormpath. Have you used it for any project so far? Any Github repo that you'd like to share to see how you've used it?

shprink commented 8 years ago

@AbdullahAlger Do you mean how to use stormpath with webpack or how to build a lib such as stormpath with webpack?

If it is about building a lib with CommonJS and Webpack these are good examples:

https://github.com/shprink/wp-api-angularjs https://github.com/shprink/ionic-native-transitions https://github.com/shprink/volkswagen.js

If it is about using strompath with webpack, just install the fork I created and import the lib like this:

import 'stormpath-sdk-angularjs';

let mod = angular.module('yourModule.api', [
    'stormpath',
    'stormpath.templates'
]);
robertjd commented 8 years ago

Thanks to everyone for your input! I've merged #71 so that you can use the dist/ assets. The new release on npm is 0.8.0.

In the future I'd like to refactor this library to be Common JS.