Skip to content

Commit a1f8c1c

Browse files
committed
Support for canary versions from lerna ds300#212
1 parent 2e9716b commit a1f8c1c

File tree

5 files changed

+55
-1
lines changed

5 files changed

+55
-1
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# make sure errors stop the script
2+
set -e
3+
4+
echo "add patch-package"
5+
yarn add $1
6+
7+
echo "Add @parcel/codeframe"
8+
yarn add @parcel/[email protected]
9+
10+
echo "replace codeframe with yarn in @parcel/codefram/src/codeframe.js"
11+
npx replace codeframe yarn node_modules/@parcel/codeframe/src/codeframe.js
12+
13+
echo "SNAPSHOT: making patch"
14+
npx patch-package @parcel/codeframe
15+
echo "END SNAPSHOT"
16+
17+
echo "SNAPSHOT: the patch looks like this"
18+
cat patches/@parcel/codeframe+2.0.0-nightly.137.patch
19+
echo "END SNAPSHOT"
20+
21+
echo "reinstall node_modules"
22+
npx rimraf node_modules
23+
yarn
24+
25+
echo "patch-package didn't run"
26+
if grep yarn node_modules/@parcel/codeframe/src/codeframe.js ; then
27+
exit 1
28+
fi
29+
30+
echo "add patch-package to postinstall hook"
31+
node ./add-postinstall.js
32+
33+
echo "reinstall node_modules"
34+
npx rimraf node_modules
35+
yarn
36+
37+
echo "patch-package did run"
38+
grep yarn node_modules/@parcel/codeframe/src/codeframe.js
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { runIntegrationTest } from "../runIntegrationTest"
2+
runIntegrationTest({projectName: "lerna-canary", shouldProduceSnapshots: false})
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "lerna-canary",
3+
"version": "1.0.0",
4+
"description": "integration test for patch-package",
5+
"main": "index.js",
6+
"author": "",
7+
"license": "ISC",
8+
"dependencies": {}
9+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2+
# yarn lockfile v1
3+
4+

src/getPackageResolution.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ export function getPackageResolution({
3131
throw new Error("Can't parse lock file")
3232
}
3333

34-
const installedVersion = require(join(
34+
const installedVersionLong = require(join(
3535
resolve(appPath, packageDetails.path),
3636
"package.json",
3737
)).version as string
38+
const installedVersion = installedVersionLong.substring(0, installedVersionLong.indexOf('+'))
3839

3940
const entries = Object.entries(appLockFile.object).filter(
4041
([k, v]) =>

0 commit comments

Comments
 (0)