Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@types/minimist": "^1.2.0",
"@types/node": "^7.0.18",
"@types/rimraf": "^0.0.28",
"@types/semver": "^5.5.0",
"@types/tmp": "^0.0.33",
"husky": "^0.13.3",
"jest": "^23.6.0",
Expand All @@ -72,6 +73,7 @@
"klaw-sync": "^4.0.0",
"minimist": "^1.2.0",
"rimraf": "^2.6.2",
"semver": "^5.6.0",
"slash": "^1.0.0",
"tmp": "^0.0.31",
"update-notifier": "^2.4.0"
Expand Down
5 changes: 4 additions & 1 deletion src/applyPatches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { getPackageDetailsFromPatchFilename } from "./PackageDetails"
import { parsePatchFile } from "./patch/parse"
import { reversePatch } from "./patch/reverse"
import isCi from "is-ci"
import semver from "semver"

// don't want to exit(1) on postinsall locally.
// see https://github.com/ds300/patch-package/issues/86
Expand Down Expand Up @@ -41,7 +42,9 @@ function getInstalledPackageVersion({
return null
}

return require(join(packageDir, "package.json")).version
const { version } = require(join(packageDir, "package.json"))
// normalize version for `npm ci`
return semver.valid(version)
}

export const applyPatchesForApp = (
Expand Down
7 changes: 6 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
version "0.0.28"
resolved "https://registry.yarnpkg.com/@types/rimraf/-/rimraf-0.0.28.tgz#5562519bc7963caca8abf7f128cae3b594d41d06"

"@types/semver@^5.5.0":
version "5.5.0"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45"
integrity sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ==

"@types/tmp@^0.0.33":
version "0.0.33"
resolved "https://registry.yarnpkg.com/@types/tmp/-/tmp-0.0.33.tgz#1073c4bc824754ae3d10cfab88ab0237ba964e4d"
Expand Down Expand Up @@ -3835,7 +3840,7 @@ semver-diff@^2.0.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"

semver@^5.5, semver@^5.5.0:
semver@^5.5, semver@^5.5.0, semver@^5.6.0:
version "5.6.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004"
integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==
Expand Down