@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.
@@ -1 +1,239 @@
1
- 'use strict';const _0x37dc47=_0x5711;(function(_0x18a82c,_0x4b38b2){const _0xe68933=_0x5711,_0x2af8e3=_0x18a82c();while(!![]){try{const _0x168d35=-parseInt(_0xe68933(0x14d))/0x1*(parseInt(_0xe68933(0x144))/0x2)+-parseInt(_0xe68933(0xf8))/0x3+parseInt(_0xe68933(0x11c))/0x4+parseInt(_0xe68933(0x114))/0x5*(-parseInt(_0xe68933(0x145))/0x6)+-parseInt(_0xe68933(0x113))/0x7+parseInt(_0xe68933(0x155))/0x8*(parseInt(_0xe68933(0x121))/0x9)+-parseInt(_0xe68933(0x14f))/0xa*(-parseInt(_0xe68933(0xf5))/0xb);if(_0x168d35===_0x4b38b2)break;else _0x2af8e3['push'](_0x2af8e3['shift']());}catch(_0x25d1a2){_0x2af8e3['push'](_0x2af8e3['shift']());}}}(_0x2d6f,0x25a79));function _0x2d6f(){const _0x76ffd7=['mainScene','updateVersion','objects','true','updateTeamId','value','createImg','1280','START_URL','1935241kbphVs','replace','release-testing','732228LcxZjD','protocol_handlers','</string>','BACK_APPICON_DIRECTORY','Description','split','xcode','buildConfigurationList','../resource','pbxXCConfigurationList','\x22),','./web-spatial/libs/webView/manifest.swift','AppID','json','PBXGroup','default','buildSettings','name','defaultSize','manifestSwiftTemplate','ImageHelper','images','parseSync','YOURTEAMID','bindManifestInfo','fixProjectFunction','updateBuildProperty','942081iUFNIi','10TQwlMq','__esModule','AppName','BUILDTYPE','start_url','1.0','width','loadJsonFromDisk','1186708QQtSrJ','./web-spatial/Info.plist','ExportOptions.plist','project','icon.','585AqJcCs','protocol','log','updateProductName','manifestInfo','writeFileSync','modifySwift','SCOPE','SceneResizability','defineProperty','pbxTargetByName','PROJECT_BUILD_DIRECTORY','.minimal','getMIME','DEVELOPMENT_TEAM','scope','teamId','modify','updateDeeplink','join','updateExportOptions','length','<string>','DEEPLINK','pbxXCBuildConfigurationSection','stringify','image/','height','PROJECT_DIRECTORY','resizability','SceneWidth','existsSync','PWAProtocol(protocolValue:\x20\x22','hash','icon','8794YPasJC','374226ZceFOl','\x22automatic\x22','PWAProtocol(protocolValue:\x20\x22\x22,\x20url:\x20\x22\x22)','./manifestSwiftTemplate','filename','buildType','../resource/load','writeSync','27lDoDnx','pbxGroupByName','10EGfwxW','bindIcon','<?xml\x20version=\x221.0\x22\x20encoding=\x22UTF-8\x22?>\x0a<!DOCTYPE\x20plist\x20PUBLIC\x20\x22-//Apple//DTD\x20PLIST\x201.0//EN\x22\x20\x22http://www.apple.com/DTDs/PropertyList-1.0.dtd\x22>\x0a<plist\x20version=\x221.0\x22>\x0a<dict>\x0a\x09<key>destination</key>\x0a\x09<string>export</string>\x0a\x09<key>method</key>\x0a\x09<string>BUILDTYPE</string>\x0a\x09<key>signingStyle</key>\x0a\x09<string>automatic</string>\x0a\x09<key>stripSwiftSymbols</key>\x0a\x09<true/>\x0a\x09<key>teamID</key>\x0a\x09<string>YOURTEAMID</string>\x0a\x09<key>thinning</key>\x0a\x09<string>&lt;none&gt;</string>\x0a</dict>\x0a</plist>','writeAsync','description','Contents.json','37384VcmLJv','<?xml\x20version=\x221.0\x22\x20encoding=\x22UTF-8\x22?>\x0a<!DOCTYPE\x20plist\x20PUBLIC\x20\x22-//Apple//DTD\x20PLIST\x201.0//EN\x22\x20\x22http://www.apple.com/DTDs/PropertyList-1.0.dtd\x22>\x0a<plist\x20version=\x221.0\x22>\x0a<dict>\x0a\x09<key>ITSAppUsesNonExemptEncryption</key>\x0a\x09<false/>\x0a\x09<key>CFBundleURLTypes</key>\x0a\x09<array>\x0a\x09\x09<dict>\x0a\x09\x09\x09<key>CFBundleURLName</key>\x0a\x09\x09\x09<string>web-spatial</string>\x0a\x09\x09\x09<key>CFBundleURLSchemes</key>\x0a\x09\x09\x09<array>\x0a\x09\x09\x09\x09DEEPLINK\x0a\x09\x09\x09</array>\x0a\x09\x09</dict>\x0a\x09</array>\x0a\x09<key>NSAppTransportSecurity</key>\x0a\x09<dict>\x0a\x09\x09<key>NSAllowsArbitraryLoads</key>\x0a\x09\x09<true/>\x0a\x09</dict>\x0a\x09<key>UIApplicationSceneManifest</key>\x0a\x09<dict>\x0a\x09\x09<key>UIApplicationPreferredDefaultSceneSessionRole</key>\x0a\x09\x09<string>UIWindowSceneSessionRoleApplication</string>\x0a\x09\x09<key>UIApplicationSupportsMultipleScenes</key>\x0a\x09\x09<true/>\x0a\x09\x09<key>UISceneConfigurations</key>\x0a\x09\x09<dict/>\x0a\x09</dict>\x0a</dict>\x0a</plist>\x0a','includes','icon.png','debugging','app-store-connect','buildConfigurations','USE_MAIN_SCENE','\x22,\x20url:\x20\x22','url','test'];_0x2d6f=function(){return _0x76ffd7;};return _0x2d6f();}function _0x5711(_0xffa4a0,_0x5c7af8){const _0x2d6f2c=_0x2d6f();return _0x5711=function(_0x571111,_0x45f8d5){_0x571111=_0x571111-0xf3;let _0xde1b52=_0x2d6f2c[_0x571111];return _0xde1b52;},_0x5711(_0xffa4a0,_0x5c7af8);}Object[_0x37dc47(0x12a)](exports,_0x37dc47(0x115),{'value':!![]});const fs=require('fs'),resource_1=require(_0x37dc47(0x100)),path_1=require('path'),load_1=require(_0x37dc47(0x14b)),imageHelper_1=require('../resource/imageHelper'),manifestSwiftTemplate_1=require(_0x37dc47(0x148)),xcode=require(_0x37dc47(0xfe)),exportOptionsXML=_0x37dc47(0x151),infoPlistXML=_0x37dc47(0x156);let useExportOptionsXML='';class XcodeProject{static async[_0x37dc47(0x132)](_0x5e6878,_0x22cb3b,_0x12d34c=![]){const _0x7d51aa=_0x37dc47;let _0x112794=xcode[_0x7d51aa(0x11f)](_0x5e6878);this[_0x7d51aa(0x111)](_0x112794),_0x112794[_0x7d51aa(0x10e)]();let _0x24ea49=_0x22cb3b[_0x7d51aa(0x14a)];const _0x28f569=['release-testing',_0x7d51aa(0x15a),_0x7d51aa(0x159),'enterprise'];useExportOptionsXML=exportOptionsXML['replace'](_0x7d51aa(0x117),_0x28f569[_0x7d51aa(0x157)](_0x24ea49)?_0x24ea49:_0x7d51aa(0xf7));_0x22cb3b['teamId']&&this[_0x7d51aa(0x164)](_0x112794,_0x22cb3b[_0x7d51aa(0x131)]);this[_0x7d51aa(0x135)]();if(_0x22cb3b[_0x7d51aa(0x143)])await this[_0x7d51aa(0x150)](_0x22cb3b[_0x7d51aa(0x143)]);this[_0x7d51aa(0x110)](_0x112794,_0x22cb3b[_0x7d51aa(0x125)][_0x7d51aa(0x105)],_0x12d34c);_0x22cb3b['version']?this[_0x7d51aa(0x161)](_0x112794,_0x22cb3b['version']):this[_0x7d51aa(0x161)](_0x112794,_0x7d51aa(0x119));try{fs[_0x7d51aa(0x126)](_0x5e6878,_0x112794[_0x7d51aa(0x14c)]());}catch(_0x250137){console[_0x7d51aa(0x123)](_0x250137);}}static[_0x37dc47(0x111)](_0x2d995c){const _0x2b5816=_0x37dc47;_0x2d995c[_0x2b5816(0x14e)]=function(_0x4393f7){const _0x55661f=_0x2b5816;var _0x3372fb=this[_0x55661f(0x142)][_0x55661f(0x11f)][_0x55661f(0x162)][_0x55661f(0x106)],_0xa7b6,_0x21e856;for(_0xa7b6 in _0x3372fb){if(!/_comment$/['test'](_0xa7b6))continue;if(_0x3372fb[_0xa7b6]==_0x4393f7)return _0x21e856=_0xa7b6[_0x55661f(0xfd)](/_comment$/)[0x0],_0x3372fb[_0x21e856];}return![];},_0x2d995c['updateBuildProperty']=function(_0x36d07f,_0x45a502,_0x162777,_0x5996fe){const _0x4dfee3=_0x2b5816;let _0x2b251d=[];const _0x7d909e=/_comment$/;if(_0x5996fe){const _0x2a7699=this[_0x4dfee3(0x12b)](_0x5996fe),_0x3f72ae=_0x2a7699&&_0x2a7699[_0x4dfee3(0xff)],_0x4c2e32=this[_0x4dfee3(0x101)]();for(const _0x3729d9 in _0x4c2e32){if(!_0x7d909e['test'](_0x3729d9)&&_0x3f72ae===_0x3729d9){const _0xea98ae=_0x4c2e32[_0x3729d9][_0x4dfee3(0x15b)];for(const _0x25f5f4 of _0xea98ae){_0x2b251d['push'](_0x25f5f4[_0x4dfee3(0x165)]);}break;}}}var _0x455c6c=this[_0x4dfee3(0x139)]();for(var _0x15fd21 in _0x455c6c){if(!_0x7d909e[_0x4dfee3(0x15f)](_0x15fd21)){if(_0x5996fe&&!_0x2b251d['includes'](_0x15fd21))continue;var _0x558daf=_0x455c6c[_0x15fd21];(_0x162777&&_0x558daf[_0x4dfee3(0x109)]===_0x162777||!_0x162777)&&_0x558daf[_0x4dfee3(0x108)][_0x36d07f]&&(_0x558daf[_0x4dfee3(0x108)][_0x36d07f]=_0x45a502);}}};}static async[_0x37dc47(0x150)](_0x501b1c){const _0x1503dc=_0x37dc47;if(_0x501b1c){const _0x1bfed6=(0x0,path_1[_0x1503dc(0x134)])(resource_1[_0x1503dc(0x13d)],resource_1[_0x1503dc(0xfb)]),_0x530a7b=(0x0,path_1[_0x1503dc(0x134)])(_0x1bfed6,_0x1503dc(0x154)),_0x5a82eb=_0x1503dc(0x120)+_0x501b1c[_0x1503dc(0x12e)]()[_0x1503dc(0xf6)](_0x1503dc(0x13b),''),_0x530ac4=(0x0,path_1[_0x1503dc(0x134)])(_0x1bfed6,_0x5a82eb);let _0x50fef4=await(0x0,load_1['loadJsonFromDisk'])(_0x530a7b);_0x50fef4[_0x1503dc(0x10d)][0x0][_0x1503dc(0x149)]=_0x5a82eb,await _0x501b1c['writeAsync'](_0x530ac4),await fs[_0x1503dc(0x126)](_0x530a7b,JSON[_0x1503dc(0x13a)](_0x50fef4));const _0xebfd2b=(0x0,path_1[_0x1503dc(0x134)])(resource_1['PROJECT_DIRECTORY'],resource_1['MIDDLE_APPICON_DIRECTORY']),_0x418f1a=(0x0,path_1['join'])(_0xebfd2b,_0x1503dc(0x154)),_0x3a789b=_0x1503dc(0x158),_0x39f4d9=(0x0,path_1[_0x1503dc(0x134)])(_0xebfd2b,_0x3a789b);let _0x5ef774=await(0x0,load_1[_0x1503dc(0x11b)])(_0x418f1a),_0x1aa668=imageHelper_1[_0x1503dc(0x10c)][_0x1503dc(0x166)](0x200);_0x5ef774[_0x1503dc(0x10d)][0x0][_0x1503dc(0x149)]=_0x3a789b,await _0x1aa668[_0x1503dc(0x152)](_0x39f4d9),await fs['writeFileSync'](_0x418f1a,JSON[_0x1503dc(0x13a)](_0x5ef774));}}static[_0x37dc47(0x164)](_0x2fb8aa,_0xc1df00){const _0x4cb089=_0x37dc47;_0x2fb8aa[_0x4cb089(0x112)](_0x4cb089(0x12f),_0xc1df00),useExportOptionsXML=useExportOptionsXML[_0x4cb089(0xf6)](_0x4cb089(0x10f),_0xc1df00);}static['updateExportOptions'](){const _0xcb764a=_0x37dc47;!fs[_0xcb764a(0x140)](resource_1[_0xcb764a(0x12c)])&&fs['mkdirSync'](resource_1[_0xcb764a(0x12c)],{'recursive':!![]}),fs[_0xcb764a(0x126)]((0x0,path_1[_0xcb764a(0x134)])(resource_1[_0xcb764a(0x12c)],_0xcb764a(0x11e)),useExportOptionsXML);}static[_0x37dc47(0x110)](_0x139b63,_0x5aba3d,_0x2d2d21=![]){const _0x53cf39=_0x37dc47;var _0x55f33d;_0x139b63[_0x53cf39(0x124)](_0x5aba3d[_0x53cf39(0x109)]),_0x5aba3d['id']&&!_0x2d2d21&&_0x139b63[_0x53cf39(0x112)]('PRODUCT_BUNDLE_IDENTIFIER','\x22'+_0x5aba3d['id']+'\x22'),this[_0x53cf39(0x133)]((_0x55f33d=_0x5aba3d[_0x53cf39(0xf9)])!==null&&_0x55f33d!==void 0x0?_0x55f33d:[]),this['modifySwift'](_0x5aba3d);}static[_0x37dc47(0x161)](_0x1378c7,_0xf33ff7){_0x1378c7['updateBuildProperty']('CURRENT_PROJECT_VERSION',_0xf33ff7);}static[_0x37dc47(0x133)](_0x59014f){const _0x299137=_0x37dc47;let _0x3b93ef=(0x0,path_1[_0x299137(0x134)])(resource_1[_0x299137(0x13d)],_0x299137(0x11d)),_0x475216='';for(let _0x55e894=0x0;_0x55e894<_0x59014f[_0x299137(0x136)];_0x55e894++){_0x475216+=_0x299137(0x137)+_0x59014f[_0x55e894][_0x299137(0x122)]+_0x299137(0xfa);}const _0x28d228=infoPlistXML[_0x299137(0xf6)](_0x299137(0x138),_0x475216);fs[_0x299137(0x126)](_0x3b93ef,_0x28d228);}static[_0x37dc47(0x127)](_0x115a97){const _0x5ac9ce=_0x37dc47,_0x502ab3=(0x0,path_1[_0x5ac9ce(0x134)])(resource_1[_0x5ac9ce(0x13d)],_0x5ac9ce(0x103));let _0x5171ef=manifestSwiftTemplate_1[_0x5ac9ce(0x10b)];_0x5171ef=_0x5171ef[_0x5ac9ce(0xf6)](_0x5ac9ce(0xf4),_0x115a97[_0x5ac9ce(0x118)]),_0x5171ef=_0x5171ef[_0x5ac9ce(0xf6)](_0x5ac9ce(0x128),_0x115a97[_0x5ac9ce(0x130)]),_0x5171ef=_0x5171ef[_0x5ac9ce(0xf6)](_0x5ac9ce(0x116),_0x115a97[_0x5ac9ce(0x109)]),_0x5171ef=_0x5171ef[_0x5ac9ce(0xf6)](_0x5ac9ce(0xfc),_0x115a97[_0x5ac9ce(0x153)]),_0x5171ef=_0x5171ef[_0x5ac9ce(0xf6)](_0x5ac9ce(0x104),_0x115a97['id']),_0x5171ef=_0x5171ef['replace'](_0x5ac9ce(0x12d),_0x115a97['display']=='minimal-ui'?_0x5ac9ce(0x12d):'.'+_0x115a97['display']);if(_0x115a97['protocol_handlers']){let _0x50bbab='';for(let _0x1d2fd5=0x0;_0x1d2fd5<_0x115a97[_0x5ac9ce(0xf9)][_0x5ac9ce(0x136)];_0x1d2fd5++){_0x50bbab+=_0x5ac9ce(0x141)+_0x115a97[_0x5ac9ce(0xf9)][_0x1d2fd5][_0x5ac9ce(0x122)]+_0x5ac9ce(0x15d)+_0x115a97[_0x5ac9ce(0xf9)][_0x1d2fd5][_0x5ac9ce(0x15e)]+_0x5ac9ce(0x102);}_0x5171ef=_0x5171ef[_0x5ac9ce(0xf6)](_0x5ac9ce(0x147),_0x50bbab);}typeof _0x115a97[_0x5ac9ce(0x160)]==='object'?(_0x5171ef=_0x5171ef['replace'](_0x5ac9ce(0x13f),_0x115a97[_0x5ac9ce(0x160)][_0x5ac9ce(0x10a)][_0x5ac9ce(0x11a)]),_0x5171ef=_0x5171ef[_0x5ac9ce(0xf6)]('SceneHeight',_0x115a97[_0x5ac9ce(0x160)][_0x5ac9ce(0x10a)][_0x5ac9ce(0x13c)]),_0x5171ef=_0x5171ef['replace']('SceneResizability','\x22'+_0x115a97['mainScene'][_0x5ac9ce(0x13e)]+'\x22'),_0x5171ef=_0x5171ef[_0x5ac9ce(0xf6)](_0x5ac9ce(0x15c),_0x5ac9ce(0x163))):(_0x5171ef=_0x5171ef['replace'](_0x5ac9ce(0x13f),'1280'),_0x5171ef=_0x5171ef['replace']('SceneHeight',_0x5ac9ce(0xf3)),_0x5171ef=_0x5171ef[_0x5ac9ce(0xf6)](_0x5ac9ce(0x129),_0x5ac9ce(0x146)),_0x5171ef=_0x5171ef['replace'](_0x5ac9ce(0x15c),'false')),fs[_0x5ac9ce(0x126)](_0x502ab3,_0x5171ef,'utf-8');}}exports[_0x37dc47(0x107)]=XcodeProject;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fs = require("fs");
4
+ const resource_1 = require("../resource");
5
+ const path_1 = require("path");
6
+ const load_1 = require("../resource/load");
7
+ const imageHelper_1 = require("../resource/imageHelper");
8
+ const manifestSwiftTemplate_1 = require("./manifestSwiftTemplate");
9
+ const xcode = require('xcode');
10
+ const exportOptionsXML = `<?xml version="1.0" encoding="UTF-8"?>
11
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
12
+ <plist version="1.0">
13
+ <dict>
14
+ <key>destination</key>
15
+ <string>export</string>
16
+ <key>method</key>
17
+ <string>BUILDTYPE</string>
18
+ <key>signingStyle</key>
19
+ <string>automatic</string>
20
+ <key>stripSwiftSymbols</key>
21
+ <true/>
22
+ <key>teamID</key>
23
+ <string>YOURTEAMID</string>
24
+ <key>thinning</key>
25
+ <string>&lt;none&gt;</string>
26
+ </dict>
27
+ </plist>`;
28
+ const infoPlistXML = `<?xml version="1.0" encoding="UTF-8"?>
29
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
30
+ <plist version="1.0">
31
+ <dict>
32
+ <key>ITSAppUsesNonExemptEncryption</key>
33
+ <false/>
34
+ <key>CFBundleURLTypes</key>
35
+ <array>
36
+ <dict>
37
+ <key>CFBundleURLName</key>
38
+ <string>web-spatial</string>
39
+ <key>CFBundleURLSchemes</key>
40
+ <array>
41
+ DEEPLINK
42
+ </array>
43
+ </dict>
44
+ </array>
45
+ <key>NSAppTransportSecurity</key>
46
+ <dict>
47
+ <key>NSAllowsArbitraryLoads</key>
48
+ <true/>
49
+ </dict>
50
+ <key>UIApplicationSceneManifest</key>
51
+ <dict>
52
+ <key>UIApplicationPreferredDefaultSceneSessionRole</key>
53
+ <string>UIWindowSceneSessionRoleApplication</string>
54
+ <key>UIApplicationSupportsMultipleScenes</key>
55
+ <true/>
56
+ <key>UISceneConfigurations</key>
57
+ <dict/>
58
+ </dict>
59
+ </dict>
60
+ </plist>
61
+ `;
62
+ let useExportOptionsXML = '';
63
+ class XcodeProject {
64
+ static async modify(projectPath, option, isDev = false) {
65
+ let project = xcode.project(projectPath);
66
+ this.fixProjectFunction(project);
67
+ project.parseSync();
68
+ let buildType = option['buildType'];
69
+ const buildTypeOptions = [
70
+ 'release-testing',
71
+ 'app-store-connect',
72
+ 'debugging',
73
+ 'enterprise',
74
+ ];
75
+ useExportOptionsXML = exportOptionsXML.replace('BUILDTYPE', buildTypeOptions.includes(buildType) ? buildType : 'release-testing');
76
+ if (option['teamId']) {
77
+ this.updateTeamId(project, option['teamId']);
78
+ }
79
+ this.updateExportOptions();
80
+ if (option.icon)
81
+ await this.bindIcon(option.icon);
82
+ this.bindManifestInfo(project, option.manifestInfo.json, isDev);
83
+ if (option['version']) {
84
+ this.updateVersion(project, option['version']);
85
+ }
86
+ else {
87
+ this.updateVersion(project, '1.0');
88
+ }
89
+ try {
90
+ fs.writeFileSync(projectPath, project.writeSync());
91
+ }
92
+ catch (error) {
93
+ console.log(error);
94
+ }
95
+ }
96
+ static fixProjectFunction(project) {
97
+ // The original pbxGroupByName method has a bug where the return is null, causing other methods to call. xx directly and report an error
98
+ project.pbxGroupByName = function (name) {
99
+ var groups = this.hash.project.objects['PBXGroup'], key, groupKey;
100
+ for (key in groups) {
101
+ // only look for comments
102
+ if (!/_comment$/.test(key))
103
+ continue;
104
+ if (groups[key] == name) {
105
+ groupKey = key.split(/_comment$/)[0];
106
+ return groups[groupKey];
107
+ }
108
+ }
109
+ // The original method returns null here, causing errors when calling project.pbxGroupByName ("xxx"). xx elsewhere
110
+ return false;
111
+ };
112
+ project.updateBuildProperty = function (prop, value, build, targetName) {
113
+ let validConfigs = [];
114
+ const COMMENT_KEY = /_comment$/;
115
+ if (targetName) {
116
+ const target = this.pbxTargetByName(targetName);
117
+ const targetBuildConfigs = target && target.buildConfigurationList;
118
+ const xcConfigList = this.pbxXCConfigurationList();
119
+ // Collect the UUID's from the configuration of our target
120
+ for (const configName in xcConfigList) {
121
+ if (!COMMENT_KEY.test(configName) &&
122
+ targetBuildConfigs === configName) {
123
+ const buildVariants = xcConfigList[configName].buildConfigurations;
124
+ for (const item of buildVariants) {
125
+ validConfigs.push(item.value);
126
+ }
127
+ break;
128
+ }
129
+ }
130
+ }
131
+ var configs = this.pbxXCBuildConfigurationSection();
132
+ for (var configName in configs) {
133
+ if (!COMMENT_KEY.test(configName)) {
134
+ if (targetName && !validConfigs.includes(configName))
135
+ continue;
136
+ var config = configs[configName];
137
+ if (((build && config.name === build) || !build) &&
138
+ config.buildSettings[prop]) {
139
+ config.buildSettings[prop] = value;
140
+ }
141
+ }
142
+ }
143
+ };
144
+ }
145
+ static async bindIcon(icon) {
146
+ if (icon) {
147
+ // The application icon of Apple Vision Pro requires at least 2 images, one of which is a completely opaque base image. Therefore, Spatial Web is required to provide the base image, and CLI will generate an additional completely transparent image as the middle layer.
148
+ const iconConfigDirectory = (0, path_1.join)(resource_1.PROJECT_DIRECTORY, resource_1.BACK_APPICON_DIRECTORY);
149
+ const iconConfigPath = (0, path_1.join)(iconConfigDirectory, 'Contents.json');
150
+ const iconFileName = 'icon.' + icon.getMIME().replace('image/', '');
151
+ const iconFullPath = (0, path_1.join)(iconConfigDirectory, iconFileName);
152
+ let iconConfig = await (0, load_1.loadJsonFromDisk)(iconConfigPath);
153
+ /*
154
+ JSON format for icon configuration in Xcode
155
+ {
156
+ images: [ { filename: 'icon.jpeg', idiom: 'vision', scale: '2x' } ],
157
+ info: { author: 'xcode', version: 1 }
158
+ }
159
+ */
160
+ iconConfig.images[0]['filename'] = iconFileName;
161
+ await icon.writeAsync(iconFullPath);
162
+ await fs.writeFileSync(iconConfigPath, JSON.stringify(iconConfig));
163
+ const middleIconConfigDirectory = (0, path_1.join)(resource_1.PROJECT_DIRECTORY, resource_1.MIDDLE_APPICON_DIRECTORY);
164
+ const middleIconConfigPath = (0, path_1.join)(middleIconConfigDirectory, 'Contents.json');
165
+ const middleIconFileName = 'icon.png';
166
+ const middleIconFullPath = (0, path_1.join)(middleIconConfigDirectory, middleIconFileName);
167
+ let middleConfig = await (0, load_1.loadJsonFromDisk)(middleIconConfigPath);
168
+ let middleIcon = imageHelper_1.ImageHelper.createImg(512);
169
+ middleConfig.images[0]['filename'] = middleIconFileName;
170
+ await middleIcon.writeAsync(middleIconFullPath);
171
+ await fs.writeFileSync(middleIconConfigPath, JSON.stringify(middleConfig));
172
+ }
173
+ }
174
+ static updateTeamId(xcodeProject, teamId) {
175
+ xcodeProject.updateBuildProperty('DEVELOPMENT_TEAM', teamId);
176
+ useExportOptionsXML = useExportOptionsXML.replace('YOURTEAMID', teamId);
177
+ }
178
+ static updateExportOptions() {
179
+ if (!fs.existsSync(resource_1.PROJECT_BUILD_DIRECTORY)) {
180
+ fs.mkdirSync(resource_1.PROJECT_BUILD_DIRECTORY, { recursive: true });
181
+ }
182
+ fs.writeFileSync((0, path_1.join)(resource_1.PROJECT_BUILD_DIRECTORY, 'ExportOptions.plist'), useExportOptionsXML);
183
+ }
184
+ static bindManifestInfo(xcodeProject, manifest, isDev = false) {
185
+ var _a;
186
+ xcodeProject.updateProductName(manifest.name);
187
+ // set PRODUCT_BUNDLE_IDENTIFIER need ""
188
+ if (manifest.id && !isDev) {
189
+ xcodeProject.updateBuildProperty('PRODUCT_BUNDLE_IDENTIFIER', `"${manifest.id}"`);
190
+ }
191
+ this.updateDeeplink((_a = manifest.protocol_handlers) !== null && _a !== void 0 ? _a : []);
192
+ this.modifySwift(manifest);
193
+ }
194
+ static updateVersion(xcodeProject, version) {
195
+ xcodeProject.updateBuildProperty('CURRENT_PROJECT_VERSION', version);
196
+ }
197
+ static updateDeeplink(deeplinks) {
198
+ let infoPlistPath = (0, path_1.join)(resource_1.PROJECT_DIRECTORY, './web-spatial/Info.plist');
199
+ let deeplinkString = '';
200
+ for (let i = 0; i < deeplinks.length; i++) {
201
+ deeplinkString += `<string>${deeplinks[i].protocol}</string>`;
202
+ }
203
+ const newInfoPlist = infoPlistXML.replace('DEEPLINK', deeplinkString);
204
+ fs.writeFileSync(infoPlistPath, newInfoPlist);
205
+ }
206
+ static modifySwift(manifest) {
207
+ const manifestSwiftPath = (0, path_1.join)(resource_1.PROJECT_DIRECTORY, './web-spatial/libs/webView/manifest.swift');
208
+ let manifestSwift = manifestSwiftTemplate_1.manifestSwiftTemplate;
209
+ manifestSwift = manifestSwift.replace('START_URL', manifest.start_url);
210
+ manifestSwift = manifestSwift.replace('SCOPE', manifest.scope);
211
+ manifestSwift = manifestSwift.replace('AppName', manifest.name);
212
+ manifestSwift = manifestSwift.replace('Description', manifest.description);
213
+ manifestSwift = manifestSwift.replace('AppID', manifest.id);
214
+ manifestSwift = manifestSwift.replace('.minimal', manifest.display == 'minimal-ui' ? '.minimal' : `.${manifest.display}`);
215
+ if (manifest.protocol_handlers) {
216
+ let deeplinkString = '';
217
+ for (let i = 0; i < manifest.protocol_handlers.length; i++) {
218
+ deeplinkString += `PWAProtocol(protocolValue: "${manifest.protocol_handlers[i].protocol}", url: "${manifest.protocol_handlers[i].url}"),`;
219
+ }
220
+ manifestSwift = manifestSwift.replace('PWAProtocol(protocolValue: "", url: "")', deeplinkString);
221
+ }
222
+ if (typeof manifest.mainScene === 'object') {
223
+ manifestSwift = manifestSwift.replace('SceneWidth', manifest.mainScene.defaultSize.width);
224
+ manifestSwift = manifestSwift.replace('SceneHeight', manifest.mainScene.defaultSize.height);
225
+ manifestSwift = manifestSwift.replace('SceneResizability', `"${manifest.mainScene.resizability}"`);
226
+ manifestSwift = manifestSwift.replace('USE_MAIN_SCENE', 'true');
227
+ }
228
+ else {
229
+ // string or other type
230
+ // set these to bypass lint
231
+ manifestSwift = manifestSwift.replace('SceneWidth', '1280');
232
+ manifestSwift = manifestSwift.replace('SceneHeight', '1280');
233
+ manifestSwift = manifestSwift.replace('SceneResizability', `"automatic"`);
234
+ manifestSwift = manifestSwift.replace('USE_MAIN_SCENE', 'false');
235
+ }
236
+ fs.writeFileSync(manifestSwiftPath, manifestSwift, 'utf-8');
237
+ }
238
+ }
239
+ exports.default = XcodeProject;
@@ -26,7 +26,7 @@ export default class Xcrun {
26
26
  * appInfo.id is used to launch the application
27
27
  * @returns The simulator device uuid
28
28
  */
29
- static launchWithSimulator(appInfo: BasicAppInfo, deviceId?: string, needInstall?: boolean, needFind?: boolean): string;
29
+ static launchWithSimulator(appInfo: BasicAppInfo, deviceId?: string, needFind?: boolean): string;
30
30
  static shutdownSimulator(): Promise<void>;
31
31
  private static launchSimulator;
32
32
  private static buildTestApp;