blindly copying deltachat-node to core repository

This commit is contained in:
missytake
2022-05-02 18:56:37 +02:00
committed by Simon Laux
parent 961612370d
commit a786a1427d
48 changed files with 10343 additions and 0 deletions

26
node/scripts/common.js Normal file
View File

@@ -0,0 +1,26 @@
const spawnSync = require('child_process').spawnSync
const verbose = isVerbose()
function spawn (cmd, args, opts) {
log(`>> spawn: ${cmd} ${args.join(' ')}`)
const result = spawnSync(cmd, args, opts)
if (result.status === null) {
console.error(`Could not find ${cmd}`)
process.exit(1)
} else if (result.status !== 0) {
console.error(`${cmd} failed with code ${result.status}`)
process.exit(1)
}
}
function log (...args) {
if (verbose) console.log(...args)
}
function isVerbose () {
const loglevel = process.env.npm_config_loglevel
return loglevel === 'verbose' || process.env.CI === 'true'
}
module.exports = { spawn, log, isVerbose, verbose }