eas-cli 0.44.1 → 0.45.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/README.md +844 -0
- package/build/commands/device/delete.d.ts +17 -0
- package/build/commands/device/delete.js +181 -0
- package/build/commands/device/list.js +1 -1
- package/build/commands/webhook/update.js +1 -1
- package/build/credentials/ios/actions/DeviceUtils.d.ts +1 -0
- package/build/credentials/ios/actions/DeviceUtils.js +16 -1
- package/build/credentials/ios/api/graphql/mutations/AppleDeviceMutation.d.ts +1 -0
- package/build/credentials/ios/api/graphql/mutations/AppleDeviceMutation.js +16 -0
- package/build/graphql/generated.d.ts +5808 -3522
- package/build/graphql/generated.js +223 -223
- package/build/submit/ArchiveSource.js +0 -1
- package/oclif.manifest.json +1 -1
- package/package.json +37 -38
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import EasCommand from '../../commandUtils/EasCommand';
|
|
2
|
+
import { AppleDeviceQueryResult, AppleDevicesByTeamIdentifierQueryResult } from '../../credentials/ios/api/graphql/queries/AppleDeviceQuery';
|
|
3
|
+
import { AppleDevice, Maybe } from '../../graphql/generated';
|
|
4
|
+
export default class DeviceDelete extends EasCommand {
|
|
5
|
+
static description: string;
|
|
6
|
+
static flags: {
|
|
7
|
+
'apple-team-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
|
|
8
|
+
udid: import("@oclif/core/lib/interfaces").OptionFlag<string[]>;
|
|
9
|
+
};
|
|
10
|
+
runAsync(): Promise<void>;
|
|
11
|
+
askAndDisableOnAppleAsync(chosenDevices: (AppleDevice | AppleDeviceQueryResult)[], appleTeamIdentifier: string): Promise<void>;
|
|
12
|
+
askAndRemoveFromExpoAsync(chosenDevices: (AppleDevice | AppleDeviceQueryResult)[]): Promise<boolean>;
|
|
13
|
+
logChosenDevices(chosenDevices: (AppleDevice | AppleDeviceQueryResult)[], appleTeamName: Maybe<string> | undefined, appleTeamIdentifier: string): void;
|
|
14
|
+
chooseDevicesToDeleteAsync(appleDevices: AppleDeviceQueryResult[], udids: string[]): Promise<(AppleDevice | AppleDeviceQueryResult)[]>;
|
|
15
|
+
getDevicesForTeamAsync(accountName: string, appleTeamIdentifier: string): Promise<AppleDevicesByTeamIdentifierQueryResult | undefined>;
|
|
16
|
+
askForAppleTeamAsync(accountName: string): Promise<string | undefined>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const apple_utils_1 = require("@expo/apple-utils");
|
|
5
|
+
const config_1 = require("@expo/config");
|
|
6
|
+
const core_1 = require("@oclif/core");
|
|
7
|
+
const assert_1 = (0, tslib_1.__importDefault)(require("assert"));
|
|
8
|
+
const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/EasCommand"));
|
|
9
|
+
const DeviceUtils_1 = require("../../credentials/ios/actions/DeviceUtils");
|
|
10
|
+
const AppleDeviceMutation_1 = require("../../credentials/ios/api/graphql/mutations/AppleDeviceMutation");
|
|
11
|
+
const AppleDeviceQuery_1 = require("../../credentials/ios/api/graphql/queries/AppleDeviceQuery");
|
|
12
|
+
const AppleTeamQuery_1 = require("../../credentials/ios/api/graphql/queries/AppleTeamQuery");
|
|
13
|
+
const authenticate_1 = require("../../credentials/ios/appstore/authenticate");
|
|
14
|
+
const formatDevice_1 = (0, tslib_1.__importDefault)(require("../../devices/utils/formatDevice"));
|
|
15
|
+
const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
|
|
16
|
+
const ora_1 = require("../../ora");
|
|
17
|
+
const projectUtils_1 = require("../../project/projectUtils");
|
|
18
|
+
const prompts_1 = require("../../prompts");
|
|
19
|
+
class DeviceDelete extends EasCommand_1.default {
|
|
20
|
+
async runAsync() {
|
|
21
|
+
let { flags: { 'apple-team-id': appleTeamIdentifier, udid: udids }, } = await this.parse(DeviceDelete);
|
|
22
|
+
const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
|
|
23
|
+
const { exp } = (0, config_1.getConfig)(projectDir, { skipSDKVersionRequirement: true });
|
|
24
|
+
const accountName = await (0, projectUtils_1.getProjectAccountNameAsync)(exp);
|
|
25
|
+
if (!appleTeamIdentifier) {
|
|
26
|
+
appleTeamIdentifier = await this.askForAppleTeamAsync(accountName);
|
|
27
|
+
}
|
|
28
|
+
(0, assert_1.default)(appleTeamIdentifier, 'No team identifier is specified');
|
|
29
|
+
const appleDevicesResult = await this.getDevicesForTeamAsync(accountName, appleTeamIdentifier);
|
|
30
|
+
if (!appleDevicesResult) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const { appleTeamName, appleDevices } = appleDevicesResult;
|
|
34
|
+
const chosenDevices = await this.chooseDevicesToDeleteAsync(appleDevices, udids);
|
|
35
|
+
if (chosenDevices.length === 0) {
|
|
36
|
+
log_1.default.newLine();
|
|
37
|
+
log_1.default.warn('No devices were chosen to be removed.');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
this.logChosenDevices(chosenDevices, appleTeamName, appleTeamIdentifier);
|
|
41
|
+
const hasRemoved = await this.askAndRemoveFromExpoAsync(chosenDevices);
|
|
42
|
+
if (!hasRemoved) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
await this.askAndDisableOnAppleAsync(chosenDevices, appleTeamIdentifier);
|
|
46
|
+
}
|
|
47
|
+
async askAndDisableOnAppleAsync(chosenDevices, appleTeamIdentifier) {
|
|
48
|
+
log_1.default.newLine();
|
|
49
|
+
const deleteOnApple = await (0, prompts_1.toggleConfirmAsync)({
|
|
50
|
+
message: 'Do you want to disable these devices on your Apple account as well?',
|
|
51
|
+
});
|
|
52
|
+
if (!deleteOnApple) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const ctx = await (0, authenticate_1.authenticateAsync)({ teamId: appleTeamIdentifier });
|
|
56
|
+
const context = (0, authenticate_1.getRequestContext)(ctx);
|
|
57
|
+
log_1.default.addNewLineIfNone();
|
|
58
|
+
const removeAppleSpinner = (0, ora_1.ora)('Disabling devices on Apple').start();
|
|
59
|
+
try {
|
|
60
|
+
let realDevices = await apple_utils_1.Device.getAllIOSProfileDevicesAsync(context);
|
|
61
|
+
realDevices = realDevices.filter(d => chosenDevices.map(cd => cd.identifier).includes(d.attributes.udid));
|
|
62
|
+
for (const device of realDevices) {
|
|
63
|
+
await device.updateAsync({ status: apple_utils_1.DeviceStatus.DISABLED });
|
|
64
|
+
}
|
|
65
|
+
removeAppleSpinner.succeed('Disabled devices on Apple');
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
removeAppleSpinner.fail();
|
|
69
|
+
throw err;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async askAndRemoveFromExpoAsync(chosenDevices) {
|
|
73
|
+
log_1.default.warn(`You are about to remove the Apple device${chosenDevices.length > 1 ? 's' : ''} listed above from your Expo account.`);
|
|
74
|
+
log_1.default.newLine();
|
|
75
|
+
const confirmed = await (0, prompts_1.toggleConfirmAsync)({
|
|
76
|
+
message: 'Are you sure you wish to proceed?',
|
|
77
|
+
});
|
|
78
|
+
if (confirmed) {
|
|
79
|
+
const removalSpinner = (0, ora_1.ora)(`Removing Apple devices on Expo`).start();
|
|
80
|
+
try {
|
|
81
|
+
for (const chosenDevice of chosenDevices) {
|
|
82
|
+
await AppleDeviceMutation_1.AppleDeviceMutation.deleteAppleDeviceAsync(chosenDevice.id);
|
|
83
|
+
}
|
|
84
|
+
removalSpinner.succeed('Removed Apple devices from Expo');
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
removalSpinner.fail();
|
|
88
|
+
throw err;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return confirmed;
|
|
92
|
+
}
|
|
93
|
+
logChosenDevices(chosenDevices, appleTeamName, appleTeamIdentifier) {
|
|
94
|
+
log_1.default.addNewLineIfNone();
|
|
95
|
+
chosenDevices.forEach(device => {
|
|
96
|
+
log_1.default.log((0, formatDevice_1.default)(device, {
|
|
97
|
+
appleTeamName,
|
|
98
|
+
appleTeamIdentifier: appleTeamIdentifier,
|
|
99
|
+
}));
|
|
100
|
+
log_1.default.newLine();
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
async chooseDevicesToDeleteAsync(appleDevices, udids) {
|
|
104
|
+
let chosenDevices = [];
|
|
105
|
+
log_1.default.newLine();
|
|
106
|
+
if (udids) {
|
|
107
|
+
udids.forEach(udid => {
|
|
108
|
+
const foundDevice = appleDevices.find(device => device.identifier === udid);
|
|
109
|
+
if (foundDevice) {
|
|
110
|
+
chosenDevices.push(foundDevice);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
log_1.default.warn(`No device found with UDID ${udid}.`);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
if (chosenDevices.length === 0) {
|
|
118
|
+
log_1.default.addNewLineIfNone();
|
|
119
|
+
chosenDevices = await (0, DeviceUtils_1.chooseDevicesToDeleteAsync)(appleDevices);
|
|
120
|
+
log_1.default.newLine();
|
|
121
|
+
}
|
|
122
|
+
return chosenDevices;
|
|
123
|
+
}
|
|
124
|
+
async getDevicesForTeamAsync(accountName, appleTeamIdentifier) {
|
|
125
|
+
const devicesSpinner = (0, ora_1.ora)().start('Fetching the list of devices for the team…');
|
|
126
|
+
try {
|
|
127
|
+
const result = await AppleDeviceQuery_1.AppleDeviceQuery.getAllForAppleTeamAsync(accountName, appleTeamIdentifier);
|
|
128
|
+
if (result === null || result === void 0 ? void 0 : result.appleDevices.length) {
|
|
129
|
+
const { appleTeamName, appleDevices } = result;
|
|
130
|
+
devicesSpinner.succeed(`Found ${appleDevices.length} devices for team ${appleTeamName !== null && appleTeamName !== void 0 ? appleTeamName : appleTeamIdentifier}`);
|
|
131
|
+
return result;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
devicesSpinner.fail(`Couldn't find any devices for the team ${appleTeamIdentifier}`);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
catch (e) {
|
|
139
|
+
devicesSpinner.fail(`Something went wrong and we couldn't fetch the device list`);
|
|
140
|
+
throw e;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
async askForAppleTeamAsync(accountName) {
|
|
144
|
+
const teamSpinner = (0, ora_1.ora)().start('Fetching the list of teams for the project…');
|
|
145
|
+
try {
|
|
146
|
+
const teams = await AppleTeamQuery_1.AppleTeamQuery.getAllForAccountAsync(accountName);
|
|
147
|
+
if (teams.length > 0) {
|
|
148
|
+
teamSpinner.succeed('Fetched the list of teams for the project');
|
|
149
|
+
if (teams.length === 1) {
|
|
150
|
+
return teams[0].appleTeamIdentifier;
|
|
151
|
+
}
|
|
152
|
+
const result = await (0, prompts_1.promptAsync)({
|
|
153
|
+
type: 'select',
|
|
154
|
+
name: 'appleTeamIdentifier',
|
|
155
|
+
message: 'What Apple Team would you like to list devices for?',
|
|
156
|
+
choices: teams.map(team => ({
|
|
157
|
+
title: team.appleTeamName
|
|
158
|
+
? `${team.appleTeamName} (ID: ${team.appleTeamIdentifier})`
|
|
159
|
+
: team.appleTeamIdentifier,
|
|
160
|
+
value: team.appleTeamIdentifier,
|
|
161
|
+
})),
|
|
162
|
+
});
|
|
163
|
+
return result.appleTeamIdentifier;
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
teamSpinner.fail(`Couldn't find any teams for the account ${accountName}`);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
catch (e) {
|
|
171
|
+
teamSpinner.fail(`Something went wrong and we couldn't fetch the list of teams`);
|
|
172
|
+
throw e;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
exports.default = DeviceDelete;
|
|
177
|
+
DeviceDelete.description = 'remove a registered device from your account';
|
|
178
|
+
DeviceDelete.flags = {
|
|
179
|
+
'apple-team-id': core_1.Flags.string(),
|
|
180
|
+
udid: core_1.Flags.string({ multiple: true }),
|
|
181
|
+
};
|
|
@@ -24,7 +24,7 @@ class BuildList extends EasCommand_1.default {
|
|
|
24
24
|
spinner = (0, ora_1.ora)().start('Fetching the list of teams for the project…');
|
|
25
25
|
try {
|
|
26
26
|
const teams = await AppleTeamQuery_1.AppleTeamQuery.getAllForAccountAsync(accountName);
|
|
27
|
-
if (teams.length) {
|
|
27
|
+
if (teams.length > 0) {
|
|
28
28
|
spinner.succeed();
|
|
29
29
|
if (teams.length === 1) {
|
|
30
30
|
appleTeamIdentifier = teams[0].appleTeamIdentifier;
|
|
@@ -27,7 +27,7 @@ class WebhookUpdate extends EasCommand_1.default {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
exports.default = WebhookUpdate;
|
|
30
|
-
WebhookUpdate.description = '
|
|
30
|
+
WebhookUpdate.description = 'Update a webhook on the current project.';
|
|
31
31
|
WebhookUpdate.flags = {
|
|
32
32
|
id: core_1.Flags.string({
|
|
33
33
|
description: 'Webhook ID',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { AppleDevice, AppleDeviceFragment } from '../../../graphql/generated';
|
|
2
2
|
export declare function chooseDevicesAsync(allDevices: AppleDeviceFragment[], preselectedDeviceIdentifiers?: string[]): Promise<AppleDevice[]>;
|
|
3
|
+
export declare function chooseDevicesToDeleteAsync(allDevices: AppleDeviceFragment[]): Promise<AppleDevice[]>;
|
|
3
4
|
export declare function formatDeviceLabel(device: AppleDeviceFragment): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatDeviceLabel = exports.chooseDevicesAsync = void 0;
|
|
3
|
+
exports.formatDeviceLabel = exports.chooseDevicesToDeleteAsync = exports.chooseDevicesAsync = void 0;
|
|
4
4
|
const AppleDevice_1 = require("../../../graphql/types/credentials/AppleDevice");
|
|
5
5
|
const prompts_1 = require("../.././../prompts");
|
|
6
6
|
async function chooseDevicesAsync(allDevices, preselectedDeviceIdentifiers = []) {
|
|
@@ -23,6 +23,21 @@ async function chooseDevicesAsync(allDevices, preselectedDeviceIdentifiers = [])
|
|
|
23
23
|
return devices;
|
|
24
24
|
}
|
|
25
25
|
exports.chooseDevicesAsync = chooseDevicesAsync;
|
|
26
|
+
async function chooseDevicesToDeleteAsync(allDevices) {
|
|
27
|
+
const { devices } = await (0, prompts_1.promptAsync)({
|
|
28
|
+
type: 'multiselect',
|
|
29
|
+
name: 'devices',
|
|
30
|
+
message: 'Which devices do you want to remove?',
|
|
31
|
+
choices: allDevices.map(device => ({
|
|
32
|
+
value: device,
|
|
33
|
+
title: formatDeviceLabel(device),
|
|
34
|
+
selected: false,
|
|
35
|
+
})),
|
|
36
|
+
instructions: false,
|
|
37
|
+
});
|
|
38
|
+
return devices;
|
|
39
|
+
}
|
|
40
|
+
exports.chooseDevicesToDeleteAsync = chooseDevicesToDeleteAsync;
|
|
26
41
|
function formatDeviceLabel(device) {
|
|
27
42
|
var _a;
|
|
28
43
|
const deviceDetails = formatDeviceDetails(device);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AppleDeviceFragment, AppleDeviceInput } from '../../../../../graphql/generated';
|
|
2
2
|
export declare const AppleDeviceMutation: {
|
|
3
3
|
createAppleDeviceAsync(appleDeviceInput: AppleDeviceInput, accountId: string): Promise<AppleDeviceFragment>;
|
|
4
|
+
deleteAppleDeviceAsync(deviceId: string): Promise<string>;
|
|
4
5
|
};
|
|
@@ -29,4 +29,20 @@ exports.AppleDeviceMutation = {
|
|
|
29
29
|
.toPromise());
|
|
30
30
|
return data.appleDevice.createAppleDevice;
|
|
31
31
|
},
|
|
32
|
+
async deleteAppleDeviceAsync(deviceId) {
|
|
33
|
+
const data = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
|
|
34
|
+
.mutation((0, graphql_tag_1.default) `
|
|
35
|
+
mutation DeleteAppleDeviceMutation($deviceId: ID!) {
|
|
36
|
+
appleDevice {
|
|
37
|
+
deleteAppleDevice(id: $deviceId) {
|
|
38
|
+
id
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
`, {
|
|
43
|
+
deviceId,
|
|
44
|
+
})
|
|
45
|
+
.toPromise());
|
|
46
|
+
return data.id;
|
|
47
|
+
},
|
|
32
48
|
};
|