Skip to content

Commit

Permalink
[font] Only include supported font files (expo#27002)
Browse files Browse the repository at this point in the history
  • Loading branch information
alanjhughes authored Feb 9, 2024
1 parent a1906b7 commit 07286b1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions packages/expo-font/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### 🐛 Bug fixes

- Only include supported font files when using the plugin. ([#27002](https://github.com/expo/expo/pull/27002) by [@alanjhughes](https://github.com/alanjhughes))

### 💡 Others

- Remove most of Constants.appOwnership. ([#26313](https://github.com/expo/expo/pull/26313) by [@wschurman](https://github.com/wschurman))
Expand Down
4 changes: 3 additions & 1 deletion packages/expo-font/plugin/build/utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion packages/expo-font/plugin/build/withFontsAndroid.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion packages/expo-font/plugin/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ export async function resolveFontPaths(fonts: string[], projectRoot: string) {
}
return [resolvedPath];
});
return (await Promise.all(promises)).flat();
return (await Promise.all(promises))
.flat()
.filter((p) => p.endsWith('.ttf') || p.endsWith('.otf'));
}
4 changes: 3 additions & 1 deletion packages/expo-font/plugin/src/withFontsAndroid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export const withFontsAndroid: ConfigPlugin<string[]> = (config, fonts) => {
);
await fs.mkdir(fontsDir, { recursive: true });
const output = path.join(fontsDir, path.basename(asset));
await fs.copyFile(asset, output);
if (output.endsWith('.ttf') || output.endsWith('.otf')) {
await fs.copyFile(asset, output);
}
})
);
return config;
Expand Down

0 comments on commit 07286b1

Please sign in to comment.