Browse Source

deps(ui): Bump ios device list (#47482)

fixes #47453
Scott Cooper 1 year ago
parent
commit
ad2b9ba7e7
4 changed files with 62 additions and 14 deletions
  1. 1 1
      package.json
  2. 13 6
      scripts/extract-ios-device-names.ts
  3. 44 3
      static/app/constants/ios-device-list.tsx
  4. 4 4
      yarn.lock

+ 1 - 1
package.json

@@ -111,7 +111,7 @@
     "gettext-parser": "1.3.1",
     "gl-matrix": "^3.4.3",
     "intersection-observer": "^0.12.2",
-    "ios-device-list": "^1.1.35",
+    "ios-device-list": "1.1.37",
     "jed": "^1.1.0",
     "js-beautify": "^1.14.4",
     "js-cookie": "3.0.1",

+ 13 - 6
scripts/extract-ios-device-names.ts

@@ -1,10 +1,11 @@
+/* eslint-disable import/no-nodejs-modules */
 /* eslint-env node */
-import path from 'path';
 import fs from 'fs';
+import path from 'path';
 
 import prettier from 'prettier';
 
-//joining path of directory
+// joining path of directory
 const tmpOutputPath = path.join(
   __dirname,
   '../static/app/constants/ios-device-list.tmp.tsx'
@@ -17,9 +18,11 @@ async function getDefinitionFiles(): Promise<string[]> {
 
   const maybeJSONFiles = await fs.readdirSync(directoryPath);
 
-  //listing all files using forEach
+  // listing all files using forEach
   maybeJSONFiles.forEach(file => {
-    if (!file.endsWith('.json') || file === 'package.json') return;
+    if (!file.endsWith('.json') || file === 'package.json') {
+      return;
+    }
 
     files.push(path.join(path.resolve(directoryPath), file));
   });
@@ -32,7 +35,7 @@ type Identifier = string;
 
 type Mapping = Record<Identifier, Generation>;
 
-async function collectDefinitions(files: string[]): Promise<Mapping> {
+function collectDefinitions(files: string[]): Mapping {
   const definitions: Mapping = {};
 
   const queue = [...files];
@@ -52,6 +55,10 @@ async function collectDefinitions(files: string[]): Promise<Mapping> {
     }
 
     for (let i = 0; i < content.length; i++) {
+      if (!content[i].Identifier) {
+        continue;
+      }
+
       definitions[content[i].Identifier] = content[i].Generation;
     }
   }
@@ -86,7 +93,7 @@ const formatOutput = async (unformatted: string) => {
 
 export async function extractIOSDeviceNames() {
   const files = await getDefinitionFiles();
-  const definitions = await collectDefinitions(files);
+  const definitions = collectDefinitions(files);
   const formatted = await formatOutput(
     template(JSON.stringify(definitions, undefined, 2))
   );

+ 44 - 3
static/app/constants/ios-device-list.tsx

@@ -41,8 +41,8 @@ const iOSDeviceMapping: Record<string, string> = {
   'iPhone10,6': 'iPhone X',
   'iPhone11,8': 'iPhone XR',
   'iPhone11,2': 'iPhone XS',
-  'iPhone11,4': 'iPhone XS Max',
   'iPhone11,6': 'iPhone XS Max',
+  'iPhone11,4': 'iPhone XS Max',
   'iPhone12,1': 'iPhone 11',
   'iPhone12,3': 'iPhone 11 Pro',
   'iPhone12,5': 'iPhone 11 Pro Max',
@@ -51,6 +51,15 @@ const iOSDeviceMapping: Record<string, string> = {
   'iPhone13,2': 'iPhone 12',
   'iPhone13,3': 'iPhone 12 Pro',
   'iPhone13,4': 'iPhone 12 Pro Max',
+  'iPhone14,4': 'iPhone 13 mini',
+  'iPhone14,5': 'iPhone 13',
+  'iPhone14,2': 'iPhone 13 Pro',
+  'iPhone14,3': 'iPhone 13 Pro Max',
+  'iPhone14,6': 'iPhone SE (3rd generation)',
+  'iPhone14,7': 'iPhone 14',
+  'iPhone14,8': 'iPhone 14 Plus',
+  'iPhone15,2': 'iPhone 14 Pro',
+  'iPhone15,3': 'iPhone 14 Pro Max',
   'iPad6,7': 'iPad Pro (12.9-inch)',
   'iPad6,8': 'iPad Pro (12.9-inch)',
   'iPad6,3': 'iPad Pro (9.7-inch)',
@@ -71,6 +80,14 @@ const iOSDeviceMapping: Record<string, string> = {
   'iPad8,10': 'iPad Pro (11-inch) (2nd generation)',
   'iPad8,11': 'iPad Pro (12.9-inch) (4th generation)',
   'iPad8,12': 'iPad Pro (12.9-inch) (4th generation)',
+  'iPad13,4': 'iPad Pro (11-inch) (3rd generation)',
+  'iPad13,5': 'iPad Pro (11-inch) (3rd generation)',
+  'iPad13,6': 'iPad Pro (11-inch) (3rd generation)',
+  'iPad13,7': 'iPad Pro (11-inch) (3rd generation)',
+  'iPad13,8': 'iPad Pro (12.9-inch) (5th generation)',
+  'iPad13,9': 'iPad Pro (12.9-inch) (5th generation)',
+  'iPad13,10': 'iPad Pro (12.9-inch) (5th generation)',
+  'iPad13,11': 'iPad Pro (12.9-inch) (5th generation)',
   'iPad2,5': 'iPad mini',
   'iPad2,6': 'iPad mini',
   'iPad2,7': 'iPad mini',
@@ -84,6 +101,8 @@ const iOSDeviceMapping: Record<string, string> = {
   'iPad5,2': 'iPad mini 4',
   'iPad11,1': 'iPad mini (5th generation)',
   'iPad11,2': 'iPad mini (5th generation)',
+  'iPad14,1': 'iPad mini (6th generation)',
+  'iPad14,2': 'iPad mini (6th generation)',
   'iPad4,1': 'iPad Air',
   'iPad4,2': 'iPad Air',
   'iPad4,3': 'iPad Air',
@@ -93,6 +112,8 @@ const iOSDeviceMapping: Record<string, string> = {
   'iPad11,4': 'iPad Air (3rd generation)',
   'iPad13,1': 'iPad Air (4th generation)',
   'iPad13,2': 'iPad Air (4th generation)',
+  'iPad13,16': 'iPad Air (5th generation)',
+  'iPad13,17': 'iPad Air (5th generation)',
   'iPad1,1': 'iPad',
   'iPad2,1': 'iPad 2',
   'iPad2,2': 'iPad 2',
@@ -112,6 +133,8 @@ const iOSDeviceMapping: Record<string, string> = {
   'iPad7,12': 'iPad (7th generation)',
   'iPad11,6': 'iPad (8th generation)',
   'iPad11,7': 'iPad (8th generation)',
+  'iPad12,1': 'iPad (9th generation)',
+  'iPad12,2': 'iPad (9th generation)',
   'AudioAccessory1,1': 'HomePod',
   'AudioAccessory1,2': 'HomePod',
   'AudioAccessory5,1': 'HomePod mini',
@@ -141,15 +164,33 @@ const iOSDeviceMapping: Record<string, string> = {
   'Watch6,2': 'Apple Watch Series 6',
   'Watch6,3': 'Apple Watch Series 6',
   'Watch6,4': 'Apple Watch Series 6',
+  'Watch6,6': 'Apple Watch Series 7',
+  'Watch6,7': 'Apple Watch Series 7',
+  'Watch6,8': 'Apple Watch Series 7',
+  'Watch6,9': 'Apple Watch Series 7',
+  'Watch6,10': 'Apple Watch SE (2nd generation)',
+  'Watch6,11': 'Apple Watch SE (2nd generation)',
+  'Watch6,12': 'Apple Watch SE (2nd generation)',
+  'Watch6,13': 'Apple Watch SE (2nd generation)',
+  'Watch6,14': 'Apple Watch Series 8',
+  'Watch6,15': 'Apple Watch Series 8',
+  'Watch6,16': 'Apple Watch Series 8',
+  'Watch6,17': 'Apple Watch Series 8',
+  'Watch6,18': 'Apple Watch Ultra',
   'AppleTV1,1': 'Apple TV (1st generation)',
   'AppleTV2,1': 'Apple TV (2nd generation)',
   'AppleTV3,1': 'Apple TV (3rd generation)',
   'AppleTV3,2': 'Apple TV (3rd generation)',
   'AppleTV5,3': 'Apple TV (4th generation)',
   'AppleTV6,2': 'Apple TV 4K',
+  'AppleTV11,1': 'Apple TV 4K (2nd generation)',
+  'AirTag1,1': 'AirTag',
   'AirPods1,1': 'AirPods (1st generation)',
-  'AirPods2,1': 'AirPods (2nd generation)',
-  'iProd8,1': 'AirPods Pro',
+  'AirPods2,1,AirPods2,1': 'AirPods (2nd generation)',
+  'AirPods1,3,Audio2,1': 'AirPods (3rd generation)',
+  'AirPods2,2,AirPodsPro1,1,iProd8,1': 'AirPods Pro',
+  'AirPodsPro1,2': 'AirPods Pro (2nd generation)',
+  'AirPodsMax1,1,iProd8,6': 'AirPods Max',
 };
 
 export {iOSDeviceMapping};

+ 4 - 4
yarn.lock

@@ -6709,10 +6709,10 @@ invariant@^2.2.1, invariant@^2.2.4:
   dependencies:
     loose-envify "^1.0.0"
 
-ios-device-list@^1.1.35:
-  version "1.1.35"
-  resolved "https://registry.yarnpkg.com/ios-device-list/-/ios-device-list-1.1.35.tgz#cddc2ed9634f4f1af1061016caf31ef4f4dc5307"
-  integrity sha512-ESaQizoD8nGdw8vhkYqab0jbPcSPnpGmqhwd3aqtyan9AZFNnQdj31ic6FdDd+/gUqp5N6RFU/ODxVKGwDhoMw==
+ios-device-list@1.1.37:
+  version "1.1.37"
+  resolved "https://registry.yarnpkg.com/ios-device-list/-/ios-device-list-1.1.37.tgz#0461dcba91ff824422740cfabc32490bfd95e686"
+  integrity sha512-0CS8kand3WDF58GtQV7AlFl9mONeHyQDtrypNEVSUyFsxNcbvj/o4gGeS/LNrQAK8V8V4rSIIpxx3hBVDDFwIg==
   dependencies:
     lodash.clonedeep "^4.5.0"
     lodash.flatten "^4.4.0"