mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-30 09:32:50 +01:00
refactor: migrate app.config and Expo config plugins to TypeScript (#1718)
This commit is contained in:
32
plugins/withGitPod.ts
Normal file
32
plugins/withGitPod.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { type ConfigPlugin, withPodfile } from "expo/config-plugins";
|
||||
|
||||
interface GitPodOptions {
|
||||
podName: string;
|
||||
podspecUrl: string;
|
||||
}
|
||||
|
||||
const withGitPod: ConfigPlugin<GitPodOptions> = (
|
||||
config,
|
||||
{ podName, podspecUrl },
|
||||
) => {
|
||||
return withPodfile(config, (config) => {
|
||||
const podfile = config.modResults.contents;
|
||||
|
||||
const podLine = ` pod '${podName}', :podspec => '${podspecUrl}'`;
|
||||
|
||||
// Check if already added
|
||||
if (podfile.includes(podLine)) {
|
||||
return config;
|
||||
}
|
||||
|
||||
// Insert after "use_expo_modules!"
|
||||
config.modResults.contents = podfile.replace(
|
||||
"use_expo_modules!",
|
||||
`use_expo_modules!\n${podLine}`,
|
||||
);
|
||||
|
||||
return config;
|
||||
});
|
||||
};
|
||||
|
||||
export default withGitPod;
|
||||
Reference in New Issue
Block a user