我需要在groovy中执行nodeJS脚本,如下所示
"./npm install".execute()
def x = "npm run docker-deploy".execute()
但是我需要在我的nodeJS脚本中返回一个值,在这种情况下我想返回deployInfo变量,必须有一种方法可以在节点中返回或共享这个变量来实现groovy吗?
'use strict';
const nodeReleaseTasks = require('./docker-deployOld');
const pkg = require('../package.json');
var deployInfo = "";
function getDeployInfo(deployResponse) {
deployInfo = deployResponse;
}
nodeReleaseTasks({
name: pkg.name,
version: pkg.version
}, pkg.name, getDeployInfo);