do-local-functions
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -71,7 +71,9 @@ #!/usr/bin/env node | ||
return new Promise((resolve, reject) => { | ||
const script = `require("./${route.entrypoint}").${ | ||
route.action.main ?? 'main' | ||
}(JSON.parse(process.argv[1])).then((result) => console.log("RESULT:" + JSON.stringify(result))).catch((err) => console.error(JSON.stringify(err)));`; | ||
const script = `require("./${route.entrypoint}").${route.action.main ?? 'main'}(${JSON.stringify( | ||
params | ||
)}).then((result) => console.log("RESULT:" + JSON.stringify(result))).catch((err) => console.error(JSON.stringify(err)));`; | ||
exec(`node -e '${script}' "${JSON.stringify(params).replace(/"/g, '\\"')}"`, { cwd: route.path }, (error, stdout, stderr) => { | ||
const random = Math.random().toString(36).substring(7); | ||
exec(`node <<'EOF_${random}_'\n${script}\nEOF_${random}_\n`, { cwd: route.path }, (error, stdout, stderr) => { | ||
if (error) { | ||
@@ -78,0 +80,0 @@ reject(stderr); |
{ | ||
"name": "do-local-functions", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"bin": { | ||
@@ -5,0 +5,0 @@ "local-functions": "./local-functions.js" |
7088
190