UNPKG

serverless

Version:

Serverless Framework - Build web, mobile and IoT applications with serverless architectures using AWS Lambda, Azure Functions, Google CloudFunctions & more

20 lines (16 loc) 452 B
'use strict'; const path = require('path'); const fse = require('fs-extra'); const localNpmBinPath = path.join(__dirname, '../../node_modules/npm/bin/npm-cli.js'); module.exports = fse .stat(localNpmBinPath) .then( stats => stats.isFile(), error => { if (error.code === 'ENOENT') return null; throw error; } ) .then(isNpmInstalledLocaly => { return isNpmInstalledLocaly ? `node ${localNpmBinPath}` : 'npm'; });