Skip to content

Commit

Permalink
feat!: Revert "feat!: remove skipInstalls config option (#22648)"
Browse files Browse the repository at this point in the history
This reverts commit 4c68647.
  • Loading branch information
rarkins committed Jun 27, 2023
1 parent ddd2af9 commit b11bb7d
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 14 deletions.
8 changes: 7 additions & 1 deletion docs/usage/self-hosted-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {

In the `renovate.json` file, define the commands and files to be included in the final commit.

The command to install dependencies (`npm ci --ignore-scripts`) is needed because, by default, the installation of dependencies is skipped.
The command to install dependencies (`npm ci --ignore-scripts`) is needed because, by default, the installation of dependencies is skipped (see the `skipInstalls` global option).

```json
{
Expand Down Expand Up @@ -822,6 +822,12 @@ It could then be used in a repository config or preset like so:

Secret names must start with an upper or lower case character and can have only characters, digits, or underscores.

## skipInstalls

By default, Renovate will use the most efficient approach to updating package files and lock files, which in most cases skips the need to perform a full module install by the bot.
If this is set to false, then a full install of modules will be done.
This is currently applicable to `npm` and `lerna`/`npm` only, and only used in cases where bugs in `npm` result in incorrect lock files being updated.

## token

## unicodeEmoji
Expand Down
8 changes: 8 additions & 0 deletions lib/config/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,14 @@ const options: RenovateOptions[] = [
description: 'Set to `false` to disable lock file updating.',
type: 'boolean',
},
{
name: 'skipInstalls',
description:
'Skip installing modules/dependencies if lock file updating is possible without a full install.',
type: 'boolean',
default: null,
globalOnly: true,
},
{
name: 'autodiscover',
description: 'Autodiscover all repositories.',
Expand Down
1 change: 1 addition & 0 deletions lib/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ export interface RenovateConfig
secrets?: Record<string, string>;

constraints?: Record<string, string>;
skipInstalls?: boolean | null;

constraintsFiltering?: ConstraintsFilter;

Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/npm/extract/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const realFs = jest.requireActual<typeof import('../../../../util/fs')>(
);

const defaultExtractConfig = {
skipInstalls: true,
skipInstalls: null,
} satisfies ExtractConfig;

const input01Content = Fixtures.get('inputs/01.json', '..');
Expand Down
22 changes: 13 additions & 9 deletions lib/modules/manager/npm/extract/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,15 +473,19 @@ export async function extractPackageFile(
return null;
}
}
let skipInstalls = true; // skip installing modules by default
if ((hasFancyRefs && lockFiles.npmLock) || yarnZeroInstall) {
// https://github.com/npm/cli/issues/1432
// Explanation:
// - npm install --package-lock-only is buggy for transitive deps in file: and npm: references
// - So we set skipInstalls to false if file: or npm: refs are found *and* the user hasn't explicitly set the value already
// - Also, do not skip install if Yarn zero-install is used
logger.debug('Automatically setting skipInstalls to false');
skipInstalls = false;
let skipInstalls = config.skipInstalls;
if (skipInstalls === null) {
if ((hasFancyRefs && lockFiles.npmLock) || yarnZeroInstall) {
// https://github.com/npm/cli/issues/1432
// Explanation:
// - npm install --package-lock-only is buggy for transitive deps in file: and npm: references
// - So we set skipInstalls to false if file: or npm: refs are found *and* the user hasn't explicitly set the value already
// - Also, do not skip install if Yarn zero-install is used
logger.debug('Automatically setting skipInstalls to false');
skipInstalls = false;
} else {
skipInstalls = true;
}
}

return {
Expand Down
6 changes: 3 additions & 3 deletions lib/modules/manager/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface ExtractConfig extends CustomExtractConfig {
registryAliases?: Record<string, string>;
npmrc?: string;
npmrcMerge?: boolean;
skipInstalls?: boolean;
skipInstalls?: boolean | null;
}

export interface CustomExtractConfig extends RegexManagerTemplates {
Expand Down Expand Up @@ -64,7 +64,7 @@ export interface PackageFileContent<T = Record<string, any>>
lockFiles?: string[];
npmrc?: string;
packageFileVersion?: string;
skipInstalls?: boolean;
skipInstalls?: boolean | null;
matchStrings?: string[];
matchStringsStrategy?: MatchStringsStrategy;
}
Expand Down Expand Up @@ -274,7 +274,7 @@ export interface PostUpdateConfig<T = Record<string, any>>
ManagerData<T> {
updatedPackageFiles?: FileChange[];
postUpdateOptions?: string[];
skipInstalls?: boolean;
skipInstalls?: boolean | null;
ignoreScripts?: boolean;

packageFile?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ describe('workers/repository/extract/extract-fingerprint-config', () => {
registryAliases: {
notStable: 'http://some.link.2',
},
skipInstalls: null,
});
expect(
fingerprintConfig.managers.find((manager) => manager.manager === 'regex')
Expand All @@ -65,6 +66,7 @@ describe('workers/repository/extract/extract-fingerprint-config', () => {
registryAliases: {
stable: 'http://some.link',
},
skipInstalls: null,
});
});

Expand All @@ -88,6 +90,7 @@ describe('workers/repository/extract/extract-fingerprint-config', () => {
npmrc: 'some-string',
npmrcMerge: true,
registryAliases: {},
skipInstalls: null,
});
expect(
fingerprintConfig.managers.find(
Expand All @@ -106,6 +109,7 @@ describe('workers/repository/extract/extract-fingerprint-config', () => {
npmrc: 'some-string',
npmrcMerge: true,
registryAliases: {},
skipInstalls: null,
});
expect(
fingerprintConfig.managers.find((manager) => manager.manager === 'regex')
Expand Down

0 comments on commit b11bb7d

Please sign in to comment.