-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
560 additions
and
877 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
/*! | ||
* npm-api <https://github.com/doowb/npm-api> | ||
* | ||
* Copyright (c) 2016, Brian Woodward. | ||
* Licensed under the MIT License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var npm = require('../')(); | ||
var maintainer = npm.maintainer('doowb'); | ||
maintainer.repos() | ||
.then(function (repos) { | ||
console.log(repos); | ||
}, function(err) { | ||
const NpmApi = require('../'); | ||
const npm = new NpmApi(); | ||
|
||
run() | ||
.then(() => { | ||
process.exit(); | ||
}) | ||
.catch(err => { | ||
console.error(err); | ||
process.exit(1); | ||
}); | ||
|
||
async function run() { | ||
let maintainer = npm.maintainer('doowb'); | ||
let repos = await maintainer.repos(); | ||
console.log(repos); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,25 @@ | ||
/*! | ||
* npm-api <https://github.com/doowb/npm-api> | ||
* | ||
* Copyright (c) 2016, Brian Woodward. | ||
* Licensed under the MIT License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var co = require('co'); | ||
var npm = require('../')(); | ||
const NpmApi = require('../'); | ||
const npm = new NpmApi(); | ||
|
||
var repo = npm.repo('micromatch'); | ||
co(function* () { | ||
run() | ||
.then(() => { | ||
process.exit(); | ||
}) | ||
.catch(err => { | ||
console.error(err); | ||
process.exit(1); | ||
}); | ||
|
||
var downloads = yield repo.downloads(); | ||
async function run() { | ||
let repo = npm.repo('micromatch'); | ||
let downloads = await repo.downloads(); | ||
console.log(downloads.length + ' days of downloads have been pulled for ' + repo.name); | ||
console.log(); | ||
|
||
console.log('total:', yield repo.total()); | ||
console.log('last 30 days:', yield repo.last(30)); | ||
console.log('last 7 days:', yield repo.last(7)); | ||
console.log('last day:', yield repo.last(1)); | ||
|
||
process.exit(); | ||
}); | ||
console.log('total:', await repo.total()); | ||
console.log('last 30 days:', await repo.last(30)); | ||
console.log('last 7 days:', await repo.last(7)); | ||
console.log('last day:', await repo.last(1)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,26 @@ | ||
'use strict'; | ||
|
||
var co = require('co'); | ||
var npm = require('../')(); | ||
var view = npm.view('listAll'); | ||
const NpmApi = require('../'); | ||
const npm = new NpmApi(); | ||
|
||
co(function* () { | ||
var pkg = yield view.query({ | ||
run() | ||
.then(() => { | ||
process.exit(); | ||
}) | ||
.catch(err => { | ||
console.error(err); | ||
process.exit(1); | ||
}); | ||
|
||
async function run() { | ||
let view = npm.view('listAll'); | ||
let pkg = await view.query({ | ||
// group_level: 4, | ||
startkey: JSON.stringify('micromatch'), | ||
endkey: JSON.stringify('micromatch') | ||
}); | ||
var val = pkg[0].value; | ||
var latest = val.versions[val['dist-tags'].latest]; | ||
|
||
let val = pkg[0].value; | ||
let latest = val.versions[val['dist-tags'].latest]; | ||
console.log(latest); | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.