@webspatial/builder 0.1.16 → 0.1.18
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.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.d.ts +1 -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 +5 -4
package/dist/lib/xcode/xcrun.js
CHANGED
|
@@ -1 +1,433 @@
|
|
|
1
|
-
'use strict';const _0x1a59a9=_0x475b;(function(_0x428841,_0x16c823){const _0x331514=_0x475b,_0x463ad6=_0x428841();while(!![]){try{const _0x5e0e04=-parseInt(_0x331514(0x148))/0x1*(parseInt(_0x331514(0x151))/0x2)+-parseInt(_0x331514(0x102))/0x3*(parseInt(_0x331514(0xf8))/0x4)+parseInt(_0x331514(0x136))/0x5+-parseInt(_0x331514(0xfa))/0x6+-parseInt(_0x331514(0x154))/0x7+parseInt(_0x331514(0x122))/0x8*(parseInt(_0x331514(0xe8))/0x9)+-parseInt(_0x331514(0x140))/0xa*(-parseInt(_0x331514(0x143))/0xb);if(_0x5e0e04===_0x16c823)break;else _0x463ad6['push'](_0x463ad6['shift']());}catch(_0x175a9f){_0x463ad6['push'](_0x463ad6['shift']());}}}(_0xac63,0x202a8));function _0x475b(_0x68935f,_0x3300d5){const _0xac6344=_0xac63();return _0x475b=function(_0x475b84,_0x5c23c0){_0x475b84=_0x475b84-0xe8;let _0x160a38=_0xac6344[_0x475b84];return _0x160a38;},_0x475b(_0x68935f,_0x3300d5);}Object[_0x1a59a9(0x108)](exports,_0x1a59a9(0x114),{'value':!![]});function _0xac63(){const _0x44b1b3=['recordSimulator','\x20terminate\x20\x22','No\x20Apple\x20Vision\x20Pro\x20simulator\x20found!\x20Please\x20go\x20to\x20Xcode\x20to\x20download\x20the\x20Apple\x20Vision\x20Pro\x20simulator','deviceId','\x20-t\x20','includes','push','use\x20simulator:\x20','--\x20visionOS','create\x20visionOS\x20simulator:\x20','installing\x20app','mkdirSync','visionos','launch','use\x20','path','install\x20success','886525sSeAUV','write','XcodebuildCMD','-------------------\x20build\x20end\x20-------------------','listSimulator','createSimulator','validate','runWithSimulator','toString','WebSpatial\x20Simulator','3809590EwyDDW','findSimulator','parseDeviceInfo','11NAALpd','\x20--bundle-version\x20','list','platform','PROJECT_BUILD_DIRECTORY','74710FDtCgb','buildTestApp','\x22\x20\x22','execSync','info','listDeviceTypes','uploadPackage','no\x20simulator\x20available','installApp','2VLiYET','searchSimulator','\x20--validate-app\x20-f\x20','1459542EvEJlv','Apple\x20Vision\x20Pro','PROJECT_TEST_DIRECTORY','launchWithSimulator','sleep\x2010','**\x20BUILD\x20FAILED\x20**','parseSupportRuntimes','\x20&&\x20xcodebuild\x20-showdestinations\x20-scheme\x20web-spatial','parseListDevices','CliLog','PROJECT_DIRECTORY','.app','shutdownSimulator','\x20altool','existsSync','\x20--upload-package\x20','install','----\x20build\x20start\x20on\x20','length','getAppInfoRecord','parseDestinationDevices','listDevices','platform:visionOS\x20Simulator','9CFxVCz','replace','warn','log','split','../utils/history','default',',\x20try\x20next\x20device','\x20--verbose','simctl','try\x20create\x20a\x20visionOS\x20simulator','error','\x20--upload-app\x20-f\x20','\x20--apiIssuer\x20','line','listRuntimes','13188LffWaF','verbose','747612VIDtYh','create','\x20--apiKey\x20','altool','parseSupportDevices','uploadApp','state','build\x20failed\x20on\x20','183billsY','\x20list','find\x20simulators:','find\x20destination\x20device:\x20','Build/Products/Debug-xrsimulator/','../resource','defineProperty','terminate','com','\x20|\x20grep\x20','\x20-u\x20','../resource/file','xcrun','sort','\x20launch\x20\x22','test','trim','boot','__esModule','authAccount','launchApp','authApi','indexOf','clearDir','\x20-p\x20','\x20list\x20runtimes','/web-spatial.xcodeproj','slice','\x20boot\x20\x22','launchSimulator','open\x20-a\x20Simulator\x20--args\x20-CurrentDeviceUDID\x20','launch\x20app','1459384vmMCRf','project','No\x20visionOS\x20rumtime\x20found!\x20Please\x20go\x20to\x20Xcode\x20to\x20download\x20the\x20Apple\x20Vision\x20Pro\x20simulator'];_0xac63=function(){return _0x44b1b3;};return _0xac63();}const child_process_1=require('child_process'),resource_1=require(_0x1a59a9(0x107)),path_1=require(_0x1a59a9(0x134)),fs=require('fs'),xcodebuild_1=require('./xcodebuild'),file_1=require(_0x1a59a9(0x10d)),utils_1=require('../utils/utils'),history_1=require(_0x1a59a9(0xed));class Xcrun{static async[_0x1a59a9(0x13c)](_0x4157b4,_0x2e7b3c,_0x1059ff,_0x2f0511){const _0x281fb4=_0x1a59a9,_0x445ae0=new XcrunCMD()[_0x281fb4(0xfd)]();_0x445ae0['validate'](_0x4157b4);_0x2f0511?_0x445ae0[_0x281fb4(0x115)](_0x2e7b3c,_0x1059ff):_0x445ae0[_0x281fb4(0x117)](_0x2e7b3c,_0x1059ff);_0x445ae0[_0x281fb4(0x146)](_0x281fb4(0x131));const _0x26b273=(0x0,child_process_1[_0x281fb4(0x14b)])(_0x445ae0['line']);return _0x26b273[_0x281fb4(0x13e)]();}static async[_0x1a59a9(0x14e)](_0x5c9e7d,_0x4778b2,_0x195c14,_0x3a05ce,_0x44b735){const _0x4b9fc5=_0x1a59a9,_0x4e1fa9=new XcrunCMD()[_0x4b9fc5(0xfd)]();_0x4e1fa9['uploadPackage'](_0x5c9e7d);_0x44b735?_0x4e1fa9[_0x4b9fc5(0x115)](_0x4778b2,_0x195c14):_0x4e1fa9[_0x4b9fc5(0x117)](_0x4778b2,_0x195c14);_0x4e1fa9['platform']('visionos'),_0x4e1fa9['appleId'](_0x3a05ce);const _0xafdd82=(0x0,child_process_1[_0x4b9fc5(0x14b)])(_0x4e1fa9[_0x4b9fc5(0xf6)]);return _0xafdd82[_0x4b9fc5(0x13e)]();}static async['uploadApp'](_0xc9d230,_0x5695a8,_0xb569be,_0x1dbcbe){const _0x400c13=_0x1a59a9,_0x10db66=new XcrunCMD()['altool']();_0x10db66['uploadApp'](_0xc9d230);_0x1dbcbe?_0x10db66[_0x400c13(0x115)](_0x5695a8,_0xb569be):_0x10db66['authApi'](_0x5695a8,_0xb569be);_0x10db66[_0x400c13(0x146)](_0x400c13(0x131));const _0x362aa=(0x0,child_process_1[_0x400c13(0x14b)])(_0x10db66[_0x400c13(0xf6)]);return _0x362aa[_0x400c13(0x13e)]();}static async[_0x1a59a9(0x13d)](){const _0x40705e=_0x1a59a9;let _0x5a8b20=this['findSimulator']();!_0x5a8b20[0x0]&&(_0x5a8b20=[this[_0x40705e(0x13b)]()]);const _0x533416=history_1[_0x40705e(0xee)][_0x40705e(0x167)]();for(var _0x5771e1=0x0;_0x5771e1<_0x5a8b20[_0x40705e(0x166)];_0x5771e1++){if(this[_0x40705e(0x149)](_0x5a8b20[_0x5771e1][_0x40705e(0x128)])){const _0x4f0997=this[_0x40705e(0x157)](_0x533416,_0x5a8b20[_0x5771e1][_0x40705e(0x128)],!![],![]);history_1[_0x40705e(0xee)][_0x40705e(0x125)](_0x4f0997),history_1[_0x40705e(0xee)][_0x40705e(0x137)]();return;}else utils_1['CliLog']['error'](_0x40705e(0x101)+_0x5a8b20[_0x5771e1][_0x40705e(0x128)]+_0x40705e(0xef));}utils_1[_0x40705e(0x15d)][_0x40705e(0xf3)](_0x40705e(0x14f));}static async['runWithHistory'](){const _0x18651e=_0x1a59a9,_0x449a2c=history_1['default']['getSimulatorHistory'](),_0x395234=history_1[_0x18651e(0xee)][_0x18651e(0x167)](),_0x54458b=this[_0x18651e(0x157)](_0x395234,_0x449a2c);history_1['default'][_0x18651e(0x125)](_0x54458b),history_1[_0x18651e(0xee)]['write']();}static[_0x1a59a9(0x157)](_0x42557a,_0x7efe9e='',_0x5b358e=![],_0x2d34cf=!![]){const _0x2f4d55=_0x1a59a9;let _0x5b539f,_0x3f7d03=![];return _0x2d34cf?_0x5b539f=this['findSimulator'](_0x7efe9e)[0x0]:_0x5b539f=this[_0x2f4d55(0x152)](_0x7efe9e),(!_0x5b539f||_0x5b539f[_0x2f4d55(0x128)]==='')&&(_0x5b539f=this[_0x2f4d55(0x13b)](),_0x3f7d03=!![]),console[_0x2f4d55(0xeb)](_0x2f4d55(0x12c)+_0x5b539f[_0x2f4d55(0x128)]),this[_0x2f4d55(0x11f)](_0x5b539f),(_0x5b358e||_0x3f7d03)&&(console[_0x2f4d55(0xeb)](_0x2f4d55(0x12f)),this[_0x2f4d55(0x150)](resource_1[_0x2f4d55(0x156)],_0x5b539f[_0x2f4d55(0x128)],_0x42557a['name']),console[_0x2f4d55(0xeb)](_0x2f4d55(0x135))),console['log'](_0x2f4d55(0x121)),this[_0x2f4d55(0x116)](_0x5b539f[_0x2f4d55(0x128)],_0x42557a['id']),_0x5b539f['deviceId'];}static async[_0x1a59a9(0x160)](){const _0x5365a4=_0x1a59a9;let _0x23ff07=this[_0x5365a4(0x141)]()[0x0];console[_0x5365a4(0xeb)]('find\x20simulator:\x20'+_0x23ff07[_0x5365a4(0x128)]);if(_0x23ff07[_0x5365a4(0x100)]!=='Shutdown'){let _0xa7004d=new XcrunCMD()[_0x5365a4(0xf1)]();_0xa7004d['shutdown'](_0x23ff07['deviceId']),(0x0,child_process_1[_0x5365a4(0x14b)])(_0xa7004d['line']);}else console['log']('simulator\x20is\x20already\x20shutdown');}static[_0x1a59a9(0x11f)](_0x1e1917){const _0x48ef9f=_0x1a59a9;if(_0x1e1917['state']==='Shutdown'){let _0x904df1=new XcrunCMD()[_0x48ef9f(0xf1)]();_0x904df1['boot'](_0x1e1917[_0x48ef9f(0x128)]),(0x0,child_process_1[_0x48ef9f(0x14b)])(_0x904df1[_0x48ef9f(0xf6)]),(0x0,child_process_1[_0x48ef9f(0x14b)])(_0x48ef9f(0x158));}(0x0,child_process_1[_0x48ef9f(0x14b)])(_0x48ef9f(0x120)+_0x1e1917[_0x48ef9f(0x128)]);}static[_0x1a59a9(0x149)](_0x1322f0){const _0x26a8d5=_0x1a59a9,_0x35a0e3=resource_1[_0x26a8d5(0x15e)]+_0x26a8d5(0x11c);!fs[_0x26a8d5(0x162)](resource_1[_0x26a8d5(0x147)])&&fs[_0x26a8d5(0x130)](resource_1[_0x26a8d5(0x147)],{'recursive':!![]});!fs[_0x26a8d5(0x162)](resource_1['PROJECT_TEST_DIRECTORY'])&&fs[_0x26a8d5(0x130)](resource_1[_0x26a8d5(0x156)],{'recursive':!![]});(0x0,file_1[_0x26a8d5(0x119)])(resource_1[_0x26a8d5(0x156)]);const _0x42f6d6=new xcodebuild_1[(_0x26a8d5(0x138))]()[_0x26a8d5(0x123)](_0x35a0e3)[_0x26a8d5(0xf6)]+('\x20build\x20-scheme\x20web-spatial\x20-destination\x20\x27platform=visionOS\x20Simulator,id='+_0x1322f0+'\x27\x20-derivedDataPath\x20'+resource_1[_0x26a8d5(0x156)]);console[_0x26a8d5(0xeb)](_0x26a8d5(0x165)+_0x1322f0+'\x20----');try{const _0x2b1d68=(0x0,child_process_1[_0x26a8d5(0x14b)])(_0x42f6d6);if(_0x2b1d68[_0x26a8d5(0x13e)]()[_0x26a8d5(0x12a)](_0x26a8d5(0x159)))return![];}catch(_0x4ad266){}return console[_0x26a8d5(0xeb)](_0x26a8d5(0x139)),!![];}static['installApp'](_0x4ea6a2,_0x2666bd,_0x37fe18){const _0x58d3d4=_0x1a59a9,_0x36c939=(0x0,path_1['join'])(_0x4ea6a2,_0x58d3d4(0x106)+_0x37fe18+_0x58d3d4(0x15f));let _0x1f22ba=new XcrunCMD()[_0x58d3d4(0xf1)]();_0x1f22ba[_0x58d3d4(0x164)](_0x2666bd,_0x36c939),(0x0,child_process_1[_0x58d3d4(0x14b)])(_0x1f22ba[_0x58d3d4(0xf6)]);}static[_0x1a59a9(0x116)](_0x5b51be,_0x3d10a0){const _0x2e720a=_0x1a59a9;try{(0x0,child_process_1[_0x2e720a(0x14b)])(new XcrunCMD()['simctl']()[_0x2e720a(0x109)](_0x5b51be,_0x3d10a0)[_0x2e720a(0xf6)]);}catch(_0xaf28f6){}(0x0,child_process_1[_0x2e720a(0x14b)])(new XcrunCMD()[_0x2e720a(0xf1)]()[_0x2e720a(0x132)](_0x5b51be,_0x3d10a0)[_0x2e720a(0xf6)]);}static[_0x1a59a9(0x168)](_0x13995c){const _0x450e2f=_0x1a59a9;let _0x427048=_0x13995c[_0x450e2f(0xec)]('\x0a');const _0x295f19=/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/;let _0x58f505=[];for(let _0x5cc51b=0x0;_0x5cc51b<_0x427048[_0x450e2f(0x166)];_0x5cc51b++){if(_0x427048[_0x5cc51b][_0x450e2f(0x12a)](_0x450e2f(0x16a))){const _0x36ebf0=_0x427048[_0x5cc51b][_0x450e2f(0x11d)](_0x427048[_0x5cc51b][_0x450e2f(0x118)]('id:')+0x3,_0x427048[_0x5cc51b]['indexOf'](',\x20name'));_0x295f19[_0x450e2f(0x111)](_0x36ebf0)&&(_0x58f505[_0x450e2f(0x12b)](_0x36ebf0),console[_0x450e2f(0xeb)](_0x450e2f(0x105)+_0x427048[_0x5cc51b]+')'));}}return _0x58f505;}static['parseSupportDevices'](_0x32c1a2){const _0x415d6b=_0x1a59a9;let _0x413913=_0x32c1a2[_0x415d6b(0xec)]('\x0a');for(let _0x4f4053=0x0;_0x4f4053<_0x413913[_0x415d6b(0x166)];_0x4f4053++){if(_0x413913[_0x4f4053][_0x415d6b(0x12a)](_0x415d6b(0x155)))return _0x413913[_0x4f4053]=_0x413913[_0x4f4053][_0x415d6b(0xe9)](_0x415d6b(0x155),'')[_0x415d6b(0x112)](),_0x413913[_0x4f4053]=_0x413913[_0x4f4053][_0x415d6b(0xe9)]('(',''),_0x413913[_0x4f4053]=_0x413913[_0x4f4053][_0x415d6b(0xe9)](')',''),_0x413913[_0x4f4053];}throw new Error(_0x415d6b(0x127));}static['parseSupportRuntimes'](_0x2af42d){const _0x2166b8=_0x1a59a9;let _0x287c11=_0x2af42d[_0x2166b8(0xec)]('\x0a');for(let _0x1243c0=0x0;_0x1243c0<_0x287c11['length'];_0x1243c0++){if(_0x287c11[_0x1243c0][_0x2166b8(0x12a)]('visionOS'))return _0x287c11[_0x1243c0]['slice'](_0x287c11[_0x1243c0][_0x2166b8(0x118)](_0x2166b8(0x10a)))[_0x2166b8(0x112)]();}throw new Error(_0x2166b8(0x124));}static[_0x1a59a9(0x15c)](_0x5bd7af){const _0x1c2aeb=_0x1a59a9;let _0x3d6415=_0x5bd7af[_0x1c2aeb(0xec)]('\x0a'),_0x261ab8=[],_0x394455=-0x1;for(let _0x316566=0x0;_0x316566<_0x3d6415['length'];_0x316566++){if(_0x3d6415[_0x316566][_0x1c2aeb(0x12a)](_0x1c2aeb(0x12d)))_0x394455=_0x316566;else{if(_0x394455>0x0){if(_0x3d6415[_0x316566][_0x1c2aeb(0x12a)]('--\x20'))break;_0x3d6415[_0x316566]['length']>0x0&&_0x261ab8[_0x1c2aeb(0x12b)](this[_0x1c2aeb(0x142)](_0x3d6415[_0x316566]));}}}return _0x261ab8;}static[_0x1a59a9(0x142)](_0x402286){const _0x2a5e5b=_0x1a59a9,_0xdb9881=_0x402286['split']('('),_0x384b38={'name':_0xdb9881[0x0][_0x2a5e5b(0x112)](),'deviceId':_0xdb9881[0x1][_0x2a5e5b(0xec)](')')[0x0]['trim'](),'state':_0xdb9881[0x2][_0x2a5e5b(0xec)](')')[0x0]['trim']()};return _0x384b38;}static[_0x1a59a9(0x141)](_0x31a241){const _0x58033b=_0x1a59a9;let _0x570699=[_0x31a241!==null&&_0x31a241!==void 0x0?_0x31a241:''];const _0x1c36a5=(0x0,child_process_1[_0x58033b(0x14b)])('cd\x20'+resource_1[_0x58033b(0x15e)]+_0x58033b(0x15b)),_0x1245b2=this[_0x58033b(0x168)](_0x1c36a5[_0x58033b(0x13e)]());_0x570699=[..._0x570699,..._0x1245b2];let _0x57a9e1=this[_0x58033b(0x13a)]();return _0x57a9e1[_0x58033b(0x10f)]((_0x2e111d,_0x3a5bd3)=>{const _0x3d4273=_0x58033b,_0x33254c=_0x570699[_0x3d4273(0x118)](_0x2e111d[_0x3d4273(0x128)]),_0x112fdc=_0x570699[_0x3d4273(0x118)](_0x3a5bd3[_0x3d4273(0x128)]);if(_0x33254c!==-0x1&&_0x112fdc!==-0x1)return _0x33254c-_0x112fdc;else{if(_0x33254c!==-0x1)return-0x1;else{if(_0x112fdc!==-0x1)return 0x1;}}return 0x0;}),console[_0x58033b(0xeb)](_0x58033b(0x104)),console[_0x58033b(0xeb)](_0x57a9e1),_0x57a9e1;}static[_0x1a59a9(0x152)](_0x27c918){const _0xb9c7c4=_0x1a59a9,_0x2af508=new XcrunCMD()[_0xb9c7c4(0xf1)]()['listDevices'](_0xb9c7c4(0x155))[_0xb9c7c4(0xf6)]+(_0xb9c7c4(0x10b)+_0x27c918);console[_0xb9c7c4(0xeb)](_0x2af508);let _0xfdd02d=(0x0,child_process_1[_0xb9c7c4(0x14b)])(_0x2af508);return console[_0xb9c7c4(0xeb)](_0xfdd02d[_0xb9c7c4(0x13e)]()),this[_0xb9c7c4(0x142)](_0xfdd02d[_0xb9c7c4(0x13e)]());}static[_0x1a59a9(0x13b)](){const _0x41f2c9=_0x1a59a9;utils_1['CliLog'][_0x41f2c9(0xea)]('no\x20visionOS\x20simulator\x20found'),utils_1[_0x41f2c9(0x15d)][_0x41f2c9(0xea)](_0x41f2c9(0xf2));let _0x3e114c=(0x0,child_process_1[_0x41f2c9(0x14b)])(new XcrunCMD()[_0x41f2c9(0xf1)]()[_0x41f2c9(0x14d)]()[_0x41f2c9(0xf6)]);const _0x22dedc=this[_0x41f2c9(0xfe)](_0x3e114c['toString']());_0x3e114c=(0x0,child_process_1[_0x41f2c9(0x14b)])(new XcrunCMD()[_0x41f2c9(0xf1)]()[_0x41f2c9(0xf7)]()[_0x41f2c9(0xf6)]);const _0x1ffacc=this[_0x41f2c9(0x15a)](_0x3e114c['toString']());utils_1[_0x41f2c9(0x15d)][_0x41f2c9(0x14c)](_0x41f2c9(0x133)+_0x22dedc+'\x20and\x20'+_0x1ffacc+'\x20to\x20create\x20visionOS\x20simulator'),_0x3e114c=(0x0,child_process_1[_0x41f2c9(0x14b)])(new XcrunCMD()[_0x41f2c9(0xf1)]()[_0x41f2c9(0xfb)](_0x22dedc,_0x1ffacc)[_0x41f2c9(0xf6)]);const _0x4c1dc8=_0x3e114c[_0x41f2c9(0x13e)]()['trim']();return console[_0x41f2c9(0xeb)](_0x41f2c9(0x12e)+_0x4c1dc8),{'name':_0x41f2c9(0x13f),'deviceId':_0x4c1dc8,'state':'Shutdown'};}static['listSimulator'](){const _0x3af54a=_0x1a59a9;let _0xc8557b=(0x0,child_process_1[_0x3af54a(0x14b)])(new XcrunCMD()[_0x3af54a(0xf1)]()[_0x3af54a(0x169)]('Apple\x20Vision\x20Pro')[_0x3af54a(0xf6)]);return this[_0x3af54a(0x15c)](_0xc8557b[_0x3af54a(0x13e)]());}}exports[_0x1a59a9(0xee)]=Xcrun;class XcrunCMD{constructor(){const _0x38e8ed=_0x1a59a9;this[_0x38e8ed(0xf6)]=_0x38e8ed(0x10e);}[_0x1a59a9(0xfd)](){const _0x8402ec=_0x1a59a9;return this[_0x8402ec(0xf6)]+=_0x8402ec(0x161),this;}['simctl'](){return this['line']+='\x20simctl',this;}[_0x1a59a9(0x145)](){const _0x15c3c9=_0x1a59a9;return this[_0x15c3c9(0xf6)]+=_0x15c3c9(0x103),this;}[_0x1a59a9(0x169)](_0xdfb8d5){const _0x2f1719=_0x1a59a9;return this[_0x2f1719(0xf6)]+='\x20list\x20devices\x20\x22'+_0xdfb8d5+'\x22',this;}[_0x1a59a9(0x14d)](){return this['line']+='\x20list\x20devicetypes',this;}[_0x1a59a9(0xf7)](){const _0x1a6e6a=_0x1a59a9;return this['line']+=_0x1a6e6a(0x11b),this;}[_0x1a59a9(0x13c)](_0x6fc7fe){const _0x58bb2f=_0x1a59a9;return this['line']+=_0x58bb2f(0x153)+_0x6fc7fe,this;}[_0x1a59a9(0xff)](_0x3e8cd9){const _0x5bdac9=_0x1a59a9;return this[_0x5bdac9(0xf6)]+=_0x5bdac9(0xf4)+_0x3e8cd9,this;}[_0x1a59a9(0x14e)](_0x53bfaf){const _0x3abae3=_0x1a59a9;return this[_0x3abae3(0xf6)]+=_0x3abae3(0x163)+_0x53bfaf,this;}[_0x1a59a9(0x115)](_0x4f2ddf,_0x5629cf){const _0x59a01a=_0x1a59a9;return this[_0x59a01a(0xf6)]+=_0x59a01a(0x10c)+_0x4f2ddf+_0x59a01a(0x11a)+_0x5629cf,this;}[_0x1a59a9(0x117)](_0x38409f,_0x99510e){const _0x9c6d32=_0x1a59a9;return this[_0x9c6d32(0xf6)]+=_0x9c6d32(0xfc)+_0x38409f+_0x9c6d32(0xf5)+_0x99510e,this;}['appleId'](_0x51a97b){const _0x2fae97=_0x1a59a9;return this[_0x2fae97(0xf6)]+='\x20--apple-id\x20'+_0x51a97b,this;}[_0x1a59a9(0x146)](_0x396461){const _0x1f75d3=_0x1a59a9;return this[_0x1f75d3(0xf6)]+=_0x1f75d3(0x129)+_0x396461,this;}['version'](_0x12ffde){const _0x727e63=_0x1a59a9;return this[_0x727e63(0xf6)]+=_0x727e63(0x144)+_0x12ffde,this;}[_0x1a59a9(0xf9)](){const _0x29f79f=_0x1a59a9;return this[_0x29f79f(0xf6)]+=_0x29f79f(0xf0),this;}[_0x1a59a9(0xfb)](_0x52cb3a,_0x2b3895){const _0x5c3f48=_0x1a59a9;return this[_0x5c3f48(0xf6)]+='\x20create\x20\x22WebSpatialSimulator\x22\x20\x22'+_0x52cb3a+_0x5c3f48(0x14a)+_0x2b3895+'\x22',this;}['shutdown'](_0x39fac4){return this['line']+='\x20shutdown\x20\x22'+_0x39fac4+'\x22',this;}[_0x1a59a9(0x113)](_0xdb4479){const _0x3740cd=_0x1a59a9;return this[_0x3740cd(0xf6)]+=_0x3740cd(0x11e)+_0xdb4479+'\x22',this;}[_0x1a59a9(0x164)](_0x5373c3,_0x2ba63f){const _0x289677=_0x1a59a9;return this[_0x289677(0xf6)]+='\x20install\x20\x22'+_0x5373c3+_0x289677(0x14a)+_0x2ba63f+'\x22',this;}[_0x1a59a9(0x132)](_0xafac8d,_0x140cb0){const _0x2909e6=_0x1a59a9;return this[_0x2909e6(0xf6)]+=_0x2909e6(0x110)+_0xafac8d+_0x2909e6(0x14a)+_0x140cb0+'\x22',this;}['terminate'](_0x3d1fd6,_0x56a0bf){const _0x5bff4d=_0x1a59a9;return this['line']+=_0x5bff4d(0x126)+_0x3d1fd6+'\x22\x20\x22'+_0x56a0bf+'\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.18",
|
|
4
4
|
"description": "Client CLI tool to Generate XRApp project for Apple Vision Pro",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"engines": {
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": ""
|
|
14
|
+
"url": "git+https://github.com/webspatial/webspatial-sdk.git",
|
|
15
|
+
"directory": "packages/cli"
|
|
15
16
|
},
|
|
16
17
|
"files": [
|
|
17
18
|
"dist/lib",
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
"sharp": "^0.33.5",
|
|
40
41
|
"valid-url": "^1.0.9",
|
|
41
42
|
"xcode": "^3.0.1",
|
|
42
|
-
"@webspatial/platform-visionos": "^0.1.
|
|
43
|
+
"@webspatial/platform-visionos": "^0.1.18"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"@rollup/plugin-terser": "^0.4.3",
|
|
@@ -69,7 +70,7 @@
|
|
|
69
70
|
"test3": "npm run build && bin/bundlepwa.js publish --name=webspatial --version=1.0 --u=username --p=password",
|
|
70
71
|
"test4": "npm run build && bin/bundlepwa.js run --tryWithoutBuild=true",
|
|
71
72
|
"obfuscate": "node obfuscate.js",
|
|
72
|
-
"build": "tsc && npm run
|
|
73
|
+
"build": "tsc && npm run copy-assets",
|
|
73
74
|
"build1": "rollup -c ./rollup.config.js",
|
|
74
75
|
"build2": "tsc && npm run copy-assets",
|
|
75
76
|
"copy-assets": "cp -R src/assets/ dist/assets/",
|