Skip to content

Commit

Permalink
feat(manager/npm): full npm buildpack support
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice committed Aug 5, 2022
1 parent 9d939f4 commit 89abe52
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 3 additions & 0 deletions lib/modules/manager/npm/post-update/npm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ describe('modules/manager/npm/post-update/npm', () => {
'-w "some-dir" ' +
'renovate/node ' +
'bash -l -c "' +
'install-tool node 16.16.0 ' +
'&& ' +
'install-tool npm 6.0.0 ' +
'&& ' +
'hash -d npm 2>/dev/null || true ' +
Expand Down Expand Up @@ -296,6 +298,7 @@ describe('modules/manager/npm/post-update/npm', () => {
expect(fs.readLocalFile).toHaveBeenCalledTimes(1);
expect(res.lockFile).toBe('package-lock-contents');
expect(execSnapshots).toMatchObject([
{ cmd: 'install-tool node 16.16.0' },
{ cmd: 'install-tool npm 6.0.0' },
{ cmd: 'hash -d npm 2>/dev/null || true' },
{
Expand Down
13 changes: 6 additions & 7 deletions lib/modules/manager/npm/post-update/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
} from '../../../../util/fs';
import type { PostUpdateConfig, Upgrade } from '../../types';
import { composeLockFile, parseLockFile } from '../utils';
import { getNodeConstraint, getNodeUpdate } from './node-version';
import { getNodeToolConstraint } from './node-version';
import type { GenerateLockFileResult } from './types';

export async function generateLockFile(
Expand Down Expand Up @@ -55,20 +55,19 @@ export async function generateLockFile(
cmdOptions += ' --ignore-scripts';
}

const tagConstraint =
getNodeUpdate(upgrades) ?? (await getNodeConstraint(config));
const extraEnv: ExtraEnv = {
NPM_CONFIG_CACHE: env.NPM_CONFIG_CACHE,
npm_config_store: env.npm_config_store,
};
const execOptions: ExecOptions = {
cwdFile: lockFileName,
extraEnv,
toolConstraints: [npmToolConstraint],
toolConstraints: [
await getNodeToolConstraint(config, upgrades),
npmToolConstraint,
],
docker: {
image: 'node',
tagScheme: 'node',
tagConstraint,
image: 'sidecar',
},
};
// istanbul ignore if
Expand Down

0 comments on commit 89abe52

Please sign in to comment.