react-native-asset 2.2.9 → 2.2.12
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/esm/clean-assets/ios.d.ts.map +1 -1
- package/esm/clean-assets/ios.js +12 -10
- package/esm/copy-assets/ios.d.ts.map +1 -1
- package/esm/copy-assets/ios.js +10 -9
- package/esm/main.d.ts.map +1 -1
- package/esm/main.js +2 -1
- package/esm/react-native-lib/ios/getBuildProperty.d.ts +1 -8
- package/esm/react-native-lib/ios/getBuildProperty.d.ts.map +1 -1
- package/esm/react-native-lib/ios/getBuildProperty.js +3 -3
- package/esm/react-native-lib/ios/getPlist.d.ts +1 -1
- package/esm/react-native-lib/ios/getPlist.d.ts.map +1 -1
- package/esm/react-native-lib/ios/getPlist.js +2 -2
- package/esm/react-native-lib/ios/getPlistPath.d.ts +1 -1
- package/esm/react-native-lib/ios/getPlistPath.d.ts.map +1 -1
- package/esm/react-native-lib/ios/getPlistPath.js +2 -2
- package/esm/react-native-lib/ios/writePlist.d.ts +1 -1
- package/esm/react-native-lib/ios/writePlist.d.ts.map +1 -1
- package/esm/react-native-lib/ios/writePlist.js +2 -2
- package/esm/utils.d.ts +10 -0
- package/esm/utils.d.ts.map +1 -0
- package/esm/utils.js +12 -0
- package/package.json +1 -1
- package/script/clean-assets/ios.d.ts.map +1 -1
- package/script/clean-assets/ios.js +12 -10
- package/script/copy-assets/ios.d.ts.map +1 -1
- package/script/copy-assets/ios.js +10 -9
- package/script/main.d.ts.map +1 -1
- package/script/main.js +2 -1
- package/script/react-native-lib/ios/getBuildProperty.d.ts +1 -8
- package/script/react-native-lib/ios/getBuildProperty.d.ts.map +1 -1
- package/script/react-native-lib/ios/getBuildProperty.js +3 -3
- package/script/react-native-lib/ios/getPlist.d.ts +1 -1
- package/script/react-native-lib/ios/getPlist.d.ts.map +1 -1
- package/script/react-native-lib/ios/getPlist.js +2 -2
- package/script/react-native-lib/ios/getPlistPath.d.ts +1 -1
- package/script/react-native-lib/ios/getPlistPath.d.ts.map +1 -1
- package/script/react-native-lib/ios/getPlistPath.js +2 -2
- package/script/react-native-lib/ios/writePlist.d.ts +1 -1
- package/script/react-native-lib/ios/writePlist.d.ts.map +1 -1
- package/script/react-native-lib/ios/writePlist.js +2 -2
- package/script/utils.d.ts +10 -0
- package/script/utils.d.ts.map +1 -0
- package/script/utils.js +16 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../src/clean-assets/ios.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../src/clean-assets/ios.ts"],"names":[],"mappings":"AASA,wBAA8B,cAAc,CAC1C,SAAS,EAAE,MAAM,EAAE,EACnB,cAAc,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,EACrD,OAAO,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,iBA+B9B"}
|
package/esm/clean-assets/ios.js
CHANGED
|
@@ -5,19 +5,21 @@ import * as xcode from "xcode";
|
|
|
5
5
|
import createGroupWithMessage from "../react-native-lib/ios/createGroupWithMessage.js";
|
|
6
6
|
import getPlist from "../react-native-lib/ios/getPlist.js";
|
|
7
7
|
import writePlist from "../react-native-lib/ios/writePlist.js";
|
|
8
|
+
import { getTargetUUIDs } from "../utils.js";
|
|
8
9
|
export default async function cleanAssetsIos(filePaths, platformConfig, options) {
|
|
9
10
|
const project = xcode.project(platformConfig.pbxprojPath).parseSync();
|
|
10
|
-
const plist = await getPlist(project, platformConfig
|
|
11
|
-
.path);
|
|
12
11
|
createGroupWithMessage(project, "Resources");
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
for (const targetUUID of getTargetUUIDs(project)) {
|
|
13
|
+
const plist = await getPlist(project, platformConfig.path, targetUUID);
|
|
14
|
+
const removedFiles = filePaths.map((p) => {
|
|
15
|
+
return project.removeResourceFile(path.relative(platformConfig.path, p), { target: targetUUID });
|
|
16
|
+
}).filter((x) => x).map((file) => file.basename);
|
|
17
|
+
if (options.addFont) {
|
|
18
|
+
const existingFonts = plist.UIAppFonts || [];
|
|
19
|
+
const allFonts = existingFonts.filter((file) => removedFiles.indexOf(file) === -1);
|
|
20
|
+
plist.UIAppFonts = Array.from(new Set(allFonts)); // use Set to dedupe w/existing
|
|
21
|
+
}
|
|
22
|
+
await writePlist(project, platformConfig.path, plist, targetUUID);
|
|
20
23
|
}
|
|
21
24
|
await dntShim.Deno.writeTextFile(platformConfig.pbxprojPath, project.writeSync());
|
|
22
|
-
writePlist(project, platformConfig.path, plist);
|
|
23
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../src/copy-assets/ios.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../src/copy-assets/ios.ts"],"names":[],"mappings":"AAWA,wBAA8B,cAAc,CAC1C,SAAS,EAAE,MAAM,EAAE,EACnB,cAAc,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,EACrD,OAAO,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,iBAsC9B"}
|
package/esm/copy-assets/ios.js
CHANGED
|
@@ -7,6 +7,7 @@ import * as xcodeParser from "xcode/lib/parser/pbxproj.js";
|
|
|
7
7
|
import createGroupWithMessage from "../react-native-lib/ios/createGroupWithMessage.js";
|
|
8
8
|
import getPlist from "../react-native-lib/ios/getPlist.js";
|
|
9
9
|
import writePlist from "../react-native-lib/ios/writePlist.js";
|
|
10
|
+
import { getTargetUUIDs } from "../utils.js";
|
|
10
11
|
export default async function cleanAssetsIos(filePaths, platformConfig, options) {
|
|
11
12
|
const project = xcode.project(platformConfig.pbxprojPath);
|
|
12
13
|
const pbxprojContent = await dntShim.Deno.readFile(platformConfig.pbxprojPath).then((buf) => {
|
|
@@ -14,16 +15,16 @@ export default async function cleanAssetsIos(filePaths, platformConfig, options)
|
|
|
14
15
|
return decoder.decode(buf);
|
|
15
16
|
});
|
|
16
17
|
project.hash = xcodeParser.parse(pbxprojContent);
|
|
17
|
-
const plist = await getPlist(project, platformConfig
|
|
18
|
-
.path);
|
|
19
18
|
createGroupWithMessage(project, "Resources");
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
for (const targetUUID of getTargetUUIDs(project)) {
|
|
20
|
+
const plist = await getPlist(project, platformConfig.path, targetUUID);
|
|
21
|
+
const addedFiles = filePaths.map((p) => project.addResourceFile(path.relative(platformConfig.path, p), { target: targetUUID })).filter((x) => x).map((file) => file.basename);
|
|
22
|
+
if (options.addFont) {
|
|
23
|
+
const existingFonts = plist.UIAppFonts || [];
|
|
24
|
+
const allFonts = [...existingFonts, ...addedFiles];
|
|
25
|
+
plist.UIAppFonts = Array.from(new Set(allFonts)); // use Set to dedupe w/existing
|
|
26
|
+
}
|
|
27
|
+
await writePlist(project, platformConfig.path, plist, targetUUID);
|
|
26
28
|
}
|
|
27
29
|
await dntShim.Deno.writeTextFile(platformConfig.pbxprojPath, project.writeSync());
|
|
28
|
-
await writePlist(project, platformConfig.path, plist);
|
|
29
30
|
}
|
package/esm/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AASA,KAAK,YAAY,GAAG,KAAK,GAAG,SAAS,CAAC;AAEtC,eAAO,MAAM,UAAU,GACrB,wCAIG;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,GACR,CAAC,IAAI,YAAY,GAAG;QACnB,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,MAAM,EAAE,CAAC;KAClB,GACF,CAAC;CACH,KACA,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AASA,KAAK,YAAY,GAAG,KAAK,GAAG,SAAS,CAAC;AAEtC,eAAO,MAAM,UAAU,GACrB,wCAIG;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,GACR,CAAC,IAAI,YAAY,GAAG;QACnB,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,MAAM,EAAE,CAAC;KAClB,GACF,CAAC;CACH,KACA,OAAO,CAAC,IAAI,CA4Wd,CAAC"}
|
package/esm/main.js
CHANGED
|
@@ -183,7 +183,8 @@ export const linkAssets = async ({ rootPath, platforms, shouldUnlink = true, })
|
|
|
183
183
|
.map((asset) => ({
|
|
184
184
|
...asset,
|
|
185
185
|
path: path.relative(rp, asset.path).split(path.SEPARATOR).join("/"),
|
|
186
|
-
}))
|
|
186
|
+
}))
|
|
187
|
+
.sort((a, b) => a.path.localeCompare(b.path, "en")));
|
|
187
188
|
};
|
|
188
189
|
const platformsArray = [
|
|
189
190
|
{
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
1
|
/**
|
|
8
2
|
* Gets build property from the main target build section
|
|
9
3
|
*
|
|
10
4
|
* It differs from the project.getBuildProperty exposed by xcode in the way that:
|
|
11
|
-
* - it only checks for build property in the main target `Debug` section
|
|
12
5
|
* - `xcode` library iterates over all build sections and because it misses
|
|
13
6
|
* an early return when property is found, it will return undefined/wrong value
|
|
14
7
|
* when there's another build section typically after the one you want to access
|
|
15
8
|
* without the property defined (e.g. CocoaPods sections appended to project
|
|
16
9
|
* miss INFOPLIST_FILE), see: https://github.com/alunny/node-xcode/blob/master/lib/pbxProject.js#L1765
|
|
17
10
|
*/
|
|
18
|
-
export default function getBuildProperty(project: any, prop: any): any;
|
|
11
|
+
export default function getBuildProperty(project: any, prop: any, targetUUID: any): any;
|
|
19
12
|
//# sourceMappingURL=getBuildProperty.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBuildProperty.d.ts","sourceRoot":"","sources":["../../../src/react-native-lib/ios/getBuildProperty.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getBuildProperty.d.ts","sourceRoot":"","sources":["../../../src/react-native-lib/ios/getBuildProperty.js"],"names":[],"mappings":"AASA;;;;;;;;;GASG;AACH,wFASC"}
|
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
+
import { getTargetByUUID } from "../../utils.js";
|
|
7
8
|
/**
|
|
8
9
|
* Gets build property from the main target build section
|
|
9
10
|
*
|
|
10
11
|
* It differs from the project.getBuildProperty exposed by xcode in the way that:
|
|
11
|
-
* - it only checks for build property in the main target `Debug` section
|
|
12
12
|
* - `xcode` library iterates over all build sections and because it misses
|
|
13
13
|
* an early return when property is found, it will return undefined/wrong value
|
|
14
14
|
* when there's another build section typically after the one you want to access
|
|
15
15
|
* without the property defined (e.g. CocoaPods sections appended to project
|
|
16
16
|
* miss INFOPLIST_FILE), see: https://github.com/alunny/node-xcode/blob/master/lib/pbxProject.js#L1765
|
|
17
17
|
*/
|
|
18
|
-
export default function getBuildProperty(project, prop) {
|
|
19
|
-
const target = project
|
|
18
|
+
export default function getBuildProperty(project, prop, targetUUID) {
|
|
19
|
+
const target = getTargetByUUID(project, targetUUID);
|
|
20
20
|
const config = project.pbxXCConfigurationList()[target.buildConfigurationList];
|
|
21
21
|
const buildSection = project.pbxXCBuildConfigurationSection()[config.buildConfigurations[0].value];
|
|
22
22
|
return buildSection.buildSettings[prop];
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Returns `null` if INFOPLIST_FILE is not specified.
|
|
5
5
|
*/
|
|
6
|
-
export default function getPlist(project: any, sourceDir: any): Promise<any>;
|
|
6
|
+
export default function getPlist(project: any, sourceDir: any, targetUUID: any): Promise<any>;
|
|
7
7
|
//# sourceMappingURL=getPlist.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPlist.d.ts","sourceRoot":"","sources":["../../../src/react-native-lib/ios/getPlist.js"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"getPlist.d.ts","sourceRoot":"","sources":["../../../src/react-native-lib/ios/getPlist.js"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,8FAkBC"}
|
|
@@ -12,8 +12,8 @@ import getPlistPath from "./getPlistPath.js";
|
|
|
12
12
|
*
|
|
13
13
|
* Returns `null` if INFOPLIST_FILE is not specified.
|
|
14
14
|
*/
|
|
15
|
-
export default async function getPlist(project, sourceDir) {
|
|
16
|
-
const plistPath = getPlistPath(project, sourceDir);
|
|
15
|
+
export default async function getPlist(project, sourceDir, targetUUID) {
|
|
16
|
+
const plistPath = getPlistPath(project, sourceDir, targetUUID);
|
|
17
17
|
if (!plistPath ||
|
|
18
18
|
!(await dntShim.Deno.lstat(plistPath)
|
|
19
19
|
.then(() => true)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default function getPlistPath(project: any, sourceDir: any): string | null;
|
|
1
|
+
export default function getPlistPath(project: any, sourceDir: any, targetUUID: any): string | null;
|
|
2
2
|
//# sourceMappingURL=getPlistPath.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPlistPath.d.ts","sourceRoot":"","sources":["../../../src/react-native-lib/ios/getPlistPath.js"],"names":[],"mappings":"AAUA,
|
|
1
|
+
{"version":3,"file":"getPlistPath.d.ts","sourceRoot":"","sources":["../../../src/react-native-lib/ios/getPlistPath.js"],"names":[],"mappings":"AAUA,mGAWC"}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as path from "../../deps/jsr.io/@std/path/1.1.4/mod.js";
|
|
8
8
|
import getBuildProperty from "./getBuildProperty.js";
|
|
9
|
-
export default function getPlistPath(project, sourceDir) {
|
|
10
|
-
const plistFile = getBuildProperty(project, "INFOPLIST_FILE");
|
|
9
|
+
export default function getPlistPath(project, sourceDir, targetUUID) {
|
|
10
|
+
const plistFile = getBuildProperty(project, "INFOPLIST_FILE", targetUUID);
|
|
11
11
|
if (!plistFile) {
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Returns `null` if INFOPLIST_FILE is not specified or file is non-existent.
|
|
5
5
|
*/
|
|
6
|
-
export default function writePlist(project: any, sourceDir: any, plist: any): Promise<void | null>;
|
|
6
|
+
export default function writePlist(project: any, sourceDir: any, plist: any, targetUUID: any): Promise<void | null>;
|
|
7
7
|
//# sourceMappingURL=writePlist.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writePlist.d.ts","sourceRoot":"","sources":["../../../src/react-native-lib/ios/writePlist.js"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"writePlist.d.ts","sourceRoot":"","sources":["../../../src/react-native-lib/ios/writePlist.js"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,oHAmBC"}
|
|
@@ -12,8 +12,8 @@ import getPlistPath from "./getPlistPath.js";
|
|
|
12
12
|
*
|
|
13
13
|
* Returns `null` if INFOPLIST_FILE is not specified or file is non-existent.
|
|
14
14
|
*/
|
|
15
|
-
export default async function writePlist(project, sourceDir, plist) {
|
|
16
|
-
const plistPath = getPlistPath(project, sourceDir);
|
|
15
|
+
export default async function writePlist(project, sourceDir, plist, targetUUID) {
|
|
16
|
+
const plistPath = getPlistPath(project, sourceDir, targetUUID);
|
|
17
17
|
if (!plistPath) {
|
|
18
18
|
return null;
|
|
19
19
|
}
|
package/esm/utils.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type xcode from "xcode";
|
|
2
|
+
/**
|
|
3
|
+
* Get an array containing the UUID of each target in the project
|
|
4
|
+
*/
|
|
5
|
+
export declare function getTargetUUIDs(project: xcode.Project): string[];
|
|
6
|
+
/**
|
|
7
|
+
* Get a target by UUID
|
|
8
|
+
*/
|
|
9
|
+
export declare function getTargetByUUID(project: xcode.Project, uuid: string): unknown;
|
|
10
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,MAAM,EAAE,CAE/D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,WAEnE"}
|
package/esm/utils.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get an array containing the UUID of each target in the project
|
|
3
|
+
*/
|
|
4
|
+
export function getTargetUUIDs(project) {
|
|
5
|
+
return project.getFirstProject().firstProject.targets.map((t) => t.value);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Get a target by UUID
|
|
9
|
+
*/
|
|
10
|
+
export function getTargetByUUID(project, uuid) {
|
|
11
|
+
return project.pbxNativeTargetSection()[uuid];
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../src/clean-assets/ios.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../src/clean-assets/ios.ts"],"names":[],"mappings":"AASA,wBAA8B,cAAc,CAC1C,SAAS,EAAE,MAAM,EAAE,EACnB,cAAc,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,EACrD,OAAO,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,iBA+B9B"}
|
|
@@ -44,19 +44,21 @@ const xcode = __importStar(require("xcode"));
|
|
|
44
44
|
const createGroupWithMessage_js_1 = __importDefault(require("../react-native-lib/ios/createGroupWithMessage.js"));
|
|
45
45
|
const getPlist_js_1 = __importDefault(require("../react-native-lib/ios/getPlist.js"));
|
|
46
46
|
const writePlist_js_1 = __importDefault(require("../react-native-lib/ios/writePlist.js"));
|
|
47
|
+
const utils_js_1 = require("../utils.js");
|
|
47
48
|
async function cleanAssetsIos(filePaths, platformConfig, options) {
|
|
48
49
|
const project = xcode.project(platformConfig.pbxprojPath).parseSync();
|
|
49
|
-
const plist = await (0, getPlist_js_1.default)(project, platformConfig
|
|
50
|
-
.path);
|
|
51
50
|
(0, createGroupWithMessage_js_1.default)(project, "Resources");
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
for (const targetUUID of (0, utils_js_1.getTargetUUIDs)(project)) {
|
|
52
|
+
const plist = await (0, getPlist_js_1.default)(project, platformConfig.path, targetUUID);
|
|
53
|
+
const removedFiles = filePaths.map((p) => {
|
|
54
|
+
return project.removeResourceFile(path.relative(platformConfig.path, p), { target: targetUUID });
|
|
55
|
+
}).filter((x) => x).map((file) => file.basename);
|
|
56
|
+
if (options.addFont) {
|
|
57
|
+
const existingFonts = plist.UIAppFonts || [];
|
|
58
|
+
const allFonts = existingFonts.filter((file) => removedFiles.indexOf(file) === -1);
|
|
59
|
+
plist.UIAppFonts = Array.from(new Set(allFonts)); // use Set to dedupe w/existing
|
|
60
|
+
}
|
|
61
|
+
await (0, writePlist_js_1.default)(project, platformConfig.path, plist, targetUUID);
|
|
59
62
|
}
|
|
60
63
|
await dntShim.Deno.writeTextFile(platformConfig.pbxprojPath, project.writeSync());
|
|
61
|
-
(0, writePlist_js_1.default)(project, platformConfig.path, plist);
|
|
62
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../src/copy-assets/ios.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../src/copy-assets/ios.ts"],"names":[],"mappings":"AAWA,wBAA8B,cAAc,CAC1C,SAAS,EAAE,MAAM,EAAE,EACnB,cAAc,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,EACrD,OAAO,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,iBAsC9B"}
|
|
@@ -46,6 +46,7 @@ const xcodeParser = __importStar(require("xcode/lib/parser/pbxproj.js"));
|
|
|
46
46
|
const createGroupWithMessage_js_1 = __importDefault(require("../react-native-lib/ios/createGroupWithMessage.js"));
|
|
47
47
|
const getPlist_js_1 = __importDefault(require("../react-native-lib/ios/getPlist.js"));
|
|
48
48
|
const writePlist_js_1 = __importDefault(require("../react-native-lib/ios/writePlist.js"));
|
|
49
|
+
const utils_js_1 = require("../utils.js");
|
|
49
50
|
async function cleanAssetsIos(filePaths, platformConfig, options) {
|
|
50
51
|
const project = xcode.project(platformConfig.pbxprojPath);
|
|
51
52
|
const pbxprojContent = await dntShim.Deno.readFile(platformConfig.pbxprojPath).then((buf) => {
|
|
@@ -53,16 +54,16 @@ async function cleanAssetsIos(filePaths, platformConfig, options) {
|
|
|
53
54
|
return decoder.decode(buf);
|
|
54
55
|
});
|
|
55
56
|
project.hash = xcodeParser.parse(pbxprojContent);
|
|
56
|
-
const plist = await (0, getPlist_js_1.default)(project, platformConfig
|
|
57
|
-
.path);
|
|
58
57
|
(0, createGroupWithMessage_js_1.default)(project, "Resources");
|
|
59
|
-
const
|
|
60
|
-
.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
58
|
+
for (const targetUUID of (0, utils_js_1.getTargetUUIDs)(project)) {
|
|
59
|
+
const plist = await (0, getPlist_js_1.default)(project, platformConfig.path, targetUUID);
|
|
60
|
+
const addedFiles = filePaths.map((p) => project.addResourceFile(path.relative(platformConfig.path, p), { target: targetUUID })).filter((x) => x).map((file) => file.basename);
|
|
61
|
+
if (options.addFont) {
|
|
62
|
+
const existingFonts = plist.UIAppFonts || [];
|
|
63
|
+
const allFonts = [...existingFonts, ...addedFiles];
|
|
64
|
+
plist.UIAppFonts = Array.from(new Set(allFonts)); // use Set to dedupe w/existing
|
|
65
|
+
}
|
|
66
|
+
await (0, writePlist_js_1.default)(project, platformConfig.path, plist, targetUUID);
|
|
65
67
|
}
|
|
66
68
|
await dntShim.Deno.writeTextFile(platformConfig.pbxprojPath, project.writeSync());
|
|
67
|
-
await (0, writePlist_js_1.default)(project, platformConfig.path, plist);
|
|
68
69
|
}
|
package/script/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AASA,KAAK,YAAY,GAAG,KAAK,GAAG,SAAS,CAAC;AAEtC,eAAO,MAAM,UAAU,GACrB,wCAIG;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,GACR,CAAC,IAAI,YAAY,GAAG;QACnB,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,MAAM,EAAE,CAAC;KAClB,GACF,CAAC;CACH,KACA,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AASA,KAAK,YAAY,GAAG,KAAK,GAAG,SAAS,CAAC;AAEtC,eAAO,MAAM,UAAU,GACrB,wCAIG;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,GACR,CAAC,IAAI,YAAY,GAAG;QACnB,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,MAAM,EAAE,CAAC;KAClB,GACF,CAAC;CACH,KACA,OAAO,CAAC,IAAI,CA4Wd,CAAC"}
|
package/script/main.js
CHANGED
|
@@ -222,7 +222,8 @@ const linkAssets = async ({ rootPath, platforms, shouldUnlink = true, }) => {
|
|
|
222
222
|
.map((asset) => ({
|
|
223
223
|
...asset,
|
|
224
224
|
path: path.relative(rp, asset.path).split(path.SEPARATOR).join("/"),
|
|
225
|
-
}))
|
|
225
|
+
}))
|
|
226
|
+
.sort((a, b) => a.path.localeCompare(b.path, "en")));
|
|
226
227
|
};
|
|
227
228
|
const platformsArray = [
|
|
228
229
|
{
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
1
|
/**
|
|
8
2
|
* Gets build property from the main target build section
|
|
9
3
|
*
|
|
10
4
|
* It differs from the project.getBuildProperty exposed by xcode in the way that:
|
|
11
|
-
* - it only checks for build property in the main target `Debug` section
|
|
12
5
|
* - `xcode` library iterates over all build sections and because it misses
|
|
13
6
|
* an early return when property is found, it will return undefined/wrong value
|
|
14
7
|
* when there's another build section typically after the one you want to access
|
|
15
8
|
* without the property defined (e.g. CocoaPods sections appended to project
|
|
16
9
|
* miss INFOPLIST_FILE), see: https://github.com/alunny/node-xcode/blob/master/lib/pbxProject.js#L1765
|
|
17
10
|
*/
|
|
18
|
-
export default function getBuildProperty(project: any, prop: any): any;
|
|
11
|
+
export default function getBuildProperty(project: any, prop: any, targetUUID: any): any;
|
|
19
12
|
//# sourceMappingURL=getBuildProperty.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBuildProperty.d.ts","sourceRoot":"","sources":["../../../src/react-native-lib/ios/getBuildProperty.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getBuildProperty.d.ts","sourceRoot":"","sources":["../../../src/react-native-lib/ios/getBuildProperty.js"],"names":[],"mappings":"AASA;;;;;;;;;GASG;AACH,wFASC"}
|
|
@@ -7,19 +7,19 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.default = getBuildProperty;
|
|
10
|
+
const utils_js_1 = require("../../utils.js");
|
|
10
11
|
/**
|
|
11
12
|
* Gets build property from the main target build section
|
|
12
13
|
*
|
|
13
14
|
* It differs from the project.getBuildProperty exposed by xcode in the way that:
|
|
14
|
-
* - it only checks for build property in the main target `Debug` section
|
|
15
15
|
* - `xcode` library iterates over all build sections and because it misses
|
|
16
16
|
* an early return when property is found, it will return undefined/wrong value
|
|
17
17
|
* when there's another build section typically after the one you want to access
|
|
18
18
|
* without the property defined (e.g. CocoaPods sections appended to project
|
|
19
19
|
* miss INFOPLIST_FILE), see: https://github.com/alunny/node-xcode/blob/master/lib/pbxProject.js#L1765
|
|
20
20
|
*/
|
|
21
|
-
function getBuildProperty(project, prop) {
|
|
22
|
-
const target =
|
|
21
|
+
function getBuildProperty(project, prop, targetUUID) {
|
|
22
|
+
const target = (0, utils_js_1.getTargetByUUID)(project, targetUUID);
|
|
23
23
|
const config = project.pbxXCConfigurationList()[target.buildConfigurationList];
|
|
24
24
|
const buildSection = project.pbxXCBuildConfigurationSection()[config.buildConfigurations[0].value];
|
|
25
25
|
return buildSection.buildSettings[prop];
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Returns `null` if INFOPLIST_FILE is not specified.
|
|
5
5
|
*/
|
|
6
|
-
export default function getPlist(project: any, sourceDir: any): Promise<any>;
|
|
6
|
+
export default function getPlist(project: any, sourceDir: any, targetUUID: any): Promise<any>;
|
|
7
7
|
//# sourceMappingURL=getPlist.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPlist.d.ts","sourceRoot":"","sources":["../../../src/react-native-lib/ios/getPlist.js"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"getPlist.d.ts","sourceRoot":"","sources":["../../../src/react-native-lib/ios/getPlist.js"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,8FAkBC"}
|
|
@@ -51,8 +51,8 @@ const getPlistPath_js_1 = __importDefault(require("./getPlistPath.js"));
|
|
|
51
51
|
*
|
|
52
52
|
* Returns `null` if INFOPLIST_FILE is not specified.
|
|
53
53
|
*/
|
|
54
|
-
async function getPlist(project, sourceDir) {
|
|
55
|
-
const plistPath = (0, getPlistPath_js_1.default)(project, sourceDir);
|
|
54
|
+
async function getPlist(project, sourceDir, targetUUID) {
|
|
55
|
+
const plistPath = (0, getPlistPath_js_1.default)(project, sourceDir, targetUUID);
|
|
56
56
|
if (!plistPath ||
|
|
57
57
|
!(await dntShim.Deno.lstat(plistPath)
|
|
58
58
|
.then(() => true)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default function getPlistPath(project: any, sourceDir: any): string | null;
|
|
1
|
+
export default function getPlistPath(project: any, sourceDir: any, targetUUID: any): string | null;
|
|
2
2
|
//# sourceMappingURL=getPlistPath.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPlistPath.d.ts","sourceRoot":"","sources":["../../../src/react-native-lib/ios/getPlistPath.js"],"names":[],"mappings":"AAUA,
|
|
1
|
+
{"version":3,"file":"getPlistPath.d.ts","sourceRoot":"","sources":["../../../src/react-native-lib/ios/getPlistPath.js"],"names":[],"mappings":"AAUA,mGAWC"}
|
|
@@ -45,8 +45,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
45
45
|
exports.default = getPlistPath;
|
|
46
46
|
const path = __importStar(require("../../deps/jsr.io/@std/path/1.1.4/mod.js"));
|
|
47
47
|
const getBuildProperty_js_1 = __importDefault(require("./getBuildProperty.js"));
|
|
48
|
-
function getPlistPath(project, sourceDir) {
|
|
49
|
-
const plistFile = (0, getBuildProperty_js_1.default)(project, "INFOPLIST_FILE");
|
|
48
|
+
function getPlistPath(project, sourceDir, targetUUID) {
|
|
49
|
+
const plistFile = (0, getBuildProperty_js_1.default)(project, "INFOPLIST_FILE", targetUUID);
|
|
50
50
|
if (!plistFile) {
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Returns `null` if INFOPLIST_FILE is not specified or file is non-existent.
|
|
5
5
|
*/
|
|
6
|
-
export default function writePlist(project: any, sourceDir: any, plist: any): Promise<void | null>;
|
|
6
|
+
export default function writePlist(project: any, sourceDir: any, plist: any, targetUUID: any): Promise<void | null>;
|
|
7
7
|
//# sourceMappingURL=writePlist.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writePlist.d.ts","sourceRoot":"","sources":["../../../src/react-native-lib/ios/writePlist.js"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"writePlist.d.ts","sourceRoot":"","sources":["../../../src/react-native-lib/ios/writePlist.js"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,oHAmBC"}
|
|
@@ -51,8 +51,8 @@ const getPlistPath_js_1 = __importDefault(require("./getPlistPath.js"));
|
|
|
51
51
|
*
|
|
52
52
|
* Returns `null` if INFOPLIST_FILE is not specified or file is non-existent.
|
|
53
53
|
*/
|
|
54
|
-
async function writePlist(project, sourceDir, plist) {
|
|
55
|
-
const plistPath = (0, getPlistPath_js_1.default)(project, sourceDir);
|
|
54
|
+
async function writePlist(project, sourceDir, plist, targetUUID) {
|
|
55
|
+
const plistPath = (0, getPlistPath_js_1.default)(project, sourceDir, targetUUID);
|
|
56
56
|
if (!plistPath) {
|
|
57
57
|
return null;
|
|
58
58
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type xcode from "xcode";
|
|
2
|
+
/**
|
|
3
|
+
* Get an array containing the UUID of each target in the project
|
|
4
|
+
*/
|
|
5
|
+
export declare function getTargetUUIDs(project: xcode.Project): string[];
|
|
6
|
+
/**
|
|
7
|
+
* Get a target by UUID
|
|
8
|
+
*/
|
|
9
|
+
export declare function getTargetByUUID(project: xcode.Project, uuid: string): unknown;
|
|
10
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,MAAM,EAAE,CAE/D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,WAEnE"}
|
package/script/utils.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTargetUUIDs = getTargetUUIDs;
|
|
4
|
+
exports.getTargetByUUID = getTargetByUUID;
|
|
5
|
+
/**
|
|
6
|
+
* Get an array containing the UUID of each target in the project
|
|
7
|
+
*/
|
|
8
|
+
function getTargetUUIDs(project) {
|
|
9
|
+
return project.getFirstProject().firstProject.targets.map((t) => t.value);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Get a target by UUID
|
|
13
|
+
*/
|
|
14
|
+
function getTargetByUUID(project, uuid) {
|
|
15
|
+
return project.pbxNativeTargetSection()[uuid];
|
|
16
|
+
}
|