From 880f38da71aa0876cb04785e7c05814c406a4dbd Mon Sep 17 00:00:00 2001 From: Ali Naci Erdem Date: Sat, 11 Nov 2023 10:59:53 +0300 Subject: [PATCH] refactor(project-info.js): drop support for legacy configuation file Earlier versions of the cli used to keep the image name in a separate file in the manifest directory. This was removed in favor of the new json file but the cli continued to migrate from this old file. Migration code path is now being removed. To properly cleanup your project, make sure you run the previous major version of the tool at least once, or manually remove the `docker-image` file from `.libdragon` folder. BREAKING CHANGE: The cli will no longer migrate the `.libdragon/docker-image` Either make sure you run the 10.x version once for your project or remove the file manually. --- modules/constants.js | 2 -- modules/project-info.js | 27 ++------------------------- 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/modules/constants.js b/modules/constants.js index 068290c..76638af 100644 --- a/modules/constants.js +++ b/modules/constants.js @@ -21,6 +21,4 @@ module.exports = /** @type {const} */ ({ STATUS_ERROR: 1, STATUS_BAD_PARAM: 2, STATUS_VALIDATION_ERROR: 4, - - IMAGE_FILE: 'docker-image', // deprecated }); diff --git a/modules/project-info.js b/modules/project-info.js index b7c54fe..969921e 100644 --- a/modules/project-info.js +++ b/modules/project-info.js @@ -14,7 +14,6 @@ const { CONFIG_FILE, DOCKER_HUB_IMAGE, DEFAULT_STRATEGY, - IMAGE_FILE, LIBDRAGON_SUBMODULE, CACHED_CONTAINER_FILE, CONTAINER_TARGET_PATH, @@ -159,15 +158,7 @@ const readProjectInfo = async function (optionInfo) { return /** @type {NoProjectInfo} */ (optionInfo); } - const migratedRoot = await findLibdragonRoot(); - - // Look for old one for backwards compatibility - const projectRoot = - migratedRoot ?? - (await findLibdragonRoot( - '.', - path.join(LIBDRAGON_PROJECT_MANIFEST, IMAGE_FILE) - )); + const projectRoot = await findLibdragonRoot(); if ( !projectRoot && @@ -204,7 +195,7 @@ const readProjectInfo = async function (optionInfo) { log(`Project root: ${info.root}`, true); - if (migratedRoot) { + if (projectRoot) { info = { ...info, ...JSON.parse( @@ -214,20 +205,6 @@ const readProjectInfo = async function (optionInfo) { ) ), }; - } else { - // Cleanup old files and migrate to the new config file - const imageFile = path.join( - info.root, - LIBDRAGON_PROJECT_MANIFEST, - IMAGE_FILE - ); - if (await fileExists(imageFile)) { - info.imageName = ( - await fs.readFile(imageFile, { encoding: 'utf8' }) - ).trim(); - // Immediately update the config as this is the first migration - await Promise.all([writeProjectInfo(info), fs.rm(imageFile)]); - } } if (!process.env.DOCKER_CONTAINER) {