@faable/faable 1.39.0 → 1.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -17,9 +17,9 @@ const actions_create = {
|
|
|
17
17
|
.option('trigger', {
|
|
18
18
|
alias: 't',
|
|
19
19
|
type: 'string',
|
|
20
|
-
choices: ['post-login', 'continue'],
|
|
20
|
+
choices: ['post-login', 'continue', 'client-credentials'],
|
|
21
21
|
demandOption: true,
|
|
22
|
-
description: 'Trigger point'
|
|
22
|
+
description: 'Trigger point (client-credentials runs on M2M token grants: no user, no redirect)'
|
|
23
23
|
})
|
|
24
24
|
.option('code-file', {
|
|
25
25
|
alias: 'f',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import prompts from 'prompts';
|
|
1
2
|
import { requireApi } from '../../api/context.js';
|
|
2
3
|
import { Configuration } from '../../lib/Configuration.js';
|
|
3
4
|
import { log } from '../../log.js';
|
|
@@ -52,6 +53,12 @@ const deploy = {
|
|
|
52
53
|
.option('release', {
|
|
53
54
|
type: 'string',
|
|
54
55
|
description: 'Release version to record on the deployment (injected as FAABLE_RELEASE). Defaults to FAABLE_RELEASE env or the latest git tag'
|
|
56
|
+
})
|
|
57
|
+
.option('yes', {
|
|
58
|
+
alias: 'y',
|
|
59
|
+
type: 'boolean',
|
|
60
|
+
default: false,
|
|
61
|
+
description: 'Skip the confirmation prompt (only asked in interactive terminals — CI is unaffected)'
|
|
55
62
|
})
|
|
56
63
|
.showHelpOnFail(false);
|
|
57
64
|
},
|
|
@@ -64,6 +71,25 @@ const deploy = {
|
|
|
64
71
|
const config = Configuration.instance().deployConfig();
|
|
65
72
|
const app_id = await resolve_app_id(args.app_id, ctx.appId, api, workdir);
|
|
66
73
|
const app = await api.getApp(app_id);
|
|
74
|
+
// Guard against the `faable deploy <app_id> <subcommand>` typo: yargs
|
|
75
|
+
// doesn't recognize an unmatched trailing token as the subcommand, so it
|
|
76
|
+
// silently falls through to THIS handler and deploys `workdir` instead.
|
|
77
|
+
// Only prompts in a real terminal — CI (non-TTY) keeps deploying
|
|
78
|
+
// unattended exactly as before, so existing pipelines need no changes.
|
|
79
|
+
if (!args.yes && process.stdout.isTTY) {
|
|
80
|
+
const { confirm } = await prompts({
|
|
81
|
+
type: 'toggle',
|
|
82
|
+
name: 'confirm',
|
|
83
|
+
message: `Deploy "${app.name}" (${app.id}) from ${workdir}?`,
|
|
84
|
+
initial: false,
|
|
85
|
+
active: 'yes',
|
|
86
|
+
inactive: 'no'
|
|
87
|
+
});
|
|
88
|
+
if (!confirm) {
|
|
89
|
+
log.info('Cancelled.');
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
67
93
|
// Monorepo Root Directory — single precedence rule everywhere
|
|
68
94
|
// (arch/deploy/root-dir-faable-json.md): App.root_dir (platform
|
|
69
95
|
// override, exceptional) > repo faable.json rootDir (the supported
|