@capawesome/cli 3.2.1 → 3.3.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/CHANGELOG.md +14 -0
- package/dist/commands/apps/bundles/create.js +17 -7
- package/dist/commands/apps/bundles/delete.js +6 -6
- package/dist/commands/apps/bundles/delete.test.js +1 -1
- package/dist/commands/apps/bundles/update.js +16 -6
- package/dist/commands/apps/bundles/update.test.js +1 -1
- package/dist/commands/apps/channels/create.js +5 -5
- package/dist/commands/apps/channels/create.test.js +1 -1
- package/dist/commands/apps/channels/delete.js +6 -6
- package/dist/commands/apps/channels/delete.test.js +1 -1
- package/dist/commands/apps/channels/update.js +5 -5
- package/dist/commands/apps/channels/update.test.js +1 -1
- package/dist/commands/apps/create.js +5 -5
- package/dist/commands/apps/create.test.js +1 -1
- package/dist/commands/apps/delete.js +4 -4
- package/dist/commands/apps/delete.test.js +1 -1
- package/dist/commands/apps/devices/delete.js +6 -6
- package/dist/commands/apps/devices/delete.test.js +1 -1
- package/dist/commands/login.js +3 -3
- package/dist/commands/login.test.js +2 -2
- package/dist/commands/manifests/generate.js +3 -3
- package/dist/commands/manifests/generate.test.js +1 -1
- package/dist/commands/organizations/create.js +3 -3
- package/dist/commands/organizations/create.test.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [3.3.0](https://github.com/capawesome-team/cli/compare/v3.2.2...v3.3.0) (2025-10-03)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **apps:bundles:create:** add `--android-eq` and `--ios-eq` options ([#87](https://github.com/capawesome-team/cli/issues/87)) ([ca6c9f1](https://github.com/capawesome-team/cli/commit/ca6c9f11e37ef1dc4d636e660bc0f4227b469710))
|
|
11
|
+
|
|
12
|
+
## [3.2.2](https://github.com/capawesome-team/cli/compare/v3.2.1...v3.2.2) (2025-09-29)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* check for interactive terminal interface before prompt ([#86](https://github.com/capawesome-team/cli/issues/86)) ([ed8b6b0](https://github.com/capawesome-team/cli/commit/ed8b6b07d5ddedb10541472cf769176095c24645)), closes [#85](https://github.com/capawesome-team/cli/issues/85)
|
|
18
|
+
|
|
5
19
|
## [3.2.1](https://github.com/capawesome-team/cli/compare/v3.2.0...v3.2.1) (2025-09-26)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -15,7 +15,7 @@ import zip from '../../../utils/zip.js';
|
|
|
15
15
|
import { defineCommand, defineOptions } from '@robingenz/zli';
|
|
16
16
|
import consola from 'consola';
|
|
17
17
|
import { createReadStream } from 'fs';
|
|
18
|
-
import {
|
|
18
|
+
import { hasTTY } from 'std-env';
|
|
19
19
|
import { z } from 'zod';
|
|
20
20
|
export default defineCommand({
|
|
21
21
|
description: 'Create a new app bundle.',
|
|
@@ -28,6 +28,10 @@ export default defineCommand({
|
|
|
28
28
|
.string()
|
|
29
29
|
.optional()
|
|
30
30
|
.describe('The minimum Android version code (`versionCode`) that the bundle supports.'),
|
|
31
|
+
androidEq: z.coerce
|
|
32
|
+
.string()
|
|
33
|
+
.optional()
|
|
34
|
+
.describe('The exact Android version code (`versionCode`) that the bundle does not support.'),
|
|
31
35
|
appId: z
|
|
32
36
|
.string({
|
|
33
37
|
message: 'App ID must be a UUID.',
|
|
@@ -69,6 +73,10 @@ export default defineCommand({
|
|
|
69
73
|
.string()
|
|
70
74
|
.optional()
|
|
71
75
|
.describe('The minimum iOS bundle version (`CFBundleVersion`) that the bundle supports.'),
|
|
76
|
+
iosEq: z
|
|
77
|
+
.string()
|
|
78
|
+
.optional()
|
|
79
|
+
.describe('The exact iOS bundle version (`CFBundleVersion`) that the bundle does not support.'),
|
|
72
80
|
path: z
|
|
73
81
|
.string()
|
|
74
82
|
.optional()
|
|
@@ -89,7 +97,7 @@ export default defineCommand({
|
|
|
89
97
|
url: z.string().optional().describe('The url to the self-hosted bundle file.'),
|
|
90
98
|
})),
|
|
91
99
|
action: async (options, args) => {
|
|
92
|
-
let { androidMax, androidMin, appId, artifactType, channel, commitMessage, commitRef, commitSha, customProperty, expiresInDays, iosMax, iosMin, path, privateKey, rollout, url, } = options;
|
|
100
|
+
let { androidEq, androidMax, androidMin, appId, artifactType, channel, commitMessage, commitRef, commitSha, customProperty, expiresInDays, iosEq, iosMax, iosMin, path, privateKey, rollout, url, } = options;
|
|
93
101
|
// Check if the user is logged in
|
|
94
102
|
if (!authorizationService.hasAuthorizationToken()) {
|
|
95
103
|
consola.error('You must be logged in to run this command.');
|
|
@@ -104,8 +112,8 @@ export default defineCommand({
|
|
|
104
112
|
}
|
|
105
113
|
// Check that either a path or a url is provided
|
|
106
114
|
if (!path && !url) {
|
|
107
|
-
if (
|
|
108
|
-
consola.error('You must provide either a path or a url when running in
|
|
115
|
+
if (!hasTTY) {
|
|
116
|
+
consola.error('You must provide either a path or a url when running in non-interactive environment.');
|
|
109
117
|
process.exit(1);
|
|
110
118
|
}
|
|
111
119
|
else {
|
|
@@ -157,8 +165,8 @@ export default defineCommand({
|
|
|
157
165
|
process.exit(1);
|
|
158
166
|
}
|
|
159
167
|
if (!appId) {
|
|
160
|
-
if (
|
|
161
|
-
consola.error('You must provide an app ID when running in
|
|
168
|
+
if (!hasTTY) {
|
|
169
|
+
consola.error('You must provide an app ID when running in non-interactive environment.');
|
|
162
170
|
process.exit(1);
|
|
163
171
|
}
|
|
164
172
|
const organizations = await organizationsService.findAll();
|
|
@@ -192,7 +200,7 @@ export default defineCommand({
|
|
|
192
200
|
process.exit(1);
|
|
193
201
|
}
|
|
194
202
|
}
|
|
195
|
-
if (!channel &&
|
|
203
|
+
if (!channel && hasTTY) {
|
|
196
204
|
const promptChannel = await prompt('Do you want to deploy to a specific channel?', {
|
|
197
205
|
type: 'select',
|
|
198
206
|
options: ['Yes', 'No'],
|
|
@@ -259,6 +267,8 @@ export default defineCommand({
|
|
|
259
267
|
artifactType,
|
|
260
268
|
channelName: channel,
|
|
261
269
|
checksum,
|
|
270
|
+
eqAndroidAppVersionCode: androidEq,
|
|
271
|
+
eqIosAppVersionCode: iosEq,
|
|
262
272
|
gitCommitMessage: commitMessage,
|
|
263
273
|
gitCommitRef: commitRef,
|
|
264
274
|
gitCommitSha: commitSha,
|
|
@@ -5,7 +5,7 @@ import organizationsService from '../../../services/organizations.js';
|
|
|
5
5
|
import { prompt } from '../../../utils/prompt.js';
|
|
6
6
|
import { defineCommand, defineOptions } from '@robingenz/zli';
|
|
7
7
|
import consola from 'consola';
|
|
8
|
-
import {
|
|
8
|
+
import { hasTTY } from 'std-env';
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
export default defineCommand({
|
|
11
11
|
description: 'Delete an app bundle.',
|
|
@@ -21,8 +21,8 @@ export default defineCommand({
|
|
|
21
21
|
}
|
|
22
22
|
// Prompt for missing arguments
|
|
23
23
|
if (!appId) {
|
|
24
|
-
if (
|
|
25
|
-
consola.error('You must provide an app ID when running in
|
|
24
|
+
if (!hasTTY) {
|
|
25
|
+
consola.error('You must provide an app ID when running in non-interactive environment.');
|
|
26
26
|
process.exit(1);
|
|
27
27
|
}
|
|
28
28
|
const organizations = await organizationsService.findAll();
|
|
@@ -53,8 +53,8 @@ export default defineCommand({
|
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
if (!bundleId) {
|
|
56
|
-
if (
|
|
57
|
-
consola.error('You must provide the bundle ID when running in
|
|
56
|
+
if (!hasTTY) {
|
|
57
|
+
consola.error('You must provide the bundle ID when running in non-interactive environment.');
|
|
58
58
|
process.exit(1);
|
|
59
59
|
}
|
|
60
60
|
bundleId = await prompt('Enter the bundle ID:', {
|
|
@@ -62,7 +62,7 @@ export default defineCommand({
|
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
// Confirm deletion
|
|
65
|
-
if (
|
|
65
|
+
if (hasTTY) {
|
|
66
66
|
const confirmed = await prompt('Are you sure you want to delete this bundle?', {
|
|
67
67
|
type: 'confirm',
|
|
68
68
|
});
|
|
@@ -12,7 +12,7 @@ vi.mock('@/utils/prompt.js');
|
|
|
12
12
|
vi.mock('@/services/authorization-service.js');
|
|
13
13
|
vi.mock('consola');
|
|
14
14
|
vi.mock('std-env', () => ({
|
|
15
|
-
|
|
15
|
+
hasTTY: true,
|
|
16
16
|
}));
|
|
17
17
|
describe('apps-bundles-delete', () => {
|
|
18
18
|
const mockUserConfig = vi.mocked(userConfig);
|
|
@@ -5,7 +5,7 @@ import organizationsService from '../../../services/organizations.js';
|
|
|
5
5
|
import { prompt } from '../../../utils/prompt.js';
|
|
6
6
|
import { defineCommand, defineOptions } from '@robingenz/zli';
|
|
7
7
|
import consola from 'consola';
|
|
8
|
-
import {
|
|
8
|
+
import { hasTTY } from 'std-env';
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
export default defineCommand({
|
|
11
11
|
description: 'Update an app bundle.',
|
|
@@ -18,6 +18,10 @@ export default defineCommand({
|
|
|
18
18
|
.string()
|
|
19
19
|
.optional()
|
|
20
20
|
.describe('The minimum Android version code (`versionCode`) that the bundle supports.'),
|
|
21
|
+
androidEq: z
|
|
22
|
+
.string()
|
|
23
|
+
.optional()
|
|
24
|
+
.describe('The exact Android version code (`versionCode`) that the bundle should not support.'),
|
|
21
25
|
appId: z.string().optional().describe('ID of the app.'),
|
|
22
26
|
bundleId: z.string().optional().describe('ID of the bundle.'),
|
|
23
27
|
rollout: z.coerce
|
|
@@ -36,17 +40,21 @@ export default defineCommand({
|
|
|
36
40
|
.string()
|
|
37
41
|
.optional()
|
|
38
42
|
.describe('The minimum iOS bundle version (`CFBundleVersion`) that the bundle supports.'),
|
|
43
|
+
iosEq: z
|
|
44
|
+
.string()
|
|
45
|
+
.optional()
|
|
46
|
+
.describe('The exact iOS bundle version (`CFBundleVersion`) that the bundle should not support.'),
|
|
39
47
|
})),
|
|
40
48
|
action: async (options, args) => {
|
|
41
|
-
let { androidMax, androidMin, appId, bundleId, rollout, iosMax, iosMin } = options;
|
|
49
|
+
let { androidMax, androidMin, androidEq, appId, bundleId, rollout, iosMax, iosMin, iosEq } = options;
|
|
42
50
|
if (!authorizationService.hasAuthorizationToken()) {
|
|
43
51
|
consola.error('You must be logged in to run this command.');
|
|
44
52
|
process.exit(1);
|
|
45
53
|
}
|
|
46
54
|
// Prompt for missing arguments
|
|
47
55
|
if (!appId) {
|
|
48
|
-
if (
|
|
49
|
-
consola.error('You must provide an app ID when running in
|
|
56
|
+
if (!hasTTY) {
|
|
57
|
+
consola.error('You must provide an app ID when running in non-interactive environment.');
|
|
50
58
|
process.exit(1);
|
|
51
59
|
}
|
|
52
60
|
const organizations = await organizationsService.findAll();
|
|
@@ -77,8 +85,8 @@ export default defineCommand({
|
|
|
77
85
|
});
|
|
78
86
|
}
|
|
79
87
|
if (!bundleId) {
|
|
80
|
-
if (
|
|
81
|
-
consola.error('You must provide the bundle ID when running in
|
|
88
|
+
if (!hasTTY) {
|
|
89
|
+
consola.error('You must provide the bundle ID when running in non-interactive environment.');
|
|
82
90
|
process.exit(1);
|
|
83
91
|
}
|
|
84
92
|
bundleId = await prompt('Enter the bundle ID:', {
|
|
@@ -93,6 +101,8 @@ export default defineCommand({
|
|
|
93
101
|
maxIosAppVersionCode: iosMax,
|
|
94
102
|
minAndroidAppVersionCode: androidMin,
|
|
95
103
|
minIosAppVersionCode: iosMin,
|
|
104
|
+
eqAndroidAppVersionCode: androidEq,
|
|
105
|
+
eqIosAppVersionCode: iosEq,
|
|
96
106
|
rolloutPercentage: rollout,
|
|
97
107
|
});
|
|
98
108
|
consola.success('Bundle updated successfully.');
|
|
@@ -12,7 +12,7 @@ vi.mock('@/utils/prompt.js');
|
|
|
12
12
|
vi.mock('@/services/authorization-service.js');
|
|
13
13
|
vi.mock('consola');
|
|
14
14
|
vi.mock('std-env', () => ({
|
|
15
|
-
|
|
15
|
+
hasTTY: true,
|
|
16
16
|
}));
|
|
17
17
|
describe('apps-bundles-update', () => {
|
|
18
18
|
const mockUserConfig = vi.mocked(userConfig);
|
|
@@ -6,7 +6,7 @@ import { getMessageFromUnknownError } from '../../../utils/error.js';
|
|
|
6
6
|
import { prompt } from '../../../utils/prompt.js';
|
|
7
7
|
import { defineCommand, defineOptions } from '@robingenz/zli';
|
|
8
8
|
import consola from 'consola';
|
|
9
|
-
import {
|
|
9
|
+
import { hasTTY } from 'std-env';
|
|
10
10
|
import { z } from 'zod';
|
|
11
11
|
export default defineCommand({
|
|
12
12
|
description: 'Create a new app channel.',
|
|
@@ -43,8 +43,8 @@ export default defineCommand({
|
|
|
43
43
|
}
|
|
44
44
|
// Validate the app ID
|
|
45
45
|
if (!appId) {
|
|
46
|
-
if (
|
|
47
|
-
consola.error('You must provide an app ID when running in
|
|
46
|
+
if (!hasTTY) {
|
|
47
|
+
consola.error('You must provide an app ID when running in non-interactive environment.');
|
|
48
48
|
process.exit(1);
|
|
49
49
|
}
|
|
50
50
|
const organizations = await organizationsService.findAll();
|
|
@@ -76,8 +76,8 @@ export default defineCommand({
|
|
|
76
76
|
}
|
|
77
77
|
// Validate the channel name
|
|
78
78
|
if (!name) {
|
|
79
|
-
if (
|
|
80
|
-
consola.error('You must provide the channel name when running in
|
|
79
|
+
if (!hasTTY) {
|
|
80
|
+
consola.error('You must provide the channel name when running in non-interactive environment.');
|
|
81
81
|
process.exit(1);
|
|
82
82
|
}
|
|
83
83
|
name = await prompt('Enter the name of the channel:', { type: 'text' });
|
|
@@ -12,7 +12,7 @@ vi.mock('@/utils/prompt.js');
|
|
|
12
12
|
vi.mock('@/services/authorization-service.js');
|
|
13
13
|
vi.mock('consola');
|
|
14
14
|
vi.mock('std-env', () => ({
|
|
15
|
-
|
|
15
|
+
hasTTY: true,
|
|
16
16
|
}));
|
|
17
17
|
describe('apps-channels-create', () => {
|
|
18
18
|
const mockUserConfig = vi.mocked(userConfig);
|
|
@@ -5,7 +5,7 @@ import organizationsService from '../../../services/organizations.js';
|
|
|
5
5
|
import { prompt } from '../../../utils/prompt.js';
|
|
6
6
|
import { defineCommand, defineOptions } from '@robingenz/zli';
|
|
7
7
|
import consola from 'consola';
|
|
8
|
-
import {
|
|
8
|
+
import { hasTTY } from 'std-env';
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
export default defineCommand({
|
|
11
11
|
description: 'Delete an app channel.',
|
|
@@ -27,8 +27,8 @@ export default defineCommand({
|
|
|
27
27
|
process.exit(1);
|
|
28
28
|
}
|
|
29
29
|
if (!appId) {
|
|
30
|
-
if (
|
|
31
|
-
consola.error('You must provide an app ID when running in
|
|
30
|
+
if (!hasTTY) {
|
|
31
|
+
consola.error('You must provide an app ID when running in non-interactive environment.');
|
|
32
32
|
process.exit(1);
|
|
33
33
|
}
|
|
34
34
|
const organizations = await organizationsService.findAll();
|
|
@@ -60,8 +60,8 @@ export default defineCommand({
|
|
|
60
60
|
}
|
|
61
61
|
// Prompt for channel ID or name if neither is provided
|
|
62
62
|
if (!channelId && !name) {
|
|
63
|
-
if (
|
|
64
|
-
consola.error('You must provide either the channel ID or name when running in
|
|
63
|
+
if (!hasTTY) {
|
|
64
|
+
consola.error('You must provide either the channel ID or name when running in non-interactive environment.');
|
|
65
65
|
process.exit(1);
|
|
66
66
|
}
|
|
67
67
|
name = await prompt('Enter the channel name:', {
|
|
@@ -69,7 +69,7 @@ export default defineCommand({
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
// Confirm deletion
|
|
72
|
-
if (
|
|
72
|
+
if (hasTTY) {
|
|
73
73
|
const confirmed = await prompt('Are you sure you want to delete this channel?', {
|
|
74
74
|
type: 'confirm',
|
|
75
75
|
});
|
|
@@ -12,7 +12,7 @@ vi.mock('@/utils/prompt.js');
|
|
|
12
12
|
vi.mock('@/services/authorization-service.js');
|
|
13
13
|
vi.mock('consola');
|
|
14
14
|
vi.mock('std-env', () => ({
|
|
15
|
-
|
|
15
|
+
hasTTY: true,
|
|
16
16
|
}));
|
|
17
17
|
describe('apps-channels-delete', () => {
|
|
18
18
|
const mockUserConfig = vi.mocked(userConfig);
|
|
@@ -5,7 +5,7 @@ import organizationsService from '../../../services/organizations.js';
|
|
|
5
5
|
import { prompt } from '../../../utils/prompt.js';
|
|
6
6
|
import { defineCommand, defineOptions } from '@robingenz/zli';
|
|
7
7
|
import consola from 'consola';
|
|
8
|
-
import {
|
|
8
|
+
import { hasTTY } from 'std-env';
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
export default defineCommand({
|
|
11
11
|
description: 'Update an existing app channel.',
|
|
@@ -26,8 +26,8 @@ export default defineCommand({
|
|
|
26
26
|
}
|
|
27
27
|
// Prompt app ID if not provided
|
|
28
28
|
if (!appId) {
|
|
29
|
-
if (
|
|
30
|
-
consola.error('You must provide an app ID when running in
|
|
29
|
+
if (!hasTTY) {
|
|
30
|
+
consola.error('You must provide an app ID when running in non-interactive environment.');
|
|
31
31
|
process.exit(1);
|
|
32
32
|
}
|
|
33
33
|
const organizations = await organizationsService.findAll();
|
|
@@ -59,8 +59,8 @@ export default defineCommand({
|
|
|
59
59
|
}
|
|
60
60
|
// Prompt for channel ID if not provided
|
|
61
61
|
if (!channelId) {
|
|
62
|
-
if (
|
|
63
|
-
consola.error('You must provide the channel ID when running in
|
|
62
|
+
if (!hasTTY) {
|
|
63
|
+
consola.error('You must provide the channel ID when running in non-interactive environment.');
|
|
64
64
|
process.exit(1);
|
|
65
65
|
}
|
|
66
66
|
channelId = await prompt('Enter the channel ID:', {
|
|
@@ -12,7 +12,7 @@ vi.mock('@/utils/prompt.js');
|
|
|
12
12
|
vi.mock('@/services/authorization-service.js');
|
|
13
13
|
vi.mock('consola');
|
|
14
14
|
vi.mock('std-env', () => ({
|
|
15
|
-
|
|
15
|
+
hasTTY: true,
|
|
16
16
|
}));
|
|
17
17
|
describe('apps-channels-update', () => {
|
|
18
18
|
const mockUserConfig = vi.mocked(userConfig);
|
|
@@ -4,7 +4,7 @@ import organizationsService from '../../services/organizations.js';
|
|
|
4
4
|
import { prompt } from '../../utils/prompt.js';
|
|
5
5
|
import { defineCommand, defineOptions } from '@robingenz/zli';
|
|
6
6
|
import consola from 'consola';
|
|
7
|
-
import {
|
|
7
|
+
import { hasTTY } from 'std-env';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
export default defineCommand({
|
|
10
10
|
description: 'Create a new app.',
|
|
@@ -19,8 +19,8 @@ export default defineCommand({
|
|
|
19
19
|
process.exit(1);
|
|
20
20
|
}
|
|
21
21
|
if (!organizationId) {
|
|
22
|
-
if (
|
|
23
|
-
consola.error('You must provide the organization ID when running in
|
|
22
|
+
if (!hasTTY) {
|
|
23
|
+
consola.error('You must provide the organization ID when running in non-interactive environment.');
|
|
24
24
|
process.exit(1);
|
|
25
25
|
}
|
|
26
26
|
const organizations = await organizationsService.findAll();
|
|
@@ -39,8 +39,8 @@ export default defineCommand({
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
if (!name) {
|
|
42
|
-
if (
|
|
43
|
-
consola.error('You must provide the app name when running in
|
|
42
|
+
if (!hasTTY) {
|
|
43
|
+
consola.error('You must provide the app name when running in non-interactive environment.');
|
|
44
44
|
process.exit(1);
|
|
45
45
|
}
|
|
46
46
|
name = await prompt('Enter the name of the app:', { type: 'text' });
|
|
@@ -4,7 +4,7 @@ import organizationsService from '../../services/organizations.js';
|
|
|
4
4
|
import { prompt } from '../../utils/prompt.js';
|
|
5
5
|
import { defineCommand, defineOptions } from '@robingenz/zli';
|
|
6
6
|
import consola from 'consola';
|
|
7
|
-
import {
|
|
7
|
+
import { hasTTY } from 'std-env';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
export default defineCommand({
|
|
10
10
|
description: 'Delete an app.',
|
|
@@ -18,8 +18,8 @@ export default defineCommand({
|
|
|
18
18
|
process.exit(1);
|
|
19
19
|
}
|
|
20
20
|
if (!appId) {
|
|
21
|
-
if (
|
|
22
|
-
consola.error('You must provide the app ID when running in
|
|
21
|
+
if (!hasTTY) {
|
|
22
|
+
consola.error('You must provide the app ID when running in non-interactive environment.');
|
|
23
23
|
process.exit(1);
|
|
24
24
|
}
|
|
25
25
|
const organizations = await organizationsService.findAll();
|
|
@@ -49,7 +49,7 @@ export default defineCommand({
|
|
|
49
49
|
options: apps.map((app) => ({ label: app.name, value: app.id })),
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
if (
|
|
52
|
+
if (hasTTY) {
|
|
53
53
|
const confirmed = await prompt('Are you sure you want to delete this app?', {
|
|
54
54
|
type: 'confirm',
|
|
55
55
|
});
|
|
@@ -5,7 +5,7 @@ import organizationsService from '../../../services/organizations.js';
|
|
|
5
5
|
import { prompt } from '../../../utils/prompt.js';
|
|
6
6
|
import { defineCommand, defineOptions } from '@robingenz/zli';
|
|
7
7
|
import consola from 'consola';
|
|
8
|
-
import {
|
|
8
|
+
import { hasTTY } from 'std-env';
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
export default defineCommand({
|
|
11
11
|
description: 'Delete an app device.',
|
|
@@ -21,8 +21,8 @@ export default defineCommand({
|
|
|
21
21
|
}
|
|
22
22
|
// Prompt for app ID if not provided
|
|
23
23
|
if (!appId) {
|
|
24
|
-
if (
|
|
25
|
-
consola.error('You must provide an app ID when running in
|
|
24
|
+
if (!hasTTY) {
|
|
25
|
+
consola.error('You must provide an app ID when running in non-interactive environment.');
|
|
26
26
|
process.exit(1);
|
|
27
27
|
}
|
|
28
28
|
const organizations = await organizationsService.findAll();
|
|
@@ -54,8 +54,8 @@ export default defineCommand({
|
|
|
54
54
|
}
|
|
55
55
|
// Prompt for device ID if not provided
|
|
56
56
|
if (!deviceId) {
|
|
57
|
-
if (
|
|
58
|
-
consola.error('You must provide the device ID when running in
|
|
57
|
+
if (!hasTTY) {
|
|
58
|
+
consola.error('You must provide the device ID when running in non-interactive environment.');
|
|
59
59
|
process.exit(1);
|
|
60
60
|
}
|
|
61
61
|
deviceId = await prompt('Enter the device ID:', {
|
|
@@ -63,7 +63,7 @@ export default defineCommand({
|
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
// Confirm deletion
|
|
66
|
-
if (
|
|
66
|
+
if (hasTTY) {
|
|
67
67
|
const confirmed = await prompt('Are you sure you want to delete this device?', {
|
|
68
68
|
type: 'confirm',
|
|
69
69
|
});
|
|
@@ -12,7 +12,7 @@ vi.mock('@/utils/prompt.js');
|
|
|
12
12
|
vi.mock('@/services/authorization-service.js');
|
|
13
13
|
vi.mock('consola');
|
|
14
14
|
vi.mock('std-env', () => ({
|
|
15
|
-
|
|
15
|
+
hasTTY: true,
|
|
16
16
|
}));
|
|
17
17
|
describe('apps-devices-delete', () => {
|
|
18
18
|
const mockUserConfig = vi.mocked(userConfig);
|
package/dist/commands/login.js
CHANGED
|
@@ -8,7 +8,7 @@ import { defineCommand, defineOptions } from '@robingenz/zli';
|
|
|
8
8
|
import { AxiosError } from 'axios';
|
|
9
9
|
import consola from 'consola';
|
|
10
10
|
import open from 'open';
|
|
11
|
-
import {
|
|
11
|
+
import { hasTTY } from 'std-env';
|
|
12
12
|
import { z } from 'zod';
|
|
13
13
|
export default defineCommand({
|
|
14
14
|
description: 'Sign in to the Capawesome Cloud Console.',
|
|
@@ -19,8 +19,8 @@ export default defineCommand({
|
|
|
19
19
|
const consoleBaseUrl = await configService.getValueForKey('CONSOLE_BASE_URL');
|
|
20
20
|
let { token: sessionIdOrToken } = options;
|
|
21
21
|
if (sessionIdOrToken === undefined) {
|
|
22
|
-
if (
|
|
23
|
-
consola.error('You must provide a token when running in
|
|
22
|
+
if (!hasTTY) {
|
|
23
|
+
consola.error('You must provide a token when running in non-interactive environment.');
|
|
24
24
|
process.exit(1);
|
|
25
25
|
}
|
|
26
26
|
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
@@ -18,10 +18,10 @@ vi.mock('open');
|
|
|
18
18
|
vi.mock('consola');
|
|
19
19
|
vi.mock('@/utils/prompt.js');
|
|
20
20
|
vi.mock('std-env', () => ({
|
|
21
|
-
|
|
21
|
+
hasTTY: true,
|
|
22
22
|
}));
|
|
23
23
|
vi.mock('std-env', () => ({
|
|
24
|
-
|
|
24
|
+
hasTTY: true,
|
|
25
25
|
}));
|
|
26
26
|
describe('login', () => {
|
|
27
27
|
const mockUserConfig = vi.mocked(userConfig);
|
|
@@ -3,7 +3,7 @@ import { generateManifestJson } from '../../utils/manifest.js';
|
|
|
3
3
|
import { prompt } from '../../utils/prompt.js';
|
|
4
4
|
import { defineCommand, defineOptions } from '@robingenz/zli';
|
|
5
5
|
import consola from 'consola';
|
|
6
|
-
import {
|
|
6
|
+
import { hasTTY } from 'std-env';
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
export default defineCommand({
|
|
9
9
|
description: 'Generate a manifest file.',
|
|
@@ -13,8 +13,8 @@ export default defineCommand({
|
|
|
13
13
|
action: async (options, args) => {
|
|
14
14
|
let path = options.path;
|
|
15
15
|
if (!path) {
|
|
16
|
-
if (
|
|
17
|
-
consola.error('You must provide the path to the web assets folder when running in
|
|
16
|
+
if (!hasTTY) {
|
|
17
|
+
consola.error('You must provide the path to the web assets folder when running in non-interactive environment.');
|
|
18
18
|
process.exit(1);
|
|
19
19
|
}
|
|
20
20
|
path = await prompt('Enter the path to the web assets folder:', {
|
|
@@ -10,7 +10,7 @@ vi.mock('@/utils/manifest.js');
|
|
|
10
10
|
vi.mock('@/utils/prompt.js');
|
|
11
11
|
vi.mock('consola');
|
|
12
12
|
vi.mock('std-env', () => ({
|
|
13
|
-
|
|
13
|
+
hasTTY: true,
|
|
14
14
|
}));
|
|
15
15
|
describe('manifests-generate', () => {
|
|
16
16
|
const mockFileExistsAtPath = vi.mocked(fileExistsAtPath);
|
|
@@ -3,7 +3,7 @@ import organizationsService from '../../services/organizations.js';
|
|
|
3
3
|
import { prompt } from '../../utils/prompt.js';
|
|
4
4
|
import { defineCommand, defineOptions } from '@robingenz/zli';
|
|
5
5
|
import consola from 'consola';
|
|
6
|
-
import {
|
|
6
|
+
import { hasTTY } from 'std-env';
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
export default defineCommand({
|
|
9
9
|
description: 'Create a new organization.',
|
|
@@ -17,8 +17,8 @@ export default defineCommand({
|
|
|
17
17
|
process.exit(1);
|
|
18
18
|
}
|
|
19
19
|
if (!name) {
|
|
20
|
-
if (
|
|
21
|
-
consola.error('You must provide the organization name when running in
|
|
20
|
+
if (!hasTTY) {
|
|
21
|
+
consola.error('You must provide the organization name when running in non-interactive environment.');
|
|
22
22
|
process.exit(1);
|
|
23
23
|
}
|
|
24
24
|
name = await prompt('Enter the name of the organization:', { type: 'text' });
|
|
@@ -12,7 +12,7 @@ vi.mock('@/utils/prompt.js');
|
|
|
12
12
|
vi.mock('@/services/authorization-service.js');
|
|
13
13
|
vi.mock('consola');
|
|
14
14
|
vi.mock('std-env', () => ({
|
|
15
|
-
|
|
15
|
+
hasTTY: true,
|
|
16
16
|
}));
|
|
17
17
|
describe('organizations-create', () => {
|
|
18
18
|
const mockUserConfig = vi.mocked(userConfig);
|