forked from Archives/fx
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
655 B
JavaScript
32 lines
655 B
JavaScript
import os from 'node:os'
|
|
import fs from 'node:fs'
|
|
import path from 'node:path'
|
|
import {createRequire} from 'node:module'
|
|
|
|
const cwd = process.env.FX_CWD ? process.env.FX_CWD : process.cwd()
|
|
const require = createRequire(cwd)
|
|
|
|
// .fxrc.js %v
|
|
|
|
void async function () {
|
|
process.chdir(cwd)
|
|
|
|
let buffer = ''
|
|
process.stdin.setEncoding('utf8')
|
|
for await (let chunk of process.stdin) {
|
|
buffer += chunk
|
|
}
|
|
let x = JSON.parse(buffer)
|
|
|
|
// Reducers %v
|
|
|
|
if (typeof x === 'undefined') {
|
|
process.stderr.write('undefined')
|
|
} else {
|
|
process.stdout.write(JSON.stringify(x))
|
|
}
|
|
}().catch(err => {
|
|
console.error(err)
|
|
process.exitCode = 1
|
|
})
|