podshim
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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";

// pod 'PodName'
console.log(
  pod({
    name: "PodName",
  })
);

// pod 'PodName', '>= 0.2'
console.log(
  pod({
    name: "PodName",
    version: ">= 0.2",
  })
);

// pod 'PodName', :git => 'https://github.com/PodName/PodName.git'
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";

/**
 * Will add the pod reference above the line that contains
 * the 'use_framework' string. 
 */
const contents = readFileSync("./Podfile", "utf-8");
const modified = shim({
  contents,
  anchor: "use_frameworks",
  insert: [
    pod({ name: "Podname" })
  ]
});

writeFileSync("./Podfile", "utf-8");

Package Sidebar

Install

npm i podshim

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

12.5 kB

Total Files

21

Last publish

Collaborators

  • ridafkih