* The constructor. * @param {Object} config The config. * @param {String} config.packageName The package name to check. * @param {String} config.packageSupportUrl The URL to the package website * that shows the End-of-Life support dates. * @param {String} config.yamlFilePath The path
(config)
| 44 | * fail and recommend an upgrade to version 2.0.0. |
| 45 | */ |
| 46 | constructor(config) { |
| 47 | const { |
| 48 | packageName, |
| 49 | packageSupportUrl, |
| 50 | yamlFilePath, |
| 51 | ciEnvironmentsKeyPath, |
| 52 | ciVersionKey, |
| 53 | releasedVersions, |
| 54 | ignoreReleasedVersions = [], |
| 55 | latestComponent = CiVersionCheck.versionComponents.patch, |
| 56 | } = config; |
| 57 | |
| 58 | // Ensure required params are set |
| 59 | if ([ |
| 60 | packageName, |
| 61 | packageSupportUrl, |
| 62 | yamlFilePath, |
| 63 | ciEnvironmentsKeyPath, |
| 64 | ciVersionKey, |
| 65 | releasedVersions, |
| 66 | ].includes(undefined)) { |
| 67 | throw 'invalid configuration'; |
| 68 | } |
| 69 | |
| 70 | if (!Object.keys(CiVersionCheck.versionComponents).includes(latestComponent)) { |
| 71 | throw 'invalid configuration for latestComponent'; |
| 72 | } |
| 73 | |
| 74 | this.packageName = packageName; |
| 75 | this.packageSupportUrl = packageSupportUrl; |
| 76 | this.yamlFilePath = yamlFilePath; |
| 77 | this.ciEnvironmentsKeyPath = ciEnvironmentsKeyPath; |
| 78 | this.ciVersionKey = ciVersionKey; |
| 79 | this.releasedVersions = releasedVersions; |
| 80 | this.ignoreReleasedVersions = ignoreReleasedVersions; |
| 81 | this.latestComponent = latestComponent; |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * The definition of version components. |
nothing calls this directly
no outgoing calls
no test coverage detected