bundo-appgen 0.0.10 → 0.0.11
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/lib/bin/bin.mjs +546 -191
- package/lib/module/{chunk-dvyy3g4j.js → chunk-mxb4tw3v.js} +0 -1
- package/lib/module/{chunk-bhc5nymd.js → chunk-z47xn1nx.js} +1 -2
- package/lib/module/config/apple/index.js +1 -1
- package/lib/module/config/index.js +2 -2
- package/lib/module/index.js +2 -2
- package/lib/typescript/config/apple/asset-catalogs-namespaced.d.ts +5 -1
- package/lib/typescript/config/apple/asset-catalogs-namespaced.d.ts.map +1 -1
- package/lib/typescript/config/apple/data.d.ts +22 -3
- package/lib/typescript/config/apple/data.d.ts.map +1 -1
- package/lib/typescript/config/apple/index.d.mts +3 -2
- package/lib/typescript/config/apple/index.d.mts.map +1 -1
- package/lib/typescript/config/apple/plist-value.d.ts +6 -0
- package/lib/typescript/config/apple/plist-value.d.ts.map +1 -0
- package/lib/typescript/config/apple/plist.d.ts +4 -0
- package/lib/typescript/config/apple/plist.d.ts.map +1 -0
- package/lib/typescript/config/apple/podfile/index.d.ts +5 -0
- package/lib/typescript/config/apple/podfile/index.d.ts.map +1 -0
- package/lib/typescript/config/apple/podfile/pod-dependency-from-cocoapods.d.ts +12 -0
- package/lib/typescript/config/apple/podfile/pod-dependency-from-cocoapods.d.ts.map +1 -0
- package/lib/typescript/config/apple/podfile/pod-dependency-from-git.d.ts +16 -0
- package/lib/typescript/config/apple/podfile/pod-dependency-from-git.d.ts.map +1 -0
- package/lib/typescript/config/apple/podfile/pod-dependency-from-local.d.ts +12 -0
- package/lib/typescript/config/apple/podfile/pod-dependency-from-local.d.ts.map +1 -0
- package/lib/typescript/config/apple/podfile/pod-dependency.d.ts +5 -0
- package/lib/typescript/config/apple/podfile/pod-dependency.d.ts.map +1 -0
- package/lib/typescript/plugin/apple/context.d.ts +1 -1
- package/lib/typescript/plugin/apple/context.d.ts.map +1 -1
- package/lib/typescript/plugin/apple/index.d.ts +0 -3
- package/lib/typescript/plugin/apple/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/_bin/_main/_check-config-validity.mts +10 -2
- package/src/_bin/_main/_helpers/config/cache-paths/asset-catalogs-tracker-file.mts +9 -0
- package/src/_bin/_main/_helpers/config/cache-paths/dir-cache.mts +19 -0
- package/src/_bin/_main/_helpers/config/cache-paths/index.mts +3 -0
- package/src/_bin/_main/_helpers/config/cache-paths/string-catalogs-tracker-file.mts +9 -0
- package/src/_bin/_main/_helpers/config/get-name.mts +1 -3
- package/src/_bin/_main/_helpers/config/get-project-name.mts +10 -5
- package/src/_bin/_main/_helpers/config/index.mts +1 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_get-xcassets-path.mts +29 -0
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_init-appiconsets.mts +25 -12
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_init-imagesets.mts +32 -13
- package/src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/create-asset-catalogs.mts +194 -9
- package/src/_bin/_main/_init-template/_init-apple/_create-string-catalogs/create-string-catalog.mts +159 -81
- package/src/_bin/_main/_init-template/_init-apple/_mod-files/_app-delegate-swift.mts +3 -6
- package/src/_bin/_main/_init-template/_init-apple/_mod-files/_podfile/_pod-dependencies.mts +78 -0
- package/src/_bin/_main/_init-template/_init-apple/_mod-files/_podfile/index.mts +1 -0
- package/src/_bin/_main/_init-template/_init-apple/_mod-files/{_podfile.mts → _podfile/podfile.mts} +16 -4
- package/src/_bin/_main/_init-template/_init-apple/_mod-files/_privacy-manifest.mts +119 -0
- package/src/_bin/_main/_init-template/_init-apple/_mod-files/mod-files.mts +8 -2
- package/src/_bin/_main/_init-template/_init-apple/init-apple.mts +13 -8
- package/src/_bin/_main/_init-template/init-template.mts +2 -0
- package/src/_bin/_main/_xcodegen/_create-project-spec/_init-resources.mts +21 -9
- package/src/_bin/_main/_xcodegen/_create-project-spec/create-project-spec.mts +51 -32
- package/src/_bin/_main/_xcodegen/_mod-known-regions/mod-known-regions.mts +2 -2
- package/src/_bin/_main/_xcodegen/xcodegen.mts +1 -1
- package/src/_bin/_main/main.mts +1 -1
- package/src/_bin/plugin-sandbox-runner/plugin-runner-context-result.ts +0 -27
- package/src/config/apple/asset-catalogs-namespaced.ts +1 -1
- package/src/config/apple/data.ts +27 -4
- package/src/config/apple/index.mts +3 -2
- package/src/config/apple/{info-plist-value.ts → plist-value.ts} +5 -4
- package/src/config/apple/plist.ts +6 -0
- package/src/config/apple/podfile/index.ts +4 -0
- package/src/config/apple/podfile/pod-dependency-from-cocoapods.ts +15 -0
- package/src/config/apple/podfile/pod-dependency-from-git.ts +23 -0
- package/src/config/apple/podfile/pod-dependency-from-local.ts +15 -0
- package/src/config/apple/podfile/pod-dependency.ts +16 -0
- package/src/plugin/apple/context.ts +1 -35
- package/src/plugin/apple/index.ts +0 -3
- package/template/macos/Podfile +4 -0
- package/template/macos/PrivacyInfo.xcprivacy +5 -0
- package/template/macos/pod_dependencies.rb +2 -0
- package/lib/typescript/config/apple/info-plist-value.d.ts +0 -8
- package/lib/typescript/config/apple/info-plist-value.d.ts.map +0 -1
- package/lib/typescript/config/apple/info-plist.d.ts +0 -4
- package/lib/typescript/config/apple/info-plist.d.ts.map +0 -1
- package/lib/typescript/plugin/apple/pod-spec-source-from-cocoapods.d.ts +0 -5
- package/lib/typescript/plugin/apple/pod-spec-source-from-cocoapods.d.ts.map +0 -1
- package/lib/typescript/plugin/apple/pod-spec-source-from-git.d.ts +0 -11
- package/lib/typescript/plugin/apple/pod-spec-source-from-git.d.ts.map +0 -1
- package/lib/typescript/plugin/apple/pod-spec-source-from-local.d.ts +0 -7
- package/lib/typescript/plugin/apple/pod-spec-source-from-local.d.ts.map +0 -1
- package/src/config/apple/info-plist.ts +0 -6
- package/src/plugin/apple/pod-spec-source-from-cocoapods.ts +0 -9
- package/src/plugin/apple/pod-spec-source-from-git.ts +0 -13
- package/src/plugin/apple/pod-spec-source-from-local.ts +0 -6
package/lib/bin/bin.mjs
CHANGED
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __returnValue = (v) => v;
|
|
4
|
+
function __exportSetter(name, newValue) {
|
|
5
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
+
}
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
set: __exportSetter.bind(all, name)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// src/_bin/_main/_helpers/config/cache-paths/index.mts
|
|
18
|
+
var exports_cache_paths = {};
|
|
19
|
+
__export(exports_cache_paths, {
|
|
20
|
+
assetCatalogsTrackerFile: () => assetCatalogsTrackerFile,
|
|
21
|
+
dirCache: () => dirCache,
|
|
22
|
+
stringCatalogsTrackerFile: () => stringCatalogsTrackerFile
|
|
23
|
+
});
|
|
2
24
|
|
|
3
25
|
// src/_bin/bin.mts
|
|
4
26
|
import yargs from "yargs";
|
|
@@ -41,9 +63,32 @@ var GlobalVars;
|
|
|
41
63
|
})(GlobalVars ||= {});
|
|
42
64
|
|
|
43
65
|
// src/_bin/_main/main.mts
|
|
44
|
-
import * as
|
|
45
|
-
import * as
|
|
66
|
+
import * as node_fs18 from "node:fs";
|
|
67
|
+
import * as node_path24 from "node:path";
|
|
68
|
+
|
|
69
|
+
// src/_bin/_main/_helpers/config/cache-paths/asset-catalogs-tracker-file.mts
|
|
70
|
+
import * as node_path2 from "node:path";
|
|
71
|
+
|
|
72
|
+
// src/_bin/_main/_helpers/config/cache-paths/dir-cache.mts
|
|
73
|
+
import * as node_fs from "node:fs";
|
|
74
|
+
import * as node_path from "node:path";
|
|
75
|
+
function dirCache() {
|
|
76
|
+
const path = node_path.join(node_path.dirname(GlobalVars.configFilePath.get()), ".bundo.rn");
|
|
77
|
+
if (!node_fs.existsSync(path)) {
|
|
78
|
+
node_fs.mkdirSync(path);
|
|
79
|
+
}
|
|
80
|
+
return path;
|
|
81
|
+
}
|
|
46
82
|
|
|
83
|
+
// src/_bin/_main/_helpers/config/cache-paths/asset-catalogs-tracker-file.mts
|
|
84
|
+
function assetCatalogsTrackerFile() {
|
|
85
|
+
return node_path2.join(dirCache(), "asset-catalogs.json");
|
|
86
|
+
}
|
|
87
|
+
// src/_bin/_main/_helpers/config/cache-paths/string-catalogs-tracker-file.mts
|
|
88
|
+
import * as node_path3 from "node:path";
|
|
89
|
+
function stringCatalogsTrackerFile() {
|
|
90
|
+
return node_path3.join(dirCache(), "string-catalogs.json");
|
|
91
|
+
}
|
|
47
92
|
// src/_bin/_main/_helpers/config/get-name.mts
|
|
48
93
|
function getName(config, platform) {
|
|
49
94
|
if (platform == "macos") {
|
|
@@ -52,17 +97,20 @@ function getName(config, platform) {
|
|
|
52
97
|
return config.name;
|
|
53
98
|
}
|
|
54
99
|
// src/_bin/_main/_helpers/config/get-project-name.mts
|
|
55
|
-
var
|
|
100
|
+
var cacheMacos;
|
|
56
101
|
function getProjectName(...params) {
|
|
57
|
-
if (
|
|
58
|
-
return
|
|
102
|
+
if (params[1] == "macos" && cacheMacos) {
|
|
103
|
+
return cacheMacos;
|
|
59
104
|
}
|
|
60
105
|
const name = getName(...params);
|
|
61
106
|
if (!name) {
|
|
62
107
|
return;
|
|
63
108
|
}
|
|
64
|
-
|
|
65
|
-
|
|
109
|
+
if (params[1] == "macos") {
|
|
110
|
+
cacheMacos = name.replace(/[^a-zA-Z0-9]/g, "");
|
|
111
|
+
return cacheMacos;
|
|
112
|
+
}
|
|
113
|
+
return;
|
|
66
114
|
}
|
|
67
115
|
// src/_bin/_main/_helpers/platform/compatibility-error.mts
|
|
68
116
|
var CompatibilityError = new Error(`
|
|
@@ -85,10 +133,10 @@ function isCompatible() {
|
|
|
85
133
|
}
|
|
86
134
|
|
|
87
135
|
// src/_bin/_main/_helpers/platform/get-data.mts
|
|
88
|
-
var
|
|
136
|
+
var cache;
|
|
89
137
|
function getData() {
|
|
90
|
-
if (
|
|
91
|
-
return
|
|
138
|
+
if (cache) {
|
|
139
|
+
return cache;
|
|
92
140
|
}
|
|
93
141
|
if (!isCompatible()) {
|
|
94
142
|
throw CompatibilityError;
|
|
@@ -106,10 +154,10 @@ function getData() {
|
|
|
106
154
|
version: process.versions.node
|
|
107
155
|
};
|
|
108
156
|
}
|
|
109
|
-
|
|
157
|
+
cache = {
|
|
110
158
|
developmentRuntime
|
|
111
159
|
};
|
|
112
|
-
return
|
|
160
|
+
return cache;
|
|
113
161
|
}
|
|
114
162
|
// src/_bin/_main/_check-config-validity.mts
|
|
115
163
|
function checkConfigValidity(config) {
|
|
@@ -121,7 +169,9 @@ function checkConfigValidity(config) {
|
|
|
121
169
|
checkMacosConfig(config);
|
|
122
170
|
} else if (process.platform == "darwin") {
|
|
123
171
|
checkMacosConfig(config);
|
|
124
|
-
} else
|
|
172
|
+
} else {
|
|
173
|
+
throw new Error(`Cannot support appgen for macOS in ${process.platform} platform.`);
|
|
174
|
+
}
|
|
125
175
|
if (config.plugins) {
|
|
126
176
|
if (Array.isArray(config.plugins)) {
|
|
127
177
|
config.plugins.forEach((plugin) => {
|
|
@@ -170,9 +220,9 @@ function checkMacosConfig(config) {
|
|
|
170
220
|
}
|
|
171
221
|
|
|
172
222
|
// src/_bin/_main/_evaluate-plugin-registry.mts
|
|
173
|
-
import * as
|
|
223
|
+
import * as node_fs2 from "node:fs";
|
|
174
224
|
import * as node_module from "node:module";
|
|
175
|
-
import * as
|
|
225
|
+
import * as node_path4 from "node:path";
|
|
176
226
|
function evaluatePluginRegistry(plugins) {
|
|
177
227
|
if (!plugins?.length) {
|
|
178
228
|
return;
|
|
@@ -203,9 +253,9 @@ function evaluatePluginRegistry(plugins) {
|
|
|
203
253
|
});
|
|
204
254
|
continue;
|
|
205
255
|
}
|
|
206
|
-
const filePath =
|
|
207
|
-
if (
|
|
208
|
-
const lstat =
|
|
256
|
+
const filePath = node_path4.join(node_path4.dirname(GlobalVars.configFilePath.get()), nameOrPath);
|
|
257
|
+
if (node_fs2.existsSync(filePath)) {
|
|
258
|
+
const lstat = node_fs2.lstatSync(filePath);
|
|
209
259
|
if (lstat.isFile()) {
|
|
210
260
|
registry.push({
|
|
211
261
|
name: nameOrPath,
|
|
@@ -225,18 +275,18 @@ function getPluginMainPathFromNodeModules(name) {
|
|
|
225
275
|
let modulePath;
|
|
226
276
|
let isDirectory = true;
|
|
227
277
|
try {
|
|
228
|
-
const __require = node_module.createRequire(
|
|
278
|
+
const __require = node_module.createRequire(node_path4.join(process.cwd(), "package.json"));
|
|
229
279
|
const nodeModulePaths = __require.resolve.paths("bundo-appgen");
|
|
230
280
|
if (nodeModulePaths?.length) {
|
|
231
281
|
for (const nodeModulePath of nodeModulePaths) {
|
|
232
|
-
const __modulePath =
|
|
233
|
-
if (
|
|
234
|
-
const modulePathStat =
|
|
282
|
+
const __modulePath = node_path4.join(nodeModulePath, name);
|
|
283
|
+
if (node_fs2.existsSync(__modulePath)) {
|
|
284
|
+
const modulePathStat = node_fs2.lstatSync(__modulePath);
|
|
235
285
|
if (modulePathStat.isFile()) {
|
|
236
286
|
isDirectory = false;
|
|
237
287
|
}
|
|
238
288
|
if (modulePathStat.isSymbolicLink()) {
|
|
239
|
-
modulePath =
|
|
289
|
+
modulePath = node_fs2.realpathSync(__modulePath);
|
|
240
290
|
} else {
|
|
241
291
|
modulePath = __modulePath;
|
|
242
292
|
}
|
|
@@ -255,11 +305,11 @@ function getPluginMainPathFromNodeModules(name) {
|
|
|
255
305
|
}
|
|
256
306
|
let mainPath;
|
|
257
307
|
for (const pluginMainFileExt of pluginMainFileExts) {
|
|
258
|
-
const path =
|
|
259
|
-
if (
|
|
260
|
-
const lstat =
|
|
308
|
+
const path = node_path4.join(modulePath, `bundo.plugin.${pluginMainFileExt}`);
|
|
309
|
+
if (node_fs2.existsSync(path)) {
|
|
310
|
+
const lstat = node_fs2.lstatSync(path);
|
|
261
311
|
if (lstat.isSymbolicLink()) {
|
|
262
|
-
mainPath =
|
|
312
|
+
mainPath = node_fs2.realpathSync(path);
|
|
263
313
|
} else {
|
|
264
314
|
mainPath = path;
|
|
265
315
|
}
|
|
@@ -274,13 +324,13 @@ var pluginMainFileExts = [
|
|
|
274
324
|
];
|
|
275
325
|
|
|
276
326
|
// src/_bin/_main/_exec-plugin-runner/exec-plugin-runner.mts
|
|
277
|
-
import * as
|
|
327
|
+
import * as node_path6 from "node:path";
|
|
278
328
|
|
|
279
329
|
// src/_bin/_main/_exec-plugin-runner/_spawn-plugin-sandbox-runner.mts
|
|
280
330
|
import * as node_childProcess from "node:child_process";
|
|
281
|
-
import * as
|
|
331
|
+
import * as node_fs3 from "node:fs";
|
|
282
332
|
import * as node_module2 from "node:module";
|
|
283
|
-
import * as
|
|
333
|
+
import * as node_path5 from "node:path";
|
|
284
334
|
async function spawnPluginSandboxRunner(registry, permissions, metadata) {
|
|
285
335
|
const requireModule = node_module2.createRequire(process.cwd()), messageID = Math.random().toString();
|
|
286
336
|
return new Promise((resolve) => {
|
|
@@ -302,15 +352,15 @@ async function spawnPluginSandboxRunner(registry, permissions, metadata) {
|
|
|
302
352
|
}
|
|
303
353
|
});
|
|
304
354
|
registry.forEach((plugin) => {
|
|
305
|
-
const pluginDirectory =
|
|
306
|
-
const lstat =
|
|
355
|
+
const pluginDirectory = node_path5.dirname(plugin.mainPath);
|
|
356
|
+
const lstat = node_fs3.lstatSync(pluginDirectory);
|
|
307
357
|
if (lstat.isSymbolicLink()) {
|
|
308
|
-
nodeArgs.push(`--allow-fs-read=${
|
|
358
|
+
nodeArgs.push(`--allow-fs-read=${node_fs3.realpathSync(pluginDirectory)}`);
|
|
309
359
|
} else {
|
|
310
360
|
nodeArgs.push(`--allow-fs-read=${pluginDirectory}`);
|
|
311
361
|
}
|
|
312
362
|
});
|
|
313
|
-
nodeArgs.push(
|
|
363
|
+
nodeArgs.push(node_path5.join(GlobalVars.appgenRoot.get(), "lib", "bin", "plugin-sandbox-runner.mjs"));
|
|
314
364
|
nodeArgs.push(`--json=${JSON.stringify({
|
|
315
365
|
projectDirectory: metadata.projectDirectory,
|
|
316
366
|
projectName: metadata.projectName,
|
|
@@ -356,13 +406,13 @@ async function execPluginRunner(registry, options) {
|
|
|
356
406
|
if (!registry?.length) {
|
|
357
407
|
return;
|
|
358
408
|
}
|
|
359
|
-
const projectDirectory =
|
|
409
|
+
const projectDirectory = node_path6.dirname(GlobalVars.configFilePath.get()), projectName = getProjectName(GlobalVars.appConfig.get(), "macos");
|
|
360
410
|
if (options?.mode === "restricted") {
|
|
361
411
|
console.log(`Executing ${registry.length} plugin${registry.length == 1 ? "" : "s"}`);
|
|
362
412
|
return await spawnPluginSandboxRunner(registry, {
|
|
363
413
|
"--allow-fs-read": [
|
|
364
|
-
|
|
365
|
-
|
|
414
|
+
node_path6.join(projectDirectory, "macos", projectName, "AppDelegate.swift"),
|
|
415
|
+
node_path6.join(projectDirectory, "macos", "Podfile")
|
|
366
416
|
],
|
|
367
417
|
"--allow-fs-write": null,
|
|
368
418
|
"--allow-net": false
|
|
@@ -372,7 +422,7 @@ async function execPluginRunner(registry, options) {
|
|
|
372
422
|
});
|
|
373
423
|
} else {
|
|
374
424
|
console.log(`Executing ${registry.length} less restrictive plugin${registry.length == 1 ? "" : "s"}`);
|
|
375
|
-
const projectDirectoryMacos =
|
|
425
|
+
const projectDirectoryMacos = node_path6.join(projectDirectory, "macos");
|
|
376
426
|
return await spawnPluginSandboxRunner(registry, {
|
|
377
427
|
"--allow-fs-read": [
|
|
378
428
|
projectDirectoryMacos
|
|
@@ -389,10 +439,10 @@ async function execPluginRunner(registry, options) {
|
|
|
389
439
|
}
|
|
390
440
|
// src/_bin/_main/_get-config.mts
|
|
391
441
|
import * as node_module3 from "node:module";
|
|
392
|
-
import * as
|
|
442
|
+
import * as node_path7 from "node:path";
|
|
393
443
|
var __filename = "/home/runner/work/bundo.rn/bundo.rn/packages/bundo-appgen/src/_bin/_main/_get-config.mts";
|
|
394
444
|
async function getConfig(configFilePath) {
|
|
395
|
-
const ext =
|
|
445
|
+
const ext = node_path7.extname(configFilePath);
|
|
396
446
|
if (ext == ".ts" || ext == ".mts") {
|
|
397
447
|
if (typeof Bun !== "undefined" || process.versions.bun) {
|
|
398
448
|
return import(configFilePath).then((c) => c.default);
|
|
@@ -421,16 +471,27 @@ or you can use Bun, or just use the JavaScript config file.
|
|
|
421
471
|
}
|
|
422
472
|
|
|
423
473
|
// src/_bin/_main/_init-template/init-template.mts
|
|
424
|
-
import * as
|
|
425
|
-
import * as
|
|
474
|
+
import * as node_fs13 from "node:fs";
|
|
475
|
+
import * as node_path18 from "node:path";
|
|
426
476
|
|
|
427
477
|
// src/_bin/_main/_init-template/_init-apple/init-apple.mts
|
|
428
|
-
import * as
|
|
429
|
-
import * as
|
|
478
|
+
import * as node_fs12 from "node:fs";
|
|
479
|
+
import * as node_path17 from "node:path";
|
|
480
|
+
|
|
481
|
+
// src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/create-asset-catalogs.mts
|
|
482
|
+
import * as node_fs6 from "node:fs";
|
|
483
|
+
import * as node_path11 from "node:path";
|
|
484
|
+
|
|
485
|
+
// src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_get-xcassets-path.mts
|
|
486
|
+
import * as node_path8 from "node:path";
|
|
487
|
+
function getXcassetsPath(platform) {
|
|
488
|
+
const projectDirectory = node_path8.dirname(GlobalVars.configFilePath.get()), projectName = getProjectName(GlobalVars.appConfig.get(), platform);
|
|
489
|
+
return node_path8.join(projectDirectory, platform, projectName, "Assets.xcassets");
|
|
490
|
+
}
|
|
430
491
|
|
|
431
492
|
// src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_init-appiconsets.mts
|
|
432
|
-
import * as
|
|
433
|
-
import * as
|
|
493
|
+
import * as node_fs4 from "node:fs";
|
|
494
|
+
import * as node_path9 from "node:path";
|
|
434
495
|
|
|
435
496
|
// src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_metadata-check/appearances.mts
|
|
436
497
|
function appearances(value) {
|
|
@@ -498,17 +559,17 @@ function initAppiconsets(appiconsets, metadata) {
|
|
|
498
559
|
if (!appiconsets?.length) {
|
|
499
560
|
return;
|
|
500
561
|
}
|
|
501
|
-
const projectDirectory =
|
|
502
|
-
const
|
|
562
|
+
const createdCatalogs = [], projectDirectory = node_path9.dirname(GlobalVars.configFilePath.get());
|
|
563
|
+
const xcassetsPath = getXcassetsPath(metadata.platform);
|
|
503
564
|
let appiconset_index = -1;
|
|
504
565
|
for (const appiconset of appiconsets) {
|
|
505
566
|
if (!appiconset.images.length) {
|
|
506
567
|
break;
|
|
507
568
|
}
|
|
508
569
|
appiconset_index++;
|
|
509
|
-
const _appiconset_directory =
|
|
510
|
-
if (!
|
|
511
|
-
|
|
570
|
+
const _appiconset_directory = node_path9.join(xcassetsPath, `${appiconset.name}.appiconset`);
|
|
571
|
+
if (!node_fs4.existsSync(_appiconset_directory)) {
|
|
572
|
+
node_fs4.mkdirSync(_appiconset_directory);
|
|
512
573
|
}
|
|
513
574
|
const contentsJson = {
|
|
514
575
|
images: [],
|
|
@@ -520,13 +581,13 @@ function initAppiconsets(appiconsets, metadata) {
|
|
|
520
581
|
let image_index = -1;
|
|
521
582
|
for (const { path: imagePath, ...image } of appiconset.images) {
|
|
522
583
|
image_index++;
|
|
523
|
-
const imageFilePath =
|
|
584
|
+
const imageFilePath = node_path9.resolve(projectDirectory, imagePath), imageMetadata = {
|
|
524
585
|
appearances: image.appearances?.[0] ? [{
|
|
525
586
|
appearance: image.appearances[0].appearance,
|
|
526
587
|
value: image.appearances[0].value
|
|
527
588
|
}] : undefined,
|
|
528
589
|
"display-gamut": image["display-gamut"] || undefined,
|
|
529
|
-
filename:
|
|
590
|
+
filename: node_path9.basename(imageFilePath),
|
|
530
591
|
size: image.size,
|
|
531
592
|
idiom: image.idiom || "universal",
|
|
532
593
|
scale: image.scale || "1x"
|
|
@@ -548,10 +609,10 @@ function initAppiconsets(appiconsets, metadata) {
|
|
|
548
609
|
if (image["idiom"] && !idiom(image.idiom)) {
|
|
549
610
|
throw new Error(`Not a valid idiom in the ${traceStr}.`);
|
|
550
611
|
}
|
|
551
|
-
if (!
|
|
612
|
+
if (!node_fs4.existsSync(imageFilePath)) {
|
|
552
613
|
throw new Error(`Cannot find ${imagePath} relatively from your project directory.`);
|
|
553
614
|
}
|
|
554
|
-
const imageExtname =
|
|
615
|
+
const imageExtname = node_path9.extname(imageFilePath);
|
|
555
616
|
if (imageExtname !== ".png") {
|
|
556
617
|
throw new Error(`${imageExtname} file is not supported in Asset Catalogs.`);
|
|
557
618
|
}
|
|
@@ -564,11 +625,13 @@ function initAppiconsets(appiconsets, metadata) {
|
|
|
564
625
|
}
|
|
565
626
|
}
|
|
566
627
|
}
|
|
567
|
-
|
|
628
|
+
node_fs4.copyFileSync(imageFilePath, node_path9.join(_appiconset_directory, imageMetadata.filename));
|
|
568
629
|
contentsJson.images.push({ ...imageMetadata });
|
|
569
630
|
}
|
|
570
|
-
|
|
631
|
+
node_fs4.writeFileSync(node_path9.join(_appiconset_directory, "Contents.json"), JSON.stringify(contentsJson, null, 2), "utf8");
|
|
632
|
+
createdCatalogs.push(appiconset.name);
|
|
571
633
|
}
|
|
634
|
+
return createdCatalogs;
|
|
572
635
|
}
|
|
573
636
|
var mapImageSize = {
|
|
574
637
|
"16x16": 1,
|
|
@@ -591,20 +654,20 @@ var mapImageSize = {
|
|
|
591
654
|
};
|
|
592
655
|
|
|
593
656
|
// src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/_init-imagesets.mts
|
|
594
|
-
import * as
|
|
595
|
-
import * as
|
|
657
|
+
import * as node_fs5 from "node:fs";
|
|
658
|
+
import * as node_path10 from "node:path";
|
|
596
659
|
function initImagesets(imagesets, metadata) {
|
|
597
660
|
if (!imagesets?.length) {
|
|
598
661
|
return;
|
|
599
662
|
}
|
|
600
|
-
const projectDirectory =
|
|
601
|
-
let
|
|
663
|
+
const createdCatalogs = [], projectDirectory = node_path10.dirname(GlobalVars.configFilePath.get());
|
|
664
|
+
let xcassetsPath = getXcassetsPath(metadata.platform);
|
|
602
665
|
if (metadata.namespace) {
|
|
603
|
-
|
|
604
|
-
|
|
666
|
+
xcassetsPath = node_path10.join(xcassetsPath, metadata.namespace);
|
|
667
|
+
node_fs5.mkdirSync(xcassetsPath, {
|
|
605
668
|
recursive: true
|
|
606
669
|
});
|
|
607
|
-
|
|
670
|
+
node_fs5.writeFileSync(node_path10.join(xcassetsPath, "Contents.json"), JSON.stringify({
|
|
608
671
|
info: {
|
|
609
672
|
version: 1,
|
|
610
673
|
author: metadata.bundleIdentifier
|
|
@@ -620,9 +683,9 @@ function initImagesets(imagesets, metadata) {
|
|
|
620
683
|
break;
|
|
621
684
|
}
|
|
622
685
|
imageset_index++;
|
|
623
|
-
const _imageset_directory =
|
|
624
|
-
if (!
|
|
625
|
-
|
|
686
|
+
const _imageset_directory = node_path10.join(xcassetsPath, `${imageset.name}.imageset`);
|
|
687
|
+
if (!node_fs5.existsSync(_imageset_directory)) {
|
|
688
|
+
node_fs5.mkdirSync(_imageset_directory);
|
|
626
689
|
}
|
|
627
690
|
const existingImageFilenames = [];
|
|
628
691
|
const contentsJson = {
|
|
@@ -638,14 +701,14 @@ function initImagesets(imagesets, metadata) {
|
|
|
638
701
|
if (!imagePath) {
|
|
639
702
|
throw new Error("Not a valid image metadata object in the `imagesets[number].images[number]`");
|
|
640
703
|
}
|
|
641
|
-
const imageFilePath =
|
|
704
|
+
const imageFilePath = node_path10.resolve(projectDirectory, imagePath), imageMetadata = {
|
|
642
705
|
appearances: image.appearances?.[0] ? [{
|
|
643
706
|
appearance: image.appearances[0].appearance,
|
|
644
707
|
value: image.appearances[0].value
|
|
645
708
|
}] : undefined,
|
|
646
709
|
"compression-type": image["compression-type"] || undefined,
|
|
647
710
|
"display-gamut": image["display-gamut"] || undefined,
|
|
648
|
-
filename:
|
|
711
|
+
filename: node_path10.basename(imageFilePath),
|
|
649
712
|
idiom: image.idiom || "universal",
|
|
650
713
|
languageDirection: image.languageDirection,
|
|
651
714
|
scale: image.scale || "1x"
|
|
@@ -670,10 +733,10 @@ function initImagesets(imagesets, metadata) {
|
|
|
670
733
|
if (image.languageDirection && !languageDirection(image.languageDirection)) {
|
|
671
734
|
throw new Error(`Not a valid image language direction in the ${traceStr}.`);
|
|
672
735
|
}
|
|
673
|
-
if (!
|
|
736
|
+
if (!node_fs5.existsSync(imageFilePath)) {
|
|
674
737
|
throw new Error(`Cannot find ${imagePath} relatively from your project directory.`);
|
|
675
738
|
}
|
|
676
|
-
const imageExtname =
|
|
739
|
+
const imageExtname = node_path10.extname(imageFilePath);
|
|
677
740
|
if (supportedImageExts.indexOf(imageExtname) == -1) {
|
|
678
741
|
throw new Error(`${imageExtname} file is not supported in Asset Catalogs.`);
|
|
679
742
|
}
|
|
@@ -689,11 +752,17 @@ function initImagesets(imagesets, metadata) {
|
|
|
689
752
|
}
|
|
690
753
|
}
|
|
691
754
|
}
|
|
692
|
-
|
|
755
|
+
node_fs5.copyFileSync(imageFilePath, node_path10.join(_imageset_directory, imageMetadata.filename));
|
|
693
756
|
contentsJson.images.push({ ...imageMetadata });
|
|
694
757
|
}
|
|
695
|
-
|
|
758
|
+
node_fs5.writeFileSync(node_path10.join(_imageset_directory, "Contents.json"), JSON.stringify(contentsJson, null, 2), "utf8");
|
|
759
|
+
if (metadata.namespace) {
|
|
760
|
+
createdCatalogs.push(`${metadata.namespace}/${imageset.name}`);
|
|
761
|
+
} else {
|
|
762
|
+
createdCatalogs.push(imageset.name);
|
|
763
|
+
}
|
|
696
764
|
}
|
|
765
|
+
return createdCatalogs;
|
|
697
766
|
}
|
|
698
767
|
var supportedImageExts = [
|
|
699
768
|
".heic",
|
|
@@ -705,122 +774,384 @@ var supportedImageExts = [
|
|
|
705
774
|
|
|
706
775
|
// src/_bin/_main/_init-template/_init-apple/_create-asset-catalogs/create-asset-catalogs.mts
|
|
707
776
|
function createAssetCatalogs(assetCatalogs, metadata) {
|
|
777
|
+
const xcassetsPath = getXcassetsPath(metadata.platform), assetCatalogsTrackerFilePath = exports_cache_paths.assetCatalogsTrackerFile();
|
|
778
|
+
let catalogsTracker = {
|
|
779
|
+
appiconsets: undefined,
|
|
780
|
+
imagesets: undefined
|
|
781
|
+
};
|
|
782
|
+
function removeAllCatalogs() {
|
|
783
|
+
if (node_fs6.existsSync(xcassetsPath)) {
|
|
784
|
+
node_fs6.rmSync(xcassetsPath, {
|
|
785
|
+
recursive: true,
|
|
786
|
+
force: true
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
if (node_fs6.existsSync(assetCatalogsTrackerFilePath)) {
|
|
790
|
+
node_fs6.rmSync(assetCatalogsTrackerFilePath);
|
|
791
|
+
}
|
|
792
|
+
}
|
|
708
793
|
if (!assetCatalogs) {
|
|
794
|
+
removeAllCatalogs();
|
|
709
795
|
return;
|
|
710
796
|
}
|
|
797
|
+
try {
|
|
798
|
+
if (node_fs6.existsSync(assetCatalogsTrackerFilePath)) {
|
|
799
|
+
catalogsTracker = JSON.parse(node_fs6.readFileSync(assetCatalogsTrackerFilePath, "utf8"));
|
|
800
|
+
}
|
|
801
|
+
} catch {
|
|
802
|
+
removeAllCatalogs();
|
|
803
|
+
}
|
|
804
|
+
const newCatalogsTracker = createCatalogs(assetCatalogs, {
|
|
805
|
+
bundleIdentifier: metadata.bundleIdentifier,
|
|
806
|
+
platform: metadata.platform,
|
|
807
|
+
namespace: metadata.namespace
|
|
808
|
+
});
|
|
809
|
+
catalogsTracker.appiconsets?.forEach((existingCatalog) => {
|
|
810
|
+
if (newCatalogsTracker.appiconsets?.indexOf(existingCatalog) === -1) {
|
|
811
|
+
const existingPath = node_path11.join(xcassetsPath, existingCatalog + ".appiconset");
|
|
812
|
+
if (node_fs6.existsSync(existingPath)) {
|
|
813
|
+
node_fs6.rmSync(existingPath, {
|
|
814
|
+
recursive: true,
|
|
815
|
+
force: true
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
});
|
|
820
|
+
catalogsTracker.imagesets?.forEach((existingCatalog) => {
|
|
821
|
+
if (newCatalogsTracker.imagesets?.indexOf(existingCatalog) === -1) {
|
|
822
|
+
const existingCatalogBasename = existingCatalog.split("/")[0];
|
|
823
|
+
if (!existingCatalogBasename) {
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
const existingPath = node_path11.join(xcassetsPath, existingCatalogBasename);
|
|
827
|
+
if (node_fs6.existsSync(existingPath)) {
|
|
828
|
+
node_fs6.rmSync(existingPath, {
|
|
829
|
+
recursive: true,
|
|
830
|
+
force: true
|
|
831
|
+
});
|
|
832
|
+
} else {
|
|
833
|
+
const imagesetDir = node_path11.join(existingCatalogBasename, ".imageset");
|
|
834
|
+
if (node_fs6.existsSync(imagesetDir)) {
|
|
835
|
+
node_fs6.rmSync(imagesetDir, {
|
|
836
|
+
recursive: true,
|
|
837
|
+
force: true
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
});
|
|
843
|
+
node_fs6.writeFileSync(assetCatalogsTrackerFilePath, JSON.stringify(newCatalogsTracker, null, 2), "utf8");
|
|
844
|
+
}
|
|
845
|
+
function createCatalogs(assetCatalogs, metadata, nextTracker) {
|
|
846
|
+
const tracker = nextTracker ?? {
|
|
847
|
+
appiconsets: undefined,
|
|
848
|
+
imagesets: undefined
|
|
849
|
+
};
|
|
850
|
+
if (!assetCatalogs) {
|
|
851
|
+
return tracker;
|
|
852
|
+
}
|
|
853
|
+
let isRecursived = false;
|
|
711
854
|
for (const _key of Object.keys(assetCatalogs)) {
|
|
712
855
|
const key = _key;
|
|
713
856
|
if (key == "imagesets") {
|
|
714
|
-
initImagesets(assetCatalogs.imagesets, metadata);
|
|
857
|
+
const trackedCatalogs = initImagesets(assetCatalogs.imagesets, metadata);
|
|
858
|
+
if (trackedCatalogs?.length) {
|
|
859
|
+
if (!tracker.imagesets?.length) {
|
|
860
|
+
tracker.imagesets = trackedCatalogs;
|
|
861
|
+
} else {
|
|
862
|
+
tracker.imagesets = [
|
|
863
|
+
...tracker.imagesets,
|
|
864
|
+
...trackedCatalogs
|
|
865
|
+
];
|
|
866
|
+
}
|
|
867
|
+
}
|
|
715
868
|
} else if (key == "appiconsets") {
|
|
716
|
-
|
|
869
|
+
if (!isRecursived) {
|
|
870
|
+
const trackedCatalogs = initAppiconsets(assetCatalogs.appiconsets, metadata);
|
|
871
|
+
if (trackedCatalogs?.length) {
|
|
872
|
+
if (!tracker.appiconsets?.length) {
|
|
873
|
+
tracker.appiconsets = trackedCatalogs;
|
|
874
|
+
} else {
|
|
875
|
+
tracker.appiconsets = [
|
|
876
|
+
...tracker.appiconsets,
|
|
877
|
+
...trackedCatalogs
|
|
878
|
+
];
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
}
|
|
717
882
|
} else {
|
|
718
883
|
const namespacedCatalogs = assetCatalogs[key];
|
|
719
884
|
if (namespacedCatalogs && Object.keys(namespacedCatalogs).length) {
|
|
720
|
-
|
|
885
|
+
isRecursived = true;
|
|
886
|
+
createCatalogs(namespacedCatalogs, {
|
|
721
887
|
...metadata,
|
|
722
|
-
namespace: key
|
|
723
|
-
});
|
|
888
|
+
namespace: metadata.namespace ? `${metadata.namespace}/${key}` : key
|
|
889
|
+
}, tracker);
|
|
724
890
|
}
|
|
725
891
|
}
|
|
726
892
|
}
|
|
893
|
+
return tracker;
|
|
727
894
|
}
|
|
728
895
|
// src/_bin/_main/_init-template/_init-apple/_create-string-catalogs/create-string-catalog.mts
|
|
729
|
-
import * as
|
|
730
|
-
import * as
|
|
896
|
+
import * as node_fs7 from "node:fs";
|
|
897
|
+
import * as node_path12 from "node:path";
|
|
731
898
|
function createStringCatalogs(stringCatalogs, locales = ["en"], metadata) {
|
|
732
|
-
const config = GlobalVars.appConfig.get(),
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
899
|
+
const config = GlobalVars.appConfig.get(), targetProjectDir = node_path12.join(node_path12.dirname(GlobalVars.configFilePath.get()), metadata.platform, getProjectName(config, metadata.platform)), catalogs = stringCatalogs ? Object.entries(stringCatalogs) : null, stringCatalogsTrackerFilePath = exports_cache_paths.stringCatalogsTrackerFile();
|
|
900
|
+
let catalogsTracker = {
|
|
901
|
+
catalogs: undefined
|
|
902
|
+
};
|
|
903
|
+
if (!catalogs?.length) {
|
|
904
|
+
if (node_fs7.existsSync(stringCatalogsTrackerFilePath)) {
|
|
905
|
+
node_fs7.rmSync(stringCatalogsTrackerFilePath);
|
|
906
|
+
}
|
|
907
|
+
return;
|
|
908
|
+
}
|
|
909
|
+
try {
|
|
910
|
+
catalogsTracker = node_fs7.existsSync(stringCatalogsTrackerFilePath) ? JSON.parse(node_fs7.readFileSync(stringCatalogsTrackerFilePath, "utf8")) : { catalogs: undefined };
|
|
911
|
+
} catch {}
|
|
912
|
+
if (catalogsTracker.catalogs?.length) {
|
|
913
|
+
catalogsTracker.catalogs.slice().forEach((existingCatalog, index) => {
|
|
914
|
+
if (!stringCatalogs?.[existingCatalog]) {
|
|
915
|
+
const existingPath = getCatalogFilePath({
|
|
916
|
+
targetProjectDirectory: targetProjectDir,
|
|
917
|
+
catalogName: existingCatalog
|
|
918
|
+
});
|
|
919
|
+
if (node_fs7.existsSync(existingPath)) {
|
|
920
|
+
node_fs7.rmSync(existingPath, {
|
|
921
|
+
force: true
|
|
922
|
+
});
|
|
744
923
|
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
924
|
+
catalogsTracker.catalogs?.splice(index, 1);
|
|
925
|
+
}
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
for (const [catalogName, data] of catalogs) {
|
|
929
|
+
const json = {
|
|
930
|
+
sourceLanguage: locales[0],
|
|
931
|
+
strings: {},
|
|
932
|
+
version: "1.2"
|
|
933
|
+
}, keys = Object.keys(data);
|
|
934
|
+
for (const key of keys) {
|
|
935
|
+
const localizedValue = data[key];
|
|
936
|
+
if (!localizedValue) {
|
|
937
|
+
throw new Error(`String catalog of ${catalogName} has invalid configuration.`);
|
|
938
|
+
}
|
|
939
|
+
const localesOfValue = Object.keys(localizedValue);
|
|
940
|
+
{
|
|
941
|
+
for (const localeOfValue of localesOfValue) {
|
|
942
|
+
if (locales.indexOf(localeOfValue) == -1) {
|
|
943
|
+
throw new Error(`"${localeOfValue}" was not found from your \`locales\` config. Add "${localeOfValue}" to the \`locales\` array.`);
|
|
751
944
|
}
|
|
752
945
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
946
|
+
}
|
|
947
|
+
localesOfValue.forEach((locale) => {
|
|
948
|
+
const value = localizedValue[locale];
|
|
949
|
+
if (!value) {
|
|
950
|
+
throw new Error(`\`stringCatalogs.${key}.${locale}\` is empty.`);
|
|
951
|
+
}
|
|
952
|
+
if (!json.strings[key]) {
|
|
953
|
+
json.strings[key] = {
|
|
954
|
+
extractionState: "manual",
|
|
955
|
+
localizations: {
|
|
956
|
+
[locale]: {
|
|
957
|
+
stringUnit: {
|
|
958
|
+
state: "translated",
|
|
959
|
+
value
|
|
767
960
|
}
|
|
768
961
|
}
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
|
|
962
|
+
}
|
|
963
|
+
};
|
|
964
|
+
} else {
|
|
965
|
+
json.strings[key].localizations[locale] = {
|
|
966
|
+
stringUnit: {
|
|
967
|
+
state: "translated",
|
|
968
|
+
value
|
|
969
|
+
}
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
node_fs7.writeFileSync(getCatalogFilePath({
|
|
975
|
+
targetProjectDirectory: targetProjectDir,
|
|
976
|
+
catalogName
|
|
977
|
+
}), JSON.stringify(json, null, 2), "utf8");
|
|
978
|
+
if (!catalogsTracker.catalogs?.length) {
|
|
979
|
+
catalogsTracker.catalogs = [];
|
|
980
|
+
}
|
|
981
|
+
if (catalogsTracker.catalogs.indexOf(catalogName) == -1) {
|
|
982
|
+
catalogsTracker.catalogs.push(catalogName);
|
|
781
983
|
}
|
|
782
984
|
}
|
|
985
|
+
node_fs7.writeFileSync(stringCatalogsTrackerFilePath, JSON.stringify(catalogsTracker, null, 2), "utf8");
|
|
986
|
+
}
|
|
987
|
+
function getCatalogFilePath(data) {
|
|
988
|
+
return node_path12.join(data.targetProjectDirectory, `${data.catalogName}.xcstrings`);
|
|
783
989
|
}
|
|
784
990
|
|
|
785
991
|
// src/_bin/_main/_init-template/_init-apple/_mod-files/_app-delegate-swift.mts
|
|
786
|
-
import * as
|
|
787
|
-
import * as
|
|
992
|
+
import * as node_fs8 from "node:fs";
|
|
993
|
+
import * as node_path13 from "node:path";
|
|
788
994
|
function appDelegateSwift(platform) {
|
|
789
|
-
const appConfig = GlobalVars.appConfig.get(), projectName = getProjectName(appConfig, platform), appName = getName(appConfig, platform), appDelegateSwiftFilePath =
|
|
790
|
-
let appDelegateSwiftText =
|
|
995
|
+
const appConfig = GlobalVars.appConfig.get(), projectName = getProjectName(appConfig, platform), appName = getName(appConfig, platform), appDelegateSwiftFilePath = node_path13.join(node_path13.dirname(GlobalVars.configFilePath.get()), platform, projectName, "AppDelegate.swift");
|
|
996
|
+
let appDelegateSwiftText = node_fs8.readFileSync(appDelegateSwiftFilePath, "utf8");
|
|
791
997
|
appDelegateSwiftText = appDelegateSwiftText.replace(/Window\("HelloWorld"/, `Window("${appName}"`);
|
|
792
998
|
appDelegateSwiftText = appDelegateSwiftText.replace(/factory.rootViewFactory.view\(withModuleName: "HelloWorld"/, `factory.rootViewFactory.view(withModuleName: "${projectName}"`);
|
|
793
|
-
|
|
999
|
+
node_fs8.writeFileSync(appDelegateSwiftFilePath, appDelegateSwiftText, "utf8");
|
|
794
1000
|
}
|
|
795
1001
|
|
|
796
|
-
// src/_bin/_main/_init-template/_init-apple/_mod-files/_podfile.mts
|
|
797
|
-
import * as
|
|
798
|
-
import * as
|
|
1002
|
+
// src/_bin/_main/_init-template/_init-apple/_mod-files/_podfile/podfile.mts
|
|
1003
|
+
import * as node_fs10 from "node:fs";
|
|
1004
|
+
import * as node_path15 from "node:path";
|
|
1005
|
+
|
|
1006
|
+
// src/_bin/_main/_init-template/_init-apple/_mod-files/_podfile/_pod-dependencies.mts
|
|
1007
|
+
import * as node_fs9 from "node:fs";
|
|
1008
|
+
import * as node_path14 from "node:path";
|
|
1009
|
+
function podDependencies(platform) {
|
|
1010
|
+
const dependencies = GlobalVars.appConfig.get()[platform]?.Podfile?.dependencies, nativeProjectDir = node_path14.join(node_path14.dirname(GlobalVars.configFilePath.get()), platform);
|
|
1011
|
+
const podDependenciesFilePath = node_path14.join(nativeProjectDir, "pod_dependencies.rb");
|
|
1012
|
+
let podDependenciesFile = "def pod_dependencies";
|
|
1013
|
+
dependencies?.forEach((dependency) => {
|
|
1014
|
+
let tx = `
|
|
1015
|
+
pod '${dependency.name}'`;
|
|
1016
|
+
if (dependency.type == "cocoapods") {
|
|
1017
|
+
if (dependency.version) {
|
|
1018
|
+
tx += `, '${dependency.version}'`;
|
|
1019
|
+
}
|
|
1020
|
+
} else if (dependency.type == "git") {
|
|
1021
|
+
if (!dependency.url || typeof dependency.url != "string") {
|
|
1022
|
+
throw new Error('"gitUrl" is empty or not a valid string for a pod spec source.');
|
|
1023
|
+
}
|
|
1024
|
+
tx += `, :git => '${dependency.url}'`;
|
|
1025
|
+
if (dependency.revision) {
|
|
1026
|
+
if (dependency.revision.type !== "branch" && dependency.revision.type !== "commit" && dependency.revision.type !== "tag") {
|
|
1027
|
+
throw new Error('Expected "branch", or "commit", or "tag" for the revision type.');
|
|
1028
|
+
}
|
|
1029
|
+
if (typeof dependency.revision.ref != "string" || !dependency.revision.ref) {
|
|
1030
|
+
throw new Error("Revision ref is empty or not a valid string.");
|
|
1031
|
+
}
|
|
1032
|
+
tx += `, :${dependency.revision.type} => '${dependency.revision.ref}'`;
|
|
1033
|
+
}
|
|
1034
|
+
} else if (dependency.type == "local") {
|
|
1035
|
+
if (!dependency.path || typeof dependency.path != "string") {
|
|
1036
|
+
throw new Error('"path" is empty or not a valid string for a local pod.');
|
|
1037
|
+
}
|
|
1038
|
+
tx += `, :path => '${dependency.path}'`;
|
|
1039
|
+
}
|
|
1040
|
+
podDependenciesFile += tx;
|
|
1041
|
+
});
|
|
1042
|
+
podDependenciesFile += `
|
|
1043
|
+
end
|
|
1044
|
+
`;
|
|
1045
|
+
node_fs9.writeFileSync(podDependenciesFilePath, podDependenciesFile, "utf8");
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
// src/_bin/_main/_init-template/_init-apple/_mod-files/_podfile/podfile.mts
|
|
799
1049
|
function podfile(platform) {
|
|
800
|
-
const projectName = getProjectName(GlobalVars.appConfig.get(), platform),
|
|
801
|
-
let podfileText =
|
|
1050
|
+
const projectName = getProjectName(GlobalVars.appConfig.get(), platform), nativeProjectDir = node_path15.join(node_path15.dirname(GlobalVars.configFilePath.get()), platform), podfilePath = node_path15.join(nativeProjectDir, "Podfile");
|
|
1051
|
+
let podfileText = node_fs10.readFileSync(podfilePath, "utf8");
|
|
802
1052
|
podfileText = podfileText.replace(/(target) 'HelloWorld' (do)/, `$1 '${projectName}' $2`);
|
|
803
|
-
|
|
1053
|
+
node_fs10.writeFileSync(podfilePath, podfileText, "utf8");
|
|
1054
|
+
podDependencies(platform);
|
|
1055
|
+
}
|
|
1056
|
+
// src/_bin/_main/_init-template/_init-apple/_mod-files/_privacy-manifest.mts
|
|
1057
|
+
import * as node_fs11 from "node:fs";
|
|
1058
|
+
import * as node_path16 from "node:path";
|
|
1059
|
+
function privacyManifest(platform) {
|
|
1060
|
+
const manifest = GlobalVars.appConfig.get()[platform]?.privacyManifest;
|
|
1061
|
+
if (!manifest) {
|
|
1062
|
+
return;
|
|
1063
|
+
}
|
|
1064
|
+
const nativeProjectDir = node_path16.join(node_path16.dirname(GlobalVars.configFilePath.get()), platform), privacyInfoFilePath = node_path16.join(nativeProjectDir, "PrivacyInfo.xcprivacy");
|
|
1065
|
+
let privacyInfoFile = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1066
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
1067
|
+
<plist version="1.0">
|
|
1068
|
+
<dict>`;
|
|
1069
|
+
for (const [key, plist] of Object.entries(manifest)) {
|
|
1070
|
+
privacyInfoFile += getDictionaryItem(key, plist);
|
|
1071
|
+
}
|
|
1072
|
+
privacyInfoFile += `
|
|
1073
|
+
</dict>
|
|
1074
|
+
</plist>`;
|
|
1075
|
+
node_fs11.writeFileSync(privacyInfoFilePath, privacyInfoFile, "utf8");
|
|
1076
|
+
}
|
|
1077
|
+
function getDictionaryItem(key, plist, startIndentAmount = 1) {
|
|
1078
|
+
const indent = Array(startIndentAmount).fill("\t").join("");
|
|
1079
|
+
let tx = `
|
|
1080
|
+
${indent}<key>${key}</key>`;
|
|
1081
|
+
if (typeof plist == "boolean") {
|
|
1082
|
+
if (plist) {
|
|
1083
|
+
tx += `
|
|
1084
|
+
${indent}<true/>`;
|
|
1085
|
+
} else {
|
|
1086
|
+
tx += `
|
|
1087
|
+
${indent}<false/>`;
|
|
1088
|
+
}
|
|
1089
|
+
} else if (typeof plist == "string") {
|
|
1090
|
+
if (!plist) {
|
|
1091
|
+
throw new Error("A plist item is empty or not a valid string.");
|
|
1092
|
+
}
|
|
1093
|
+
tx += `
|
|
1094
|
+
${indent}<string>${plist}</string>`;
|
|
1095
|
+
} else if (Array.isArray(plist)) {
|
|
1096
|
+
if (plist.length) {
|
|
1097
|
+
tx += `
|
|
1098
|
+
${indent}<array>`;
|
|
1099
|
+
plist.forEach((value, index) => {
|
|
1100
|
+
if (typeof value == "string") {
|
|
1101
|
+
if (!value) {
|
|
1102
|
+
throw new Error(`${key}[${index}] is empty or not a valid string.`);
|
|
1103
|
+
}
|
|
1104
|
+
tx += `
|
|
1105
|
+
${indent} <string>${value}</string>`;
|
|
1106
|
+
} else if (typeof value == "object" && value) {
|
|
1107
|
+
tx += `
|
|
1108
|
+
${indent}<dict>`;
|
|
1109
|
+
for (const [key2, plist2] of Object.entries(value)) {
|
|
1110
|
+
tx += getDictionaryItem(key2, plist2, startIndentAmount + 1);
|
|
1111
|
+
}
|
|
1112
|
+
tx += `
|
|
1113
|
+
${indent}</dict>`;
|
|
1114
|
+
}
|
|
1115
|
+
});
|
|
1116
|
+
tx += `
|
|
1117
|
+
${indent}</array>`;
|
|
1118
|
+
} else {
|
|
1119
|
+
tx += `
|
|
1120
|
+
<array/>`;
|
|
1121
|
+
}
|
|
1122
|
+
} else if (typeof plist == "object" && plist) {
|
|
1123
|
+
tx += `
|
|
1124
|
+
${indent}<dict>`;
|
|
1125
|
+
for (const [key2, plist2] of Object.entries(plist)) {
|
|
1126
|
+
tx += getDictionaryItem(key2, plist2, startIndentAmount + 1);
|
|
1127
|
+
}
|
|
1128
|
+
tx += `
|
|
1129
|
+
${indent}</dict>`;
|
|
1130
|
+
}
|
|
1131
|
+
return tx;
|
|
804
1132
|
}
|
|
805
1133
|
|
|
806
1134
|
// src/_bin/_main/_init-template/_init-apple/_mod-files/mod-files.mts
|
|
807
1135
|
function modFiles(platform) {
|
|
808
1136
|
appDelegateSwift(platform);
|
|
809
1137
|
podfile(platform);
|
|
1138
|
+
privacyManifest(platform);
|
|
810
1139
|
}
|
|
811
1140
|
// src/_bin/_main/_init-template/_init-apple/init-apple.mts
|
|
812
1141
|
function initApple(platform) {
|
|
813
|
-
const config = GlobalVars.appConfig.get(),
|
|
814
|
-
if (!
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
1142
|
+
const config = GlobalVars.appConfig.get(), appleData = config[platform];
|
|
1143
|
+
if (!appleData) {
|
|
1144
|
+
throw new Error(`"${platform}" config is empty.`);
|
|
1145
|
+
}
|
|
1146
|
+
const projectDirectory = node_path17.dirname(GlobalVars.configFilePath.get()), nativeProjectDirectory = node_path17.join(projectDirectory, platform), templateDir = node_path17.join(GlobalVars.appgenRoot.get(), "template", platform), projectName = getProjectName(config, platform);
|
|
1147
|
+
if (!node_fs12.existsSync(nativeProjectDirectory)) {
|
|
1148
|
+
node_fs12.cpSync(templateDir, nativeProjectDirectory, { recursive: true });
|
|
1149
|
+
node_fs12.renameSync(node_path17.join(nativeProjectDirectory, "HelloWorld"), node_path17.join(nativeProjectDirectory, projectName));
|
|
818
1150
|
}
|
|
819
|
-
|
|
1151
|
+
modFiles(platform);
|
|
820
1152
|
createAssetCatalogs(appleData.assetCatalogs, {
|
|
821
1153
|
bundleIdentifier: appleData.bundleIdentifier,
|
|
822
|
-
platform
|
|
823
|
-
projectName
|
|
1154
|
+
platform
|
|
824
1155
|
});
|
|
825
1156
|
createStringCatalogs(appleData.stringCatalogs, appleData.locales, {
|
|
826
1157
|
platform
|
|
@@ -835,74 +1166,78 @@ function initTemplate() {
|
|
|
835
1166
|
initApple("macos");
|
|
836
1167
|
}
|
|
837
1168
|
} catch (err) {
|
|
838
|
-
const projectDirectory =
|
|
839
|
-
if (
|
|
840
|
-
|
|
1169
|
+
const projectDirectory = node_path18.dirname(GlobalVars.configFilePath.get()), projectMacosDir = node_path18.join(projectDirectory, "macos");
|
|
1170
|
+
if (node_fs13.existsSync(projectMacosDir)) {
|
|
1171
|
+
node_fs13.rmSync(projectMacosDir, { recursive: true, force: true });
|
|
841
1172
|
}
|
|
842
1173
|
throw err;
|
|
843
1174
|
}
|
|
844
1175
|
}
|
|
845
1176
|
// src/_bin/_main/_mod-plugin/mod-plugin.mts
|
|
846
|
-
import * as
|
|
847
|
-
import * as
|
|
1177
|
+
import * as node_fs14 from "node:fs";
|
|
1178
|
+
import * as node_path19 from "node:path";
|
|
848
1179
|
function modPlugin(contextResult) {
|
|
849
|
-
const config = GlobalVars.appConfig.get(), projectDirectory =
|
|
1180
|
+
const config = GlobalVars.appConfig.get(), projectDirectory = node_path19.dirname(GlobalVars.configFilePath.get());
|
|
850
1181
|
{
|
|
851
|
-
const projectName = getProjectName(config, "macos"), nativeProjectDir =
|
|
852
|
-
|
|
853
|
-
|
|
1182
|
+
const projectName = getProjectName(config, "macos"), nativeProjectDir = node_path19.join(projectDirectory, "macos");
|
|
1183
|
+
node_fs14.writeFileSync(node_path19.join(nativeProjectDir, projectName, "AppDelegate.swift"), contextResult.macos.files.Project["AppDelegate.swift"], "utf8");
|
|
1184
|
+
node_fs14.writeFileSync(node_path19.join(nativeProjectDir, "Podfile"), contextResult.macos.files.Podfile, "utf8");
|
|
854
1185
|
}
|
|
855
1186
|
}
|
|
856
1187
|
// src/_bin/_main/_xcodegen/xcodegen.mts
|
|
857
1188
|
import * as node_childProcess2 from "node:child_process";
|
|
858
|
-
import * as
|
|
1189
|
+
import * as node_path23 from "node:path";
|
|
859
1190
|
|
|
860
1191
|
// src/_bin/_main/_xcodegen/_create-project-spec/create-project-spec.mts
|
|
861
|
-
import * as
|
|
1192
|
+
import * as node_fs16 from "node:fs";
|
|
862
1193
|
import * as node_module4 from "node:module";
|
|
863
|
-
import * as
|
|
1194
|
+
import * as node_path21 from "node:path";
|
|
864
1195
|
|
|
865
1196
|
// src/_bin/_main/_xcodegen/_create-project-spec/_init-resources.mts
|
|
866
|
-
import * as
|
|
867
|
-
import * as
|
|
1197
|
+
import * as node_fs15 from "node:fs";
|
|
1198
|
+
import * as node_path20 from "node:path";
|
|
868
1199
|
function initResources(resources, metadata) {
|
|
869
1200
|
if (!resources?.length) {
|
|
870
1201
|
return null;
|
|
871
1202
|
}
|
|
872
|
-
const projectDirectory =
|
|
873
|
-
|
|
874
|
-
|
|
1203
|
+
const projectDirectory = node_path20.dirname(GlobalVars.configFilePath.get()), resourcesDirectory = node_path20.join(projectDirectory, metadata.platform, "Resources"), basenameFiles = [], subpaths = [];
|
|
1204
|
+
node_fs15.rmSync(resourcesDirectory, { recursive: true, force: true });
|
|
1205
|
+
node_fs15.mkdirSync(resourcesDirectory);
|
|
875
1206
|
try {
|
|
876
1207
|
for (const resource of resources) {
|
|
877
|
-
let path =
|
|
878
|
-
if (!
|
|
1208
|
+
let path = node_path20.resolve(projectDirectory, resource);
|
|
1209
|
+
if (!node_fs15.existsSync(path)) {
|
|
879
1210
|
throw new Error(`The ${path} was not found.`);
|
|
880
1211
|
}
|
|
881
|
-
const lstat =
|
|
1212
|
+
const lstat = node_fs15.lstatSync(path);
|
|
882
1213
|
if (lstat.isSymbolicLink()) {
|
|
883
|
-
path =
|
|
1214
|
+
path = node_fs15.realpathSync(path);
|
|
884
1215
|
}
|
|
885
1216
|
console.log(`\x1B[32mCopying resource\x1B[0m \x1B[36m${path}\x1B[0m`);
|
|
886
|
-
|
|
1217
|
+
node_fs15.cpSync(path, node_path20.join(resourcesDirectory, node_path20.basename(path)), {
|
|
887
1218
|
recursive: true,
|
|
888
1219
|
force: true
|
|
889
1220
|
});
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
1221
|
+
if (lstat.isDirectory()) {
|
|
1222
|
+
subpaths.push(node_path20.basename(path));
|
|
1223
|
+
} else {
|
|
1224
|
+
basenameFiles.push(node_path20.basename(path));
|
|
1225
|
+
}
|
|
894
1226
|
}
|
|
895
1227
|
} catch (err) {
|
|
896
|
-
|
|
1228
|
+
node_fs15.rmSync(resourcesDirectory, { force: true, recursive: true });
|
|
897
1229
|
throw err;
|
|
898
1230
|
}
|
|
899
|
-
return
|
|
1231
|
+
return {
|
|
1232
|
+
basenameFiles,
|
|
1233
|
+
subpaths
|
|
1234
|
+
};
|
|
900
1235
|
}
|
|
901
1236
|
|
|
902
1237
|
// src/_bin/_main/_xcodegen/_create-project-spec/create-project-spec.mts
|
|
903
1238
|
function createProjectSpec(platform, overrideConfig) {
|
|
904
|
-
const projectDirectory =
|
|
905
|
-
if (!
|
|
1239
|
+
const projectDirectory = node_path21.dirname(GlobalVars.configFilePath.get()), nativeProjectDir = node_path21.join(projectDirectory, platform);
|
|
1240
|
+
if (!node_fs16.existsSync(projectDirectory)) {
|
|
906
1241
|
throw new Error(`An unexpected happened. ${projectDirectory} was not found.`);
|
|
907
1242
|
}
|
|
908
1243
|
const config = GlobalVars.appConfig.get();
|
|
@@ -912,13 +1247,20 @@ function createProjectSpec(platform, overrideConfig) {
|
|
|
912
1247
|
if (platform == "macos" && !config.macos) {
|
|
913
1248
|
throw new Error(`${platform} configuration was not found.`);
|
|
914
1249
|
}
|
|
915
|
-
const
|
|
1250
|
+
const projectName = getProjectName(config, platform);
|
|
1251
|
+
{
|
|
1252
|
+
const entitlementsFilePath = node_path21.join(nativeProjectDir, projectName, `${projectName}.entitlements`);
|
|
1253
|
+
if (node_fs16.existsSync(entitlementsFilePath)) {
|
|
1254
|
+
node_fs16.rmSync(entitlementsFilePath);
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
const requireFromNativeDirectory = node_module4.createRequire(nativeProjectDir), reactNativeXcodeScriptRelativePath = node_path21.relative(nativeProjectDir, platform == "macos" ? requireFromNativeDirectory.resolve("react-native-macos/scripts/react-native-xcode.sh") : requireFromNativeDirectory.resolve("react-native/scripts/react-native-xcode.sh")), appleData = {
|
|
916
1258
|
...config[platform],
|
|
917
1259
|
infoPlist: {
|
|
918
1260
|
...overrideConfig?.infoPlist,
|
|
919
1261
|
...config[platform].infoPlist
|
|
920
1262
|
}
|
|
921
|
-
},
|
|
1263
|
+
}, resourcesData = initResources(config.macos?.resources, {
|
|
922
1264
|
platform
|
|
923
1265
|
}), json = {
|
|
924
1266
|
name: projectName,
|
|
@@ -932,13 +1274,23 @@ function createProjectSpec(platform, overrideConfig) {
|
|
|
932
1274
|
path: projectName,
|
|
933
1275
|
type: "syncedFolder"
|
|
934
1276
|
},
|
|
935
|
-
...resourcesData?.
|
|
1277
|
+
...resourcesData?.basenameFiles.length ? [{
|
|
1278
|
+
path: "Resources",
|
|
1279
|
+
excludes: resourcesData.subpaths,
|
|
1280
|
+
buildPhase: {
|
|
1281
|
+
copyFiles: {
|
|
1282
|
+
destination: "resources"
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
}] : [],
|
|
1286
|
+
...resourcesData?.subpaths?.map((subpath) => {
|
|
936
1287
|
return {
|
|
937
1288
|
path: "Resources",
|
|
1289
|
+
excludes: resourcesData.basenameFiles,
|
|
938
1290
|
buildPhase: {
|
|
939
1291
|
copyFiles: {
|
|
940
1292
|
destination: "resources",
|
|
941
|
-
subpath
|
|
1293
|
+
subpath
|
|
942
1294
|
}
|
|
943
1295
|
}
|
|
944
1296
|
};
|
|
@@ -964,6 +1316,10 @@ function createProjectSpec(platform, overrideConfig) {
|
|
|
964
1316
|
...appleData.infoPlist
|
|
965
1317
|
}
|
|
966
1318
|
},
|
|
1319
|
+
entitlements: appleData.entitlements ? {
|
|
1320
|
+
path: `${projectName}/${projectName}.entitlements`,
|
|
1321
|
+
properties: appleData.entitlements
|
|
1322
|
+
} : undefined,
|
|
967
1323
|
postBuildScripts: [
|
|
968
1324
|
{
|
|
969
1325
|
name: "Bundle React Native code and images",
|
|
@@ -971,7 +1327,6 @@ function createProjectSpec(platform, overrideConfig) {
|
|
|
971
1327
|
${reactNativeXcodeScriptRelativePath}`
|
|
972
1328
|
}
|
|
973
1329
|
],
|
|
974
|
-
scheme: {},
|
|
975
1330
|
settings: {
|
|
976
1331
|
ASSETCATALOG_COMPILER_APPICON_NAME: appleData.appicon
|
|
977
1332
|
}
|
|
@@ -996,18 +1351,18 @@ ${reactNativeXcodeScriptRelativePath}`
|
|
|
996
1351
|
useBaseInternationalization: false
|
|
997
1352
|
}
|
|
998
1353
|
};
|
|
999
|
-
|
|
1354
|
+
node_fs16.writeFileSync(node_path21.join(nativeProjectDir, "project.json"), JSON.stringify(json, null, 2), "utf8");
|
|
1000
1355
|
}
|
|
1001
1356
|
// src/_bin/_main/_xcodegen/_mod-known-regions/mod-known-regions.mts
|
|
1002
|
-
import * as
|
|
1003
|
-
import * as
|
|
1357
|
+
import * as node_fs17 from "node:fs";
|
|
1358
|
+
import * as node_path22 from "node:path";
|
|
1004
1359
|
function modKnownRegions(platform) {
|
|
1005
1360
|
const config = GlobalVars.appConfig.get(), appleData = config[platform];
|
|
1006
1361
|
if (!appleData?.locales?.length) {
|
|
1007
1362
|
return;
|
|
1008
1363
|
}
|
|
1009
|
-
const projectName = getProjectName(config, platform), pbxprojPath =
|
|
1010
|
-
let file =
|
|
1364
|
+
const projectName = getProjectName(config, platform), pbxprojPath = node_path22.join(node_path22.dirname(GlobalVars.configFilePath.get()), platform, `${projectName}.xcodeproj`, "project.pbxproj");
|
|
1365
|
+
let file = node_fs17.readFileSync(pbxprojPath, "utf8");
|
|
1011
1366
|
let strReplacer = "knownRegions = (";
|
|
1012
1367
|
appleData.locales.forEach((locale) => {
|
|
1013
1368
|
strReplacer += `
|
|
@@ -1015,13 +1370,13 @@ $2${locale},`;
|
|
|
1015
1370
|
});
|
|
1016
1371
|
strReplacer += "$3";
|
|
1017
1372
|
file = file.replace(/knownRegions = \((\n(\t+)\w+,)+(\n\t+\);)/, strReplacer);
|
|
1018
|
-
|
|
1373
|
+
node_fs17.writeFileSync(pbxprojPath, file, "utf8");
|
|
1019
1374
|
}
|
|
1020
1375
|
|
|
1021
1376
|
// src/_bin/_main/_xcodegen/xcodegen.mts
|
|
1022
1377
|
function xcodegen(platform, overrideConfig) {
|
|
1023
1378
|
createProjectSpec(platform, overrideConfig);
|
|
1024
|
-
const xcodegenPath = GlobalVars.argv.get().xcodegenPath, nativeProjectDir =
|
|
1379
|
+
const xcodegenPath = GlobalVars.argv.get().xcodegenPath, nativeProjectDir = node_path23.join(node_path23.dirname(GlobalVars.configFilePath.get()), platform);
|
|
1025
1380
|
node_childProcess2.execSync(`${xcodegenPath} --spec project.json`, {
|
|
1026
1381
|
cwd: nativeProjectDir,
|
|
1027
1382
|
stdio: "inherit"
|
|
@@ -1042,15 +1397,15 @@ async function main() {
|
|
|
1042
1397
|
if (!isValidExt) {
|
|
1043
1398
|
throw new Error(`App config file only compatible with ${configFileExts.join(" | ")}`);
|
|
1044
1399
|
}
|
|
1045
|
-
const targetConfigFilePath =
|
|
1046
|
-
if (!
|
|
1400
|
+
const targetConfigFilePath = node_path24.resolve(process.cwd(), argv.path);
|
|
1401
|
+
if (!node_fs18.existsSync(targetConfigFilePath)) {
|
|
1047
1402
|
throw new Error(`${targetConfigFilePath} file doesn't exist.`);
|
|
1048
1403
|
}
|
|
1049
|
-
configFilePath =
|
|
1404
|
+
configFilePath = node_path24.resolve(process.cwd(), argv.path);
|
|
1050
1405
|
} else {
|
|
1051
1406
|
for (let i = 0;i < configFileExts.length; i++) {
|
|
1052
|
-
const targetConfigFilePath =
|
|
1053
|
-
if (
|
|
1407
|
+
const targetConfigFilePath = node_path24.join(process.cwd(), `bundo.config.${configFileExts[i]}`);
|
|
1408
|
+
if (node_fs18.existsSync(targetConfigFilePath)) {
|
|
1054
1409
|
configFilePath = targetConfigFilePath;
|
|
1055
1410
|
break;
|
|
1056
1411
|
} else if (i == configFileExts.length - 1) {
|
|
@@ -1095,7 +1450,7 @@ var configFileExts = [
|
|
|
1095
1450
|
"js"
|
|
1096
1451
|
];
|
|
1097
1452
|
function isValidConfigFileExt(filePath) {
|
|
1098
|
-
const ext =
|
|
1453
|
+
const ext = node_path24.extname(filePath);
|
|
1099
1454
|
if (!ext) {
|
|
1100
1455
|
return false;
|
|
1101
1456
|
}
|