renovate 42.89.4 → 42.90.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,15 +7,29 @@ require("./punycode.cjs");
7
7
  const dequal_1 = require("dequal");
8
8
  const fs_extra_1 = require("fs-extra");
9
9
  const app_strings_1 = require("./config/app-strings");
10
+ const global_1 = require("./config/global");
10
11
  const massage_1 = require("./config/massage");
11
12
  const migration_1 = require("./config/migration");
12
13
  const validation_1 = require("./config/validation");
13
14
  const expose_cjs_1 = require("./expose.cjs");
14
15
  const logger_1 = require("./logger");
15
16
  const env_1 = require("./util/env");
17
+ const parse_1 = require("./workers/global/config/parse");
16
18
  const file_1 = require("./workers/global/config/parse/file");
17
19
  const util_1 = require("./workers/global/config/parse/util");
18
20
  let returnVal = 0;
21
+ /**
22
+ * Make sure that we've resolved configuration from the different places that Renovate users would expect them to be specified
23
+ *
24
+ * This then allows a `configType=repo` config to i.e. be validated alongside a `config.js` or `env RENOVATE_ALLOWED_COMMANDS=...`
25
+ *
26
+ * Note that we intentionally don't fully initialize Renovate and its modules, as we're not fully running, and it would require a Platform to be configured
27
+ * */
28
+ async function partiallyGlobalInitialize() {
29
+ // NOTE that this doesn't allow command-line arguments
30
+ const globalConfig = await (0, parse_1.parseConfigs)((0, env_1.getEnv)(), []);
31
+ global_1.GlobalConfig.set(globalConfig);
32
+ }
19
33
  async function validate(configType, desc, config, strict, isPreset = false) {
20
34
  const { isMigrated, migratedConfig } = (0, migration_1.migrateConfig)(config);
21
35
  if (isMigrated) {
@@ -39,6 +53,7 @@ async function validate(configType, desc, config, strict, isPreset = false) {
39
53
  }
40
54
  }
41
55
  (async () => {
56
+ await partiallyGlobalInitialize();
42
57
  const program = new commander_1.Command('renovate-config-validator')
43
58
  .summary('Validate Renovate configuration files')
44
59
  .description(`Validate your Renovate configuration (repo config, shared presets or global configuration) files\n` +
@@ -53,7 +68,15 @@ Examples:
53
68
  $ renovate-config-validator first_config.json
54
69
  $ renovate-config-validator --strict config.js
55
70
  $ renovate-config-validator --no-global renovate.json5
56
- $ env RENOVATE_CONFIG_FILE=obscure-name.json renovate-config-validator`)
71
+ $ env RENOVATE_CONFIG_FILE=obscure-name.json renovate-config-validator
72
+
73
+ Global configuration:
74
+
75
+ If you have specified global self-hosted configuration (https://docs.renovatebot.com/self-hosted-configuration/) in environment variables or in a \`config.js\`, this will be detected:
76
+
77
+ $ env RENOVATE_ALLOWED_ENV='["GO*"]' renovate-config-validator
78
+ # if passing the filename, make sure it's not validating as a global config
79
+ $ env RENOVATE_ALLOWED_ENV='["GO*"]' renovate-config-validator --no-global renovate.json`)
57
80
  .argument('[config-files...]')
58
81
  .version(expose_cjs_1.pkg.version, '-v, --version')
59
82
  .option('--strict', 'Fail command if any configuration warnings, errors, or a migration is needed')
@@ -1 +1 @@
1
- {"version":3,"file":"config-validator.js","sourceRoot":"","sources":["../lib/config-validator.ts"],"names":[],"mappings":";;;AACA,yCAAoD;AACpD,uCAAqC;AACrC,0BAAwB;AACxB,mCAAgC;AAChC,uCAAgD;AAChD,sDAA0D;AAC1D,8CAAiD;AACjD,kDAAmD;AAEnD,oDAAqD;AACrD,6CAAmC;AACnC,qCAAkC;AAClC,oCAAoC;AACpC,6DAAgF;AAChF,6DAAsE;AAEtE,IAAI,SAAS,GAAG,CAAC,CAAC;AAElB,KAAK,UAAU,QAAQ,CACrB,UAA6B,EAC7B,IAAY,EACZ,MAAsB,EACtB,MAAe,EACf,QAAQ,GAAG,KAAK;IAEhB,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,IAAA,yBAAa,EAAC,MAAM,CAAC,CAAC;IAC7D,IAAI,UAAU,EAAE,CAAC;QACf,eAAM,CAAC,IAAI,CACT;YACE,SAAS,EAAE,MAAM;YACjB,SAAS,EAAE,cAAc;SAC1B,EACD,4BAA4B,CAC7B,CAAC;QACF,IAAI,MAAM,EAAE,CAAC;YACX,SAAS,GAAG,CAAC,CAAC;QAChB,CAAC;IACH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QACzJ,IAAI,CAAC,CAAC,IAAI,KAAK,yBAAyB,EAAE,CAAC;YACzC,OAAO;QACT,CAAC;IACH,CAAC;IAED,oFAAoF;IACpF,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjB,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnB,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { Command, CommanderError } from 'commander';\nimport 'source-map-support/register';\nimport './punycode.cjs';\nimport { dequal } from 'dequal';\nimport { pathExists, readFile } from 'fs-extra';\nimport { getConfigFileNames } from './config/app-strings';\nimport { massageConfig } from './config/massage';\nimport { migrateConfig } from './config/migration';\nimport type { RenovateConfig } from './config/types';\nimport { validateConfig } from './config/validation';\nimport { pkg } from './expose.cjs';\nimport { logger } from './logger';\nimport { getEnv } from './util/env';\nimport { getConfig as getFileConfig } from './workers/global/config/parse/file';\nimport { getParsedContent } from './workers/global/config/parse/util';\n\nlet returnVal = 0;\n\nasync function validate(\n configType: 'global' | 'repo',\n desc: string,\n config: RenovateConfig,\n strict: boolean,\n isPreset = false,\n): Promise<void> {\n const { isMigrated, migratedConfig } = migrateConfig(config);\n if (isMigrated) {\n logger.warn(\n {\n oldConfig: config,\n newConfig: migratedConfig,\n },\n 'Config migration necessary',\n );\n if (strict) {\n returnVal = 1;\n }\n }\n const massagedConfig = massageConfig(migratedConfig);\n const res = await validateConfig(configType, massagedConfig, isPreset);\n if (res.errors.length) {\n logger.error(\n { file: desc, errors: res.errors },\n 'Found errors in configuration',\n );\n returnVal = 1;\n }\n if (res.warnings.length) {\n logger.warn(\n { file: desc, warnings: res.warnings },\n 'Found errors in configuration',\n );\n returnVal = 1;\n }\n}\n\ninterface PackageJson {\n renovate?: RenovateConfig;\n 'renovate-config'?: Record<string, RenovateConfig>;\n}\n\n(async () => {\n const program = new Command('renovate-config-validator')\n .summary('Validate Renovate configuration files')\n .description(\n `Validate your Renovate configuration (repo config, shared presets or global configuration) files\\n` +\n 'If no [config-files...] are given, renovate-config-validator will look at the default config file locations (https://docs.renovatebot.com/configuration-options/)',\n )\n .addHelpText(\n 'after',\n `\nWhen specifying [config-files...], Renovate will treat them as global self-hosted configuration files. You can disable this behaviour with --no-global\n\nExamples:\n\n $ renovate-config-validator\n $ renovate-config-validator --strict\n $ renovate-config-validator first_config.json\n $ renovate-config-validator --strict config.js\n $ renovate-config-validator --no-global renovate.json5\n $ env RENOVATE_CONFIG_FILE=obscure-name.json renovate-config-validator`,\n )\n .argument('[config-files...]')\n .version(pkg.version, '-v, --version')\n .option(\n '--strict',\n 'Fail command if any configuration warnings, errors, or a migration is needed',\n )\n .option(\n '--no-global',\n 'When specifying [config-files], do not treat them as global self-hosted configuration file(s)',\n true,\n )\n // allow us to manage the exit code\n .exitOverride();\n\n program.action(async (files, opts) => {\n const strict = opts.strict ?? false;\n\n if (files.length) {\n let isGlobalConfig = true;\n if (opts.global === false) {\n isGlobalConfig = false;\n }\n const configType = isGlobalConfig ? 'global' : 'repo';\n for (const file of files) {\n try {\n if (!(await pathExists(file))) {\n returnVal = 1;\n logger.error({ file }, 'File does not exist');\n break;\n }\n const parsedContent = await getParsedContent(file);\n try {\n logger.info(`Validating ${file} as ${configType} config`);\n await validate(configType, file, parsedContent, strict);\n } catch (err) {\n logger.warn({ file, err }, 'File is not valid Renovate config');\n returnVal = 1;\n }\n } catch (err) {\n logger.warn({ file, err }, 'File could not be parsed');\n returnVal = 1;\n }\n }\n } else {\n for (const file of getConfigFileNames().filter(\n (name) => name !== 'package.json',\n )) {\n try {\n if (!(await pathExists(file))) {\n continue;\n }\n const parsedContent = await getParsedContent(file);\n try {\n logger.info(`Validating ${file}`);\n await validate('repo', file, parsedContent, strict);\n } catch (err) {\n logger.warn({ file, err }, 'File is not valid Renovate config');\n returnVal = 1;\n }\n } catch (err) {\n logger.warn({ file, err }, 'File could not be parsed');\n returnVal = 1;\n }\n }\n try {\n const pkgJson = JSON.parse(\n await readFile('package.json', 'utf8'),\n ) as PackageJson;\n if (pkgJson.renovate) {\n logger.info(`Validating package.json > renovate`);\n await validate(\n 'repo',\n 'package.json > renovate',\n pkgJson.renovate,\n strict,\n );\n }\n if (pkgJson['renovate-config']) {\n logger.info(`Validating package.json > renovate-config`);\n for (const presetConfig of Object.values(\n pkgJson['renovate-config'],\n )) {\n await validate(\n 'repo',\n 'package.json > renovate-config',\n presetConfig,\n strict,\n true,\n );\n }\n }\n } catch {\n // ignore\n }\n try {\n const env = getEnv();\n const fileConfig = await getFileConfig(env);\n if (!dequal(fileConfig, {})) {\n const file = env.RENOVATE_CONFIG_FILE ?? 'config.js';\n logger.info(`Validating ${file}`);\n try {\n await validate('global', file, fileConfig, strict);\n } catch (err) {\n logger.error({ file, err }, 'File is not valid Renovate config');\n returnVal = 1;\n }\n }\n } catch {\n // ignore\n }\n }\n if (returnVal !== 0) {\n process.exit(returnVal);\n }\n logger.info('Config validated successfully');\n });\n\n await program.parseAsync();\n})().catch((e) => {\n if (e instanceof CommanderError) {\n // Commander throws an error at the end of Action execution i.e. as part of the `help` command, and so we don't want to return an error code in this case\n if (e.code === 'commander.helpDisplayed') {\n return;\n }\n }\n\n // oxlint-disable-next-line no-console -- intentional: display critical error on CLI\n console.error(e);\n process.exit(99);\n});\n"]}
1
+ {"version":3,"file":"config-validator.js","sourceRoot":"","sources":["../lib/config-validator.ts"],"names":[],"mappings":";;;AACA,yCAAoD;AACpD,uCAAqC;AACrC,0BAAwB;AACxB,mCAAgC;AAChC,uCAAgD;AAChD,sDAA0D;AAC1D,4CAA+C;AAC/C,8CAAiD;AACjD,kDAAmD;AAEnD,oDAAqD;AACrD,6CAAmC;AACnC,qCAAkC;AAClC,oCAAoC;AACpC,yDAA6D;AAC7D,6DAAgF;AAChF,6DAAsE;AAEtE,IAAI,SAAS,GAAG,CAAC,CAAC;AAElB;;;;;;KAMK;AACL,KAAK,UAAU,yBAAyB;IACtC,sDAAsD;IACtD,MAAM,YAAY,GAAG,MAAM,IAAA,oBAAY,EAAC,IA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eAAM,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,mCAAmC,CAAC,CAAC;wBACjE,SAAS,GAAG,CAAC,CAAC;oBAChB,CAAC;gBACH,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,SAAS;YACX,CAAC;QACH,CAAC;QACD,IAAI,SAAS,KAAK,CAAC,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1B,CAAC;QACD,eAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;AAC7B,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;IACf,IAAI,CAAC,YAAY,0BAAc,EAAE,CAAC;QAChC,yJAAyJ;QACzJ,IAAI,CAAC,CAAC,IAAI,KAAK,yBAAyB,EAAE,CAAC;YACzC,OAAO;QACT,CAAC;IACH,CAAC;IAED,oFAAoF;IACpF,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjB,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnB,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { Command, CommanderError } from 'commander';\nimport 'source-map-support/register';\nimport './punycode.cjs';\nimport { dequal } from 'dequal';\nimport { pathExists, readFile } from 'fs-extra';\nimport { getConfigFileNames } from './config/app-strings';\nimport { GlobalConfig } from './config/global';\nimport { massageConfig } from './config/massage';\nimport { migrateConfig } from './config/migration';\nimport type { RenovateConfig } from './config/types';\nimport { validateConfig } from './config/validation';\nimport { pkg } from './expose.cjs';\nimport { logger } from './logger';\nimport { getEnv } from './util/env';\nimport { parseConfigs } from './workers/global/config/parse';\nimport { getConfig as getFileConfig } from './workers/global/config/parse/file';\nimport { getParsedContent } from './workers/global/config/parse/util';\n\nlet returnVal = 0;\n\n/**\n * Make sure that we've resolved configuration from the different places that Renovate users would expect them to be specified\n *\n * This then allows a `configType=repo` config to i.e. be validated alongside a `config.js` or `env RENOVATE_ALLOWED_COMMANDS=...`\n *\n * Note that we intentionally don't fully initialize Renovate and its modules, as we're not fully running, and it would require a Platform to be configured\n * */\nasync function partiallyGlobalInitialize(): Promise<void> {\n // NOTE that this doesn't allow command-line arguments\n const globalConfig = await parseConfigs(getEnv(), []);\n GlobalConfig.set(globalConfig);\n}\n\nasync function validate(\n configType: 'global' | 'repo',\n desc: string,\n config: RenovateConfig,\n strict: boolean,\n isPreset = false,\n): Promise<void> {\n const { isMigrated, migratedConfig } = migrateConfig(config);\n if (isMigrated) {\n logger.warn(\n {\n oldConfig: config,\n newConfig: migratedConfig,\n },\n 'Config migration necessary',\n );\n if (strict) {\n returnVal = 1;\n }\n }\n const massagedConfig = massageConfig(migratedConfig);\n const res = await validateConfig(configType, massagedConfig, isPreset);\n if (res.errors.length) {\n logger.error(\n { file: desc, errors: res.errors },\n 'Found errors in configuration',\n );\n returnVal = 1;\n }\n if (res.warnings.length) {\n logger.warn(\n { file: desc, warnings: res.warnings },\n 'Found errors in configuration',\n );\n returnVal = 1;\n }\n}\n\ninterface PackageJson {\n renovate?: RenovateConfig;\n 'renovate-config'?: Record<string, RenovateConfig>;\n}\n\n(async () => {\n await partiallyGlobalInitialize();\n\n const program = new Command('renovate-config-validator')\n .summary('Validate Renovate configuration files')\n .description(\n `Validate your Renovate configuration (repo config, shared presets or global configuration) files\\n` +\n 'If no [config-files...] are given, renovate-config-validator will look at the default config file locations (https://docs.renovatebot.com/configuration-options/)',\n )\n .addHelpText(\n 'after',\n `\nWhen specifying [config-files...], Renovate will treat them as global self-hosted configuration files. You can disable this behaviour with --no-global\n\nExamples:\n\n $ renovate-config-validator\n $ renovate-config-validator --strict\n $ renovate-config-validator first_config.json\n $ renovate-config-validator --strict config.js\n $ renovate-config-validator --no-global renovate.json5\n $ env RENOVATE_CONFIG_FILE=obscure-name.json renovate-config-validator\n\nGlobal configuration:\n\nIf you have specified global self-hosted configuration (https://docs.renovatebot.com/self-hosted-configuration/) in environment variables or in a \\`config.js\\`, this will be detected:\n\n $ env RENOVATE_ALLOWED_ENV='[\"GO*\"]' renovate-config-validator\n # if passing the filename, make sure it's not validating as a global config\n $ env RENOVATE_ALLOWED_ENV='[\"GO*\"]' renovate-config-validator --no-global renovate.json`,\n )\n .argument('[config-files...]')\n .version(pkg.version, '-v, --version')\n .option(\n '--strict',\n 'Fail command if any configuration warnings, errors, or a migration is needed',\n )\n .option(\n '--no-global',\n 'When specifying [config-files], do not treat them as global self-hosted configuration file(s)',\n true,\n )\n // allow us to manage the exit code\n .exitOverride();\n\n program.action(async (files, opts) => {\n const strict = opts.strict ?? false;\n\n if (files.length) {\n let isGlobalConfig = true;\n if (opts.global === false) {\n isGlobalConfig = false;\n }\n const configType = isGlobalConfig ? 'global' : 'repo';\n for (const file of files) {\n try {\n if (!(await pathExists(file))) {\n returnVal = 1;\n logger.error({ file }, 'File does not exist');\n break;\n }\n const parsedContent = await getParsedContent(file);\n try {\n logger.info(`Validating ${file} as ${configType} config`);\n await validate(configType, file, parsedContent, strict);\n } catch (err) {\n logger.warn({ file, err }, 'File is not valid Renovate config');\n returnVal = 1;\n }\n } catch (err) {\n logger.warn({ file, err }, 'File could not be parsed');\n returnVal = 1;\n }\n }\n } else {\n for (const file of getConfigFileNames().filter(\n (name) => name !== 'package.json',\n )) {\n try {\n if (!(await pathExists(file))) {\n continue;\n }\n const parsedContent = await getParsedContent(file);\n try {\n logger.info(`Validating ${file}`);\n await validate('repo', file, parsedContent, strict);\n } catch (err) {\n logger.warn({ file, err }, 'File is not valid Renovate config');\n returnVal = 1;\n }\n } catch (err) {\n logger.warn({ file, err }, 'File could not be parsed');\n returnVal = 1;\n }\n }\n try {\n const pkgJson = JSON.parse(\n await readFile('package.json', 'utf8'),\n ) as PackageJson;\n if (pkgJson.renovate) {\n logger.info(`Validating package.json > renovate`);\n await validate(\n 'repo',\n 'package.json > renovate',\n pkgJson.renovate,\n strict,\n );\n }\n if (pkgJson['renovate-config']) {\n logger.info(`Validating package.json > renovate-config`);\n for (const presetConfig of Object.values(\n pkgJson['renovate-config'],\n )) {\n await validate(\n 'repo',\n 'package.json > renovate-config',\n presetConfig,\n strict,\n true,\n );\n }\n }\n } catch {\n // ignore\n }\n try {\n const env = getEnv();\n const fileConfig = await getFileConfig(env);\n if (!dequal(fileConfig, {})) {\n const file = env.RENOVATE_CONFIG_FILE ?? 'config.js';\n logger.info(`Validating ${file}`);\n try {\n await validate('global', file, fileConfig, strict);\n } catch (err) {\n logger.error({ file, err }, 'File is not valid Renovate config');\n returnVal = 1;\n }\n }\n } catch {\n // ignore\n }\n }\n if (returnVal !== 0) {\n process.exit(returnVal);\n }\n logger.info('Config validated successfully');\n });\n\n await program.parseAsync();\n})().catch((e) => {\n if (e instanceof CommanderError) {\n // Commander throws an error at the end of Action execution i.e. as part of the `help` command, and so we don't want to return an error code in this case\n if (e.code === 'commander.helpDisplayed') {\n return;\n }\n }\n\n // oxlint-disable-next-line no-console -- intentional: display critical error on CLI\n console.error(e);\n process.exit(99);\n});\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "renovate",
3
3
  "description": "Automated dependency updates. Flexible so you don't need to be.",
4
- "version": "42.89.4",
4
+ "version": "42.90.0",
5
5
  "type": "commonjs",
6
6
  "bin": {
7
7
  "renovate": "dist/renovate.js",
@@ -1,7 +1,7 @@
1
1
  {
2
- "title": "JSON schema for Renovate 42.89.4 config files (https://renovatebot.com/)",
2
+ "title": "JSON schema for Renovate 42.90.0 config files (https://renovatebot.com/)",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
- "x-renovate-version": "42.89.4",
4
+ "x-renovate-version": "42.90.0",
5
5
  "allowComments": true,
6
6
  "type": "object",
7
7
  "properties": {