PodShim
What is PodShim?
PodShim allows you to programatically add Pods to a Podfile.
Warning
You should not manipulate the Podfile flippantly, do not accept user input as it could result in Podfile injection. Static, safe, and tested changes are key to making this an effective solution.
Usage
Creating Pod Reference
import { pod } from "podshim";
console.log(
pod({
name: "PodName",
})
);
console.log(
pod({
name: "PodName",
version: ">= 0.2",
})
);
console.log(
pod({
name: "PodName",
git: "https://github.com/PodName/PodName.git",
})
);
Shimming Podfile Contents
import { readFileSync, writeFileSync } from "fs";
import { pod, shim } from "podshim";
const contents = readFileSync("./Podfile", "utf-8");
const modified = shim({
contents,
anchor: "use_frameworks",
insert: [
pod({ name: "Podname" })
]
});
writeFileSync("./Podfile", "utf-8");