Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function execute(command)
{
// eslint-disable-next-line no-console
console.log(`npm-scripts.js [INFO] executing command: ${command}`);
try
{
execSync(command, { stdio: [ 'ignore', process.stdout, process.stderr ] });
}
catch (error)
{
process.exit(1);
}
}
async function bootstrap() {
const app: INestApplication = await NestFactory.create(ApplicationModule);
app.use(
morgan('dev', {
skip: (req, res) => {
return res.statusCode < 400;
},
stream: process.stderr,
}),
);
app.use(
morgan('dev', {
skip: (req, res) => {
return res.statusCode >= 400;
},
stream: process.stdout,
}),
);
// TODO Get port from recipe.
await app.listen(3000);
}
pandoc.toJSONFilter(function(type, value, format, meta) {
// redirect stderr to file - if it logs to stdout, then pandoc hangs due to improper json
errFile = path.join(folder, "mermaid-filter.err");
errorLog = fs.createWriteStream(errFile);
var origStdErr = process.stderr.write;
process.stderr.write = errorLog.write.bind(errorLog);
return mermaid(type, value, format, meta);
});
};
for (let file in tests) {
let t = tests[file];
process.stdout.write(`${file}: `);
for (let test of t) {
child_process.execSync(`mkdir -p "${tmp}"`);
try {
await test(tmp);
stats.passed++;
process.stdout.write(".");
} catch (e) {
stats.failed++;
process.stdout.write("F\n");
process.stderr.write(`${test.name}: ${e}\n`);
process.stderr.write(`${e.stack}\n`);
} finally {
child_process.execSync(`rm -rf "${tmp}"`);
}
}
process.stdout.write("\n");
}
stats.asserts = utils.assert.callCount;
return stats;
}
return new Promise((resolve, reject) => {
var child = exec(cmd, (err, stdout, stderr) => {
err ? reject(err) : resolve({ stdout, stderr })
})
child.stdout.pipe(process.stdout)
child.stderr.pipe(process.stderr)
})
}
function errorExit () {
var msg = _.toArray(arguments).join(' ') + '\n'
process.stderr.write(msg)
process.exit(1)
}
function spawnMultibahnProc(procOpts) {
var self = this;
var hyperbahnMultiProc = self.run(multiBahn, procOpts);
var relayIndex = self.relayProcs.length;
self.relayProcs.push(hyperbahnMultiProc);
hyperbahnMultiProc.stdout.pipe(process.stderr);
hyperbahnMultiProc.stderr.pipe(process.stderr);
return relayIndex;
};
powershell.on('stderr', (buffer: Buffer) => {
process.stderr.write(buffer);
});
let execOptions = { silent: true } as tr.IExecOptions;
export const handler = (argv) => {
process.stderr.write("merge-mutations\n");
const schema = JSON.parse(fs.readFileSync(argv.infile).toString());
const mutations: Mutation[] = JSON.parse(fs.readFileSync(argv.mutations).toString());
for (const mutation of mutations) {
process.stderr.write(`mutation for path ${mutation.path}\n`);
let target = mutation.path ? _.get(schema, mutation.path) : schema;
if (!target) {
throw new Error(`no target found for path ${mutation.path}`)
}
if (mutation.merge) {
target = _.merge(mutation.merge, target);
_.set(schema, mutation.path, target);
}
if (mutation.replace) {
for (const replacePath of Object.keys(mutation.replace)) {
_.set(target, replacePath, mutation.replace[replacePath])
}
_.set(schema, mutation.path, target);
constructor(outputStream = require("process").stderr) {
this.outputStream = outputStream;
this.successes = [];
this.failures = [];
}