2016-04-21 173 views

回答

2

發現一個名爲npm-latest模塊,正是這一點:

import npmLatest from 'npm-latest' 
import Promise from 'bluebird' 
const npmLatestAsync = Promise.promisify(npmLatest) 
async function getNpmVersion (dep) { 
    let { name, version } = await npmLatestAsync(dep) 
    return { name, version} 
} 
-2

另外:

npm view {packagename} version

相關問題