Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.lastLog = function lastLog() {
// When we're running on Jenkins, we know there's an env var called GIT_COMMIT
const treeLike = process.env.GIT_COMMIT || 'HEAD';
const cmd = `git log -n 1 --format=%B ${treeLike}`;
debug(`Shelling out to ${cmd}`);
const {stdout} = shellSync(cmd);
debug('Done');
return stdout;
};
function listAvailablePrinters () {
var printers = execa.shellSync("lpstat -a | awk '{print $1}'").stdout
console.log('Available printers are:\n' + printers)
}
const generateGraphQLGenStarterModels = async (path: string): Promise => {
const spinner = ora(`Generating models 👷`).start()
process.chdir(path)
try {
if (await isYarnInstalled()) {
await execa.shellSync('yarn generate', { stdio: `ignore` })
} else {
await execa.shellSync('npm run generate', { stdio: `ignore` })
}
spinner.succeed()
} catch (err) {
spinner.fail()
}
}
function execSync(command) {
return shellSync(command, {stdio: 'inherit'});
}
static willRun() {
try {
execa.shellSync('which systemctl', {stdio: 'ignore'});
return true;
} catch (e) {
return false;
}
}
}
function getMaxSatisfying (packageName, range) {
let version = JSON.parse(
execa.shellSync(`npm view ${packageName}@${range} version --json`).stdout
)
if (typeof version !== 'string') {
version = version[0]
}
return version
}
const checkGlobalDependencies = async (args) => {
if (args.command === 'create') {
try {
const { stdout } = execa.shellSync('parcel --version');
} catch(error) {
if (error.code === 127) {
await installParcel();
}
}
if (args.typescript) {
try {
const { stdout } = execa.shellSync('tsc --version');
} catch(error) {
if (error.code === 127) {
await installTypeScript();
}
}
}
}