| 203 | } |
| 204 | |
| 205 | removeFromLockFile(plugin: string): void { |
| 206 | const lockPath = path.join( |
| 207 | this.cliConfig.configDir, |
| 208 | '.cloud-graph.lock.json' |
| 209 | ) |
| 210 | try { |
| 211 | const oldLock = cosmiconfigSync('cloud-graph').load(lockPath) |
| 212 | const lockFile = oldLock?.config |
| 213 | if (!lockFile || !lockFile[this.pluginType]?.[plugin]) { |
| 214 | this.logger.warn( |
| 215 | `No lock file found containing ${plugin}, could not remove` |
| 216 | ) |
| 217 | return |
| 218 | } |
| 219 | delete lockFile[this.pluginType][plugin] |
| 220 | this.logger.success( |
| 221 | `${this.pluginType} ${chalk.green(plugin)} has been removed` |
| 222 | ) |
| 223 | fs.writeFileSync(lockPath, JSON.stringify(lockFile, null, 2)) |
| 224 | } catch (error: any) { |
| 225 | this.logger.error(`There was an error removing ${plugin} from lock file`) |
| 226 | this.logger.debug(error) |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | writeVersionToLockFile({ |
| 231 | plugin, |