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
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as node_fs from "node:fs"
|
|
2
|
+
import * as node_path from "node:path"
|
|
3
|
+
|
|
4
|
+
import type * as Config from "../../../../../config/index.mts"
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
GlobalVars,
|
|
8
|
+
} from "../../../../_global-vars/index.mts"
|
|
9
|
+
|
|
10
|
+
export function privacyManifest(
|
|
11
|
+
platform: "macos",
|
|
12
|
+
) {
|
|
13
|
+
|
|
14
|
+
const
|
|
15
|
+
manifest =
|
|
16
|
+
GlobalVars.appConfig.get()[platform as "macos"]?.privacyManifest
|
|
17
|
+
|
|
18
|
+
if(!manifest) {
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const
|
|
23
|
+
nativeProjectDir =
|
|
24
|
+
node_path.join(
|
|
25
|
+
node_path.dirname(GlobalVars.configFilePath.get()),
|
|
26
|
+
platform,
|
|
27
|
+
),
|
|
28
|
+
|
|
29
|
+
privacyInfoFilePath =
|
|
30
|
+
node_path.join(nativeProjectDir, "PrivacyInfo.xcprivacy")
|
|
31
|
+
|
|
32
|
+
let privacyInfoFile = `<?xml version="1.0" encoding="UTF-8"?>
|
|
33
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
34
|
+
<plist version="1.0">
|
|
35
|
+
<dict>`
|
|
36
|
+
|
|
37
|
+
for(const [key, plist] of Object.entries(manifest)) {
|
|
38
|
+
privacyInfoFile += getDictionaryItem(key, plist)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
privacyInfoFile += `
|
|
42
|
+
</dict>
|
|
43
|
+
</plist>`
|
|
44
|
+
|
|
45
|
+
node_fs.writeFileSync(
|
|
46
|
+
privacyInfoFilePath,
|
|
47
|
+
privacyInfoFile,
|
|
48
|
+
"utf8",
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Info.plist and .entitlements file has done by the XcodeGen,
|
|
55
|
+
* but if there are other plist-format files that we need to create than the PrivacyInfo.xcprivacy,
|
|
56
|
+
* it is better to move out this function as a reusable helper for
|
|
57
|
+
* writing a plist XML file.
|
|
58
|
+
*/
|
|
59
|
+
function getDictionaryItem(
|
|
60
|
+
key: string,
|
|
61
|
+
plist: Config.Apple.PlistValue,
|
|
62
|
+
startIndentAmount: number = 1,
|
|
63
|
+
): string {
|
|
64
|
+
|
|
65
|
+
const indent = Array(startIndentAmount).fill("\t").join("")
|
|
66
|
+
|
|
67
|
+
let tx = `\n${indent}<key>${key}</key>`
|
|
68
|
+
|
|
69
|
+
if(typeof plist == "boolean") {
|
|
70
|
+
if(plist) {
|
|
71
|
+
tx += `\n${indent}<true/>`
|
|
72
|
+
} else {
|
|
73
|
+
tx += `\n${indent}<false/>`
|
|
74
|
+
}
|
|
75
|
+
} else if(typeof plist == "string") {
|
|
76
|
+
if(!plist) {
|
|
77
|
+
throw new Error("A plist item is empty or not a valid string.")
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
tx += `\n${indent}<string>${plist}</string>`
|
|
81
|
+
} else if(Array.isArray(plist)) {
|
|
82
|
+
if(plist.length) {
|
|
83
|
+
tx += `\n${indent}<array>`
|
|
84
|
+
|
|
85
|
+
plist.forEach((value, index) => {
|
|
86
|
+
if(typeof value == "string") {
|
|
87
|
+
if(!value) {
|
|
88
|
+
throw new Error(`${key}[${index}] is empty or not a valid string.`)
|
|
89
|
+
}
|
|
90
|
+
tx += `\n${indent}\t<string>${value}</string>`
|
|
91
|
+
} else if(typeof value == "object" && value) {
|
|
92
|
+
tx += `\n${indent}<dict>`
|
|
93
|
+
|
|
94
|
+
for(const [key2, plist2] of Object.entries(value)) {
|
|
95
|
+
tx += getDictionaryItem(key2, plist2, startIndentAmount + 1)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
tx += `\n${indent}</dict>`
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
tx += `\n${indent}</array>`
|
|
103
|
+
} else {
|
|
104
|
+
// allow empty array in the plist
|
|
105
|
+
tx += `\n<array/>`
|
|
106
|
+
}
|
|
107
|
+
} else if(typeof plist == "object" && plist) {
|
|
108
|
+
tx += `\n${indent}<dict>`
|
|
109
|
+
|
|
110
|
+
for(const [key2, plist2] of Object.entries(plist)) {
|
|
111
|
+
tx += getDictionaryItem(key2, plist2, startIndentAmount + 1)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
tx += `\n${indent}</dict>`
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return tx
|
|
118
|
+
|
|
119
|
+
}
|
|
@@ -4,14 +4,20 @@ import {
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
podfile,
|
|
7
|
-
} from "./_podfile.mts"
|
|
7
|
+
} from "./_podfile/index.mts"
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
privacyManifest,
|
|
11
|
+
} from "./_privacy-manifest.mts"
|
|
8
12
|
|
|
9
13
|
export function modFiles(
|
|
10
|
-
platform: "macos"
|
|
14
|
+
platform: "macos",
|
|
11
15
|
) {
|
|
12
16
|
|
|
13
17
|
appDelegateSwift(platform)
|
|
14
18
|
|
|
15
19
|
podfile(platform)
|
|
16
20
|
|
|
21
|
+
privacyManifest(platform)
|
|
22
|
+
|
|
17
23
|
}
|
|
@@ -22,13 +22,23 @@ import {
|
|
|
22
22
|
} from "./_mod-files/index.mts"
|
|
23
23
|
|
|
24
24
|
export function initApple(
|
|
25
|
-
platform: "macos"
|
|
25
|
+
platform: "macos",
|
|
26
26
|
) {
|
|
27
27
|
const
|
|
28
|
-
// config.macos is already checked at bundo-appgen/src/_bin/_main/main.mts
|
|
29
28
|
config =
|
|
30
29
|
GlobalVars.appConfig.get(),
|
|
31
30
|
|
|
31
|
+
appleData =
|
|
32
|
+
config[platform]
|
|
33
|
+
|
|
34
|
+
// `config.macos` is already checked at bundo-appgen/src/_bin/_main/main.mts
|
|
35
|
+
// but if somehow if bundo-appgen is supporting other Apple platforms,
|
|
36
|
+
// we need a correct check in the bundo-appgen/src/_bin/_check-config-validitidy.mts
|
|
37
|
+
if(!appleData) {
|
|
38
|
+
throw new Error(`"${platform}" config is empty.`)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const
|
|
32
42
|
projectDirectory =
|
|
33
43
|
node_path.dirname(GlobalVars.configFilePath.get()),
|
|
34
44
|
|
|
@@ -54,20 +64,15 @@ export function initApple(
|
|
|
54
64
|
node_path.join(nativeProjectDirectory, "HelloWorld"),
|
|
55
65
|
node_path.join(nativeProjectDirectory, projectName),
|
|
56
66
|
)
|
|
57
|
-
|
|
58
|
-
modFiles(platform)
|
|
59
67
|
}
|
|
60
68
|
|
|
61
|
-
|
|
62
|
-
// TODO : "ios"
|
|
63
|
-
const appleData = config[platform as "macos"]!
|
|
69
|
+
modFiles(platform)
|
|
64
70
|
|
|
65
71
|
createAssetCatalogs(
|
|
66
72
|
appleData.assetCatalogs,
|
|
67
73
|
{
|
|
68
74
|
bundleIdentifier: appleData.bundleIdentifier,
|
|
69
75
|
platform,
|
|
70
|
-
projectName,
|
|
71
76
|
},
|
|
72
77
|
)
|
|
73
78
|
|
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
export function initTemplate() {
|
|
13
13
|
// config object is already checked at ../main.mts
|
|
14
14
|
|
|
15
|
+
// The platform target check here is not correct if we are supporting other platforms.
|
|
16
|
+
// bundo-appgen is only supporting the "macos" at this moment.
|
|
15
17
|
try {
|
|
16
18
|
if(process.platform == "darwin") {
|
|
17
19
|
initApple("macos")
|
|
@@ -9,15 +9,19 @@ import {
|
|
|
9
9
|
GlobalVars,
|
|
10
10
|
} from "../../../_global-vars/index.mts"
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* This function is probably better at inside of ./_bin/_main/_init-template/_init-apple,
|
|
14
|
+
* but create-project-spec.mts needs the directory name as the "subpath" resource configuration.
|
|
15
|
+
*/
|
|
12
16
|
export function initResources(
|
|
13
17
|
resources: Config.Apple.Data["resources"],
|
|
14
18
|
metadata: {
|
|
15
19
|
platform: "macos" | "ios",
|
|
16
20
|
},
|
|
17
21
|
): {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
22
|
+
basenameFiles: string[],
|
|
23
|
+
subpaths: string[],
|
|
24
|
+
} | null {
|
|
21
25
|
|
|
22
26
|
if(!resources?.length) {
|
|
23
27
|
return null
|
|
@@ -36,7 +40,10 @@ export function initResources(
|
|
|
36
40
|
"Resources",
|
|
37
41
|
),
|
|
38
42
|
|
|
39
|
-
|
|
43
|
+
basenameFiles: NonNullable<ReturnType<typeof initResources>>["basenameFiles"] =
|
|
44
|
+
[],
|
|
45
|
+
|
|
46
|
+
subpaths: NonNullable<ReturnType<typeof initResources>>["subpaths"] =
|
|
40
47
|
[]
|
|
41
48
|
|
|
42
49
|
node_fs.rmSync(resourcesDirectory, { recursive: true, force: true })
|
|
@@ -70,10 +77,11 @@ export function initResources(
|
|
|
70
77
|
},
|
|
71
78
|
)
|
|
72
79
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
if(lstat.isDirectory()) {
|
|
81
|
+
subpaths.push(node_path.basename(path))
|
|
82
|
+
} else {
|
|
83
|
+
basenameFiles.push(node_path.basename(path))
|
|
84
|
+
}
|
|
77
85
|
}
|
|
78
86
|
} catch(err) {
|
|
79
87
|
// remove the resources directory upon error
|
|
@@ -81,6 +89,10 @@ export function initResources(
|
|
|
81
89
|
throw err
|
|
82
90
|
}
|
|
83
91
|
|
|
84
|
-
return data
|
|
92
|
+
// return data
|
|
93
|
+
return {
|
|
94
|
+
basenameFiles,
|
|
95
|
+
subpaths,
|
|
96
|
+
}
|
|
85
97
|
|
|
86
98
|
}
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
* Create `project.json` file in the "<project>/macos" directory.
|
|
21
21
|
*/
|
|
22
22
|
export function createProjectSpec(
|
|
23
|
-
platform: "macos"
|
|
23
|
+
platform: "macos",
|
|
24
24
|
overrideConfig?: {
|
|
25
25
|
infoPlist?: Config.Apple.Data["infoPlist"],
|
|
26
26
|
},
|
|
@@ -42,7 +42,7 @@ export function createProjectSpec(
|
|
|
42
42
|
config =
|
|
43
43
|
GlobalVars.appConfig.get()
|
|
44
44
|
|
|
45
|
-
// TODO :
|
|
45
|
+
// TODO : other Apple platforms
|
|
46
46
|
if(
|
|
47
47
|
config.macos?.appicon &&
|
|
48
48
|
(
|
|
@@ -56,11 +56,24 @@ export function createProjectSpec(
|
|
|
56
56
|
|
|
57
57
|
if(
|
|
58
58
|
(platform == "macos" && !config.macos)
|
|
59
|
-
// TODO :
|
|
59
|
+
// TODO : other Apple platforms
|
|
60
60
|
) {
|
|
61
61
|
throw new Error(`${platform} configuration was not found.`)
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
const projectName = ConfigHelpers.getProjectName(config, platform)! // already validated
|
|
65
|
+
|
|
66
|
+
{
|
|
67
|
+
// remove the .entitlements file if any and rewrite if the entitlements properties is given.
|
|
68
|
+
// We need this because XcodeGen doesn't remove previous properties.
|
|
69
|
+
|
|
70
|
+
const entitlementsFilePath = node_path.join(nativeProjectDir, projectName, `${projectName}.entitlements`)
|
|
71
|
+
|
|
72
|
+
if(node_fs.existsSync(entitlementsFilePath)) {
|
|
73
|
+
node_fs.rmSync(entitlementsFilePath)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
64
77
|
const
|
|
65
78
|
requireFromNativeDirectory =
|
|
66
79
|
node_module.createRequire(nativeProjectDir),
|
|
@@ -74,19 +87,14 @@ export function createProjectSpec(
|
|
|
74
87
|
),
|
|
75
88
|
|
|
76
89
|
appleData: Config.Apple.Data =
|
|
77
|
-
// Intentionally asserted as "macos"
|
|
78
|
-
// TODO : "ios"
|
|
79
90
|
{
|
|
80
|
-
...config[platform
|
|
91
|
+
...config[platform]!,
|
|
81
92
|
infoPlist: {
|
|
82
93
|
...overrideConfig?.infoPlist,
|
|
83
|
-
...config[platform
|
|
94
|
+
...config[platform]!.infoPlist, // client's infoPlist takes precedence over the plugin
|
|
84
95
|
},
|
|
85
96
|
},
|
|
86
97
|
|
|
87
|
-
projectName =
|
|
88
|
-
ConfigHelpers.getProjectName(config, platform)!, // already validated
|
|
89
|
-
|
|
90
98
|
resourcesData =
|
|
91
99
|
initResources(
|
|
92
100
|
config.macos?.resources,
|
|
@@ -95,12 +103,10 @@ export function createProjectSpec(
|
|
|
95
103
|
},
|
|
96
104
|
),
|
|
97
105
|
|
|
98
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
99
|
-
|
|
100
106
|
/**
|
|
101
107
|
* See https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md
|
|
102
108
|
*/
|
|
103
|
-
json: Record<string,
|
|
109
|
+
json: Record<string, unknown> =
|
|
104
110
|
{
|
|
105
111
|
|
|
106
112
|
name: projectName,
|
|
@@ -116,26 +122,37 @@ export function createProjectSpec(
|
|
|
116
122
|
path: projectName,
|
|
117
123
|
type: "syncedFolder",
|
|
118
124
|
},
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The path "Resources" is just our group, and also our custom directory,
|
|
128
|
+
* not an actual bundle resource directory content of macOS app, e.g. /Applications/HelloWorld.app/Contents/Resources.
|
|
129
|
+
* The naming is purely a coincidence.
|
|
130
|
+
*
|
|
131
|
+
* We intentionally to copy user files to our directory called "Resources".
|
|
132
|
+
* Any user files will be copied to our "Resources" directory.
|
|
133
|
+
*
|
|
134
|
+
* See placing content in a bundle
|
|
135
|
+
* https://developer.apple.com/documentation/bundleresources/placing-content-in-a-bundle?language=objc
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
...(resourcesData?.basenameFiles.length ? [{
|
|
139
|
+
path: "Resources",
|
|
140
|
+
excludes: resourcesData.subpaths,
|
|
141
|
+
buildPhase: {
|
|
142
|
+
copyFiles: {
|
|
143
|
+
destination: "resources",
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
}] : []),
|
|
147
|
+
|
|
148
|
+
...(resourcesData?.subpaths?.map(subpath => {
|
|
131
149
|
return {
|
|
132
150
|
path: "Resources",
|
|
151
|
+
excludes: resourcesData.basenameFiles,
|
|
133
152
|
buildPhase: {
|
|
134
153
|
copyFiles: {
|
|
135
154
|
destination: "resources",
|
|
136
|
-
subpath
|
|
137
|
-
? resource.basename
|
|
138
|
-
: undefined,
|
|
155
|
+
subpath,
|
|
139
156
|
},
|
|
140
157
|
},
|
|
141
158
|
}
|
|
@@ -162,6 +179,12 @@ export function createProjectSpec(
|
|
|
162
179
|
...appleData.infoPlist,
|
|
163
180
|
},
|
|
164
181
|
},
|
|
182
|
+
|
|
183
|
+
entitlements: appleData.entitlements ? {
|
|
184
|
+
path: `${projectName}/${projectName}.entitlements`,
|
|
185
|
+
properties: appleData.entitlements,
|
|
186
|
+
} : undefined,
|
|
187
|
+
|
|
165
188
|
postBuildScripts: [
|
|
166
189
|
{
|
|
167
190
|
name: "Bundle React Native code and images",
|
|
@@ -169,8 +192,6 @@ export function createProjectSpec(
|
|
|
169
192
|
},
|
|
170
193
|
],
|
|
171
194
|
|
|
172
|
-
scheme: {},
|
|
173
|
-
|
|
174
195
|
settings: {
|
|
175
196
|
ASSETCATALOG_COMPILER_APPICON_NAME: appleData.appicon,
|
|
176
197
|
},
|
|
@@ -206,8 +227,6 @@ export function createProjectSpec(
|
|
|
206
227
|
|
|
207
228
|
}
|
|
208
229
|
|
|
209
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
210
|
-
|
|
211
230
|
node_fs.writeFileSync(
|
|
212
231
|
node_path.join(
|
|
213
232
|
nativeProjectDir, "project.json",
|
|
@@ -10,14 +10,14 @@ import {
|
|
|
10
10
|
} from "../../_helpers/index.mts"
|
|
11
11
|
|
|
12
12
|
export function modKnownRegions(
|
|
13
|
-
platform: "macos"
|
|
13
|
+
platform: "macos",
|
|
14
14
|
) {
|
|
15
15
|
const
|
|
16
16
|
config =
|
|
17
17
|
GlobalVars.appConfig.get(),
|
|
18
18
|
|
|
19
19
|
appleData =
|
|
20
|
-
config[platform as "macos"] // TODO :
|
|
20
|
+
config[platform as "macos"] // TODO : other Apple platforms
|
|
21
21
|
|
|
22
22
|
if(!appleData?.locales?.length) {
|
|
23
23
|
return
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./_mod-known-regions/mod-known-regions.mts"
|
|
15
15
|
|
|
16
16
|
export function xcodegen(
|
|
17
|
-
platform: "macos"
|
|
17
|
+
platform: "macos",
|
|
18
18
|
overrideConfig?: Parameters<typeof createProjectSpec>[1],
|
|
19
19
|
) {
|
|
20
20
|
createProjectSpec(platform, overrideConfig)
|
package/src/_bin/_main/main.mts
CHANGED
|
@@ -4,30 +4,3 @@ import type {
|
|
|
4
4
|
|
|
5
5
|
export interface PluginRunnerContextResult extends Omit<Plugin.Context, "parameter"> {
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
// export interface PluginRunnerContextResult extends Omit<Plugin.Context, "parameter" | "macos"> {
|
|
9
|
-
// macos: Omit<
|
|
10
|
-
// Plugin.Context["macos"],
|
|
11
|
-
// | "files"
|
|
12
|
-
// > & {
|
|
13
|
-
// files: Omit<
|
|
14
|
-
// Plugin.Apple.Files,
|
|
15
|
-
// | "add"
|
|
16
|
-
// | "Project"
|
|
17
|
-
// > & {
|
|
18
|
-
// Project: Omit<
|
|
19
|
-
// Plugin.Apple.Files["Project"],
|
|
20
|
-
// | "add"
|
|
21
|
-
// > & {
|
|
22
|
-
// pluginFiles: {
|
|
23
|
-
// filename: string,
|
|
24
|
-
// source: string,
|
|
25
|
-
// }[],
|
|
26
|
-
// },
|
|
27
|
-
// pluginFiles: {
|
|
28
|
-
// filename: string,
|
|
29
|
-
// source: string,
|
|
30
|
-
// }[],
|
|
31
|
-
// }
|
|
32
|
-
// }
|
|
33
|
-
// }
|
|
@@ -9,5 +9,5 @@ export type AssetCatalogsNamespaced =
|
|
|
9
9
|
* Stated by Xcode
|
|
10
10
|
* "The app icon set must be a top level object in the asset."
|
|
11
11
|
*/
|
|
12
|
-
[Namespace
|
|
12
|
+
[Namespace: Exclude<string, keyof AssetCatalogs>]: Omit<AssetCatalogs, "appiconsets"> | AssetCatalogsNamespaced
|
|
13
13
|
}
|
package/src/config/apple/data.ts
CHANGED
|
@@ -7,11 +7,23 @@ import type {
|
|
|
7
7
|
} from "./asset-catalogs-namespaced"
|
|
8
8
|
|
|
9
9
|
import type {
|
|
10
|
-
|
|
11
|
-
} from "./
|
|
10
|
+
Plist,
|
|
11
|
+
} from "./plist"
|
|
12
|
+
|
|
13
|
+
import type * as Podfile from "./podfile"
|
|
12
14
|
|
|
13
15
|
export interface Data {
|
|
14
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated
|
|
19
|
+
* React Native will move away from CocoaPods, and use Swift Package Manager.
|
|
20
|
+
* Consider this deprecation as a warning, because Swift Package Manager in React Native is still experimental.
|
|
21
|
+
* You can still use this until Swift Package Manager is supported in React Native completely.
|
|
22
|
+
*/
|
|
23
|
+
Podfile?: {
|
|
24
|
+
dependencies?: Podfile.PodDependency[],
|
|
25
|
+
},
|
|
26
|
+
|
|
15
27
|
/**
|
|
16
28
|
* Use one name of `appiconsets` in Asset Catalogs as the app icon.
|
|
17
29
|
* appgen script will throw an error if the name given is not found in the catalog.
|
|
@@ -34,12 +46,18 @@ export interface Data {
|
|
|
34
46
|
|
|
35
47
|
bundleIdentifier: string,
|
|
36
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Key-value pairs that grant an executable permission to use a service or technology.
|
|
51
|
+
* @see https://developer.apple.com/documentation/bundleresources/entitlements
|
|
52
|
+
*/
|
|
53
|
+
entitlements?: Plist,
|
|
54
|
+
|
|
37
55
|
/**
|
|
38
56
|
* Customize the information property list values for your app.
|
|
39
57
|
*
|
|
40
58
|
* For human readable information property list, you can localize the information property through string catalog. See {@link stringCatalogs|`stringCatalogs`}
|
|
41
59
|
*/
|
|
42
|
-
infoPlist?:
|
|
60
|
+
infoPlist?: Plist,
|
|
43
61
|
|
|
44
62
|
/**
|
|
45
63
|
* Provide array of [language identifier](https://developer.apple.com/documentation/xcode/choosing-localization-regions-and-scripts), made up of a [2-letter language code](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) of your desired language, with an optional region code (for example, en-US or en-GB).
|
|
@@ -62,13 +80,18 @@ export interface Data {
|
|
|
62
80
|
*/
|
|
63
81
|
name?: string,
|
|
64
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Describe the data your app or third-party SDK collects and the required reasons APIs it uses.
|
|
85
|
+
*/
|
|
86
|
+
privacyManifest?: Plist,
|
|
87
|
+
|
|
65
88
|
/**
|
|
66
89
|
* Add files to the native bundle resources directory, e.g. "/Applications/Hello World.app/Contents/Resources".
|
|
67
90
|
* This property expects an array of string, which the string represent as the path, and it can be pointing to a specific file or a directory.
|
|
68
91
|
*
|
|
69
92
|
* For example, "../node_modules/foo-bar-module/xyz/abc" will copy the "abc" including its files if it is directory. Your app will has "abc" under bundle resources directory, e.g. "/Applications/Hello World.app/Contents/Resources/abc".
|
|
70
93
|
*
|
|
71
|
-
* For another real example, you can copy your font files
|
|
94
|
+
* For another real example, you can copy your font files to the bundle resources, and use it in your React Native macOS app.
|
|
72
95
|
*
|
|
73
96
|
* ```ts
|
|
74
97
|
* import type { Config } from "bundo.rn/appgen"
|
|
@@ -3,5 +3,6 @@ export type * from "./asset-catalogs.ts"
|
|
|
3
3
|
export type * from "./asset-catalogs-namespaced.ts"
|
|
4
4
|
export * from "./create-osx-appiconset.mts"
|
|
5
5
|
export type * from "./data.ts"
|
|
6
|
-
export type * from "./
|
|
7
|
-
export type * from "./
|
|
6
|
+
export type * from "./plist.ts"
|
|
7
|
+
export type * from "./plist-value.ts"
|
|
8
|
+
export type * as Podfile from "./podfile/index.ts"
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type PlistValue =
|
|
2
2
|
| boolean
|
|
3
3
|
| string
|
|
4
4
|
| string[]
|
|
5
5
|
| DictionaryValue
|
|
6
|
+
| DictionaryValue[]
|
|
6
7
|
|
|
7
8
|
type DictionaryValue = {
|
|
8
9
|
[Key in string]:
|
|
@@ -10,7 +11,7 @@ type DictionaryValue = {
|
|
|
10
11
|
| string
|
|
11
12
|
| string[]
|
|
12
13
|
| DictionaryValue
|
|
13
|
-
| {
|
|
14
|
-
|
|
15
|
-
}[]
|
|
14
|
+
// | {
|
|
15
|
+
// [Key2 in string]: DictionaryValue
|
|
16
|
+
// }[]
|
|
16
17
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface PodDependencyFromCocoapods {
|
|
2
|
+
|
|
3
|
+
type: "cocoapods",
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The pod name or a name for specific subspec e.g. "QueryKit/Attribute".
|
|
7
|
+
*/
|
|
8
|
+
name: string,
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Use latest or specific version of a Pod. See {@link https://guides.cocoapods.org/using/the-podfile.html#specifying-pod-versions|Specifying Pod Versions}
|
|
12
|
+
*/
|
|
13
|
+
version?: string,
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface PodDependencyFromGit {
|
|
2
|
+
|
|
3
|
+
type: "git",
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The pod name or a name for specific subspec e.g. "QueryKit/Attribute".
|
|
7
|
+
*/
|
|
8
|
+
name: string,
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @example "https://github.com/facebook/react-native.git"
|
|
12
|
+
*/
|
|
13
|
+
url: string,
|
|
14
|
+
|
|
15
|
+
revision?: {
|
|
16
|
+
type:
|
|
17
|
+
| "branch"
|
|
18
|
+
| "tag"
|
|
19
|
+
| "commit",
|
|
20
|
+
ref: string,
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface PodDependencyFromLocal {
|
|
2
|
+
|
|
3
|
+
type: "local",
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The pod name or a name for specific subspec e.g. "QueryKit/Attribute".
|
|
7
|
+
*/
|
|
8
|
+
name: string,
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Using the files from a local folder to the machine.
|
|
12
|
+
*/
|
|
13
|
+
path: string,
|
|
14
|
+
|
|
15
|
+
}
|