@@ -49,6 +49,17 @@ const updatePackageVersion = async (packagePath, newVersion) => {
4949 console . log ( `Updated ${ packagePath } to version ${ newVersion } ` ) ;
5050} ;
5151
52+ const updatePackageLockVersion = async ( packageLockPath , newVersion ) => {
53+ const packageLockJson = await readJsonFile ( packageLockPath ) ;
54+
55+ if ( packageLockJson [ 'packages/assetpack' ] ) {
56+ packageLockJson [ 'packages/assetpack' ] . version = newVersion ;
57+ }
58+
59+ await writeJsonFile ( packageLockPath , packageLockJson ) ;
60+ console . log ( `Updated ${ packageLockPath } to version ${ newVersion } ` ) ;
61+ } ;
62+
5263/**
5364 * Bump the version of the package and update all relevant package.json files
5465 * @returns {Promise<string> } The next version
@@ -67,17 +78,21 @@ const version = async () => {
6778
6879 console . log ( `Next version: ${ nextVersion } ` ) ;
6980
70- // Update root package.json using npm version command
71- console . log ( 'Updating root package.json...' ) ;
72- await spawn ( 'npm' , [ 'version' , nextVersion ] ) ;
73-
7481 // Update assetpack package.json
7582 const assetpackPackagePath = join ( rootDir , 'packages' , 'assetpack' , 'package.json' ) ;
83+ const assetpackPackageLockPath = join ( rootDir , 'package-lock.json' ) ;
7684
85+ // Update root package.json using npm version command
7786 console . log ( 'Updating assetpack package.json...' ) ;
7887 await updatePackageVersion ( assetpackPackagePath , nextVersion ) ;
79- await spawn ( 'git' , [ 'add' , assetpackPackagePath ] ) ;
88+ await updatePackageLockVersion ( assetpackPackageLockPath , nextVersion ) ;
89+ await spawn ( 'git' , [ 'add' , '.' ] ) ;
8090 await spawn ( 'git' , [ 'commit' , '-m' , `chore: bump version to ${ nextVersion } ` ] ) ;
91+
92+ // Update root package.json using npm version command
93+ console . log ( 'Updating root package.json...' ) ;
94+ await spawn ( 'npm' , [ 'version' , nextVersion ] ) ;
95+
8196 // push changes to git
8297 await spawn ( 'git' , [ 'push' ] ) ;
8398 await spawn ( 'git' , [ 'push' , '--tags' ] ) ;
0 commit comments