{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/1431","repository_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/1431/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/1431/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/1431/events","html_url":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/1431","id":165411447,"number":1431,"title":"Allow individually publishable API client libraries.","user":{"login":"jmdobry","id":1213510,"avatar_url":"https://avatars.githubusercontent.com/u/1213510?v=3","gravatar_id":"","url":"https://api.github.com/users/jmdobry","html_url":"https://github.com/jmdobry","followers_url":"https://api.github.com/users/jmdobry/followers","following_url":"https://api.github.com/users/jmdobry/following{/other_user}","gists_url":"https://api.github.com/users/jmdobry/gists{/gist_id}","starred_url":"https://api.github.com/users/jmdobry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmdobry/subscriptions","organizations_url":"https://api.github.com/users/jmdobry/orgs","repos_url":"https://api.github.com/users/jmdobry/repos","events_url":"https://api.github.com/users/jmdobry/events{/privacy}","received_events_url":"https://api.github.com/users/jmdobry/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/labels/cla:%20yes","name":"cla: yes","color":"009800"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-07-13T20:17:04Z","updated_at":"2016-07-14T20:14:09Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/pulls/1431","html_url":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/1431","diff_url":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/1431.diff","patch_url":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/1431.patch"},"body":"Lots of discussion floating around on _why_ a PR like this is necessary, like GoogleCloudPlatform/gcloud-common#138.\r\n\r\n### Summary of changes\r\n\r\n**tldr;**\r\n\r\nAdd `package.json` files to each sub-folder in `lib/` and change a lot of relative import paths to use named package imports. And, switch to new `google-cloud-*` naming scheme.\r\n\r\n**Long version**\r\n\r\nWhat is this PR? Right now `gcloud-node` combines all API client library code into a single installable NPM package. This means that to update client code for an individual API, the entire `gcloud-node` package must be version bumped and re-published.\r\n\r\nThis PR makes it possible for each sub-folder within the `lib/` folder to be published to NPM as its own package. Currently, `lib/index.js` imports all of the `lib/` sub-folders using relative paths, pulling that code directly into the published `gcloud-node` package. Furthermore, individual `lib/` sub-folders sometimes import code from each other using relative paths. In order for `lib/vision/` to be cleanly publishable as an individual NPM package, any code it imports from outside of itself (e.g. `require('../storage/file.js')` or `require('../lib/common/util.js'`), needs to be changed to named package imports (e.g. `require('google-cloud-storage').File` or `require('google-cloud-common/util.js')`. This decouples the versioning and publishing of sub-packages from one another.\r\n\r\nWith this change, some individual packages will be free to move forward toward 1.0.0 while others might need to stay back at alpha or beta versions. The actual version number of the `gcloud-node` becomes less meaningful, as now the \"big\" package will just depend on a bunch of individually versioned and published packages.\r\n\r\n**Before**\r\n\r\n    npm install gcloud\r\n\r\n```js\r\nvar gcloud = require('gcloud');\r\nvar vision = gcloud.vision();\r\n```\r\n\r\n**After**\r\n\r\n    npm install google-cloud\r\n\r\n```js\r\nvar gcloud = require('google-cloud');\r\nvar vision = gcloud.vision();\r\n```\r\n\r\nor\r\n\r\n    npm install google-cloud-vision\r\n\r\n```js\r\nvar vision = require('google-cloud-vision').Vision();\r\n```\r\n\r\nor\r\n\r\n    npm install google-cloud-pubsub\r\n\r\n```js\r\nvar pubsub = require('google-cloud-pubsub').PubSub();\r\n```\r\n\r\netc.\r\n\r\n### List of changes\r\n\r\n- [ ] - `package.json`\r\n  - [x] - Change `\"name\"` from `\"gcloud\"` to `\"google-cloud\"`\r\n  - [x] - Remove existing `\"dependencies\"` and switch to depending on `google-cloud-common`, `google-cloud-storage`, `google-cloud-pubsub`, etc.\r\n  - [ ] - Update `\"version\"` to ???\r\n- [x] - `lib/index.js`\r\n  - [x] - Update `require` calls from using relative paths to using package names, e.g. `require('./storage/index.js')` => `require('google-cloud-storage')`\r\n- [ ] - Sub-packages\r\n  - [x] - Add individual `package.json` files for each `lib/<folder>`\r\n  - [x] - All individual sub-packages have one dependency: `google-cloud-common` (`lib/common`)\r\n  - [ ] - Set sub-package `package.json``\"version\"` field to ???\r\n  - [x] - Update sub-package use of relative import paths (`../lib/common`) to use `google-cloud-common`, e.g. `require('../lib/common/utils.js')` => `require('google-cloud-common/util.js')`\r\n  - [x] - Future-proof the library by switching `lib/<folder>/index.js` files to using named exports exclusively (ES2015 Modules).\r\n- [x] - Tests\r\n  - [x] - When mocking dependencies, update paths to reflect changes in `lib/`\r\n  - [ ] - **Note: There seems to be a bug in `mockery` that doesn't like the symbolic links that are now necessary for local development. I installed `proxyquire` (alternative to `mockery`), tried it, and it works fine.**\r\n- [ ] - `scripts/`\r\n  - [x] - Added `link.sh`, which sets up the symbolic links necessary for local development\r\n  - [x] - Added `unlink.sh`, the reverse of `link.sh`\r\n  - [x] - Added a simple `publish.sh` script, referenced in each sub-package `package.json` file, which can publish a sub-package to NPM with the appropriate legal files included.\r\n  - [ ] - Update release script ???\r\n- [ ] - Docs\r\n  - [ ] - ??? My thoughts are the docs can work as they are, we just need to update the overview for each API to show that it can be installed individually, and also show how to instantiate it."},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/comments/232778739","html_url":"https://github.com/GoogleCloudPlatform/gcloud-node/pull/1431#issuecomment-232778739","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-node/issues/1431","id":232778739,"user":{"login":"jmdobry","id":1213510,"avatar_url":"https://avatars.githubusercontent.com/u/1213510?v=3","gravatar_id":"","url":"https://api.github.com/users/jmdobry","html_url":"https://github.com/jmdobry","followers_url":"https://api.github.com/users/jmdobry/followers","following_url":"https://api.github.com/users/jmdobry/following{/other_user}","gists_url":"https://api.github.com/users/jmdobry/gists{/gist_id}","starred_url":"https://api.github.com/users/jmdobry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmdobry/subscriptions","organizations_url":"https://api.github.com/users/jmdobry/orgs","repos_url":"https://api.github.com/users/jmdobry/repos","events_url":"https://api.github.com/users/jmdobry/events{/privacy}","received_events_url":"https://api.github.com/users/jmdobry/received_events","type":"User","site_admin":false},"created_at":"2016-07-14T20:14:09Z","updated_at":"2016-07-14T20:14:09Z","body":"I updated the PR description."}}
{"actor":{"display_login":"jmdobry"}}