nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: conventional-changelog/standard-version
Pull request #190 (2017-06-06 09:33:11)

feat: add support for `package-lock.json`

coveralls: 
[![Coverage Status](https://coveralls.io/builds/11845667/badge)](https://coveralls.io/builds/11845667)

Coverage increased (+0.01%) to 99.515% when pulling **fd7b81303922aaee9f63755398139c3c85e30bdc on noreiller:feat/package-lock** into **4b6d6db852da88d91001abff7eed1c15a7b1a29c on conventional-changelog:master**.

stevemao: We have a bunch of `write...Json()`s. Should probably abstract them into a function sometime.
noreiller: I wanted to do so, but I had a doubt about this.

Patch:
diff --git a/lib/lifecycles/bump.js b/lib/lifecycles/bump.js
index 2508b69..47ad11f 100644
--- a/lib/lifecycles/bump.js
+++ b/lib/lifecycles/bump.js
@@ -135,6 +135,7 @@ function bumpVersion (releaseAs, callback) {
  */
 function updateConfigs (args, newVersion) {
   configsToUpdate[path.resolve(process.cwd(), './package.json')] = false
+  configsToUpdate[path.resolve(process.cwd(), './package-lock.json')] = false
   configsToUpdate[path.resolve(process.cwd(), './npm-shrinkwrap.json')] = false
   configsToUpdate[path.resolve(process.cwd(), './bower.json')] = false
   Object.keys(configsToUpdate).forEach(function (configPath) {


Test patch:
diff --git a/test.js b/test.js
index d5fc9bb..001c858 100644
--- a/test.js
+++ b/test.js
@@ -59,6 +59,12 @@ function writeNpmShrinkwrapJson (version, option) {
   fs.writeFileSync('npm-shrinkwrap.json', JSON.stringify(shrinkwrap), 'utf-8')
 }
 
+function writePackageLockJson (version, option) {
+  option = option || {}
+  var pkgLock = Object.assign(option, { version: version })
+  fs.writeFileSync('package-lock.json', JSON.stringify(pkgLock), 'utf-8')
+}
+
 function writeGitPreCommitHook () {
   fs.writeFileSync('.git/hooks/pre-commit', '#!/bin/sh\necho "precommit ran"\nexit 1', 'utf-8')
   fs.chmodSync('.git/hooks/pre-commit', '755')
@@ -676,6 +682,24 @@ describe('standard-version', function () {
     })
   })
 
+  describe('package-lock.json support', function () {
+    beforeEach(function () {
+      writePackageLockJson('1.0.0')
+    })
+
+    it('bumps version # in package-lock.json', function (done) {
+      commit('feat: first commit')
+      shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
+      commit('feat: new feature!')
+      require('./index')({silent: true})
+        .then(() => {
+          JSON.parse(fs.readFileSync('package-lock.json', 'utf-8')).version.should.equal('1.1.0')
+          getPackageVersion().should.equal('1.1.0')
+          return done()
+        })
+    })
+  })
+
   describe('dry-run', function () {
     it('skips all non-idempotent steps', function (done) {
       commit('feat: first commit')