()
| 115 | } |
| 116 | |
| 117 | async function main() { |
| 118 | const onlyModules = []; |
| 119 | if (process.argv.length > 2) { |
| 120 | onlyModules.push(...process.argv.slice(2)); |
| 121 | } |
| 122 | try { |
| 123 | await spawn('yarn', ['outdated', '--json']); |
| 124 | console.log('No packages to update.'); |
| 125 | } catch (error) { |
| 126 | const table = JSON.parse(error.stdout.split('\n')[1]); |
| 127 | for (const [ |
| 128 | packageName, |
| 129 | currentVersion, |
| 130 | wantedVersion, |
| 131 | latestVersion, |
| 132 | packageType /*, _url */, |
| 133 | ] of table.data.body) { |
| 134 | if (DO_NOT_UPGRADE.includes(packageName)) { |
| 135 | console.log( |
| 136 | `Skipping "${packageName} from update as it is in the denylist`, |
| 137 | ); |
| 138 | continue; |
| 139 | } |
| 140 | if (onlyModules.length > 0 && !onlyModules.includes(packageName)) { |
| 141 | console.log( |
| 142 | `Skipping "${packageName}" from update as it was not specified on the command line`, |
| 143 | ); |
| 144 | continue; |
| 145 | } |
| 146 | let commitPackageName = null; |
| 147 | const nodePackage = new Package( |
| 148 | packageName, |
| 149 | currentVersion, |
| 150 | wantedVersion, |
| 151 | latestVersion, |
| 152 | packageType, |
| 153 | ); |
| 154 | await nodePackage.upgrade(); |
| 155 | |
| 156 | if (packageName === '@typescript-eslint/parser') { |
| 157 | const eslintPlugin = new Package( |
| 158 | '@typescript-eslint/eslint-plugin', |
| 159 | currentVersion, |
| 160 | wantedVersion, |
| 161 | latestVersion, |
| 162 | packageType, |
| 163 | ); |
| 164 | await eslintPlugin.upgrade(); |
| 165 | commitPackageName = '@typescript-eslint/{parser,eslint-plugin}'; |
| 166 | } |
| 167 | |
| 168 | await nodePackage.smoketestAndCommit(commitPackageName); |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | if (onlyModules.length == 0) { |
| 173 | console.log(`Upgrading transitive dependencies in yarn.lock...`); |
| 174 | await yarn('upgrade'); |
no test coverage detected