diff --git a/.vscode/launch.json b/.vscode/launch.json index 5b86a78..4062c16 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -995,6 +995,37 @@ "console": "internalConsole", "sourceMaps": false }, + { + "type": "node", + "request": "launch", + "name": "xpm uninstall @xpack-dev-tools/clang", + "program": "${workspaceRoot}/bin/xpm.js", + "stopOnEntry": true, + "args": [ + "uninstall", + "@xpack-dev-tools/clang", + "--config", + "native-cmake-clang-release", + "-C", + "/Users/ilg/MyProjects/micro-os-plus.github/xPacks/micro-test-plus-xpack.git/tests", + "-dd" + ], + "cwd": "${workspaceRoot}", + "preLaunchTask": null, + "runtimeExecutable": null, + "runtimeArgs": [ + "--nolazy" + ], + "skipFiles": [ + "async_hooks.js", + "inspector_async_hook.js" + ], + "env": { + "NODE_ENV": "development" + }, + "console": "internalConsole", + "sourceMaps": false + }, { "type": "node", "request": "launch", diff --git a/lib/xpm/uninstall.js b/lib/xpm/uninstall.js index cd08e10..a3f69e9 100644 --- a/lib/xpm/uninstall.js +++ b/lib/xpm/uninstall.js @@ -285,6 +285,7 @@ export class Uninstall extends CliCommand { const dotBin = context.globalConfig.dotBin let xPackFolderPath + let xPacksBasePath = config.cwd if (config.configurationName) { // Throws if the configuration is not found. @@ -311,6 +312,11 @@ export class Uninstall extends CliCommand { configurationName: config.configurationName }) + xPacksBasePath = path.join( + config.cwd, + buildFolderRelativePath + ) + if (this.policies.nonHierarchicalLocalXpacksFolder) { xPackFolderPath = path.join( config.cwd, @@ -361,6 +367,7 @@ export class Uninstall extends CliCommand { if (!config.isDryRun) { // Remove the corresponding bin links. await this.removeDotBinLinks({ + xPacksBasePath, dotBinRelativePath: path.join( context.globalConfig.localXpacksFolderName, dotBin), packagePath: xPackFolderPath @@ -385,6 +392,7 @@ export class Uninstall extends CliCommand { if (!config.isDryRun) { // Remove the corresponding bin links. await this.removeDotBinLinks({ + xPacksBasePath, dotBinRelativePath: path.join( context.globalConfig.localXpacksFolderName, dotBin), packagePath: xPackFolderPath @@ -439,6 +447,7 @@ export class Uninstall extends CliCommand { if (!config.isDryRun) { // Remove the corresponding bin links. await this.removeDotBinLinks({ + xPacksBasePath, dotBinRelativePath: path.join( context.globalConfig.localNpmFolderName, dotBin), packagePath: nodeFolderPath @@ -600,12 +609,13 @@ export class Uninstall extends CliCommand { * Iterate the entries in the package `executables` object and remove all * corresponding links from the `.bin` folder. */ - async removeDotBinLinks ({ dotBinRelativePath, packagePath }) { + async removeDotBinLinks ({ + xPacksBasePath, + dotBinRelativePath, + packagePath + }) { const log = this.log - const context = this.context - const config = context.config - const json = await this.xpack.isFolderPackage(packagePath) if (!json) { return // Not a package (unlikely, but for just in case) @@ -622,7 +632,7 @@ export class Uninstall extends CliCommand { } const executablesAbsolutePath = - path.join(config.cwd, dotBinRelativePath) + path.join(xPacksBasePath, dotBinRelativePath) for (const key of Object.keys(packageExecutablesPath)) { const linkPath = path.join(executablesAbsolutePath, key)