{"action":"created","issue":{"url":"https://api.github.com/repos/mohsen1/json-formatter/issues/27","labels_url":"https://api.github.com/repos/mohsen1/json-formatter/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/mohsen1/json-formatter/issues/27/comments","events_url":"https://api.github.com/repos/mohsen1/json-formatter/issues/27/events","html_url":"https://github.com/mohsen1/json-formatter/issues/27","id":102171435,"number":27,"title":"Publish to NPM plus support for Webpack + CommonJS Package Manager","user":{"login":"benoror","id":119117,"avatar_url":"https://avatars.githubusercontent.com/u/119117?v=3","gravatar_id":"","url":"https://api.github.com/users/benoror","html_url":"https://github.com/benoror","followers_url":"https://api.github.com/users/benoror/followers","following_url":"https://api.github.com/users/benoror/following{/other_user}","gists_url":"https://api.github.com/users/benoror/gists{/gist_id}","starred_url":"https://api.github.com/users/benoror/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benoror/subscriptions","organizations_url":"https://api.github.com/users/benoror/orgs","repos_url":"https://api.github.com/users/benoror/repos","events_url":"https://api.github.com/users/benoror/events{/privacy}","received_events_url":"https://api.github.com/users/benoror/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-20T15:54:13Z","updated_at":"2015-08-20T15:56:54Z","closed_at":null,"body":"# Motivation\r\n\r\nHi!\r\n\r\nI'm in the process of refactoring an app to support modern JS tooling like NPM(-only), Webpack & ES6.\r\n\r\n# Code Change\r\n\r\nA small change is needed to support CommonJS.:\r\n\r\n```\r\n/* commonjs package manager support (eg componentjs) */\r\nif (typeof module !== \"undefined\" && typeof exports !== \"undefined\" && module.exports === exports){\r\n  module.exports = 'jsonFormatter';\r\n}\r\n```\r\n* Source: [ui-router release](https://github.com/angular-ui/ui-router/blob/master/release/angular-ui-router.js#L9)\r\n* Or: [UMD (Universal Module Definition)](https://github.com/umdjs/umd)\r\n\r\n# Working Examples\r\n\r\nI have done other PRs for some of my dependencies:\r\n\r\n* https://github.com/wix/angular-tree-control/pull/152\r\n* https://github.com/gdi2290/angular-md5/issues/8\r\n  * https://github.com/gdi2290/angular-md5/pull/9\r\n* https://github.com/muratcorlu/angular-urlify/pull/1\r\n* https://github.com/tarkanlar/Angular-Urlify/pull/1\r\n\r\n# Sources\r\n\r\n* [Using Angular 1.x With ES6 and Webpack by Jesus Rodriguez](http://angular-tips.com/blog/2015/06/using-angular-1-dot-x-with-es6-and-webpack/)\r\n* [Webpack & Angular by Shawn McKay ](http://www.shmck.com/webpack-angular-part-3/)\r\n* [Angular and Webpack for Modular Applications by @kentcdodds](https://egghead.io/series/angular-and-webpack-for-modular-applications)\r\n* [NPM for Everything](http://beletsky.net/2015/04/npm-for-everything.html)\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mohsen1/json-formatter/issues/comments/133059374","html_url":"https://github.com/mohsen1/json-formatter/issues/27#issuecomment-133059374","issue_url":"https://api.github.com/repos/mohsen1/json-formatter/issues/27","id":133059374,"user":{"login":"benoror","id":119117,"avatar_url":"https://avatars.githubusercontent.com/u/119117?v=3","gravatar_id":"","url":"https://api.github.com/users/benoror","html_url":"https://github.com/benoror","followers_url":"https://api.github.com/users/benoror/followers","following_url":"https://api.github.com/users/benoror/following{/other_user}","gists_url":"https://api.github.com/users/benoror/gists{/gist_id}","starred_url":"https://api.github.com/users/benoror/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benoror/subscriptions","organizations_url":"https://api.github.com/users/benoror/orgs","repos_url":"https://api.github.com/users/benoror/repos","events_url":"https://api.github.com/users/benoror/events{/privacy}","received_events_url":"https://api.github.com/users/benoror/received_events","type":"User","site_admin":false},"created_at":"2015-08-20T15:56:54Z","updated_at":"2015-08-20T15:56:54Z","body":"Update: I just found the package already in npmjs: https://www.npmjs.com/package/jsonformatter\r\n\r\nI will PR the README.md accordingly"}}