Closed beckend closed 4 years ago
Hi, could you post some code I can run to reproduce this issue please.
Use the "--script=require('ts-node').register({transpileOnly: true})\nrequire('/tmp/fork/server-fork.ts')"
and parse it, your script argument should be what yargs gives but does not handle \n
Hi, i need code please so I can see your optionDefinitions - you just repeated your original post which didn't add any new information. I can't reproduce this issue, that's why I asked for a reproduction case - code I can run to reproduce the issue. Also, which OS are you on?
With this code:
const commandLineArgs = require('command-line-args')
const optionDefinitions = [
{ name: 'script' }
]
const options = commandLineArgs(optionDefinitions)
console.log(options)
The invocation works correctly on macOS:
$ node example.js "--script=require('ts-node').register({transpileOnly: true})\nrequire('/tmp/fork/server-fork.ts')"
{
script: "require('ts-node').register({transpileOnly: true})\\nrequire('/tmp/fork/server-fork.ts')"
}
Please post code and an example invocation like the above so I can reproduce your issue, thanks.
I see, well your test looks correct, but then again this was quite I while ago i tested this. My OS is linux, and the EOL charater was imported from
import { EOL } from 'os'
// or
const { EOL } = require('os')
I will close this since it seems not an issue.
"--script=require('ts-node').register({transpileOnly: true})\nrequire('/tmp/fork/server-fork.ts')"
yargs yields:
require('ts-node').register({transpileOnly: true})\nrequire('/tmp/fork/server-fork.ts')
command-line-args:
require('ts-node').register({transpileOnly: true})