@webspatial/builder 0.1.15 → 0.1.17
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 +15 -75
- package/dist/index.js +99 -1
- package/dist/lib/cmds/build.js +116 -1
- package/dist/lib/cmds/check.js +41 -1
- package/dist/lib/cmds/help.js +66 -1
- package/dist/lib/cmds/launch.js +14 -1
- package/dist/lib/cmds/shutdown.js +8 -1
- package/dist/lib/cmds/version.js +11 -1
- package/dist/lib/pwa/config.js +208 -1
- package/dist/lib/pwa/index.js +92 -1
- package/dist/lib/pwa/validate.js +240 -1
- package/dist/lib/resource/file.js +45 -1
- package/dist/lib/resource/imageHelper.js +37 -1
- package/dist/lib/resource/index.js +102 -1
- package/dist/lib/resource/load.js +121 -1
- package/dist/lib/types.d.ts +2 -2
- package/dist/lib/types.js +2 -1
- package/dist/lib/utils/CustomError.js +11 -1
- package/dist/lib/utils/FetchUtils-1.js +25 -1
- package/dist/lib/utils/Log.js +98 -1
- package/dist/lib/utils/fetch.js +56 -1
- package/dist/lib/utils/history.d.ts +1 -0
- package/dist/lib/utils/history.js +116 -1
- package/dist/lib/utils/messages.js +102 -1
- package/dist/lib/utils/utils.js +15 -1
- package/dist/lib/xcode/index.js +35 -1
- package/dist/lib/xcode/manifestSwiftTemplate.js +109 -1
- package/dist/lib/xcode/xcodebuild.js +119 -1
- package/dist/lib/xcode/xcodeproject.js +239 -1
- package/dist/lib/xcode/xcrun.d.ts +1 -1
- package/dist/lib/xcode/xcrun.js +433 -1
- package/package.json +3 -3
package/dist/lib/xcode/xcrun.js
CHANGED
|
@@ -1 +1,433 @@
|
|
|
1
|
-
'use strict';const _0xd61acb=_0x4e80;(function(_0x20be87,_0x1944a6){const _0x1f520e=_0x4e80,_0x510d57=_0x20be87();while(!![]){try{const _0x3265aa=-parseInt(_0x1f520e(0xf3))/0x1+parseInt(_0x1f520e(0xab))/0x2+parseInt(_0x1f520e(0x78))/0x3*(-parseInt(_0x1f520e(0x98))/0x4)+parseInt(_0x1f520e(0xce))/0x5*(-parseInt(_0x1f520e(0xbf))/0x6)+-parseInt(_0x1f520e(0x9a))/0x7+parseInt(_0x1f520e(0xbd))/0x8+parseInt(_0x1f520e(0x84))/0x9*(parseInt(_0x1f520e(0xea))/0xa);if(_0x3265aa===_0x1944a6)break;else _0x510d57['push'](_0x510d57['shift']());}catch(_0x30c26d){_0x510d57['push'](_0x510d57['shift']());}}}(_0x3f67,0xdfc7d));function _0x3f67(){const _0x2dc6c2=['\x20build\x20-scheme\x20web-spatial\x20-destination\x20\x27platform=visionOS\x20Simulator,id=','\x20--apple-id\x20','\x20shutdown\x20\x22','indexOf','log','\x20list','appleId','60210PKOZhS','uploadPackage','getSimulatorHistory','buildTestApp','\x20altool','\x20--upload-package\x20','error','\x20--apiIssuer\x20','authApi','301816cfSpdr','../resource','No\x20visionOS\x20rumtime\x20found!\x20Please\x20go\x20to\x20Xcode\x20to\x20download\x20the\x20Apple\x20Vision\x20Pro\x20simulator','\x20list\x20devicetypes','mkdirSync','\x20--validate-app\x20-f\x20','--\x20visionOS','\x20--bundle-version\x20','\x20list\x20devices\x20\x22','/web-spatial.xcodeproj','getAppInfoRecord','try\x20create\x20a\x20visionOS\x20simulator','xcrun',',\x20name','3YWNOFl','\x20-t\x20','\x20|\x20grep\x20','path','test','length','slice','uploadApp','__esModule','parseDeviceInfo','\x20--apiKey\x20','PROJECT_DIRECTORY','4698TfwDlC','listDevices','cd\x20','PROJECT_BUILD_DIRECTORY','Build/Products/Debug-xrsimulator/','no\x20visionOS\x20simulator\x20found','\x20and\x20','launch','Apple\x20Vision\x20Pro','includes','\x20boot\x20\x22','version','parseDestinationDevices','\x22\x20\x22','\x20simctl','listSimulator','Shutdown','platform:visionOS\x20Simulator','simctl','create','350156RohOHE','existsSync','9605540rCWEDZ','runWithSimulator','No\x20Apple\x20Vision\x20Pro\x20simulator\x20found!\x20Please\x20go\x20to\x20Xcode\x20to\x20download\x20the\x20Apple\x20Vision\x20Pro\x20simulator','use\x20simulator:\x20','terminate','write','altool','\x20-u\x20','findSimulator','project','visionOS','child_process','push','launchSimulator','listDeviceTypes','execSync','installing\x20app','1248804iBPBuG','parseSupportDevices','com','id:','line','use\x20','.app','validate','\x27\x20-derivedDataPath\x20','./xcodebuild','simulator\x20is\x20already\x20shutdown','../utils/utils','parseSupportRuntimes','build\x20failed\x20on\x20','warn','launchApp','no\x20simulator\x20available','-------------------\x20build\x20end\x20-------------------','3632760iwCoYG','visionos','9259674ntDDqT','deviceId','createSimulator','find\x20simulators:',',\x20try\x20next\x20device','sort','trim','create\x20visionOS\x20simulator:\x20','join','install','\x20&&\x20xcodebuild\x20-showdestinations\x20-scheme\x20web-spatial','defineProperty','\x20list\x20runtimes','\x20----','listRuntimes','5SKAIEQ','boot','shutdownSimulator','find\x20destination\x20device:\x20','searchSimulator','recordSimulator','authAccount','default','runWithHistory','toString','\x20create\x20\x22WebSpatialSimulator\x22\x20\x22','launchWithSimulator','XcodebuildCMD','----\x20build\x20start\x20on\x20','replace','open\x20-a\x20Simulator\x20--args\x20-CurrentDeviceUDID\x20','split','\x20--verbose','platform','PROJECT_TEST_DIRECTORY','CliLog'];_0x3f67=function(){return _0x2dc6c2;};return _0x3f67();}function _0x4e80(_0x143f95,_0x3eae63){const _0x3f675a=_0x3f67();return _0x4e80=function(_0x4e8091,_0x28612f){_0x4e8091=_0x4e8091-0x6b;let _0x1a6a47=_0x3f675a[_0x4e8091];return _0x1a6a47;},_0x4e80(_0x143f95,_0x3eae63);}Object[_0xd61acb(0xca)](exports,_0xd61acb(0x80),{'value':!![]});const child_process_1=require(_0xd61acb(0xa5)),resource_1=require(_0xd61acb(0x6b)),path_1=require(_0xd61acb(0x7b)),fs=require('fs'),xcodebuild_1=require(_0xd61acb(0xb4)),file_1=require('../resource/file'),utils_1=require(_0xd61acb(0xb6)),history_1=require('../utils/history');class Xcrun{static async[_0xd61acb(0xb2)](_0x53bf46,_0x5038f2,_0x3a2ef2,_0x1ec471){const _0x15c93c=_0xd61acb,_0x506428=new XcrunCMD()[_0x15c93c(0xa0)]();_0x506428[_0x15c93c(0xb2)](_0x53bf46);_0x1ec471?_0x506428[_0x15c93c(0xd4)](_0x5038f2,_0x3a2ef2):_0x506428[_0x15c93c(0xf2)](_0x5038f2,_0x3a2ef2);_0x506428[_0x15c93c(0xe0)](_0x15c93c(0xbe));const _0x31423f=(0x0,child_process_1[_0x15c93c(0xa9)])(_0x506428[_0x15c93c(0xaf)]);return _0x31423f[_0x15c93c(0xd7)]();}static async[_0xd61acb(0xeb)](_0x245a47,_0x1e2d20,_0x4a4f74,_0x1b8378,_0x331cc0){const _0x411f9f=_0xd61acb,_0x519f0f=new XcrunCMD()['altool']();_0x519f0f[_0x411f9f(0xeb)](_0x245a47);_0x331cc0?_0x519f0f['authAccount'](_0x1e2d20,_0x4a4f74):_0x519f0f[_0x411f9f(0xf2)](_0x1e2d20,_0x4a4f74);_0x519f0f[_0x411f9f(0xe0)](_0x411f9f(0xbe)),_0x519f0f['appleId'](_0x1b8378);const _0x38f073=(0x0,child_process_1[_0x411f9f(0xa9)])(_0x519f0f[_0x411f9f(0xaf)]);return _0x38f073['toString']();}static async[_0xd61acb(0x7f)](_0x101a93,_0x5eaf62,_0x11ff47,_0x3fc336){const _0x39efa9=_0xd61acb,_0x59219a=new XcrunCMD()[_0x39efa9(0xa0)]();_0x59219a[_0x39efa9(0x7f)](_0x101a93);_0x3fc336?_0x59219a[_0x39efa9(0xd4)](_0x5eaf62,_0x11ff47):_0x59219a[_0x39efa9(0xf2)](_0x5eaf62,_0x11ff47);_0x59219a[_0x39efa9(0xe0)](_0x39efa9(0xbe));const _0x24e1ed=(0x0,child_process_1[_0x39efa9(0xa9)])(_0x59219a[_0x39efa9(0xaf)]);return _0x24e1ed[_0x39efa9(0xd7)]();}static async[_0xd61acb(0x9b)](){const _0x105530=_0xd61acb;let _0x1368c9=this['findSimulator']();!_0x1368c9[0x0]&&(_0x1368c9=[this[_0x105530(0xc1)]()]);const _0x10f53b=history_1[_0x105530(0xd5)]['getAppInfoRecord']();for(var _0x2b7c9e=0x0;_0x2b7c9e<_0x1368c9[_0x105530(0x7d)];_0x2b7c9e++){if(this['buildTestApp'](_0x1368c9[_0x2b7c9e][_0x105530(0xc0)])){const _0x30e1fd=this[_0x105530(0xd9)](_0x10f53b,_0x1368c9[_0x2b7c9e][_0x105530(0xc0)],!![],![]);history_1['default'][_0x105530(0xd3)](_0x30e1fd),history_1[_0x105530(0xd5)]['write']();return;}else utils_1[_0x105530(0xe2)][_0x105530(0xf0)](_0x105530(0xb8)+_0x1368c9[_0x2b7c9e][_0x105530(0xc0)]+_0x105530(0xc3));}utils_1[_0x105530(0xe2)]['error'](_0x105530(0xbb));}static async[_0xd61acb(0xd6)](){const _0x4190a9=_0xd61acb,_0x3d782e=history_1[_0x4190a9(0xd5)][_0x4190a9(0xec)](),_0x17f65c=history_1[_0x4190a9(0xd5)][_0x4190a9(0x74)](),_0x1e1099=this['launchWithSimulator'](_0x17f65c,_0x3d782e);history_1[_0x4190a9(0xd5)][_0x4190a9(0xd3)](_0x1e1099),history_1[_0x4190a9(0xd5)][_0x4190a9(0x9f)]();}static[_0xd61acb(0xd9)](_0x4ad7aa,_0x26803e='',_0x23e707=![],_0x225ea3=!![]){const _0x4ab596=_0xd61acb;let _0x393250,_0x17f586=![];return _0x225ea3?_0x393250=this[_0x4ab596(0xa2)](_0x26803e)[0x0]:_0x393250=this['searchSimulator'](_0x26803e),(!_0x393250||_0x393250['deviceId']==='')&&(_0x393250=this['createSimulator'](),_0x17f586=!![]),console[_0x4ab596(0xe7)](_0x4ab596(0x9d)+_0x393250['deviceId']),this[_0x4ab596(0xa7)](_0x393250),(_0x23e707||_0x17f586)&&(console[_0x4ab596(0xe7)](_0x4ab596(0xaa)),this['installApp'](resource_1['PROJECT_TEST_DIRECTORY'],_0x393250['deviceId'],_0x4ad7aa['name']),console[_0x4ab596(0xe7)]('install\x20success')),console[_0x4ab596(0xe7)]('launch\x20app'),this[_0x4ab596(0xba)](_0x393250['deviceId'],_0x4ad7aa['id']),_0x393250[_0x4ab596(0xc0)];}static async[_0xd61acb(0xd0)](){const _0x3bb944=_0xd61acb;let _0x3dab08=this[_0x3bb944(0xa2)]()[0x0];console[_0x3bb944(0xe7)]('find\x20simulator:\x20'+_0x3dab08['deviceId']);if(_0x3dab08['state']!=='Shutdown'){let _0x21c73e=new XcrunCMD()[_0x3bb944(0x96)]();_0x21c73e['shutdown'](_0x3dab08[_0x3bb944(0xc0)]),(0x0,child_process_1[_0x3bb944(0xa9)])(_0x21c73e['line']);}else console[_0x3bb944(0xe7)](_0x3bb944(0xb5));}static[_0xd61acb(0xa7)](_0x71f4d){const _0x2c28a0=_0xd61acb;if(_0x71f4d['state']===_0x2c28a0(0x94)){let _0x3d9d7c=new XcrunCMD()['simctl']();_0x3d9d7c[_0x2c28a0(0xcf)](_0x71f4d[_0x2c28a0(0xc0)]),(0x0,child_process_1['execSync'])(_0x3d9d7c[_0x2c28a0(0xaf)]),(0x0,child_process_1[_0x2c28a0(0xa9)])('sleep\x2010');}(0x0,child_process_1[_0x2c28a0(0xa9)])(_0x2c28a0(0xdd)+_0x71f4d['deviceId']);}static[_0xd61acb(0xed)](_0x5d2995){const _0x1dd82f=_0xd61acb,_0x52f627=resource_1[_0x1dd82f(0x83)]+_0x1dd82f(0x73);!fs[_0x1dd82f(0x99)](resource_1[_0x1dd82f(0x87)])&&fs[_0x1dd82f(0x6e)](resource_1[_0x1dd82f(0x87)],{'recursive':!![]});!fs[_0x1dd82f(0x99)](resource_1[_0x1dd82f(0xe1)])&&fs['mkdirSync'](resource_1[_0x1dd82f(0xe1)],{'recursive':!![]});(0x0,file_1['clearDir'])(resource_1[_0x1dd82f(0xe1)]);const _0x4ce3da=new xcodebuild_1[(_0x1dd82f(0xda))]()[_0x1dd82f(0xa3)](_0x52f627)['line']+(_0x1dd82f(0xe3)+_0x5d2995+_0x1dd82f(0xb3)+resource_1[_0x1dd82f(0xe1)]);console[_0x1dd82f(0xe7)](_0x1dd82f(0xdb)+_0x5d2995+_0x1dd82f(0xcc));try{const _0x27c50b=(0x0,child_process_1[_0x1dd82f(0xa9)])(_0x4ce3da);if(_0x27c50b[_0x1dd82f(0xd7)]()[_0x1dd82f(0x8d)]('**\x20BUILD\x20FAILED\x20**'))return![];}catch(_0x289946){}return console[_0x1dd82f(0xe7)](_0x1dd82f(0xbc)),!![];}static['installApp'](_0x2bfd93,_0x5cd157,_0x5834a8){const _0x4d7de4=_0xd61acb,_0x59610c=(0x0,path_1[_0x4d7de4(0xc7)])(_0x2bfd93,_0x4d7de4(0x88)+_0x5834a8+_0x4d7de4(0xb1));let _0x23449e=new XcrunCMD()[_0x4d7de4(0x96)]();_0x23449e['install'](_0x5cd157,_0x59610c),(0x0,child_process_1[_0x4d7de4(0xa9)])(_0x23449e[_0x4d7de4(0xaf)]);}static[_0xd61acb(0xba)](_0x50b6c3,_0xcc3f1a){const _0x17f830=_0xd61acb;try{(0x0,child_process_1[_0x17f830(0xa9)])(new XcrunCMD()[_0x17f830(0x96)]()['terminate'](_0x50b6c3,_0xcc3f1a)[_0x17f830(0xaf)]);}catch(_0x156c25){}(0x0,child_process_1[_0x17f830(0xa9)])(new XcrunCMD()[_0x17f830(0x96)]()[_0x17f830(0x8b)](_0x50b6c3,_0xcc3f1a)[_0x17f830(0xaf)]);}static[_0xd61acb(0x90)](_0xcbf254){const _0x2e9ebf=_0xd61acb;let _0x487b96=_0xcbf254[_0x2e9ebf(0xde)]('\x0a');const _0x2dc851=/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/;let _0x5a02a1=[];for(let _0x3bb9c3=0x0;_0x3bb9c3<_0x487b96[_0x2e9ebf(0x7d)];_0x3bb9c3++){if(_0x487b96[_0x3bb9c3][_0x2e9ebf(0x8d)](_0x2e9ebf(0x95))){const _0x373307=_0x487b96[_0x3bb9c3][_0x2e9ebf(0x7e)](_0x487b96[_0x3bb9c3][_0x2e9ebf(0xe6)](_0x2e9ebf(0xae))+0x3,_0x487b96[_0x3bb9c3][_0x2e9ebf(0xe6)](_0x2e9ebf(0x77)));_0x2dc851[_0x2e9ebf(0x7c)](_0x373307)&&(_0x5a02a1['push'](_0x373307),console['log'](_0x2e9ebf(0xd1)+_0x487b96[_0x3bb9c3]+')'));}}return _0x5a02a1;}static[_0xd61acb(0xac)](_0x579c01){const _0x2e6d9b=_0xd61acb;let _0x57b120=_0x579c01['split']('\x0a');for(let _0x685f00=0x0;_0x685f00<_0x57b120[_0x2e6d9b(0x7d)];_0x685f00++){if(_0x57b120[_0x685f00]['includes']('Apple\x20Vision\x20Pro'))return _0x57b120[_0x685f00]=_0x57b120[_0x685f00][_0x2e6d9b(0xdc)](_0x2e6d9b(0x8c),'')['trim'](),_0x57b120[_0x685f00]=_0x57b120[_0x685f00][_0x2e6d9b(0xdc)]('(',''),_0x57b120[_0x685f00]=_0x57b120[_0x685f00][_0x2e6d9b(0xdc)](')',''),_0x57b120[_0x685f00];}throw new Error(_0x2e6d9b(0x9c));}static[_0xd61acb(0xb7)](_0x14e2a4){const _0xf453f1=_0xd61acb;let _0x36864a=_0x14e2a4[_0xf453f1(0xde)]('\x0a');for(let _0x395cb6=0x0;_0x395cb6<_0x36864a[_0xf453f1(0x7d)];_0x395cb6++){if(_0x36864a[_0x395cb6][_0xf453f1(0x8d)](_0xf453f1(0xa4)))return _0x36864a[_0x395cb6][_0xf453f1(0x7e)](_0x36864a[_0x395cb6][_0xf453f1(0xe6)](_0xf453f1(0xad)))['trim']();}throw new Error(_0xf453f1(0x6c));}static['parseListDevices'](_0x20652f){const _0x47860b=_0xd61acb;let _0x4c4735=_0x20652f[_0x47860b(0xde)]('\x0a'),_0xd4f521=[],_0x1f315a=-0x1;for(let _0x197059=0x0;_0x197059<_0x4c4735['length'];_0x197059++){if(_0x4c4735[_0x197059][_0x47860b(0x8d)](_0x47860b(0x70)))_0x1f315a=_0x197059;else{if(_0x1f315a>0x0){if(_0x4c4735[_0x197059]['includes']('--\x20'))break;_0x4c4735[_0x197059][_0x47860b(0x7d)]>0x0&&_0xd4f521[_0x47860b(0xa6)](this[_0x47860b(0x81)](_0x4c4735[_0x197059]));}}}return _0xd4f521;}static[_0xd61acb(0x81)](_0x1092c){const _0x566781=_0xd61acb,_0xc3c966=_0x1092c[_0x566781(0xde)]('('),_0xfe9ba2={'name':_0xc3c966[0x0]['trim'](),'deviceId':_0xc3c966[0x1][_0x566781(0xde)](')')[0x0][_0x566781(0xc5)](),'state':_0xc3c966[0x2][_0x566781(0xde)](')')[0x0][_0x566781(0xc5)]()};return _0xfe9ba2;}static[_0xd61acb(0xa2)](_0x2d9d38){const _0xfcf48f=_0xd61acb;let _0x58802c=[_0x2d9d38!==null&&_0x2d9d38!==void 0x0?_0x2d9d38:''];const _0x5dafac=(0x0,child_process_1[_0xfcf48f(0xa9)])(_0xfcf48f(0x86)+resource_1['PROJECT_DIRECTORY']+_0xfcf48f(0xc9)),_0x1126f2=this['parseDestinationDevices'](_0x5dafac[_0xfcf48f(0xd7)]());_0x58802c=[..._0x58802c,..._0x1126f2];let _0x17b803=this[_0xfcf48f(0x93)]();return _0x17b803[_0xfcf48f(0xc4)]((_0x172a0e,_0x44510f)=>{const _0x4dadec=_0xfcf48f,_0x4452f8=_0x58802c[_0x4dadec(0xe6)](_0x172a0e[_0x4dadec(0xc0)]),_0x3125bd=_0x58802c[_0x4dadec(0xe6)](_0x44510f['deviceId']);if(_0x4452f8!==-0x1&&_0x3125bd!==-0x1)return _0x4452f8-_0x3125bd;else{if(_0x4452f8!==-0x1)return-0x1;else{if(_0x3125bd!==-0x1)return 0x1;}}return 0x0;}),console['log'](_0xfcf48f(0xc2)),console[_0xfcf48f(0xe7)](_0x17b803),_0x17b803;}static[_0xd61acb(0xd2)](_0x44c25d){const _0x410e28=_0xd61acb,_0x157702=new XcrunCMD()[_0x410e28(0x96)]()[_0x410e28(0x85)](_0x410e28(0x8c))['line']+(_0x410e28(0x7a)+_0x44c25d);console['log'](_0x157702);let _0x3af0bf=(0x0,child_process_1['execSync'])(_0x157702);return console[_0x410e28(0xe7)](_0x3af0bf[_0x410e28(0xd7)]()),this[_0x410e28(0x81)](_0x3af0bf['toString']());}static[_0xd61acb(0xc1)](){const _0x32b850=_0xd61acb;utils_1[_0x32b850(0xe2)][_0x32b850(0xb9)](_0x32b850(0x89)),utils_1[_0x32b850(0xe2)][_0x32b850(0xb9)](_0x32b850(0x75));let _0x540a51=(0x0,child_process_1[_0x32b850(0xa9)])(new XcrunCMD()[_0x32b850(0x96)]()[_0x32b850(0xa8)]()['line']);const _0x25d365=this[_0x32b850(0xac)](_0x540a51[_0x32b850(0xd7)]());_0x540a51=(0x0,child_process_1['execSync'])(new XcrunCMD()[_0x32b850(0x96)]()[_0x32b850(0xcd)]()['line']);const _0x4e0e9b=this['parseSupportRuntimes'](_0x540a51[_0x32b850(0xd7)]());utils_1[_0x32b850(0xe2)]['info'](_0x32b850(0xb0)+_0x25d365+_0x32b850(0x8a)+_0x4e0e9b+'\x20to\x20create\x20visionOS\x20simulator'),_0x540a51=(0x0,child_process_1[_0x32b850(0xa9)])(new XcrunCMD()[_0x32b850(0x96)]()[_0x32b850(0x97)](_0x25d365,_0x4e0e9b)[_0x32b850(0xaf)]);const _0x46f17a=_0x540a51[_0x32b850(0xd7)]()[_0x32b850(0xc5)]();return console['log'](_0x32b850(0xc6)+_0x46f17a),{'name':'WebSpatial\x20Simulator','deviceId':_0x46f17a,'state':_0x32b850(0x94)};}static['listSimulator'](){const _0x4b81c2=_0xd61acb;let _0x37ae0c=(0x0,child_process_1[_0x4b81c2(0xa9)])(new XcrunCMD()[_0x4b81c2(0x96)]()[_0x4b81c2(0x85)]('Apple\x20Vision\x20Pro')[_0x4b81c2(0xaf)]);return this['parseListDevices'](_0x37ae0c[_0x4b81c2(0xd7)]());}}exports[_0xd61acb(0xd5)]=Xcrun;class XcrunCMD{constructor(){const _0x56d6d5=_0xd61acb;this[_0x56d6d5(0xaf)]=_0x56d6d5(0x76);}['altool'](){const _0x463ba0=_0xd61acb;return this['line']+=_0x463ba0(0xee),this;}[_0xd61acb(0x96)](){const _0x2a8e46=_0xd61acb;return this[_0x2a8e46(0xaf)]+=_0x2a8e46(0x92),this;}['list'](){const _0x4eb5fe=_0xd61acb;return this['line']+=_0x4eb5fe(0xe8),this;}['listDevices'](_0x5a23be){const _0x50c17e=_0xd61acb;return this[_0x50c17e(0xaf)]+=_0x50c17e(0x72)+_0x5a23be+'\x22',this;}[_0xd61acb(0xa8)](){const _0x563b96=_0xd61acb;return this[_0x563b96(0xaf)]+=_0x563b96(0x6d),this;}['listRuntimes'](){const _0x406b06=_0xd61acb;return this[_0x406b06(0xaf)]+=_0x406b06(0xcb),this;}[_0xd61acb(0xb2)](_0x368fce){const _0x53e96c=_0xd61acb;return this['line']+=_0x53e96c(0x6f)+_0x368fce,this;}[_0xd61acb(0x7f)](_0x5b0c95){return this['line']+='\x20--upload-app\x20-f\x20'+_0x5b0c95,this;}[_0xd61acb(0xeb)](_0x96b5ee){const _0xbbb83=_0xd61acb;return this['line']+=_0xbbb83(0xef)+_0x96b5ee,this;}['authAccount'](_0x1299b6,_0x4e8072){const _0x120760=_0xd61acb;return this[_0x120760(0xaf)]+=_0x120760(0xa1)+_0x1299b6+'\x20-p\x20'+_0x4e8072,this;}[_0xd61acb(0xf2)](_0x3965d8,_0x3502a5){const _0x1a2567=_0xd61acb;return this['line']+=_0x1a2567(0x82)+_0x3965d8+_0x1a2567(0xf1)+_0x3502a5,this;}[_0xd61acb(0xe9)](_0x5588d1){const _0x3f5504=_0xd61acb;return this['line']+=_0x3f5504(0xe4)+_0x5588d1,this;}['platform'](_0x49c4cb){const _0x2e7c42=_0xd61acb;return this['line']+=_0x2e7c42(0x79)+_0x49c4cb,this;}[_0xd61acb(0x8f)](_0x46f80e){const _0x12da92=_0xd61acb;return this[_0x12da92(0xaf)]+=_0x12da92(0x71)+_0x46f80e,this;}['verbose'](){const _0x5f28a0=_0xd61acb;return this[_0x5f28a0(0xaf)]+=_0x5f28a0(0xdf),this;}['create'](_0x23f3d1,_0x57f228){const _0x4c76b3=_0xd61acb;return this[_0x4c76b3(0xaf)]+=_0x4c76b3(0xd8)+_0x23f3d1+_0x4c76b3(0x91)+_0x57f228+'\x22',this;}['shutdown'](_0xfddc45){const _0xa02873=_0xd61acb;return this[_0xa02873(0xaf)]+=_0xa02873(0xe5)+_0xfddc45+'\x22',this;}[_0xd61acb(0xcf)](_0x12df37){const _0x1002a8=_0xd61acb;return this[_0x1002a8(0xaf)]+=_0x1002a8(0x8e)+_0x12df37+'\x22',this;}[_0xd61acb(0xc8)](_0x2dd1c4,_0x396b45){const _0x5bc12a=_0xd61acb;return this[_0x5bc12a(0xaf)]+='\x20install\x20\x22'+_0x2dd1c4+_0x5bc12a(0x91)+_0x396b45+'\x22',this;}[_0xd61acb(0x8b)](_0xac48f5,_0x4583ac){const _0x3b5ecb=_0xd61acb;return this['line']+='\x20launch\x20\x22'+_0xac48f5+_0x3b5ecb(0x91)+_0x4583ac+'\x22',this;}[_0xd61acb(0x9e)](_0x566c6a,_0x1ec284){const _0x54c6d5=_0xd61acb;return this[_0x54c6d5(0xaf)]+='\x20terminate\x20\x22'+_0x566c6a+_0x54c6d5(0x91)+_0x1ec284+'\x22',this;}}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const child_process_1 = require("child_process");
|
|
4
|
+
const resource_1 = require("../resource");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
const xcodebuild_1 = require("./xcodebuild");
|
|
8
|
+
const file_1 = require("../resource/file");
|
|
9
|
+
const utils_1 = require("../utils/utils");
|
|
10
|
+
const history_1 = require("../utils/history");
|
|
11
|
+
class Xcrun {
|
|
12
|
+
static async validate(path, key1, key2, useAccount) {
|
|
13
|
+
const cmd = new XcrunCMD().altool();
|
|
14
|
+
cmd.validate(path);
|
|
15
|
+
if (useAccount) {
|
|
16
|
+
cmd.authAccount(key1, key2);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
cmd.authApi(key1, key2);
|
|
20
|
+
}
|
|
21
|
+
cmd.platform('visionos');
|
|
22
|
+
const res = (0, child_process_1.execSync)(cmd.line);
|
|
23
|
+
return res.toString();
|
|
24
|
+
}
|
|
25
|
+
static async uploadPackage(path, key1, key2, appleId, useAccount) {
|
|
26
|
+
const cmd = new XcrunCMD().altool();
|
|
27
|
+
cmd.uploadPackage(path);
|
|
28
|
+
if (useAccount) {
|
|
29
|
+
cmd.authAccount(key1, key2);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
cmd.authApi(key1, key2);
|
|
33
|
+
}
|
|
34
|
+
cmd.platform('visionos');
|
|
35
|
+
cmd.appleId(appleId);
|
|
36
|
+
const res = (0, child_process_1.execSync)(cmd.line);
|
|
37
|
+
return res.toString();
|
|
38
|
+
}
|
|
39
|
+
static async uploadApp(path, key1, key2, useAccount) {
|
|
40
|
+
const cmd = new XcrunCMD().altool();
|
|
41
|
+
cmd.uploadApp(path);
|
|
42
|
+
if (useAccount) {
|
|
43
|
+
cmd.authAccount(key1, key2);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
cmd.authApi(key1, key2);
|
|
47
|
+
}
|
|
48
|
+
cmd.platform('visionos');
|
|
49
|
+
const res = (0, child_process_1.execSync)(cmd.line);
|
|
50
|
+
return res.toString();
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @description
|
|
54
|
+
* Find suitable simulator device
|
|
55
|
+
* Attempt to build a testing app
|
|
56
|
+
* Try running the test app on the simulator
|
|
57
|
+
*/
|
|
58
|
+
static async runWithSimulator() {
|
|
59
|
+
let deviceList = this.findSimulator();
|
|
60
|
+
if (!deviceList[0]) {
|
|
61
|
+
deviceList = [this.createSimulator()];
|
|
62
|
+
}
|
|
63
|
+
const recordAppInfo = history_1.default.getAppInfoRecord();
|
|
64
|
+
for (var i = 0; i < deviceList.length; i++) {
|
|
65
|
+
if (this.buildTestApp(deviceList[i].deviceId)) {
|
|
66
|
+
const launchedDeviceId = this.launchWithSimulator(recordAppInfo, deviceList[i].deviceId, false);
|
|
67
|
+
history_1.default.recordSimulator(launchedDeviceId);
|
|
68
|
+
history_1.default.write();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
utils_1.CliLog.error(`build failed on ${deviceList[i].deviceId}, try next device`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
utils_1.CliLog.error('no simulator available');
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @description
|
|
79
|
+
* Attempt to launch the app using information from the history
|
|
80
|
+
*/
|
|
81
|
+
static async runWithHistory() {
|
|
82
|
+
const historyDeviceId = history_1.default.getSimulatorHistory();
|
|
83
|
+
const historyAppInfo = history_1.default.getAppInfoRecord();
|
|
84
|
+
const launchedDeviceId = this.launchWithSimulator(historyAppInfo, historyDeviceId);
|
|
85
|
+
history_1.default.recordSimulator(launchedDeviceId);
|
|
86
|
+
history_1.default.write();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @description
|
|
90
|
+
* Find a simulator with the given deviceId
|
|
91
|
+
* If no deviceId is provided, find the first available simulator
|
|
92
|
+
* If no simulator is found, create a new simulator
|
|
93
|
+
* @param deviceId The deviceId of the simulator to find, defaulting to the first available simulator
|
|
94
|
+
* @param appInfo
|
|
95
|
+
* appInfo.name is used for installing applications
|
|
96
|
+
* appInfo.id is used to launch the application
|
|
97
|
+
* @returns The simulator device uuid
|
|
98
|
+
*/
|
|
99
|
+
static launchWithSimulator(appInfo, deviceId = '', needFind = true) {
|
|
100
|
+
let device;
|
|
101
|
+
if (needFind) {
|
|
102
|
+
device = this.findSimulator(deviceId)[0];
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
device = this.searchSimulator(deviceId);
|
|
106
|
+
}
|
|
107
|
+
if (!device || device.deviceId === '') {
|
|
108
|
+
device = this.createSimulator();
|
|
109
|
+
}
|
|
110
|
+
console.log(`use simulator: ${device.deviceId}`);
|
|
111
|
+
// launch visionOS simulator
|
|
112
|
+
this.launchSimulator(device);
|
|
113
|
+
// install app
|
|
114
|
+
console.log('installing app');
|
|
115
|
+
this.installApp(resource_1.PROJECT_TEST_DIRECTORY, device.deviceId, appInfo.name);
|
|
116
|
+
console.log('install success');
|
|
117
|
+
// launch app
|
|
118
|
+
console.log('launch app');
|
|
119
|
+
this.launchApp(device.deviceId, appInfo.id);
|
|
120
|
+
return device.deviceId;
|
|
121
|
+
}
|
|
122
|
+
static async shutdownSimulator() {
|
|
123
|
+
let device = this.findSimulator()[0];
|
|
124
|
+
console.log(`find simulator: ${device.deviceId}`);
|
|
125
|
+
if (device.state !== 'Shutdown') {
|
|
126
|
+
let cmd = new XcrunCMD().simctl();
|
|
127
|
+
cmd.shutdown(device.deviceId);
|
|
128
|
+
(0, child_process_1.execSync)(cmd.line);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
console.log('simulator is already shutdown');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
static launchSimulator(device) {
|
|
135
|
+
// boot visionOS simulator if not booted
|
|
136
|
+
if (device.state === 'Shutdown') {
|
|
137
|
+
let cmd = new XcrunCMD().simctl();
|
|
138
|
+
cmd.boot(device.deviceId);
|
|
139
|
+
(0, child_process_1.execSync)(cmd.line);
|
|
140
|
+
// wait 10s for simulator to boot
|
|
141
|
+
(0, child_process_1.execSync)('sleep 10');
|
|
142
|
+
}
|
|
143
|
+
// open simulator
|
|
144
|
+
(0, child_process_1.execSync)('open -a Simulator --args -CurrentDeviceUDID ' + device.deviceId);
|
|
145
|
+
}
|
|
146
|
+
static buildTestApp(deviceId) {
|
|
147
|
+
const projectFile = resource_1.PROJECT_DIRECTORY + '/web-spatial.xcodeproj';
|
|
148
|
+
if (!fs.existsSync(resource_1.PROJECT_BUILD_DIRECTORY)) {
|
|
149
|
+
fs.mkdirSync(resource_1.PROJECT_BUILD_DIRECTORY, { recursive: true });
|
|
150
|
+
}
|
|
151
|
+
if (!fs.existsSync(resource_1.PROJECT_TEST_DIRECTORY)) {
|
|
152
|
+
fs.mkdirSync(resource_1.PROJECT_TEST_DIRECTORY, { recursive: true });
|
|
153
|
+
}
|
|
154
|
+
(0, file_1.clearDir)(resource_1.PROJECT_TEST_DIRECTORY);
|
|
155
|
+
const buildCMD = new xcodebuild_1.XcodebuildCMD().project(projectFile).line +
|
|
156
|
+
` build -scheme web-spatial -destination 'platform=visionOS Simulator,id=${deviceId}' -derivedDataPath ${resource_1.PROJECT_TEST_DIRECTORY}`;
|
|
157
|
+
console.log(`---- build start on ${deviceId} ----`);
|
|
158
|
+
try {
|
|
159
|
+
const res = (0, child_process_1.execSync)(buildCMD);
|
|
160
|
+
if (res.toString().includes('** BUILD FAILED **')) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
catch (e) { }
|
|
165
|
+
console.log('------------------- build end -------------------');
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
static installApp(path, deviceId, appName) {
|
|
169
|
+
const appFile = (0, path_1.join)(path, `Build/Products/Debug-xrsimulator/${appName}.app`);
|
|
170
|
+
let cmd = new XcrunCMD().simctl();
|
|
171
|
+
cmd.install(deviceId, appFile);
|
|
172
|
+
(0, child_process_1.execSync)(cmd.line);
|
|
173
|
+
}
|
|
174
|
+
static launchApp(deviceId, bundleId) {
|
|
175
|
+
(0, child_process_1.execSync)(new XcrunCMD().simctl().launch(deviceId, bundleId).line);
|
|
176
|
+
}
|
|
177
|
+
/*
|
|
178
|
+
* use command to find available destinations for the "web-spatial" scheme
|
|
179
|
+
* command: xcodebuild -showdestinations -scheme web-spatial
|
|
180
|
+
* result like:
|
|
181
|
+
* { platform:visionOS, id:dvtdevice-DVTiOSDevicePlaceholder-xros:placeholder, name:Any visionOS Device }
|
|
182
|
+
* { platform:visionOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-xrsimulator:placeholder, name:Any visionOS Simulator Device }
|
|
183
|
+
* { platform:visionOS Simulator, id:8C7AD003-4039-478F-9F94-938876D57817, OS:2.3, name:Apple Vision Pro }
|
|
184
|
+
* { platform:visionOS Simulator, id:3E883774-AFD3-4E0D-884C-FA9B940F8720, OS:2.3, name:WebSpatialSimulator }
|
|
185
|
+
*
|
|
186
|
+
* only uuid deviceId is valid
|
|
187
|
+
*/
|
|
188
|
+
static parseDestinationDevices(devices) {
|
|
189
|
+
let res = devices.split('\n');
|
|
190
|
+
const uuidRegex = /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/;
|
|
191
|
+
let deviceList = [];
|
|
192
|
+
for (let i = 0; i < res.length; i++) {
|
|
193
|
+
if (res[i].includes('platform:visionOS Simulator')) {
|
|
194
|
+
const uuid = res[i].slice(res[i].indexOf('id:') + 3, res[i].indexOf(', name'));
|
|
195
|
+
if (uuidRegex.test(uuid)) {
|
|
196
|
+
deviceList.push(uuid);
|
|
197
|
+
console.log(`find destination device: ${res[i]})`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return deviceList;
|
|
202
|
+
}
|
|
203
|
+
/*
|
|
204
|
+
* use command to find available simDevice when create a simulator
|
|
205
|
+
* command: xcrun simctl list devicetypes
|
|
206
|
+
* result like:
|
|
207
|
+
* Apple Watch Series 2 (38mm) (com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-2-38mm)
|
|
208
|
+
* Apple Vision Pro (com.apple.CoreSimulator.SimDeviceType.Apple-Vision-Pro)
|
|
209
|
+
*
|
|
210
|
+
* only Apple Vision Pro is valid
|
|
211
|
+
*/
|
|
212
|
+
static parseSupportDevices(devices) {
|
|
213
|
+
let res = devices.split('\n');
|
|
214
|
+
for (let i = 0; i < res.length; i++) {
|
|
215
|
+
if (res[i].includes('Apple Vision Pro')) {
|
|
216
|
+
res[i] = res[i].replace('Apple Vision Pro', '').trim();
|
|
217
|
+
res[i] = res[i].replace('(', '');
|
|
218
|
+
res[i] = res[i].replace(')', '');
|
|
219
|
+
return res[i];
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
throw new Error('No Apple Vision Pro simulator found! Please go to Xcode to download the Apple Vision Pro simulator');
|
|
223
|
+
}
|
|
224
|
+
/*
|
|
225
|
+
* use command to find available runtime when create a simulator
|
|
226
|
+
* command: xcrun simctl list devicetypes
|
|
227
|
+
* result like:
|
|
228
|
+
* iOS 17.2 (17.2 - 21C62) - com.apple.CoreSimulator.SimRuntime.iOS-17-2
|
|
229
|
+
* visionOS 2.3 (2.3 - 22N895) - com.apple.CoreSimulator.SimRuntime.xrOS-2-3
|
|
230
|
+
*
|
|
231
|
+
* only visionOS is valid
|
|
232
|
+
*/
|
|
233
|
+
static parseSupportRuntimes(runtimes) {
|
|
234
|
+
let res = runtimes.split('\n');
|
|
235
|
+
for (let i = 0; i < res.length; i++) {
|
|
236
|
+
if (res[i].includes('visionOS')) {
|
|
237
|
+
return res[i].slice(res[i].indexOf('com')).trim();
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
throw new Error('No visionOS rumtime found! Please go to Xcode to download the Apple Vision Pro simulator');
|
|
241
|
+
}
|
|
242
|
+
/*
|
|
243
|
+
* use command to find all sumlators about "Apple Vision Pro"
|
|
244
|
+
* command: xcrun simctl list devices "Apple Vision Pro"
|
|
245
|
+
* result like:
|
|
246
|
+
* == Devices ==
|
|
247
|
+
* -- iOS 17.2 --
|
|
248
|
+
* -- visionOS 2.3 --
|
|
249
|
+
* Apple Vision Pro (8C7AD003-4039-478F-9F94-938876D57817) (Shutdown)
|
|
250
|
+
* WebSpatialSimulator (C57E4C63-BF38-4E49-B1DC-8F1775A89712) (Shutdown)
|
|
251
|
+
*/
|
|
252
|
+
static parseListDevices(devices) {
|
|
253
|
+
let res = devices.split('\n');
|
|
254
|
+
let list = [];
|
|
255
|
+
let findIndex = -1;
|
|
256
|
+
for (let i = 0; i < res.length; i++) {
|
|
257
|
+
if (res[i].includes('-- visionOS')) {
|
|
258
|
+
findIndex = i; // start add visionOS simulator
|
|
259
|
+
}
|
|
260
|
+
else if (findIndex > 0) {
|
|
261
|
+
if (res[i].includes('-- ')) {
|
|
262
|
+
// end add visionOS simulator
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
if (res[i].length > 0) {
|
|
266
|
+
list.push(this.parseDeviceInfo(res[i]));
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return list;
|
|
271
|
+
}
|
|
272
|
+
/*
|
|
273
|
+
* device info like:
|
|
274
|
+
* Apple Vision Pro (8C7AD003-4039-478F-9F94-938876D57817) (Shutdown)
|
|
275
|
+
*/
|
|
276
|
+
static parseDeviceInfo(device) {
|
|
277
|
+
const info = device.split('(');
|
|
278
|
+
const deviceInfo = {
|
|
279
|
+
name: info[0].trim(),
|
|
280
|
+
deviceId: info[1].split(')')[0].trim(),
|
|
281
|
+
state: info[2].split(')')[0].trim(),
|
|
282
|
+
};
|
|
283
|
+
return deviceInfo;
|
|
284
|
+
}
|
|
285
|
+
// Try to find an available simulator, if not, create one and save the running record for the next time direct use.
|
|
286
|
+
static findSimulator(deviceId) {
|
|
287
|
+
let device = [deviceId !== null && deviceId !== void 0 ? deviceId : ''];
|
|
288
|
+
const res = (0, child_process_1.execSync)(`cd ${resource_1.PROJECT_DIRECTORY} && xcodebuild -showdestinations -scheme web-spatial`);
|
|
289
|
+
const arr = this.parseDestinationDevices(res.toString());
|
|
290
|
+
device = [...device, ...arr];
|
|
291
|
+
let simList = this.listSimulator();
|
|
292
|
+
// Sorting logic: Prioritize the DeviceId in the device array
|
|
293
|
+
simList.sort((a, b) => {
|
|
294
|
+
const aIndex = device.indexOf(a.deviceId);
|
|
295
|
+
const bIndex = device.indexOf(b.deviceId);
|
|
296
|
+
if (aIndex !== -1 && bIndex !== -1) {
|
|
297
|
+
return aIndex - bIndex; // All in device, in order of device
|
|
298
|
+
}
|
|
299
|
+
else if (aIndex !== -1) {
|
|
300
|
+
return -1; // Only 'a' is in the device, 'a' is in the front row
|
|
301
|
+
}
|
|
302
|
+
else if (bIndex !== -1) {
|
|
303
|
+
return 1; // Only 'b' is in the device, 'b' is in the front row
|
|
304
|
+
}
|
|
305
|
+
return 0; // Neither 'a' nor 'b' is in the device, no change in order
|
|
306
|
+
});
|
|
307
|
+
console.log('find simulators:');
|
|
308
|
+
console.log(simList);
|
|
309
|
+
return simList;
|
|
310
|
+
}
|
|
311
|
+
static searchSimulator(deviceId) {
|
|
312
|
+
const cmd = new XcrunCMD().simctl().listDevices('Apple Vision Pro').line +
|
|
313
|
+
` | grep ${deviceId}`;
|
|
314
|
+
console.log(cmd);
|
|
315
|
+
let res = (0, child_process_1.execSync)(cmd);
|
|
316
|
+
console.log(res.toString());
|
|
317
|
+
return this.parseDeviceInfo(res.toString());
|
|
318
|
+
}
|
|
319
|
+
static createSimulator() {
|
|
320
|
+
utils_1.CliLog.warn('no visionOS simulator found');
|
|
321
|
+
utils_1.CliLog.warn('try create a visionOS simulator');
|
|
322
|
+
// list support device include Apple Vision Pro
|
|
323
|
+
let res = (0, child_process_1.execSync)(new XcrunCMD().simctl().listDeviceTypes().line);
|
|
324
|
+
const supportDevice = this.parseSupportDevices(res.toString());
|
|
325
|
+
// list support runtime include visionOS
|
|
326
|
+
res = (0, child_process_1.execSync)(new XcrunCMD().simctl().listRuntimes().line);
|
|
327
|
+
const supportRuntime = this.parseSupportRuntimes(res.toString());
|
|
328
|
+
// use device and runtime to create simulator
|
|
329
|
+
utils_1.CliLog.info(`use ${supportDevice} and ${supportRuntime} to create visionOS simulator`);
|
|
330
|
+
res = (0, child_process_1.execSync)(new XcrunCMD().simctl().create(supportDevice, supportRuntime).line);
|
|
331
|
+
const device = res.toString().trim();
|
|
332
|
+
console.log(`create visionOS simulator: ${device}`);
|
|
333
|
+
return {
|
|
334
|
+
name: 'WebSpatial Simulator',
|
|
335
|
+
deviceId: device,
|
|
336
|
+
state: 'Shutdown',
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
static listSimulator() {
|
|
340
|
+
let res = (0, child_process_1.execSync)(new XcrunCMD().simctl().listDevices('Apple Vision Pro').line);
|
|
341
|
+
return this.parseListDevices(res.toString());
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
exports.default = Xcrun;
|
|
345
|
+
class XcrunCMD {
|
|
346
|
+
constructor() {
|
|
347
|
+
this.line = 'xcrun';
|
|
348
|
+
}
|
|
349
|
+
altool() {
|
|
350
|
+
this.line += ' altool';
|
|
351
|
+
return this;
|
|
352
|
+
}
|
|
353
|
+
simctl() {
|
|
354
|
+
this.line += ' simctl';
|
|
355
|
+
return this;
|
|
356
|
+
}
|
|
357
|
+
list() {
|
|
358
|
+
this.line += ' list';
|
|
359
|
+
return this;
|
|
360
|
+
}
|
|
361
|
+
listDevices(device) {
|
|
362
|
+
this.line += ` list devices "${device}"`;
|
|
363
|
+
return this;
|
|
364
|
+
}
|
|
365
|
+
listDeviceTypes() {
|
|
366
|
+
this.line += ` list devicetypes`;
|
|
367
|
+
return this;
|
|
368
|
+
}
|
|
369
|
+
listRuntimes() {
|
|
370
|
+
this.line += ` list runtimes`;
|
|
371
|
+
return this;
|
|
372
|
+
}
|
|
373
|
+
validate(path) {
|
|
374
|
+
this.line += ` --validate-app -f ${path}`;
|
|
375
|
+
return this;
|
|
376
|
+
}
|
|
377
|
+
uploadApp(path) {
|
|
378
|
+
this.line += ` --upload-app -f ${path}`;
|
|
379
|
+
return this;
|
|
380
|
+
}
|
|
381
|
+
uploadPackage(path) {
|
|
382
|
+
this.line += ` --upload-package ${path}`;
|
|
383
|
+
return this;
|
|
384
|
+
}
|
|
385
|
+
authAccount(username, password) {
|
|
386
|
+
this.line += ` -u ${username} -p ${password}`;
|
|
387
|
+
return this;
|
|
388
|
+
}
|
|
389
|
+
authApi(key, issuer) {
|
|
390
|
+
this.line += ` --apiKey ${key} --apiIssuer ${issuer}`;
|
|
391
|
+
return this;
|
|
392
|
+
}
|
|
393
|
+
appleId(id) {
|
|
394
|
+
this.line += ` --apple-id ${id}`;
|
|
395
|
+
return this;
|
|
396
|
+
}
|
|
397
|
+
platform(platform) {
|
|
398
|
+
this.line += ` -t ${platform}`;
|
|
399
|
+
return this;
|
|
400
|
+
}
|
|
401
|
+
version(version) {
|
|
402
|
+
this.line += ` --bundle-version ${version}`;
|
|
403
|
+
return this;
|
|
404
|
+
}
|
|
405
|
+
verbose() {
|
|
406
|
+
this.line += ` --verbose`;
|
|
407
|
+
return this;
|
|
408
|
+
}
|
|
409
|
+
create(device, runtime) {
|
|
410
|
+
this.line += ` create "WebSpatialSimulator" "${device}" "${runtime}"`;
|
|
411
|
+
return this;
|
|
412
|
+
}
|
|
413
|
+
shutdown(device) {
|
|
414
|
+
this.line += ` shutdown "${device}"`;
|
|
415
|
+
return this;
|
|
416
|
+
}
|
|
417
|
+
boot(device) {
|
|
418
|
+
this.line += ` boot "${device}"`;
|
|
419
|
+
return this;
|
|
420
|
+
}
|
|
421
|
+
install(device, path) {
|
|
422
|
+
this.line += ` install "${device}" "${path}"`;
|
|
423
|
+
return this;
|
|
424
|
+
}
|
|
425
|
+
launch(device, packName) {
|
|
426
|
+
this.line += ` launch "${device}" "${packName}"`;
|
|
427
|
+
return this;
|
|
428
|
+
}
|
|
429
|
+
terminate(device, packName) {
|
|
430
|
+
this.line += ` terminate "${device}" "${packName}"`;
|
|
431
|
+
return this;
|
|
432
|
+
}
|
|
433
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webspatial/builder",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "Client CLI tool to Generate XRApp project for Apple Vision Pro",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"engines": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"sharp": "^0.33.5",
|
|
40
40
|
"valid-url": "^1.0.9",
|
|
41
41
|
"xcode": "^3.0.1",
|
|
42
|
-
"@webspatial/platform-visionos": "^0.1.
|
|
42
|
+
"@webspatial/platform-visionos": "^0.1.17"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@rollup/plugin-terser": "^0.4.3",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"test3": "npm run build && bin/bundlepwa.js publish --name=webspatial --version=1.0 --u=username --p=password",
|
|
70
70
|
"test4": "npm run build && bin/bundlepwa.js run --tryWithoutBuild=true",
|
|
71
71
|
"obfuscate": "node obfuscate.js",
|
|
72
|
-
"build": "tsc && npm run
|
|
72
|
+
"build": "tsc && npm run copy-assets",
|
|
73
73
|
"build1": "rollup -c ./rollup.config.js",
|
|
74
74
|
"build2": "tsc && npm run copy-assets",
|
|
75
75
|
"copy-assets": "cp -R src/assets/ dist/assets/",
|