Commit 08d6090 1 parent 2fc7732 commit 08d6090 Copy full SHA for 08d6090
File tree 3 files changed +33
-0
lines changed
3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 51
51
},
52
52
"peerDependencies" : {
53
53
"@parcel/core" : " 2.5.0"
54
+ },
55
+ "scripts" : {
56
+ "version" : " node ../../scripts/pin-version.js"
54
57
}
55
58
}
Original file line number Diff line number Diff line change 270
270
"postinstall" : " node scripts/postinstall.js" ,
271
271
"prepare" : " cross-env NODE_ENV=production npm run build" ,
272
272
"watch" : " rimraf dist && mkdir dist && npm run build:internal-plugins && npm run build:rawfiles && npm run build:src -- --watch" ,
273
+ "version" : " node ../../scripts/pin-version.js" ,
273
274
"typecheck" : " tsc --noEmit"
274
275
},
275
276
"types" : " index.d.ts" ,
Original file line number Diff line number Diff line change
1
+ const fs = require ( `fs-extra` )
2
+ const path = require ( `path` )
3
+
4
+ const packagesToPin = [
5
+ `@gatsbyjs/parcel-namer-relative-to-cwd` ,
6
+ `gatsby-parcel-config` ,
7
+ ]
8
+
9
+ function adjustDeps ( packageDirectoryPath ) {
10
+ const packageJsonPath = path . join ( packageDirectoryPath , `package.json` )
11
+ const packageJsonString = fs . readFileSync ( packageJsonPath , `utf-8` )
12
+
13
+ let updatedPackageJson = packageJsonString
14
+
15
+ for ( const packageToPin of packagesToPin ) {
16
+ const regexp = new RegExp ( `"${ packageToPin } ": "\\^([^"]+)"` , `g` )
17
+
18
+ updatedPackageJson = updatedPackageJson . replace (
19
+ regexp ,
20
+ `"${ packageToPin } ": "$1"`
21
+ )
22
+ }
23
+
24
+ if ( updatedPackageJson !== packageJsonString ) {
25
+ fs . writeFileSync ( packageJsonPath , updatedPackageJson )
26
+ }
27
+ }
28
+
29
+ adjustDeps ( process . cwd ( ) )
You can’t perform that action at this time.
0 commit comments