From b8dadb718d757938f21cbbf61ec6060f7d09023e Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@keylocation.sg> Date: Tue, 5 Dec 2017 07:50:16 +0100 Subject: [PATCH] feat: travis.yml node_js versions support (#1243) This PR adds support for renovating the `node_js` versions in `.travis.yml` configuration files. Important notes: - Functionality is disabled by default and hence opt-in via configuration - Added a new manager type `node` because it is anticipated to support more than just Travis in future, with mostly unified logic - Added the config option "policy" with supported values: lts, active, current, lts_latest and lts_active - Policy is actually an array, to allow additive combining, e.g. `["lts_latest", "current"]` - Actual node versions are *hardcoded*. There is no perfect metadata source for this and they change infrequently enough that it is definitely not a problem for now (next change will be in April 2018) - If node versions need updating, they are listed from newest to oldest - Replacing function attempts to detect the indention (spacing) in file and use that To enable, configure `node.enabled=true` and optionally `node.policy=["<policy>"]` if you want something other than `lts`. Closes #1208 --- docs/configuration.md | 22 ++ lib/config/definitions.js | 21 + lib/config/templates/node/branch-name.hbs | 1 + lib/config/templates/node/pr-body.hbs | 35 ++ lib/config/templates/node/pr-title.hbs | 1 + lib/manager/index.js | 12 + lib/manager/node/detect.js | 13 + lib/manager/node/extract.js | 13 + lib/manager/node/package.js | 36 ++ lib/manager/node/resolve.js | 18 + lib/manager/node/update.js | 20 + lib/manager/resolve.js | 4 + lib/workers/dep-type/index.js | 3 + lib/workers/package-file/index.js | 20 + lib/workers/repository/updates/determine.js | 6 + package.json | 2 + test/_fixtures/node/travis.yml | 21 + test/manager/__snapshots__/index.spec.js.snap | 6 + .../__snapshots__/resolve.spec.js.snap | 358 +++++++++++++++++- test/manager/index.spec.js | 15 + .../node/__snapshots__/package.spec.js.snap | 13 + .../node/__snapshots__/update.spec.js.snap | 27 ++ test/manager/node/extract.spec.js | 14 + test/manager/node/package.spec.js | 26 ++ test/manager/node/update.spec.js | 34 ++ test/manager/resolve.spec.js | 9 +- test/workers/dep-type/index.spec.js | 9 + test/workers/package-file/index.spec.js | 21 + .../package/__snapshots__/index.spec.js.snap | 1 + test/workers/package/index.spec.js | 8 + .../__snapshots__/branchify.spec.js.snap | 220 +++++++++++ .../repository/updates/determine.spec.js | 6 +- yarn.lock | 10 +- 33 files changed, 1013 insertions(+), 12 deletions(-) create mode 100644 lib/config/templates/node/branch-name.hbs create mode 100644 lib/config/templates/node/pr-body.hbs create mode 100644 lib/config/templates/node/pr-title.hbs create mode 100644 lib/manager/node/detect.js create mode 100644 lib/manager/node/extract.js create mode 100644 lib/manager/node/package.js create mode 100644 lib/manager/node/resolve.js create mode 100644 lib/manager/node/update.js create mode 100644 test/_fixtures/node/travis.yml create mode 100644 test/manager/node/__snapshots__/package.spec.js.snap create mode 100644 test/manager/node/__snapshots__/update.spec.js.snap create mode 100644 test/manager/node/extract.spec.js create mode 100644 test/manager/node/package.spec.js create mode 100644 test/manager/node/update.spec.js diff --git a/docs/configuration.md b/docs/configuration.md index f39950b92b..7b128073bb 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -749,6 +749,28 @@ location with this method. <td>`RENOVATE_METEOR`</td> <td>`--meteor`<td> </tr> +<tr> + <td>`supportPolicy`</td> + <td>Dependency support policy, e.g. used for LTS vs non-LTS etc (node-only)</td> + <td>list</td> + <td><pre>[]</pre></td> + <td>`RENOVATE_SUPPORT_POLICY`</td> + <td>`--support-policy`<td> +</tr> +<tr> + <td>`node`</td> + <td>Configuration object for node version renovation</td> + <td>json</td> + <td><pre>{ + "enabled": false, + "supportPolicy": ["lts"], + "branchName": "{{branchPrefix}}node-{{depNameSanitized}}", + "prBody": "This Pull Request updates `{{depName}}` versions from `{{currentVersions}}` to `{{newVersions}}`. This is according to the configured node.js support policy \"{{supportPolicy}}\".\n\n{{#if schedule}}\n**Note**: This PR was created on a configured schedule (\"{{schedule}}\"{{#if timezone}} in timezone `{{timezone}}`{{/if}}) and will not receive updates outside those times.\n{{/if}}\n\n{{#if hasErrors}}\n\n---\n\n### Errors\n\nRenovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR.\n\n{{#each errors as |error|}}\n- `{{error.depName}}`: {{error.message}}\n{{/each}}\n{{/if}}\n\n{{#if hasWarnings}}\n\n---\n\n### Warnings\n\nPlease make sure the following warnings are safe to ignore:\n\n{{#each warnings as |warning|}}\n- `{{warning.depName}}`: {{warning.message}}\n{{/each}}\n{{/if}}\n\n---\n\nThis PR has been generated by [Renovate Bot](https://renovateapp.com).", + "prTitle": "Update {{depName}} versions to [{{newVersions}}]" +}</pre></td> + <td>`RENOVATE_NODE`</td> + <td>`--node`<td> +</tr> <tr> <td>`docker`</td> <td>Configuration object for Dockerfile renovation</td> diff --git a/lib/config/definitions.js b/lib/config/definitions.js index b04802f417..e6abf18362 100644 --- a/lib/config/definitions.js +++ b/lib/config/definitions.js @@ -638,6 +638,27 @@ const options = [ default: { enabled: true }, mergeable: true, }, + { + name: 'supportPolicy', + description: + 'Dependency support policy, e.g. used for LTS vs non-LTS etc (node-only)', + type: 'list', + allowString: true, + }, + { + name: 'node', + description: 'Configuration object for node version renovation', + stage: 'repository', + type: 'json', + default: { + enabled: false, + supportPolicy: ['lts'], + branchName: template('branchName', 'node'), + prBody: template('prBody', 'node'), + prTitle: template('prTitle', 'node'), + }, + mergeable: true, + }, { name: 'docker', description: 'Configuration object for Dockerfile renovation', diff --git a/lib/config/templates/node/branch-name.hbs b/lib/config/templates/node/branch-name.hbs new file mode 100644 index 0000000000..38a6f040df --- /dev/null +++ b/lib/config/templates/node/branch-name.hbs @@ -0,0 +1 @@ +{{branchPrefix}}node-{{depNameSanitized}} diff --git a/lib/config/templates/node/pr-body.hbs b/lib/config/templates/node/pr-body.hbs new file mode 100644 index 0000000000..d2686f92cf --- /dev/null +++ b/lib/config/templates/node/pr-body.hbs @@ -0,0 +1,35 @@ +This Pull Request updates `{{depName}}` versions from `{{currentVersions}}` to `{{newVersions}}`. This is according to the configured node.js support policy "{{supportPolicy}}". + +{{#if schedule}} +**Note**: This PR was created on a configured schedule ("{{schedule}}"{{#if timezone}} in timezone `{{timezone}}`{{/if}}) and will not receive updates outside those times. +{{/if}} + +{{#if hasErrors}} + +--- + +### Errors + +Renovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR. + +{{#each errors as |error|}} +- `{{error.depName}}`: {{error.message}} +{{/each}} +{{/if}} + +{{#if hasWarnings}} + +--- + +### Warnings + +Please make sure the following warnings are safe to ignore: + +{{#each warnings as |warning|}} +- `{{warning.depName}}`: {{warning.message}} +{{/each}} +{{/if}} + +--- + +This PR has been generated by [Renovate Bot](https://renovateapp.com). diff --git a/lib/config/templates/node/pr-title.hbs b/lib/config/templates/node/pr-title.hbs new file mode 100644 index 0000000000..55ab0e503e --- /dev/null +++ b/lib/config/templates/node/pr-title.hbs @@ -0,0 +1 @@ +Update {{depName}} versions to [{{newVersions}}] diff --git a/lib/manager/index.js b/lib/manager/index.js index 8d75c48efa..7822746ec9 100644 --- a/lib/manager/index.js +++ b/lib/manager/index.js @@ -2,14 +2,17 @@ const minimatch = require('minimatch'); const docker = require('./docker/package'); const npm = require('./npm/package'); +const node = require('./node/package'); const dockerDetect = require('./docker/detect'); const meteorDetect = require('./meteor/detect'); const npmDetect = require('./npm/detect'); +const nodeDetect = require('./node/detect'); const npmUpdater = require('./npm/update'); const meteorUpdater = require('./meteor/update'); const dockerfileHelper = require('./docker/update'); +const nodeHelper = require('./node/update'); module.exports = { detectPackageFiles, @@ -42,6 +45,11 @@ async function detectPackageFiles(config) { logger.info({ dockerFiles }, 'Found Dockerfiles'); packageFiles = packageFiles.concat(dockerFiles); } + const nodeFiles = await nodeDetect.detectPackageFiles(config, fileList); + if (nodeFiles.length) { + logger.info({ nodeFiles }, 'Found node files'); + packageFiles = packageFiles.concat(nodeFiles); + } return packageFiles; } @@ -52,6 +60,8 @@ function getPackageUpdates(config) { return npm.getPackageUpdates(config); } else if (config.packageFile.endsWith('package.js')) { return npm.getPackageUpdates(config); + } else if (config.packageFile.endsWith('.travis.yml')) { + return node.getPackageUpdates(config); } logger.info(`Cannot find manager for ${config.packageFile}`); throw new Error('Unsupported package manager'); @@ -82,6 +92,8 @@ async function getUpdatedPackageFiles(config) { ); } else if (upgrade.packageFile.endsWith('Dockerfile')) { newContent = dockerfileHelper.setNewValue(existingContent, upgrade); + } else if (upgrade.packageFile.endsWith('.travis.yml')) { + newContent = nodeHelper.setNewValue(existingContent, upgrade); } if (!newContent) { if (config.parentBranch && config.canRebase) { diff --git a/lib/manager/node/detect.js b/lib/manager/node/detect.js new file mode 100644 index 0000000000..74901d29e3 --- /dev/null +++ b/lib/manager/node/detect.js @@ -0,0 +1,13 @@ +module.exports = { + detectPackageFiles, +}; + +function detectPackageFiles(config, fileList) { + logger.debug('node.detectPackageFiles()'); + if (config.node.enabled) { + if (fileList.includes('.travis.yml')) { + return ['.travis.yml']; + } + } + return []; +} diff --git a/lib/manager/node/extract.js b/lib/manager/node/extract.js new file mode 100644 index 0000000000..a2c0ffbba7 --- /dev/null +++ b/lib/manager/node/extract.js @@ -0,0 +1,13 @@ +const yaml = require('js-yaml'); + +module.exports = { + extractDependencies, +}; + +function extractDependencies(packageContent) { + const doc = yaml.safeLoad(packageContent); + if (doc && Array.isArray(doc.node_js)) { + return [{ depName: 'Travis node_js', currentVersions: doc.node_js }]; + } + return []; +} diff --git a/lib/manager/node/package.js b/lib/manager/node/package.js new file mode 100644 index 0000000000..6757cbf7fc --- /dev/null +++ b/lib/manager/node/package.js @@ -0,0 +1,36 @@ +const { isEqual } = require('lodash'); + +module.exports = { + getPackageUpdates, +}; + +// Start version numbers as integers for correct sorting +const policies = { + lts: [4, 6, 8], + active: [6, 8, 9], + current: [9], + lts_active: [6, 8], + lts_latest: [8], +}; + +function getPackageUpdates(config) { + logger.debug('node.getPackageUpdates()'); + if (!Array.isArray(config.supportPolicy) || !config.supportPolicy.length) { + return []; + } + const newVersions = config.supportPolicy + .map(supportPolicy => policies[supportPolicy]) + .reduce((result, supportPolicy) => result.concat(supportPolicy), []) + .sort() // sort combined array + .reverse() // we want to order latest to oldest + .map(version => `${version}`); // convert to strings + logger.debug({ newVersions }); + if (isEqual([...config.currentVersions].sort(), [...newVersions].sort())) { + return []; + } + return [ + { + newVersions, + }, + ]; +} diff --git a/lib/manager/node/resolve.js b/lib/manager/node/resolve.js new file mode 100644 index 0000000000..67bf47230f --- /dev/null +++ b/lib/manager/node/resolve.js @@ -0,0 +1,18 @@ +const configParser = require('../../config'); + +module.exports = { + resolvePackageFile, +}; + +async function resolvePackageFile(config, inputFile) { + const packageFile = configParser.mergeChildConfig(config.node, inputFile); + logger.debug( + `Resolving packageFile ${JSON.stringify(packageFile.packageFile)}` + ); + packageFile.content = await platform.getFile(packageFile.packageFile); + if (!packageFile.content) { + logger.debug('No packageFile content'); + return null; + } + return packageFile; +} diff --git a/lib/manager/node/update.js b/lib/manager/node/update.js new file mode 100644 index 0000000000..81401df2c9 --- /dev/null +++ b/lib/manager/node/update.js @@ -0,0 +1,20 @@ +const detectIndent = require('detect-indent'); + +module.exports = { + setNewValue, +}; + +function setNewValue(currentFileContent, upgrade) { + try { + logger.debug(`node.setNewValue: ${upgrade.newVersions}`); + const indent = detectIndent(currentFileContent).indent || ' '; + let newString = `\nnode_js:\n`; + upgrade.newVersions.forEach(version => { + newString += `${indent}- '${version}'\n`; + }); + return currentFileContent.replace(/\nnode_js:(\n\s+[^\n]+)+\n/, newString); + } catch (err) { + logger.info({ err }, 'Error setting new .travis.yml node versions'); + return null; + } +} diff --git a/lib/manager/resolve.js b/lib/manager/resolve.js index c7f74a42c3..4575dddabb 100644 --- a/lib/manager/resolve.js +++ b/lib/manager/resolve.js @@ -6,6 +6,7 @@ const presets = require('../config/presets'); const manager = require('./index'); const dockerResolve = require('../manager/docker/resolve'); +const nodeResolve = require('../manager/node/resolve'); const { mergeChildConfig } = require('../config'); const { checkMonorepos } = require('../manager/npm/monorepos'); @@ -125,6 +126,9 @@ async function resolvePackageFiles(config) { } else if (packageFile.packageFile.endsWith('Dockerfile')) { logger.debug('Resolving Dockerfile'); return dockerResolve.resolvePackageFile(config, packageFile); + } else if (packageFile.packageFile.endsWith('.travis.yml')) { + logger.debug('Resolving .travis.yml'); + return nodeResolve.resolvePackageFile(config, packageFile); } return null; } diff --git a/lib/workers/dep-type/index.js b/lib/workers/dep-type/index.js index bfaab69d76..89018691c7 100644 --- a/lib/workers/dep-type/index.js +++ b/lib/workers/dep-type/index.js @@ -3,6 +3,7 @@ const pkgWorker = require('../package'); const packageJson = require('./package-json'); const dockerExtract = require('../../manager/docker/extract'); const meteorExtract = require('../../manager/meteor/extract'); +const nodeExtract = require('../../manager/node/extract'); module.exports = { renovateDepType, @@ -38,6 +39,8 @@ async function renovateDepType(packageContent, config) { deps = meteorExtract.extractDependencies(packageContent); } else if (config.packageFile.endsWith('Dockerfile')) { deps = dockerExtract.extractDependencies(packageContent); + } else if (config.packageFile.endsWith('.travis.yml')) { + deps = nodeExtract.extractDependencies(packageContent); } deps = deps.filter( dependency => config.ignoreDeps.indexOf(dependency.depName) === -1 diff --git a/lib/workers/package-file/index.js b/lib/workers/package-file/index.js index 4762bd858d..eceb3ad578 100644 --- a/lib/workers/package-file/index.js +++ b/lib/workers/package-file/index.js @@ -7,6 +7,7 @@ module.exports = { renovatePackageFile, renovateMeteorPackageFile, renovateDockerfile, + renovateNodeFile, }; function mightBeABrowserLibrary(packageJson) { @@ -136,3 +137,22 @@ async function renovateDockerfile(packageFileConfig) { logger.info('Finished processing Dockerfile'); return upgrades; } + +async function renovateNodeFile(packageFileConfig) { + let upgrades = []; + logger.info(`Processing node file`); + + // Check if config is disabled + if (packageFileConfig.enabled === false) { + logger.info('node is disabled'); + return upgrades; + } + upgrades = upgrades.concat( + await depTypeWorker.renovateDepType( + packageFileConfig.content, + packageFileConfig + ) + ); + logger.info('Finished processing node file'); + return upgrades; +} diff --git a/lib/workers/repository/updates/determine.js b/lib/workers/repository/updates/determine.js index 7c95eaa405..ddd3d6e722 100644 --- a/lib/workers/repository/updates/determine.js +++ b/lib/workers/repository/updates/determine.js @@ -30,6 +30,11 @@ async function determineRepoUpgrades(config) { upgrades = upgrades.concat( await packageFileWorker.renovateDockerfile(packageFileConfig) ); + } else if (packageFileConfig.packageFile.endsWith('.travis.yml')) { + logger.info('Renovating .travis.yml node_js versions'); + upgrades = upgrades.concat( + await packageFileWorker.renovateNodeFile(packageFileConfig) + ); } } let semanticCommits; @@ -44,6 +49,7 @@ async function determineRepoUpgrades(config) { ? upgrade.depName .replace('@', '') .replace('/', '-') + .replace(/\s+/g, '-') .toLowerCase() : undefined, })); diff --git a/package.json b/package.json index dfc6e4f92f..6cb27f0616 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "conventional-commits-detector": "0.1.1", "convert-hrtime": "2.0.0", "deepcopy": "0.6.3", + "detect-indent": "5.0.0", "fs-extra": "4.0.2", "get-installed-path": "4.0.8", "gh-got": "7.0.0", @@ -57,6 +58,7 @@ "got": "8.0.1", "handlebars": "4.0.11", "ini": "1.3.5", + "js-yaml": "3.10.0", "json-dup-key-validator": "1.0.2", "json-stringify-pretty-compact": "1.0.4", "jsonwebtoken": "8.1.0", diff --git a/test/_fixtures/node/travis.yml b/test/_fixtures/node/travis.yml new file mode 100644 index 0000000000..7482c4c09a --- /dev/null +++ b/test/_fixtures/node/travis.yml @@ -0,0 +1,21 @@ +dist: trusty +language: node_js +node_js: + - '8' + - '6' + - '4' +services: + - redis-server + - mongodb + - mysql +addons: + postgresql: '9.5' +before_script: + - psql -c 'create database keyv_test;' -U postgres + - mysql -u root -e 'CREATE DATABASE keyv_test;' + - mysql -u root -e 'GRANT ALL PRIVILEGES ON keyv_test.* TO 'mysql'@'localhost';' +script: npm run test:full +after_success: npm run coverage +notifications: + email: + on_success: never diff --git a/test/manager/__snapshots__/index.spec.js.snap b/test/manager/__snapshots__/index.spec.js.snap index 9104f880dd..90f1e0df3c 100644 --- a/test/manager/__snapshots__/index.spec.js.snap +++ b/test/manager/__snapshots__/index.spec.js.snap @@ -7,6 +7,12 @@ Array [ ] `; +exports[`manager detectPackageFiles(config) finds .travis.yml files 1`] = ` +Array [ + ".travis.yml", +] +`; + exports[`manager detectPackageFiles(config) finds Dockerfiles 1`] = ` Array [ "Dockerfile", diff --git a/test/manager/__snapshots__/resolve.spec.js.snap b/test/manager/__snapshots__/resolve.spec.js.snap index 2502e7d1b4..a2e4f232f3 100644 --- a/test/manager/__snapshots__/resolve.spec.js.snap +++ b/test/manager/__snapshots__/resolve.spec.js.snap @@ -366,6 +366,49 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "minor": Object {}, "monorepoPackages": Array [], "multipleMajorPrs": false, + "node": Object { + "branchName": "{{branchPrefix}}node-{{depNameSanitized}}", + "enabled": false, + "prBody": "This Pull Request updates \`{{depName}}\` versions from \`{{currentVersions}}\` to \`{{newVersions}}\`. This is according to the configured node.js support policy \\"{{supportPolicy}}\\". + +{{#if schedule}} +**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times. +{{/if}} + +{{#if hasErrors}} + +--- + +### Errors + +Renovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR. + +{{#each errors as |error|}} +- \`{{error.depName}}\`: {{error.message}} +{{/each}} +{{/if}} + +{{#if hasWarnings}} + +--- + +### Warnings + +Please make sure the following warnings are safe to ignore: + +{{#each warnings as |warning|}} +- \`{{warning.depName}}\`: {{warning.message}} +{{/each}} +{{/if}} + +--- + +This PR has been generated by [Renovate Bot](https://renovateapp.com).", + "prTitle": "Update {{depName}} versions to [{{newVersions}}]", + "supportPolicy": Array [ + "lts", + ], + }, "npm": Object { "enabled": true, "pin": Object { @@ -466,6 +509,7 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "semanticCommits": null, "separateMajorReleases": true, "separatePatchReleases": false, + "supportPolicy": Array [], "timezone": null, "token": null, "unpublishSafe": false, @@ -847,6 +891,49 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "minor": Object {}, "monorepoPackages": Array [], "multipleMajorPrs": false, + "node": Object { + "branchName": "{{branchPrefix}}node-{{depNameSanitized}}", + "enabled": false, + "prBody": "This Pull Request updates \`{{depName}}\` versions from \`{{currentVersions}}\` to \`{{newVersions}}\`. This is according to the configured node.js support policy \\"{{supportPolicy}}\\". + +{{#if schedule}} +**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times. +{{/if}} + +{{#if hasErrors}} + +--- + +### Errors + +Renovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR. + +{{#each errors as |error|}} +- \`{{error.depName}}\`: {{error.message}} +{{/each}} +{{/if}} + +{{#if hasWarnings}} + +--- + +### Warnings + +Please make sure the following warnings are safe to ignore: + +{{#each warnings as |warning|}} +- \`{{warning.depName}}\`: {{warning.message}} +{{/each}} +{{/if}} + +--- + +This PR has been generated by [Renovate Bot](https://renovateapp.com).", + "prTitle": "Update {{depName}} versions to [{{newVersions}}]", + "supportPolicy": Array [ + "lts", + ], + }, "npm": Object { "enabled": true, "pin": Object { @@ -958,6 +1045,7 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "semanticCommits": null, "separateMajorReleases": true, "separatePatchReleases": false, + "supportPolicy": Array [], "timezone": null, "token": null, "unpublishSafe": false, @@ -968,7 +1056,7 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", } `; -exports[`manager/resolve resolvePackageFiles() detects meteor and docker 1`] = ` +exports[`manager/resolve resolvePackageFiles() detects meteor and docker and travis 1`] = ` Object { "assignees": Array [], "autodiscover": false, @@ -1334,6 +1422,49 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "minor": Object {}, "monorepoPackages": Array [], "multipleMajorPrs": false, + "node": Object { + "branchName": "{{branchPrefix}}node-{{depNameSanitized}}", + "enabled": false, + "prBody": "This Pull Request updates \`{{depName}}\` versions from \`{{currentVersions}}\` to \`{{newVersions}}\`. This is according to the configured node.js support policy \\"{{supportPolicy}}\\". + +{{#if schedule}} +**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times. +{{/if}} + +{{#if hasErrors}} + +--- + +### Errors + +Renovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR. + +{{#each errors as |error|}} +- \`{{error.depName}}\`: {{error.message}} +{{/each}} +{{/if}} + +{{#if hasWarnings}} + +--- + +### Warnings + +Please make sure the following warnings are safe to ignore: + +{{#each warnings as |warning|}} +- \`{{warning.depName}}\`: {{warning.message}} +{{/each}} +{{/if}} + +--- + +This PR has been generated by [Renovate Bot](https://renovateapp.com).", + "prTitle": "Update {{depName}} versions to [{{newVersions}}]", + "supportPolicy": Array [ + "lts", + ], + }, "npm": Object { "enabled": true, "pin": Object { @@ -1562,6 +1693,52 @@ Please make sure the following warnings are safe to ignore: This PR has been generated by [Renovate Bot](https://renovateapp.com).", "prTitle": "Update {{depName}} Dockerfile tag to {{#if isMajor}}v{{newVersionMajor}}{{else}}v{{newTag}}{{/if}}", }, + Object { + "branchName": "{{branchPrefix}}node-{{depNameSanitized}}", + "content": "hello: world +", + "enabled": false, + "packageFile": ".travis.yml", + "prBody": "This Pull Request updates \`{{depName}}\` versions from \`{{currentVersions}}\` to \`{{newVersions}}\`. This is according to the configured node.js support policy \\"{{supportPolicy}}\\". + +{{#if schedule}} +**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times. +{{/if}} + +{{#if hasErrors}} + +--- + +### Errors + +Renovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR. + +{{#each errors as |error|}} +- \`{{error.depName}}\`: {{error.message}} +{{/each}} +{{/if}} + +{{#if hasWarnings}} + +--- + +### Warnings + +Please make sure the following warnings are safe to ignore: + +{{#each warnings as |warning|}} +- \`{{warning.depName}}\`: {{warning.message}} +{{/each}} +{{/if}} + +--- + +This PR has been generated by [Renovate Bot](https://renovateapp.com).", + "prTitle": "Update {{depName}} versions to [{{newVersions}}]", + "supportPolicy": Array [ + "lts", + ], + }, ], "packageNames": Array [], "packagePatterns": Array [], @@ -1653,6 +1830,7 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "semanticCommits": null, "separateMajorReleases": true, "separatePatchReleases": false, + "supportPolicy": Array [], "timezone": null, "token": null, "unpublishSafe": false, @@ -2029,6 +2207,49 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "minor": Object {}, "monorepoPackages": Array [], "multipleMajorPrs": false, + "node": Object { + "branchName": "{{branchPrefix}}node-{{depNameSanitized}}", + "enabled": false, + "prBody": "This Pull Request updates \`{{depName}}\` versions from \`{{currentVersions}}\` to \`{{newVersions}}\`. This is according to the configured node.js support policy \\"{{supportPolicy}}\\". + +{{#if schedule}} +**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times. +{{/if}} + +{{#if hasErrors}} + +--- + +### Errors + +Renovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR. + +{{#each errors as |error|}} +- \`{{error.depName}}\`: {{error.message}} +{{/each}} +{{/if}} + +{{#if hasWarnings}} + +--- + +### Warnings + +Please make sure the following warnings are safe to ignore: + +{{#each warnings as |warning|}} +- \`{{warning.depName}}\`: {{warning.message}} +{{/each}} +{{/if}} + +--- + +This PR has been generated by [Renovate Bot](https://renovateapp.com).", + "prTitle": "Update {{depName}} versions to [{{newVersions}}]", + "supportPolicy": Array [ + "lts", + ], + }, "npm": Object { "enabled": true, "pin": Object { @@ -2137,6 +2358,7 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "semanticCommits": null, "separateMajorReleases": true, "separatePatchReleases": false, + "supportPolicy": Array [], "timezone": null, "token": null, "unpublishSafe": false, @@ -2513,6 +2735,49 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "minor": Object {}, "monorepoPackages": Array [], "multipleMajorPrs": false, + "node": Object { + "branchName": "{{branchPrefix}}node-{{depNameSanitized}}", + "enabled": false, + "prBody": "This Pull Request updates \`{{depName}}\` versions from \`{{currentVersions}}\` to \`{{newVersions}}\`. This is according to the configured node.js support policy \\"{{supportPolicy}}\\". + +{{#if schedule}} +**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times. +{{/if}} + +{{#if hasErrors}} + +--- + +### Errors + +Renovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR. + +{{#each errors as |error|}} +- \`{{error.depName}}\`: {{error.message}} +{{/each}} +{{/if}} + +{{#if hasWarnings}} + +--- + +### Warnings + +Please make sure the following warnings are safe to ignore: + +{{#each warnings as |warning|}} +- \`{{warning.depName}}\`: {{warning.message}} +{{/each}} +{{/if}} + +--- + +This PR has been generated by [Renovate Bot](https://renovateapp.com).", + "prTitle": "Update {{depName}} versions to [{{newVersions}}]", + "supportPolicy": Array [ + "lts", + ], + }, "npm": Object { "enabled": true, "pin": Object { @@ -2613,6 +2878,7 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "semanticCommits": null, "separateMajorReleases": true, "separatePatchReleases": false, + "supportPolicy": Array [], "timezone": null, "token": null, "unpublishSafe": false, @@ -2623,7 +2889,7 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", } `; -exports[`manager/resolve resolvePackageFiles() skips docker if no content or no match 1`] = ` +exports[`manager/resolve resolvePackageFiles() skips if no content or no match 1`] = ` Object { "assignees": Array [], "autodiscover": false, @@ -2989,6 +3255,49 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "minor": Object {}, "monorepoPackages": Array [], "multipleMajorPrs": false, + "node": Object { + "branchName": "{{branchPrefix}}node-{{depNameSanitized}}", + "enabled": false, + "prBody": "This Pull Request updates \`{{depName}}\` versions from \`{{currentVersions}}\` to \`{{newVersions}}\`. This is according to the configured node.js support policy \\"{{supportPolicy}}\\". + +{{#if schedule}} +**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times. +{{/if}} + +{{#if hasErrors}} + +--- + +### Errors + +Renovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR. + +{{#each errors as |error|}} +- \`{{error.depName}}\`: {{error.message}} +{{/each}} +{{/if}} + +{{#if hasWarnings}} + +--- + +### Warnings + +Please make sure the following warnings are safe to ignore: + +{{#each warnings as |warning|}} +- \`{{warning.depName}}\`: {{warning.message}} +{{/each}} +{{/if}} + +--- + +This PR has been generated by [Renovate Bot](https://renovateapp.com).", + "prTitle": "Update {{depName}} versions to [{{newVersions}}]", + "supportPolicy": Array [ + "lts", + ], + }, "npm": Object { "enabled": true, "pin": Object { @@ -3089,6 +3398,7 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "semanticCommits": null, "separateMajorReleases": true, "separatePatchReleases": false, + "supportPolicy": Array [], "timezone": null, "token": null, "unpublishSafe": false, @@ -3474,6 +3784,49 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "minor": Object {}, "monorepoPackages": Array [], "multipleMajorPrs": false, + "node": Object { + "branchName": "{{branchPrefix}}node-{{depNameSanitized}}", + "enabled": false, + "prBody": "This Pull Request updates \`{{depName}}\` versions from \`{{currentVersions}}\` to \`{{newVersions}}\`. This is according to the configured node.js support policy \\"{{supportPolicy}}\\". + +{{#if schedule}} +**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times. +{{/if}} + +{{#if hasErrors}} + +--- + +### Errors + +Renovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR. + +{{#each errors as |error|}} +- \`{{error.depName}}\`: {{error.message}} +{{/each}} +{{/if}} + +{{#if hasWarnings}} + +--- + +### Warnings + +Please make sure the following warnings are safe to ignore: + +{{#each warnings as |warning|}} +- \`{{warning.depName}}\`: {{warning.message}} +{{/each}} +{{/if}} + +--- + +This PR has been generated by [Renovate Bot](https://renovateapp.com).", + "prTitle": "Update {{depName}} versions to [{{newVersions}}]", + "supportPolicy": Array [ + "lts", + ], + }, "npm": Object { "enabled": true, "pin": Object { @@ -3574,6 +3927,7 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "semanticCommits": null, "separateMajorReleases": true, "separatePatchReleases": false, + "supportPolicy": Array [], "timezone": null, "token": null, "unpublishSafe": false, diff --git a/test/manager/index.spec.js b/test/manager/index.spec.js index acf6bd17fb..8340b2142c 100644 --- a/test/manager/index.spec.js +++ b/test/manager/index.spec.js @@ -3,6 +3,7 @@ const manager = require('../../lib/manager'); const npmUpdater = require('../../lib/manager/npm/update'); const meteorUpdater = require('../../lib/manager/meteor/update'); const dockerUpdater = require('../../lib/manager/docker/update'); +const nodeUpdater = require('../../lib/manager/node/update'); const { getUpdatedPackageFiles } = manager; @@ -59,6 +60,16 @@ describe('manager', () => { expect(res).toMatchSnapshot(); expect(res).toHaveLength(1); }); + it('finds .travis.yml files', async () => { + config.node.enabled = true; + platform.getFileList.mockReturnValueOnce([ + '.travis.yml', + 'other/.travis.yml', + ]); + const res = await manager.detectPackageFiles(config); + expect(res).toMatchSnapshot(); + expect(res).toHaveLength(1); + }); it('skips Dockerfiles with no content', async () => { platform.getFileList.mockReturnValueOnce(['Dockerfile']); platform.getFile.mockReturnValueOnce(null); @@ -87,6 +98,7 @@ describe('manager', () => { npmUpdater.setNewValue = jest.fn(); dockerUpdater.setNewValue = jest.fn(); meteorUpdater.setNewValue = jest.fn(); + nodeUpdater.setNewValue = jest.fn(); }); it('returns empty if lock file maintenance', async () => { config.upgrades = [{ type: 'lockFileMaintenance' }]; @@ -119,15 +131,18 @@ describe('manager', () => { { packageFile: 'package.json' }, { packageFile: 'Dockerfile' }, { packageFile: 'packages/foo/package.js' }, + { packageFile: '.travis.yml' }, ]; platform.getFile.mockReturnValueOnce('old content 1'); platform.getFile.mockReturnValueOnce('old content 1'); platform.getFile.mockReturnValueOnce('old content 2'); platform.getFile.mockReturnValueOnce('old content 3'); + platform.getFile.mockReturnValueOnce('old travis'); npmUpdater.setNewValue.mockReturnValueOnce('new content 1'); npmUpdater.setNewValue.mockReturnValueOnce('new content 1+'); dockerUpdater.setNewValue.mockReturnValueOnce('new content 2'); meteorUpdater.setNewValue.mockReturnValueOnce('old content 3'); + nodeUpdater.setNewValue.mockReturnValueOnce('old travis'); const res = await getUpdatedPackageFiles(config); expect(res.updatedPackageFiles).toHaveLength(2); }); diff --git a/test/manager/node/__snapshots__/package.spec.js.snap b/test/manager/node/__snapshots__/package.spec.js.snap new file mode 100644 index 0000000000..57e49a7105 --- /dev/null +++ b/test/manager/node/__snapshots__/package.spec.js.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`lib/workers/package/node getPackageUpdates returns result if needing updates 1`] = ` +Array [ + Object { + "newVersions": Array [ + "8", + "6", + "4", + ], + }, +] +`; diff --git a/test/manager/node/__snapshots__/update.spec.js.snap b/test/manager/node/__snapshots__/update.spec.js.snap new file mode 100644 index 0000000000..3b798eea38 --- /dev/null +++ b/test/manager/node/__snapshots__/update.spec.js.snap @@ -0,0 +1,27 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`manager/node/update setNewValue falls back to 2 spaces 1`] = `"hello: world"`; + +exports[`manager/node/update setNewValue updates values 1`] = ` +"dist: trusty +language: node_js +node_js: + - '6' + - '8' +services: + - redis-server + - mongodb + - mysql +addons: + postgresql: '9.5' +before_script: + - psql -c 'create database keyv_test;' -U postgres + - mysql -u root -e 'CREATE DATABASE keyv_test;' + - mysql -u root -e 'GRANT ALL PRIVILEGES ON keyv_test.* TO 'mysql'@'localhost';' +script: npm run test:full +after_success: npm run coverage +notifications: + email: + on_success: never +" +`; diff --git a/test/manager/node/extract.spec.js b/test/manager/node/extract.spec.js new file mode 100644 index 0000000000..080077b615 --- /dev/null +++ b/test/manager/node/extract.spec.js @@ -0,0 +1,14 @@ +const { extractDependencies } = require('../../../lib/manager/node/extract'); + +describe('lib/manager/node/extract', () => { + describe('extractDependencies()', () => { + let config; + beforeEach(() => { + config = {}; + }); + it('returns empty if fails to pass', () => { + const res = extractDependencies('blahhhhh:foo:@what\n', config); + expect(res).toEqual([]); + }); + }); +}); diff --git a/test/manager/node/package.spec.js b/test/manager/node/package.spec.js new file mode 100644 index 0000000000..25de540322 --- /dev/null +++ b/test/manager/node/package.spec.js @@ -0,0 +1,26 @@ +const node = require('../../../lib/manager/node/package'); +const defaultConfig = require('../../../lib/config/defaults').getConfig(); + +describe('lib/workers/package/node', () => { + describe('getPackageUpdates', () => { + let config; + beforeEach(() => { + config = { + ...defaultConfig, + }; + }); + it('returns empty if no supportPolicy array', async () => { + expect(await node.getPackageUpdates(config)).toEqual([]); + }); + it('returns empty if matching', async () => { + config.currentVersions = ['6', '8']; + config.supportPolicy = ['lts_active']; + expect(await node.getPackageUpdates(config)).toEqual([]); + }); + it('returns result if needing updates', async () => { + config.currentVersions = ['6', '8']; + config.supportPolicy = ['lts']; + expect(await node.getPackageUpdates(config)).toMatchSnapshot(); + }); + }); +}); diff --git a/test/manager/node/update.spec.js b/test/manager/node/update.spec.js new file mode 100644 index 0000000000..84b0ab6f5a --- /dev/null +++ b/test/manager/node/update.spec.js @@ -0,0 +1,34 @@ +const fs = require('fs'); +const path = require('path'); +const nodefile = require('../../../lib/manager/node/update'); + +const content = fs.readFileSync( + path.resolve('test/_fixtures/node/travis.yml'), + 'utf8' +); + +describe('manager/node/update', () => { + describe('setNewValue', () => { + it('updates values', () => { + const upgrade = { + newVersions: ['6', '8'], + }; + const res = nodefile.setNewValue(content, upgrade); + expect(res).toMatchSnapshot(); + }); + it('falls back to 2 spaces', () => { + const upgrade = { + newVersions: ['6', '8'], + }; + const res = nodefile.setNewValue('hello: world', upgrade); + expect(res).toMatchSnapshot(); + }); + it('returns null if error', () => { + const upgrade = { + newVersions: '6', + }; + const res = nodefile.setNewValue(content, upgrade); + expect(res).toBe(null); + }); + }); +}); diff --git a/test/manager/resolve.spec.js b/test/manager/resolve.spec.js index 638f5c93ae..39cf9366f7 100644 --- a/test/manager/resolve.spec.js +++ b/test/manager/resolve.spec.js @@ -64,14 +64,15 @@ describe('manager/resolve', () => { expect(res).toMatchSnapshot(); expect(res.warnings).toHaveLength(0); }); - it('detects meteor and docker', async () => { - config.packageFiles = ['package.js', 'Dockerfile']; + it('detects meteor and docker and travis', async () => { + config.packageFiles = ['package.js', 'Dockerfile', '.travis.yml']; platform.getFile.mockReturnValueOnce('# comment\nFROM node:8\n'); // Dockerfile + platform.getFile.mockReturnValueOnce('hello: world\n'); // Dockerfile const res = await resolvePackageFiles(config); expect(res).toMatchSnapshot(); }); - it('skips docker if no content or no match', async () => { - config.packageFiles = ['Dockerfile', 'other/Dockerfile']; + it('skips if no content or no match', async () => { + config.packageFiles = ['Dockerfile', 'other/Dockerfile', '.travis.yml']; platform.getFile.mockReturnValueOnce('# comment\n'); // Dockerfile const res = await resolvePackageFiles(config); expect(res).toMatchSnapshot(); diff --git a/test/workers/dep-type/index.spec.js b/test/workers/dep-type/index.spec.js index 8bbd571dfa..20dfeeceba 100644 --- a/test/workers/dep-type/index.spec.js +++ b/test/workers/dep-type/index.spec.js @@ -57,6 +57,15 @@ describe('lib/workers/dep-type/index', () => { const res = await depTypeWorker.renovateDepType(content, config); expect(res).toHaveLength(6); }); + it('returns upgrades for travis', async () => { + config.packageFile = '.travis.yml'; + const content = fs.readFileSync( + path.resolve('test/_fixtures/node/travis.yml'), + 'utf8' + ); + const res = await depTypeWorker.renovateDepType(content, config); + expect(res).toHaveLength(1); + }); it('handles malformed meteor', async () => { config.packageFile = 'package.js'; const content = 'blah'; diff --git a/test/workers/package-file/index.spec.js b/test/workers/package-file/index.spec.js index 6b2ba06d48..8feeb39674 100644 --- a/test/workers/package-file/index.spec.js +++ b/test/workers/package-file/index.spec.js @@ -76,6 +76,27 @@ describe('packageFileWorker', () => { expect(res).toHaveLength(2); }); }); + describe('renovateNodeFile(config)', () => { + let config; + beforeEach(() => { + config = { + ...defaultConfig, + packageFile: '.travis.yml', + repoIsOnboarded: true, + }; + depTypeWorker.renovateDepType.mockReturnValue([]); + }); + it('returns empty if disabled', async () => { + config.enabled = false; + const res = await packageFileWorker.renovateNodeFile(config); + expect(res).toEqual([]); + }); + it('returns upgrades', async () => { + depTypeWorker.renovateDepType.mockReturnValueOnce([{}]); + const res = await packageFileWorker.renovateNodeFile(config); + expect(res).toHaveLength(1); + }); + }); describe('renovateDockerfile', () => { let config; beforeEach(() => { diff --git a/test/workers/package/__snapshots__/index.spec.js.snap b/test/workers/package/__snapshots__/index.spec.js.snap index af1a7d707d..1547662e42 100644 --- a/test/workers/package/__snapshots__/index.spec.js.snap +++ b/test/workers/package/__snapshots__/index.spec.js.snap @@ -147,6 +147,7 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "semanticCommitScope": "deps", "semanticCommitType": "chore", "semanticCommits": null, + "supportPolicy": Array [], "timezone": null, "type": "pin", "unpublishSafe": false, diff --git a/test/workers/package/index.spec.js b/test/workers/package/index.spec.js index 91943ae1f7..c7e2d48b9a 100644 --- a/test/workers/package/index.spec.js +++ b/test/workers/package/index.spec.js @@ -4,9 +4,11 @@ const configParser = require('../../../lib/config'); const docker = require('../../../lib/manager/docker/package'); const npm = require('../../../lib/manager/npm/package'); +const node = require('../../../lib/manager/node/package'); jest.mock('../../../lib/manager/docker/package'); jest.mock('../../../lib/manager/npm/package'); +jest.mock('../../../lib/manager/node/package'); describe('lib/workers/package/index', () => { describe('renovatePackage(config)', () => { @@ -33,6 +35,12 @@ describe('lib/workers/package/index', () => { const res = await pkgWorker.renovatePackage(config); expect(res).toMatchObject([]); }); + it('calls node', async () => { + node.getPackageUpdates.mockReturnValueOnce([]); + config.packageFile = '.travis.yml'; + const res = await pkgWorker.renovatePackage(config); + expect(res).toMatchObject([]); + }); it('maps and filters type', async () => { config.packageFile = 'package.json'; config.major.enabled = false; diff --git a/test/workers/repository/updates/__snapshots__/branchify.spec.js.snap b/test/workers/repository/updates/__snapshots__/branchify.spec.js.snap index 078787f322..7c1271a407 100644 --- a/test/workers/repository/updates/__snapshots__/branchify.spec.js.snap +++ b/test/workers/repository/updates/__snapshots__/branchify.spec.js.snap @@ -410,6 +410,49 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", }, "minor": Object {}, "multipleMajorPrs": false, + "node": Object { + "branchName": "{{branchPrefix}}node-{{depNameSanitized}}", + "enabled": false, + "prBody": "This Pull Request updates \`{{depName}}\` versions from \`{{currentVersions}}\` to \`{{newVersions}}\`. This is according to the configured node.js support policy \\"{{supportPolicy}}\\". + +{{#if schedule}} +**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times. +{{/if}} + +{{#if hasErrors}} + +--- + +### Errors + +Renovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR. + +{{#each errors as |error|}} +- \`{{error.depName}}\`: {{error.message}} +{{/each}} +{{/if}} + +{{#if hasWarnings}} + +--- + +### Warnings + +Please make sure the following warnings are safe to ignore: + +{{#each warnings as |warning|}} +- \`{{warning.depName}}\`: {{warning.message}} +{{/each}} +{{/if}} + +--- + +This PR has been generated by [Renovate Bot](https://renovateapp.com).", + "prTitle": "Update {{depName}} versions to [{{newVersions}}]", + "supportPolicy": Array [ + "lts", + ], + }, "npm": Object { "enabled": true, "pin": Object { @@ -510,6 +553,7 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "semanticCommits": null, "separateMajorReleases": true, "separatePatchReleases": false, + "supportPolicy": Array [], "timezone": null, "token": null, "unpublishSafe": false, @@ -923,6 +967,49 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", }, "minor": Object {}, "multipleMajorPrs": false, + "node": Object { + "branchName": "{{branchPrefix}}node-{{depNameSanitized}}", + "enabled": false, + "prBody": "This Pull Request updates \`{{depName}}\` versions from \`{{currentVersions}}\` to \`{{newVersions}}\`. This is according to the configured node.js support policy \\"{{supportPolicy}}\\". + +{{#if schedule}} +**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times. +{{/if}} + +{{#if hasErrors}} + +--- + +### Errors + +Renovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR. + +{{#each errors as |error|}} +- \`{{error.depName}}\`: {{error.message}} +{{/each}} +{{/if}} + +{{#if hasWarnings}} + +--- + +### Warnings + +Please make sure the following warnings are safe to ignore: + +{{#each warnings as |warning|}} +- \`{{warning.depName}}\`: {{warning.message}} +{{/each}} +{{/if}} + +--- + +This PR has been generated by [Renovate Bot](https://renovateapp.com).", + "prTitle": "Update {{depName}} versions to [{{newVersions}}]", + "supportPolicy": Array [ + "lts", + ], + }, "npm": Object { "enabled": true, "pin": Object { @@ -1023,6 +1110,7 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "semanticCommits": null, "separateMajorReleases": true, "separatePatchReleases": false, + "supportPolicy": Array [], "timezone": null, "token": null, "unpublishSafe": false, @@ -1442,6 +1530,49 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", }, "minor": Object {}, "multipleMajorPrs": false, + "node": Object { + "branchName": "{{branchPrefix}}node-{{depNameSanitized}}", + "enabled": false, + "prBody": "This Pull Request updates \`{{depName}}\` versions from \`{{currentVersions}}\` to \`{{newVersions}}\`. This is according to the configured node.js support policy \\"{{supportPolicy}}\\". + +{{#if schedule}} +**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times. +{{/if}} + +{{#if hasErrors}} + +--- + +### Errors + +Renovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR. + +{{#each errors as |error|}} +- \`{{error.depName}}\`: {{error.message}} +{{/each}} +{{/if}} + +{{#if hasWarnings}} + +--- + +### Warnings + +Please make sure the following warnings are safe to ignore: + +{{#each warnings as |warning|}} +- \`{{warning.depName}}\`: {{warning.message}} +{{/each}} +{{/if}} + +--- + +This PR has been generated by [Renovate Bot](https://renovateapp.com).", + "prTitle": "Update {{depName}} versions to [{{newVersions}}]", + "supportPolicy": Array [ + "lts", + ], + }, "npm": Object { "enabled": true, "pin": Object { @@ -1542,6 +1673,7 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "semanticCommits": null, "separateMajorReleases": true, "separatePatchReleases": false, + "supportPolicy": Array [], "timezone": null, "token": null, "unpublishSafe": false, @@ -1949,6 +2081,49 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", }, "minor": Object {}, "multipleMajorPrs": false, + "node": Object { + "branchName": "{{branchPrefix}}node-{{depNameSanitized}}", + "enabled": false, + "prBody": "This Pull Request updates \`{{depName}}\` versions from \`{{currentVersions}}\` to \`{{newVersions}}\`. This is according to the configured node.js support policy \\"{{supportPolicy}}\\". + +{{#if schedule}} +**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times. +{{/if}} + +{{#if hasErrors}} + +--- + +### Errors + +Renovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR. + +{{#each errors as |error|}} +- \`{{error.depName}}\`: {{error.message}} +{{/each}} +{{/if}} + +{{#if hasWarnings}} + +--- + +### Warnings + +Please make sure the following warnings are safe to ignore: + +{{#each warnings as |warning|}} +- \`{{warning.depName}}\`: {{warning.message}} +{{/each}} +{{/if}} + +--- + +This PR has been generated by [Renovate Bot](https://renovateapp.com).", + "prTitle": "Update {{depName}} versions to [{{newVersions}}]", + "supportPolicy": Array [ + "lts", + ], + }, "npm": Object { "enabled": true, "pin": Object { @@ -2049,6 +2224,7 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "semanticCommits": null, "separateMajorReleases": true, "separatePatchReleases": false, + "supportPolicy": Array [], "timezone": null, "token": null, "unpublishSafe": false, @@ -2451,6 +2627,49 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", }, "minor": Object {}, "multipleMajorPrs": false, + "node": Object { + "branchName": "{{branchPrefix}}node-{{depNameSanitized}}", + "enabled": false, + "prBody": "This Pull Request updates \`{{depName}}\` versions from \`{{currentVersions}}\` to \`{{newVersions}}\`. This is according to the configured node.js support policy \\"{{supportPolicy}}\\". + +{{#if schedule}} +**Note**: This PR was created on a configured schedule (\\"{{schedule}}\\"{{#if timezone}} in timezone \`{{timezone}}\`{{/if}}) and will not receive updates outside those times. +{{/if}} + +{{#if hasErrors}} + +--- + +### Errors + +Renovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR. + +{{#each errors as |error|}} +- \`{{error.depName}}\`: {{error.message}} +{{/each}} +{{/if}} + +{{#if hasWarnings}} + +--- + +### Warnings + +Please make sure the following warnings are safe to ignore: + +{{#each warnings as |warning|}} +- \`{{warning.depName}}\`: {{warning.message}} +{{/each}} +{{/if}} + +--- + +This PR has been generated by [Renovate Bot](https://renovateapp.com).", + "prTitle": "Update {{depName}} versions to [{{newVersions}}]", + "supportPolicy": Array [ + "lts", + ], + }, "npm": Object { "enabled": true, "pin": Object { @@ -2552,6 +2771,7 @@ This PR has been generated by [Renovate Bot](https://renovateapp.com).", "semanticCommits": null, "separateMajorReleases": true, "separatePatchReleases": false, + "supportPolicy": Array [], "timezone": null, "token": null, "unpublishSafe": false, diff --git a/test/workers/repository/updates/determine.spec.js b/test/workers/repository/updates/determine.spec.js index 6311d37432..53fc56c8c6 100644 --- a/test/workers/repository/updates/determine.spec.js +++ b/test/workers/repository/updates/determine.spec.js @@ -38,6 +38,9 @@ describe('workers/repository/updates/determine', () => { { packageFile: 'frontend/package.js', }, + { + packageFile: '.travis.yml', + }, ]; packageFileWorker.renovateDockerfile.mockReturnValueOnce([ { depName: 'a' }, @@ -49,8 +52,9 @@ describe('workers/repository/updates/determine', () => { packageFileWorker.renovateMeteorPackageFile.mockReturnValueOnce([ { foo: 'd' }, ]); + packageFileWorker.renovateNodeFile.mockReturnValueOnce([{ foo: 'e' }]); const res = await determineRepoUpgrades(config); - expect(res.upgrades).toHaveLength(4); + expect(res.upgrades).toHaveLength(5); }); }); }); diff --git a/yarn.lock b/yarn.lock index 6fb4f470a5..179fed9abc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1216,16 +1216,16 @@ delegates@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" +detect-indent@5.0.0, detect-indent@~5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-5.0.0.tgz#3871cc0a6a002e8c3e5b3cf7f336264675f06b9d" + detect-indent@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-4.0.0.tgz#f76d064352cdf43a1cb6ce619c4ee3a9475de208" dependencies: repeating "^2.0.0" -detect-indent@~5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-5.0.0.tgz#3871cc0a6a002e8c3e5b3cf7f336264675f06b9d" - detect-libc@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.2.tgz#71ad5d204bf17a6a6ca8f450c61454066ef461e1" @@ -2896,7 +2896,7 @@ js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" -js-yaml@^3.7.0, js-yaml@^3.9.1: +js-yaml@3.10.0, js-yaml@^3.7.0, js-yaml@^3.9.1: version "3.10.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" dependencies: -- GitLab