Skip to content

script-utils/npm

Contains utility functions for NPM package.json.

InterfaceDescription
EditPackageJsonOptionsOptions for editPackageJson.
PackageLockJsonA type of the package-lock.json file.
FunctionDescription
editNpmShrinkWrapJsonReads, edits, and writes back the package-lock.json file using the provided edit function.
editPackageJsonReads, edits, and writes back the package.json file using the provided edit function.
editPackageJsonSyncReads, edits, and writes back the package.json file using the provided edit function.
editPackageLockJsonReads, edits, and writes back the package-lock.json file using the provided edit function.
editPackageLockJsonSyncReads, edits, and writes back the package-lock.json file using the provided edit function.
getNpmShrinkWrapJsonPathResolves the path to the npm-shrinkwrap.json file in the specified folder or in the root if no folder is specified.
getPackageJsonPathResolves the path to the package.json file in the specified folder or in the root if no folder is specified.
getPackageLockJsonPathResolves the path to the package-lock.json file in the specified folder or in the root if no folder is specified.
readPackageJsonReads the package.json file from the specified folder or from the root if no folder is specified.
readPackageJsonSyncReads the package.json file from the specified folder or from the root if no folder is specified.
readPackageLockJsonReads the package-lock.json file from the specified folder or from the root if no folder is specified.
readPackageLockJsonSyncReads the package-lock.json file from the specified folder or from the root if no folder is specified.
writePackageJsonWrites the provided PackageJson object to the package.json file in the specified folder or in the root.
writePackageJsonSyncWrites the provided PackageJson object to the package.json file in the specified folder or in the root.
writePackageLockJsonWrites the provided PackageJson object to the package-lock.json file in the specified folder or in the root.
writePackageLockJsonSyncWrites the provided PackageLockJson object to the package-lock.json file in the specified folder or in the root.
TypeDescription
EditNpmShrinkWrapJsonOptionsOptions for editNpmShrinkWrapJson.
EditPackageJsonSyncOptionsOptions for editPackageJsonSync.
EditPackageLockJsonOptionsOptions for editPackageLockJson.
EditPackageLockJsonSyncOptionsOptions for editPackageLockJsonSync.