Skip to content

Commit

Permalink
feat(travis): remove supportPolicy (#11176)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Aug 17, 2021
1 parent edbe6ae commit 123dc44
Show file tree
Hide file tree
Showing 24 changed files with 51 additions and 510 deletions.
6 changes: 0 additions & 6 deletions docs/usage/configuration-options.md
Expand Up @@ -2302,12 +2302,6 @@ This works because Renovate will add a "renovate/stability-days" pending status

<!-- markdownlint-enable MD001 -->

## supportPolicy

Language support is limited to those listed below:

- **Node.js** - [Read our Node.js documentation](https://docs.renovatebot.com/node#configuring-support-policy)

## suppressNotifications

Use this field to suppress various types of warnings and other notifications from Renovate.
Expand Down
39 changes: 0 additions & 39 deletions docs/usage/node.md
Expand Up @@ -17,45 +17,6 @@ Renovate can manage the Node.js version in the following files:
- The [`.nvmrc`](https://github.com/creationix/nvm#nvmrc) file for the [Node Version Manager](https://github.com/creationix/nvm)
- The [`node_js`](https://docs.travis-ci.com/user/languages/javascript-with-nodejs/#Specifying-Node.js-versions) field in [`.travis.yml`](https://docs.travis-ci.com/user/customizing-the-build/)

## How It Works

Node.js renovation in `package.json > engines` and in `.nvmrc` is enabled by default, if your existing version is pinned.

To enable `.travis.yml` renovation, you must:

1. Enable Travis renovation explicitly by setting the following Renovate configuration: `"travis": { "enabled": true }`
1. Optionally, configure a support policy (As documented below)

When Renovate processes your project's repository it will look for the files listed above and submit a single pull request that upgrades all Node.js versions simultaneously.

## Configuring Support Policy

Renovate supports a [`supportPolicy`](./configuration-options.md#supportpolicy) option that can be passed the following values and associated versions (current as of June 2021):

**Default:** `lts`

| supportPolicy | versions | description |
| ------------- | ---------- | -------------------------------------------------------- |
| all | 12, 14, 16 | All releases that have not passed their end date |
| lts | 12, 14 | All releases classified as LTS, including in maintenance |
| active | 14, 16 | All releases not in maintenance |
| lts_active | 14 | All releases both LTS and active |
| lts_latest | 14 | The latest LTS release |
| current | 16 | The latest release from "all" |

The version numbers associated with each support policy will be updated as new versions of Node.js are released, moved to LTS or maintenance, etc.

For example, to instruct Renovate to upgrade your project to the latest [Long-term Support](https://github.com/nodejs/Release#release-plan) release, you can use the following configuration:

```json
"supportPolicy": ["lts_latest"]
```

We recommend that you define this support policy inside the `node` configuration object.
This way, it is applied to all Node.js-related files.

For additional language support see the [`supportPolicy` documentation](./configuration-options.md#supportpolicy).

## Configuring which version of npm Renovate uses

When `binarySource=docker`, such as in the hosted WhiteSource Renovate App, Renovate will choose and install an `npm` version dynamically.
Expand Down
3 changes: 0 additions & 3 deletions lib/config/__snapshots__/migration.spec.ts.snap
Expand Up @@ -288,9 +288,6 @@ exports[`config/migration migrateConfig(config, parentConfig) migrates node to t
Object {
"node": Object {
"automerge": false,
"supportPolicy": Array [
"lts",
],
},
"travis": Object {
"enabled": true,
Expand Down
9 changes: 0 additions & 9 deletions lib/config/definitions.ts
Expand Up @@ -1645,15 +1645,6 @@ const options: RenovateOptions[] = [
mergeable: true,
cli: false,
},
{
name: 'supportPolicy',
description:
'Dependency support policy, e.g. used for LTS vs non-LTS etc (Node only).',
type: 'array',
subType: 'string',
stage: 'package',
allowString: true,
},
{
name: 'node',
description: 'Configuration object for Node version renovation.',
Expand Down
6 changes: 1 addition & 5 deletions lib/config/migration.spec.ts
Expand Up @@ -12,7 +12,7 @@ import type {
const defaultConfig = getConfig();

interface TestRenovateConfig extends RenovateConfig {
node?: RenovateSharedConfig & { supportPolicy?: unknown };
node?: RenovateSharedConfig;
}

describe(getName(), () => {
Expand Down Expand Up @@ -356,7 +356,6 @@ describe(getName(), () => {
const config: TestRenovateConfig = {
node: {
enabled: true,
supportPolicy: ['lts'],
automerge: 'none' as never,
},
};
Expand All @@ -372,9 +371,6 @@ describe(getName(), () => {
expect((migratedConfig.travis as RenovateSharedConfig).enabled).toBe(
true
);
expect(
(migratedConfig.node as TestRenovateConfig).supportPolicy
).toBeDefined();
});
it('migrates packageFiles', () => {
const config: TestRenovateConfig = {
Expand Down
1 change: 1 addition & 0 deletions lib/config/migration.ts
Expand Up @@ -32,6 +32,7 @@ const removedOptions = [
'groupPrBody',
'statusCheckVerify',
'lazyGrouping',
'supportPolicy',
];

// Returns a migrated config
Expand Down
20 changes: 0 additions & 20 deletions lib/manager/index.spec.ts
Expand Up @@ -91,26 +91,6 @@ describe(getName(), () => {
});
});

describe('getPackageUpdates', () => {
it('returns null', () => {
manager.getManagers().set('dummy', {
defaultConfig: {},
});
expect(manager.getPackageUpdates('unknown', null)).toBeNull();
expect(manager.getPackageUpdates('dummy', null)).toBeNull();
});
it('returns non-null', () => {
manager.getManagers().set('dummy', {
defaultConfig: {},
getPackageUpdates: () => Promise.resolve({ updates: [] }),
});
expect(manager.getPackageUpdates('dummy', {} as any)).not.toBeNull();
});
afterEach(() => {
manager.getManagers().delete('dummy');
});
});

describe('getRangeStrategy', () => {
it('returns null', () => {
manager.getManagers().set('dummy', {
Expand Down
13 changes: 0 additions & 13 deletions lib/manager/index.ts
Expand Up @@ -17,8 +17,6 @@ import type {
ExtractConfig,
ManagerApi,
PackageFile,
PackageUpdateConfig,
PackageUpdateResult,
RangeConfig,
Result,
} from './types';
Expand Down Expand Up @@ -69,17 +67,6 @@ export async function extractAllPackageFiles(
return null;
}

export function getPackageUpdates(
manager: string,
config: PackageUpdateConfig
): Result<PackageUpdateResult> | null {
if (!managers.has(manager)) {
return null;
}
const m = managers.get(manager);
return m.getPackageUpdates ? m.getPackageUpdates(config) : null;
}

export function extractPackageFile(
manager: string,
content: string,
Expand Down
13 changes: 9 additions & 4 deletions lib/manager/travis/__snapshots__/extract.spec.ts.snap
Expand Up @@ -4,11 +4,16 @@ exports[`manager/travis/extract extractPackageFile() returns results 1`] = `
Object {
"deps": Array [
Object {
"currentValue": Array [
6,
8,
],
"currentValue": 6,
"datasource": "github-tags",
"depName": "node",
"lookupName": "nodejs/node",
},
Object {
"currentValue": 8,
"datasource": "github-tags",
"depName": "node",
"lookupName": "nodejs/node",
},
],
}
Expand Down
27 changes: 0 additions & 27 deletions lib/manager/travis/__snapshots__/package.spec.ts.snap

This file was deleted.

34 changes: 0 additions & 34 deletions lib/manager/travis/__snapshots__/update.spec.ts.snap

This file was deleted.

2 changes: 1 addition & 1 deletion lib/manager/travis/extract.spec.ts
Expand Up @@ -12,7 +12,7 @@ describe(getName(), () => {
it('returns results', () => {
const res = extractPackageFile('node_js:\n - 6\n - 8\n');
expect(res).toMatchSnapshot();
expect(res.deps).toHaveLength(1);
expect(res.deps).toHaveLength(2);
});
it('should handle invalid YAML', () => {
const res = extractPackageFile(invalidYAML);
Expand Down
13 changes: 7 additions & 6 deletions lib/manager/travis/extract.ts
@@ -1,5 +1,6 @@
import is from '@sindresorhus/is';
import { load } from 'js-yaml';
import * as datasourceGithubTags from '../../datasource/github-tags';
import { logger } from '../../logger';
import type { PackageDependency, PackageFile } from '../types';

Expand All @@ -14,12 +15,12 @@ export function extractPackageFile(content: string): PackageFile | null {
}
let deps: PackageDependency[] = [];
if (doc && is.array(doc.node_js)) {
deps = [
{
depName: 'node',
currentValue: doc.node_js,
},
];
deps = doc.node_js.map((currentValue) => ({
depName: 'node',
datasource: datasourceGithubTags.id,
lookupName: 'nodejs/node',
currentValue,
}));
}
if (!deps.length) {
return null;
Expand Down
5 changes: 3 additions & 2 deletions lib/manager/travis/index.ts
Expand Up @@ -2,12 +2,13 @@ import { LANGUAGE_NODE } from '../../constants/languages';
import * as nodeVersioning from '../../versioning/node';

export { extractPackageFile } from './extract';
export { getPackageUpdates } from './package';
export { updateDependency } from './update';

export const language = LANGUAGE_NODE;

export const defaultConfig = {
fileMatch: ['^.travis.yml$'],
major: {
enabled: false,
},
versioning: nodeVersioning.id,
};
86 changes: 0 additions & 86 deletions lib/manager/travis/package.spec.ts

This file was deleted.

0 comments on commit 123dc44

Please sign in to comment.