MCPcopy Index your code
hub / github.com/ds300/patch-package / getPatchApplicationState

Function getPatchApplicationState

src/stateFile.ts:22–43  ·  view source on GitHub ↗
(
  packageDetails: PackageDetails,
)

Source from the content-addressed store, hash-verified

20export const STATE_FILE_NAME = ".patch-package.json"
21
22export function getPatchApplicationState(
23 packageDetails: PackageDetails,
24): PatchApplicationState | null {
25 const fileName = join(packageDetails.path, STATE_FILE_NAME)
26
27 let state: null | PatchApplicationState = null
28 try {
29 state = JSON.parse(readFileSync(fileName, "utf8"))
30 } catch (e) {
31 // noop
32 }
33 if (!state) {
34 return null
35 }
36 if (state.version !== version) {
37 console.log(
38 `You upgraded patch-package and need to fully reinstall node_modules to continue.`,
39 )
40 process.exit(1)
41 }
42 return state
43}
44
45export function savePatchApplicationState({
46 packageDetails,

Callers 3

makePatchFunction · 0.90
rebaseFunction · 0.90
applyPatchesForPackageFunction · 0.90

Calls 1

joinFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…