@@ -22,6 +22,7 @@ import { resolveRelativeFileDependencies } from "./resolveRelativeFileDependenci
22
22
import { getPackageResolution } from "./getPackageResolution"
23
23
import { parsePatchFile } from "./patch/parse"
24
24
import { gzipSync } from "zlib"
25
+ import { getPackageVersion } from "./getPackageVersion"
25
26
26
27
function printNoPackageFoundError (
27
28
packageName : string ,
@@ -97,13 +98,13 @@ export function makePatch({
97
98
} ) ,
98
99
)
99
100
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
+ )
104
104
105
105
// 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 ) => {
107
108
const rcPath = join ( appPath , rcFile )
108
109
if ( existsSync ( rcPath ) ) {
109
110
copySync ( rcPath , join ( tmpRepo . name , rcFile ) )
@@ -264,11 +265,11 @@ export function makePatch({
264
265
}
265
266
266
267
const packageNames = packageDetails . packageNames
267
- . map ( name => name . replace ( / \/ / g, "+" ) )
268
+ . map ( ( name ) => name . replace ( / \/ / g, "+" ) )
268
269
. join ( "++" )
269
270
270
271
// maybe delete existing
271
- getPatchFiles ( patchDir ) . forEach ( filename => {
272
+ getPatchFiles ( patchDir ) . forEach ( ( filename ) => {
272
273
const deets = getPackageDetailsFromPatchFilename ( filename )
273
274
if ( deets && deets . path === packageDetails . path ) {
274
275
unlinkSync ( join ( patchDir , filename ) )
0 commit comments