@@ -22,6 +22,7 @@ import { resolveRelativeFileDependencies } from "./resolveRelativeFileDependenci
2222import { getPackageResolution } from "./getPackageResolution"
2323import { parsePatchFile } from "./patch/parse"
2424import { gzipSync } from "zlib"
25+ import { getPackageVersion } from "./getPackageVersion"
2526
2627function printNoPackageFoundError (
2728 packageName : string ,
@@ -97,13 +98,13 @@ export function makePatch({
9798 } ) ,
9899 )
99100
100- const packageVersion = require ( join (
101- resolve ( packageDetails . path ) ,
102- "package.json" ,
103- ) ) . version as string
101+ const packageVersion = getPackageVersion (
102+ join ( resolve ( packageDetails . path ) , "package.json" ) ,
103+ )
104104
105105 // copy .npmrc/.yarnrc in case packages are hosted in private registry
106- [ ".npmrc" , ".yarnrc" ] . forEach ( rcFile => {
106+ // tslint:disable-next-line:align
107+ ; [ ".npmrc" , ".yarnrc" ] . forEach ( ( rcFile ) => {
107108 const rcPath = join ( appPath , rcFile )
108109 if ( existsSync ( rcPath ) ) {
109110 copySync ( rcPath , join ( tmpRepo . name , rcFile ) )
@@ -264,11 +265,11 @@ export function makePatch({
264265 }
265266
266267 const packageNames = packageDetails . packageNames
267- . map ( name => name . replace ( / \/ / g, "+" ) )
268+ . map ( ( name ) => name . replace ( / \/ / g, "+" ) )
268269 . join ( "++" )
269270
270271 // maybe delete existing
271- getPatchFiles ( patchDir ) . forEach ( filename => {
272+ getPatchFiles ( patchDir ) . forEach ( ( filename ) => {
272273 const deets = getPackageDetailsFromPatchFilename ( filename )
273274 if ( deets && deets . path === packageDetails . path ) {
274275 unlinkSync ( join ( patchDir , filename ) )
0 commit comments