deploy-vir 2.0.0 → 2.1.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.
- package/dist/cli/cli.js +17 -2
- package/package.json +1 -1
- package/src/cli/cli.ts +28 -3
package/dist/cli/cli.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { assertWrap } from '@augment-vir/assert';
|
|
2
2
|
import { awaitedForEach, extractErrorMessage, log } from '@augment-vir/common';
|
|
3
|
+
import { select } from '@inquirer/prompts';
|
|
3
4
|
import { resolve } from 'node:path';
|
|
4
5
|
import simpleGit from 'simple-git';
|
|
5
6
|
import { getGitRemoteName, pushDeploy } from '../git.js';
|
|
@@ -12,9 +13,23 @@ import { sendNotifications } from '../notifications/send-notifications.js';
|
|
|
12
13
|
*/
|
|
13
14
|
export async function runDeployVirCli({ args, y, }, cwd = process.cwd()) {
|
|
14
15
|
const configPath = assertWrap.isTruthy(args[0], 'Missing config path.');
|
|
15
|
-
const repoName = assertWrap.isTruthy(args[1], 'Missing repo name.');
|
|
16
|
-
const deployName = assertWrap.isTruthy(args[2], 'Missing deploy name.');
|
|
17
16
|
const config = (await import(resolve(cwd, configPath))).default;
|
|
17
|
+
const repoName = assertWrap.isTruthy(args[1] ||
|
|
18
|
+
(await select({
|
|
19
|
+
message: 'Choose a repo to deploy:',
|
|
20
|
+
choices: config.repos.map((repo) => {
|
|
21
|
+
return repo.name;
|
|
22
|
+
}),
|
|
23
|
+
})), 'Missing repo name.');
|
|
24
|
+
const deployName = assertWrap.isTruthy(args[2] ||
|
|
25
|
+
(await select({
|
|
26
|
+
message: 'Choose a deploy to trigger:',
|
|
27
|
+
choices: assertWrap
|
|
28
|
+
.isDefined(config.repos.find((repo) => repo.name === repoName), `Invalid repo name: '${repoName}'`)
|
|
29
|
+
.deploys.map((deploy) => {
|
|
30
|
+
return deploy.deployName;
|
|
31
|
+
}),
|
|
32
|
+
})), 'Missing deploy name.');
|
|
18
33
|
await runDeployVir({
|
|
19
34
|
cwd,
|
|
20
35
|
deployName,
|
package/package.json
CHANGED
package/src/cli/cli.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {assertWrap} from '@augment-vir/assert';
|
|
2
2
|
import {awaitedForEach, extractErrorMessage, log} from '@augment-vir/common';
|
|
3
|
+
import {select} from '@inquirer/prompts';
|
|
3
4
|
import {resolve} from 'node:path';
|
|
4
5
|
import simpleGit from 'simple-git';
|
|
5
6
|
import {type DeployVirConfig} from '../config.js';
|
|
@@ -23,10 +24,34 @@ export async function runDeployVirCli(
|
|
|
23
24
|
cwd = process.cwd(),
|
|
24
25
|
) {
|
|
25
26
|
const configPath = assertWrap.isTruthy(args[0], 'Missing config path.');
|
|
26
|
-
const repoName = assertWrap.isTruthy(args[1], 'Missing repo name.');
|
|
27
|
-
const deployName = assertWrap.isTruthy(args[2], 'Missing deploy name.');
|
|
28
27
|
|
|
29
|
-
const config = (await import(resolve(cwd, configPath))).default;
|
|
28
|
+
const config = (await import(resolve(cwd, configPath))).default as DeployVirConfig;
|
|
29
|
+
|
|
30
|
+
const repoName = assertWrap.isTruthy(
|
|
31
|
+
args[1] ||
|
|
32
|
+
(await select({
|
|
33
|
+
message: 'Choose a repo to deploy:',
|
|
34
|
+
choices: config.repos.map((repo) => {
|
|
35
|
+
return repo.name;
|
|
36
|
+
}),
|
|
37
|
+
})),
|
|
38
|
+
'Missing repo name.',
|
|
39
|
+
);
|
|
40
|
+
const deployName = assertWrap.isTruthy(
|
|
41
|
+
args[2] ||
|
|
42
|
+
(await select({
|
|
43
|
+
message: 'Choose a deploy to trigger:',
|
|
44
|
+
choices: assertWrap
|
|
45
|
+
.isDefined(
|
|
46
|
+
config.repos.find((repo) => repo.name === repoName),
|
|
47
|
+
`Invalid repo name: '${repoName}'`,
|
|
48
|
+
)
|
|
49
|
+
.deploys.map((deploy) => {
|
|
50
|
+
return deploy.deployName;
|
|
51
|
+
}),
|
|
52
|
+
})),
|
|
53
|
+
'Missing deploy name.',
|
|
54
|
+
);
|
|
30
55
|
|
|
31
56
|
await runDeployVir(
|
|
32
57
|
{
|