Skip to content

Commit 2c38be1

Browse files
fix: NPM_CONFIG_USERCONFIG env check
1 parent 1cb17da commit 2c38be1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/update/package_json.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,14 @@ func packageJson(newVersion string, file *os.File) error {
4747
}
4848
}
4949

50+
if os.Getenv("NPM_CONFIG_USERCONFIG") != "" {
51+
return nil
52+
}
53+
5054
npmrcPath := path.Join(path.Dir(file.Name()), ".npmrc")
51-
if _, err = os.Stat(npmrcPath); os.IsNotExist(err) && os.Getenv("NPM_CONFIG_USERCONFIG") == "" {
55+
if _, err = os.Stat(npmrcPath); os.IsNotExist(err) {
5256
return ioutil.WriteFile(npmrcPath, []byte(npmrc), 0644)
5357
}
58+
5459
return err
5560
}

0 commit comments

Comments
 (0)