Skip to content

Commit

Permalink
Support v3 lockfiles in npmUpdate script
Browse files Browse the repository at this point in the history
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
  • Loading branch information
t1m0thyj committed Aug 17, 2023
1 parent 338a152 commit da06a07
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dist/run-script.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/run-script/scripts/npmUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ function getDependencies(context: IContext, branch: IProtectedBranchWithDeps, de

async function updateDependency(context: IContext, pkgName: string, pkgTag: string, dev: boolean): Promise<void> {
context.logger.debug(`Updating ${dev ? "devD" : "d"}ependency for: ${pkgName}@${pkgTag}`);
const lockfile = JSON.parse(fs.readFileSync(lockfilePath, "utf-8"));
const currentVersion = lockfile.dependencies[pkgName].version;
const cmdOutput = (await exec.getExecOutput("npm", ["list", pkgName, "--json", "--depth", "0"])).stdout;
const currentVersion = JSON.parse(cmdOutput).dependencies[pkgName].version;

if (resolutions[pkgName] == null) {
context.logger.debug(`Gathering version information for: ${pkgName}@${pkgTag}`);
Expand Down

0 comments on commit da06a07

Please sign in to comment.