Comparing version 3.1.24 to 3.1.25
{ | ||
"name": "akkeris", | ||
"version": "3.1.24", | ||
"version": "3.1.25", | ||
"description": "Akkeris CLI", | ||
@@ -5,0 +5,0 @@ "main": "aka.js", |
@@ -81,3 +81,28 @@ const assert = require('assert'); | ||
async function trigger(appkit, args) { | ||
const engage = async (input) => { | ||
if (input === 'yes' || (typeof input === 'boolean' && input)) { | ||
const task = appkit.terminal.task(`Triggering new GitHub build for **• ${args.app}**`); | ||
task.start(); | ||
try { | ||
await appkit.api.post(null, `/apps/${args.app}/builds/auto/github/trigger`); | ||
} catch (err) { | ||
task.end('error'); | ||
appkit.terminal.error(err); | ||
return; | ||
} | ||
task.end('ok'); | ||
} else { | ||
appkit.terminal.soft_error('Confirmation did not match. Aborted.'); | ||
} | ||
}; | ||
assert.ok(args.app && args.app !== '', 'An application name was not provided.'); | ||
if (args.confirm) { | ||
await engage(args.confirm); | ||
} else { | ||
appkit.terminal.confirm(`~~▸~~ Are you sure you want to trigger a new GitHub build on **⬢ ${args.app}**?\n ~~▸~~ To proceed, type !!yes!! or re-run this command with !!--confirm!!\n`, engage); | ||
} | ||
} | ||
module.exports = { | ||
@@ -93,2 +118,16 @@ init(appkit) { | ||
}; | ||
const confirm_app_option = { | ||
app: { | ||
alias: 'a', | ||
demand: true, | ||
string: true, | ||
description: 'The app to act on', | ||
}, | ||
confirm: { | ||
alias: 'c', | ||
demand: false, | ||
boolean: true, | ||
description: 'Confirm that you want to trigger a fresh build.', | ||
}, | ||
}; | ||
const require_auto_build_option = { | ||
@@ -118,2 +157,7 @@ app: { | ||
.command('repo:unset', 'Stop watching a Git repository and do not automatically deploy changes to an app', require_app_option, unset.bind(null, appkit)) | ||
.command('repo:build', 'Trigger a fresh build from the configured Git repository on an app', confirm_app_option, trigger.bind(null, appkit)) | ||
// aliases | ||
.command('repo:trigger-build', false, confirm_app_option, trigger.bind(null, appkit)) | ||
.command('repo:build:trigger', false, confirm_app_option, trigger.bind(null, appkit)) | ||
.command('repo:trigger', false, confirm_app_option, trigger.bind(null, appkit)) | ||
.help(); | ||
@@ -120,0 +164,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
300783
7991