Skip to content

Commit

Permalink
[eas-cli] [ENG-10334] Display device creation date (#2092)
Browse files Browse the repository at this point in the history
* [eas-cli] Add createdAt to AppleDeviceFragment

Added a new field to gql type to fetch it later

See: https://linear.app/expo/issue/ENG-10334/show-creation-time-of-device-record-in-ad-hoc-device-selection-prompt

* [eas-cli] Generate gql schema

Generated a new graphql schema based on updated local version of www

See: https://linear.app/expo/issue/ENG-10334/show-creation-time-of-device-record-in-ad-hoc-device-selection-prompt

* [eas-cli] Fix mutation

Fixed mutation that started to fail after schema update

See: https://linear.app/expo/issue/ENG-10334/show-creation-time-of-device-record-in-ad-hoc-device-selection-prompt

* [eas-cli] Display creation date

Added creation date to the AppleDevice formatting function used to display details in cli

See: https://linear.app/expo/issue/ENG-10334/show-creation-time-of-device-record-in-ad-hoc-device-selection-prompt

* [eas-cli] Add changelog

Manually added the changelog entry since the automation failed for some reason

See: https://linear.app/expo/issue/ENG-10334/show-creation-time-of-device-record-in-ad-hoc-device-selection-prompt
  • Loading branch information
radoslawkrzemien authored Oct 18, 2023
1 parent 91787e1 commit aa14f21
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 38 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This is the log of notable changes to EAS CLI and related packages.
### 🧹 Chores

- Add `requiredPackageManager` to metadata. ([#2067](https://github.com/expo/eas-cli/pull/2067) by [@kadikraman](https://github.com/kadikraman))
- Display Apple device creation date when listing devices. ([#2092](https://github.com/expo/eas-cli/pull/2092) by [@radoslawkrzemien](https://github.com/radoslawkrzemien))

## [5.4.0](https://github.com/expo/eas-cli/releases/tag/v5.4.0) - 2023-09-28

Expand Down
63 changes: 47 additions & 16 deletions packages/eas-cli/graphql.schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ export async function createKeystoreAsync(
keystorePassword: keystore.keystorePassword,
keyAlias: keystore.keyAlias,
keyPassword: keystore.keyPassword,
type: keystore.type,
},
account.id
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function formatDeviceLabel(device: AppleDeviceFragment): string {
const deviceDetails = formatDeviceDetails(device);
return `${device.identifier}${deviceDetails !== '' ? ` ${deviceDetails}` : ''}${
device.name ? ` (${device.name})` : ''
}`;
}${device.createdAt ? ` (created at: ${device.createdAt})` : ''}`;
}

function formatDeviceDetails(device: AppleDeviceFragment): string {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { v4 as uuidv4 } from 'uuid';

import { AppleDeviceClass, AppleDeviceFragment } from '../../../../graphql/generated';
import { formatDeviceLabel } from '../DeviceUtils';

describe(formatDeviceLabel, () => {
it('returns createdAt clause', async () => {
const currentDate = new Date();
const appleDevice = {
__typename: 'AppleDevice',
id: uuidv4(),
identifier: 'test-apple-device-id',
name: 'test-apple-device-name',
model: '15',
deviceClass: AppleDeviceClass.Iphone,
createdAt: currentDate.toISOString(),
} as AppleDeviceFragment;

const result = formatDeviceLabel(appleDevice);

expect(result).toEqual(
`test-apple-device-id (iPhone 15) (test-apple-device-name) (created at: ${currentDate.toISOString()})`
);
});
});
Loading

0 comments on commit aa14f21

Please sign in to comment.