serverless/lib/plugins/run/utils/localEmulatorInstalled.js
2017-08-03 20:40:24 +07:00

25 lines
839 B
JavaScript

'use strict';
// const BbPromise = require('bluebird');
// const childProcess = BbPromise.promisifyAll(require('child_process'));
//
// function localEmulatorInsatlled() {
// const stdout = childProcess.execSync('npm list -g serverless-local-emulator');
// const stdoutString = new Buffer(stdout, 'base64').toString();
// return stdoutString.includes('serverless-local-emulator');
// }
//
// module.exports = localEmulatorInsatlled;
const path = require('path');
const os = require('os');
const fileExistsSync = require('../../../utils/fs/fileExistsSync');
function localEmulatorInstalled() {
const localEmulatorPackageJsonFilePath = path
.join(os.homedir(), 'node_modules', 'serverless-local-emulator', 'package.json');
return fileExistsSync(localEmulatorPackageJsonFilePath);
}
module.exports = localEmulatorInstalled;