{"action":"created","comment":{"url":"https://api.github.com/repos/NativeScript/nativescript-cli/pulls/comments/31795454","id":31795454,"diff_hunk":"@@ -50,128 +26,51 @@ export class NodePackageManager implements INodePackageManager {\n \t\t});\n \t\treturn future;\n \t}\n-\n-\tpublic install(packageName: string, opts?: INpmInstallOptions): IFuture<string> {\n-\t\treturn (() => {\n-\t\t\tthis.$lockfile.lock().wait();\n-\n-\t\t\ttry {\n-\t\t\t\tvar packageToInstall = packageName;\n-\t\t\t\tvar pathToSave = (opts && opts.pathToSave) || npm.cache;\n-\t\t\t\tvar version = (opts && opts.version) || null;\n-\n-\t\t\t\treturn this.installCore(packageToInstall, pathToSave, version).wait();\n-\t\t\t} catch(error) {\n-\t\t\t\tthis.$logger.debug(error);\n-\t\t\t\tthis.$errors.fail(\"%s. Error: %s\", NodePackageManager.NPM_LOAD_FAILED, error);\n-\t\t\t} finally {\n-\t\t\t\tthis.$lockfile.unlock().wait();\n-\t\t\t}\n-\n-\t\t}).future<string>()();\n-\t}\n-\n-\tpublic getLatestVersion(packageName: string): IFuture<string> {\n-\t\tvar future = new Future<string>();\n-\n-\t\tnpm.commands[\"view\"]([packageName, \"dist-tags\"], [false], (err: any, data: any) => { // [false] - silent\n-\t\t\tif(err) {\n-\t\t\t\tfuture.throw(err);\n-\t\t\t} else {\n-\t\t\t\tvar latestVersion = _.first(_.keys(data));\n-\t\t\t\tthis.$logger.trace(\"Using version %s. \", latestVersion);\n-\n-\t\t\t\tfuture.return(latestVersion);\n-\t\t\t}\n-\t\t});\n-\n-\t\treturn future;\n+\t\n+\tpublic install(packageName: string, pathToSave: string, config?: any): IFuture<any> {\n+\t\treturn this.loadAndExecute(\"install\", [pathToSave, packageName], { config: config });\n \t}\n-\n-\tpublic getCachedPackagePath(packageName: string, version: string): string {\n-\t\treturn path.join(npm.cache, packageName, version, \"package\");\n+\t\n+\tpublic uninstall(packageName: string, config?: any): IFuture<any> {\n+\t\treturn this.loadAndExecute(\"uninstall\", [[packageName]], { config: config });\n \t}\n \n-\tprivate installCore(packageName: string, pathToSave: string, version: string): IFuture<string> {\n-\t\treturn (() => {\n-\t\t\tif (this.$options.frameworkPath) {\n-\t\t\t\tif (this.$fs.getFsStats(this.$options.frameworkPath).wait().isFile()) {\n-\t\t\t\t\tthis.npmInstall(packageName, pathToSave, version).wait();\n-\t\t\t\t\tvar pathToNodeModules = path.join(pathToSave, \"node_modules\");\n-\t\t\t\t\tvar folders = this.$fs.readDirectory(pathToNodeModules).wait();\n-\t\t\t\t\treturn path.join(pathToNodeModules, folders[0]);\n-\t\t\t\t}\n-\t\t\t\treturn this.$options.frameworkPath;\n-\t\t\t} else {\n-\t\t\t\tversion = version || this.getLatestVersion(packageName).wait();\n-\t\t\t\tvar packagePath = this.getCachedPackagePath(packageName, version);\n-\t\t\t\tif (!this.isPackageCached(packagePath).wait()) {\n-\t\t\t\t\tthis.addToCacheCore(packageName, version).wait();\n-\t\t\t\t}\n-\n-\t\t\t\tif(!this.isPackageUnpacked(packagePath).wait()) {\n-\t\t\t\t\tthis.cacheUnpack(packageName, version).wait();\n-\t\t\t\t}\n-\t\t\t\treturn packagePath;\n-\t\t\t}\n-\t\t}).future<string>()();\n+\tpublic cache(packageName: string, version: string, config?: any): IFuture<ICacheData> {\n+\t\t// function cache (pkg, ver, where, scrub, cb)\n+\t\treturn this.loadAndExecute(\"cache\", [packageName, version, undefined, false], { subCommandName: \"add\", config: config });\n \t}\n-\n-\tprivate npmInstall(packageName: string, pathToSave: string, version: string): IFuture<void> {\n-\t\tthis.$logger.out(\"Installing \", packageName);\n-\n-\t\tvar incrementedVersion = semver.inc(version, constants.ReleaseType.MINOR);\n-\t\tif (!this.$options.frameworkPath && packageName.indexOf(\"@\") < 0) {\n-\t\t\tpackageName = packageName + \"@<\" + incrementedVersion;\n-\t\t}\n-\n-\t\tvar future = new Future<void>();\n-\t\tnpm.commands[\"install\"](pathToSave, packageName, (err: Error, data: any) => {\n-\t\t\tif(err) {\n-\t\t\t\tfuture.throw(err);\n-\t\t\t} else {\n-\t\t\t\tthis.$logger.out(\"Installed \", packageName);\n-\t\t\t\tfuture.return(data);\n-\t\t\t}\n-\t\t});\n-\t\treturn future;\n+\t\n+\tpublic cacheUnpack(packageName: string, version: string, unpackTarget?: string): IFuture<void> {\n+\t\t// function unpack (pkg, ver, unpackTarget, dMode, fMode, uid, gid, cb)\n+\t\treturn this.loadAndExecute(\"cache\", [packageName, version, unpackTarget, null, null, null, null], { subCommandName: \"unpack\" });\n \t}\n-\n-\tprivate isPackageCached(packagePath: string): IFuture<boolean> {\n-\t\treturn this.$fs.exists(packagePath);\n+\t\n+\tpublic view(packageName: string, propertyName: string): IFuture<any> {\n+\t\treturn this.loadAndExecute(\"view\", [[packageName, propertyName], [false]]);\n \t}\n-\n-\tprivate isPackageUnpacked(packagePath: string): IFuture<boolean> {\n+\t","path":"lib/node-package-manager.ts","position":157,"original_position":157,"commit_id":"ef2eb6e21fb4ee27c1a5d24e0a11812acc4a568b","original_commit_id":"ef2eb6e21fb4ee27c1a5d24e0a11812acc4a568b","user":{"login":"rosen-vladimirov","id":8351653,"avatar_url":"https://avatars.githubusercontent.com/u/8351653?v=3","gravatar_id":"","url":"https://api.github.com/users/rosen-vladimirov","html_url":"https://github.com/rosen-vladimirov","followers_url":"https://api.github.com/users/rosen-vladimirov/followers","following_url":"https://api.github.com/users/rosen-vladimirov/following{/other_user}","gists_url":"https://api.github.com/users/rosen-vladimirov/gists{/gist_id}","starred_url":"https://api.github.com/users/rosen-vladimirov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rosen-vladimirov/subscriptions","organizations_url":"https://api.github.com/users/rosen-vladimirov/orgs","repos_url":"https://api.github.com/users/rosen-vladimirov/repos","events_url":"https://api.github.com/users/rosen-vladimirov/events{/privacy}","received_events_url":"https://api.github.com/users/rosen-vladimirov/received_events","type":"User","site_admin":false},"body":"some space left here","created_at":"2015-06-05T08:30:52Z","updated_at":"2015-06-05T08:30:52Z","html_url":"https://github.com/NativeScript/nativescript-cli/pull/524#discussion_r31795454","pull_request_url":"https://api.github.com/repos/NativeScript/nativescript-cli/pulls/524","_links":{"self":{"href":"https://api.github.com/repos/NativeScript/nativescript-cli/pulls/comments/31795454"},"html":{"href":"https://github.com/NativeScript/nativescript-cli/pull/524#discussion_r31795454"},"pull_request":{"href":"https://api.github.com/repos/NativeScript/nativescript-cli/pulls/524"}}},"pull_request":{"url":"https://api.github.com/repos/NativeScript/nativescript-cli/pulls/524","id":37009145,"html_url":"https://github.com/NativeScript/nativescript-cli/pull/524","diff_url":"https://github.com/NativeScript/nativescript-cli/pull/524.diff","patch_url":"https://github.com/NativeScript/nativescript-cli/pull/524.patch","issue_url":"https://api.github.com/repos/NativeScript/nativescript-cli/issues/524","number":524,"state":"open","locked":false,"title":"Npm as package manager","user":{"login":"Fatme","id":760518,"avatar_url":"https://avatars.githubusercontent.com/u/760518?v=3","gravatar_id":"","url":"https://api.github.com/users/Fatme","html_url":"https://github.com/Fatme","followers_url":"https://api.github.com/users/Fatme/followers","following_url":"https://api.github.com/users/Fatme/following{/other_user}","gists_url":"https://api.github.com/users/Fatme/gists{/gist_id}","starred_url":"https://api.github.com/users/Fatme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fatme/subscriptions","organizations_url":"https://api.github.com/users/Fatme/orgs","repos_url":"https://api.github.com/users/Fatme/repos","events_url":"https://api.github.com/users/Fatme/events{/privacy}","received_events_url":"https://api.github.com/users/Fatme/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-05T08:05:03Z","updated_at":"2015-06-05T08:30:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"152c851c14fd2459d7f8d5ca2760bbdcf7791c61","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/NativeScript/nativescript-cli/pulls/524/commits","review_comments_url":"https://api.github.com/repos/NativeScript/nativescript-cli/pulls/524/comments","review_comment_url":"https://api.github.com/repos/NativeScript/nativescript-cli/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NativeScript/nativescript-cli/issues/524/comments","statuses_url":"https://api.github.com/repos/NativeScript/nativescript-cli/statuses/ef2eb6e21fb4ee27c1a5d24e0a11812acc4a568b","head":{"label":"NativeScript:fatme/npm-as-package-manager","ref":"fatme/npm-as-package-manager","sha":"ef2eb6e21fb4ee27c1a5d24e0a11812acc4a568b","user":{"login":"NativeScript","id":7392261,"avatar_url":"https://avatars.githubusercontent.com/u/7392261?v=3","gravatar_id":"","url":"https://api.github.com/users/NativeScript","html_url":"https://github.com/NativeScript","followers_url":"https://api.github.com/users/NativeScript/followers","following_url":"https://api.github.com/users/NativeScript/following{/other_user}","gists_url":"https://api.github.com/users/NativeScript/gists{/gist_id}","starred_url":"https://api.github.com/users/NativeScript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NativeScript/subscriptions","organizations_url":"https://api.github.com/users/NativeScript/orgs","repos_url":"https://api.github.com/users/NativeScript/repos","events_url":"https://api.github.com/users/NativeScript/events{/privacy}","received_events_url":"https://api.github.com/users/NativeScript/received_events","type":"Organization","site_admin":false},"repo":{"id":21347346,"name":"nativescript-cli","full_name":"NativeScript/nativescript-cli","owner":{"login":"NativeScript","id":7392261,"avatar_url":"https://avatars.githubusercontent.com/u/7392261?v=3","gravatar_id":"","url":"https://api.github.com/users/NativeScript","html_url":"https://github.com/NativeScript","followers_url":"https://api.github.com/users/NativeScript/followers","following_url":"https://api.github.com/users/NativeScript/following{/other_user}","gists_url":"https://api.github.com/users/NativeScript/gists{/gist_id}","starred_url":"https://api.github.com/users/NativeScript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NativeScript/subscriptions","organizations_url":"https://api.github.com/users/NativeScript/orgs","repos_url":"https://api.github.com/users/NativeScript/repos","events_url":"https://api.github.com/users/NativeScript/events{/privacy}","received_events_url":"https://api.github.com/users/NativeScript/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NativeScript/nativescript-cli","description":"Command-line interface for building NativeScript apps","fork":false,"url":"https://api.github.com/repos/NativeScript/nativescript-cli","forks_url":"https://api.github.com/repos/NativeScript/nativescript-cli/forks","keys_url":"https://api.github.com/repos/NativeScript/nativescript-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NativeScript/nativescript-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NativeScript/nativescript-cli/teams","hooks_url":"https://api.github.com/repos/NativeScript/nativescript-cli/hooks","issue_events_url":"https://api.github.com/repos/NativeScript/nativescript-cli/issues/events{/number}","events_url":"https://api.github.com/repos/NativeScript/nativescript-cli/events","assignees_url":"https://api.github.com/repos/NativeScript/nativescript-cli/assignees{/user}","branches_url":"https://api.github.com/repos/NativeScript/nativescript-cli/branches{/branch}","tags_url":"https://api.github.com/repos/NativeScript/nativescript-cli/tags","blobs_url":"https://api.github.com/repos/NativeScript/nativescript-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NativeScript/nativescript-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NativeScript/nativescript-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/NativeScript/nativescript-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NativeScript/nativescript-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/NativeScript/nativescript-cli/languages","stargazers_url":"https://api.github.com/repos/NativeScript/nativescript-cli/stargazers","contributors_url":"https://api.github.com/repos/NativeScript/nativescript-cli/contributors","subscribers_url":"https://api.github.com/repos/NativeScript/nativescript-cli/subscribers","subscription_url":"https://api.github.com/repos/NativeScript/nativescript-cli/subscription","commits_url":"https://api.github.com/repos/NativeScript/nativescript-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/NativeScript/nativescript-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/NativeScript/nativescript-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/NativeScript/nativescript-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/NativeScript/nativescript-cli/contents/{+path}","compare_url":"https://api.github.com/repos/NativeScript/nativescript-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NativeScript/nativescript-cli/merges","archive_url":"https://api.github.com/repos/NativeScript/nativescript-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NativeScript/nativescript-cli/downloads","issues_url":"https://api.github.com/repos/NativeScript/nativescript-cli/issues{/number}","pulls_url":"https://api.github.com/repos/NativeScript/nativescript-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/NativeScript/nativescript-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/NativeScript/nativescript-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NativeScript/nativescript-cli/labels{/name}","releases_url":"https://api.github.com/repos/NativeScript/nativescript-cli/releases{/id}","created_at":"2014-06-30T10:21:20Z","updated_at":"2015-06-01T23:44:04Z","pushed_at":"2015-06-05T08:05:03Z","git_url":"git://github.com/NativeScript/nativescript-cli.git","ssh_url":"git@github.com:NativeScript/nativescript-cli.git","clone_url":"https://github.com/NativeScript/nativescript-cli.git","svn_url":"https://github.com/NativeScript/nativescript-cli","homepage":"https://www.npmjs.com/package/nativescript","size":39874,"stargazers_count":271,"watchers_count":271,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":41,"mirror_url":null,"open_issues_count":80,"forks":41,"open_issues":80,"watchers":271,"default_branch":"master"}},"base":{"label":"NativeScript:master","ref":"master","sha":"cc9fca39e9a5d41551c766eedbad93ec14562ece","user":{"login":"NativeScript","id":7392261,"avatar_url":"https://avatars.githubusercontent.com/u/7392261?v=3","gravatar_id":"","url":"https://api.github.com/users/NativeScript","html_url":"https://github.com/NativeScript","followers_url":"https://api.github.com/users/NativeScript/followers","following_url":"https://api.github.com/users/NativeScript/following{/other_user}","gists_url":"https://api.github.com/users/NativeScript/gists{/gist_id}","starred_url":"https://api.github.com/users/NativeScript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NativeScript/subscriptions","organizations_url":"https://api.github.com/users/NativeScript/orgs","repos_url":"https://api.github.com/users/NativeScript/repos","events_url":"https://api.github.com/users/NativeScript/events{/privacy}","received_events_url":"https://api.github.com/users/NativeScript/received_events","type":"Organization","site_admin":false},"repo":{"id":21347346,"name":"nativescript-cli","full_name":"NativeScript/nativescript-cli","owner":{"login":"NativeScript","id":7392261,"avatar_url":"https://avatars.githubusercontent.com/u/7392261?v=3","gravatar_id":"","url":"https://api.github.com/users/NativeScript","html_url":"https://github.com/NativeScript","followers_url":"https://api.github.com/users/NativeScript/followers","following_url":"https://api.github.com/users/NativeScript/following{/other_user}","gists_url":"https://api.github.com/users/NativeScript/gists{/gist_id}","starred_url":"https://api.github.com/users/NativeScript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NativeScript/subscriptions","organizations_url":"https://api.github.com/users/NativeScript/orgs","repos_url":"https://api.github.com/users/NativeScript/repos","events_url":"https://api.github.com/users/NativeScript/events{/privacy}","received_events_url":"https://api.github.com/users/NativeScript/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NativeScript/nativescript-cli","description":"Command-line interface for building NativeScript apps","fork":false,"url":"https://api.github.com/repos/NativeScript/nativescript-cli","forks_url":"https://api.github.com/repos/NativeScript/nativescript-cli/forks","keys_url":"https://api.github.com/repos/NativeScript/nativescript-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NativeScript/nativescript-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NativeScript/nativescript-cli/teams","hooks_url":"https://api.github.com/repos/NativeScript/nativescript-cli/hooks","issue_events_url":"https://api.github.com/repos/NativeScript/nativescript-cli/issues/events{/number}","events_url":"https://api.github.com/repos/NativeScript/nativescript-cli/events","assignees_url":"https://api.github.com/repos/NativeScript/nativescript-cli/assignees{/user}","branches_url":"https://api.github.com/repos/NativeScript/nativescript-cli/branches{/branch}","tags_url":"https://api.github.com/repos/NativeScript/nativescript-cli/tags","blobs_url":"https://api.github.com/repos/NativeScript/nativescript-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NativeScript/nativescript-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NativeScript/nativescript-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/NativeScript/nativescript-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NativeScript/nativescript-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/NativeScript/nativescript-cli/languages","stargazers_url":"https://api.github.com/repos/NativeScript/nativescript-cli/stargazers","contributors_url":"https://api.github.com/repos/NativeScript/nativescript-cli/contributors","subscribers_url":"https://api.github.com/repos/NativeScript/nativescript-cli/subscribers","subscription_url":"https://api.github.com/repos/NativeScript/nativescript-cli/subscription","commits_url":"https://api.github.com/repos/NativeScript/nativescript-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/NativeScript/nativescript-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/NativeScript/nativescript-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/NativeScript/nativescript-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/NativeScript/nativescript-cli/contents/{+path}","compare_url":"https://api.github.com/repos/NativeScript/nativescript-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NativeScript/nativescript-cli/merges","archive_url":"https://api.github.com/repos/NativeScript/nativescript-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NativeScript/nativescript-cli/downloads","issues_url":"https://api.github.com/repos/NativeScript/nativescript-cli/issues{/number}","pulls_url":"https://api.github.com/repos/NativeScript/nativescript-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/NativeScript/nativescript-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/NativeScript/nativescript-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NativeScript/nativescript-cli/labels{/name}","releases_url":"https://api.github.com/repos/NativeScript/nativescript-cli/releases{/id}","created_at":"2014-06-30T10:21:20Z","updated_at":"2015-06-01T23:44:04Z","pushed_at":"2015-06-05T08:05:03Z","git_url":"git://github.com/NativeScript/nativescript-cli.git","ssh_url":"git@github.com:NativeScript/nativescript-cli.git","clone_url":"https://github.com/NativeScript/nativescript-cli.git","svn_url":"https://github.com/NativeScript/nativescript-cli","homepage":"https://www.npmjs.com/package/nativescript","size":39874,"stargazers_count":271,"watchers_count":271,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":41,"mirror_url":null,"open_issues_count":80,"forks":41,"open_issues":80,"watchers":271,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NativeScript/nativescript-cli/pulls/524"},"html":{"href":"https://github.com/NativeScript/nativescript-cli/pull/524"},"issue":{"href":"https://api.github.com/repos/NativeScript/nativescript-cli/issues/524"},"comments":{"href":"https://api.github.com/repos/NativeScript/nativescript-cli/issues/524/comments"},"review_comments":{"href":"https://api.github.com/repos/NativeScript/nativescript-cli/pulls/524/comments"},"review_comment":{"href":"https://api.github.com/repos/NativeScript/nativescript-cli/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NativeScript/nativescript-cli/pulls/524/commits"},"statuses":{"href":"https://api.github.com/repos/NativeScript/nativescript-cli/statuses/ef2eb6e21fb4ee27c1a5d24e0a11812acc4a568b"}}}}