Skip to content

Commit 1c5683f

Browse files
committed
Tests fixed
1 parent 3f96b43 commit 1c5683f

File tree

5 files changed

+255
-495
lines changed

5 files changed

+255
-495
lines changed

packages/cli/src/lib/setup/setupInstall.ts

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,10 +1427,10 @@ export class Install {
14271427
if (!adapterDir || !fs.existsSync(path.join(adapterDir, 'io-package.json'))) {
14281428
return false;
14291429
}
1430-
1430+
14311431
const ioPackage = await fs.readJSON(path.join(adapterDir, 'io-package.json'));
14321432
return ioPackage.common?.allowDeletionOfFilesInMetaObject === true;
1433-
} catch (err) {
1433+
} catch {
14341434
// If we can't read the io-package.json, assume meta file deletion is not allowed
14351435
return false;
14361436
}
@@ -1446,17 +1446,19 @@ export class Install {
14461446
if (!process.stdin.isTTY || !process.stdout.isTTY) {
14471447
return false; // In non-interactive environment, don't delete meta files
14481448
}
1449-
14501449
const rl = (await import('node:readline')).createInterface({
14511450
input: process.stdin,
14521451
output: process.stdout,
14531452
});
14541453

1455-
return new Promise((resolve) => {
1456-
rl.question('This instance has meta files (e.g., vis projects) that will be permanently deleted. Do you want to continue? [y/N]: ', (answer) => {
1457-
rl.close();
1458-
resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
1459-
});
1454+
return new Promise(resolve => {
1455+
rl.question(
1456+
'This instance has meta files (e.g., vis projects) that will be permanently deleted. Do you want to continue? [y/N]: ',
1457+
(answer: string) => {
1458+
rl.close();
1459+
resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
1460+
},
1461+
);
14601462
});
14611463
}
14621464
private async _deleteInstanceFiles(adapter: string, instance: number): Promise<void> {
@@ -1691,7 +1693,11 @@ export class Install {
16911693
* @param instance e.g. 1, if undefined deletes all instances
16921694
* @param withMeta if true, also delete meta files without asking for confirmation
16931695
*/
1694-
async deleteInstance(adapter: string, instance?: number, withMeta?: boolean): Promise<void | EXIT_CODES.CANNOT_DELETE_DEPENDENCY> {
1696+
async deleteInstance(
1697+
adapter: string,
1698+
instance?: number,
1699+
withMeta?: boolean,
1700+
): Promise<void | EXIT_CODES.CANNOT_DELETE_DEPENDENCY> {
16951701
const knownObjectIDs: string[] = [];
16961702
const knownStateIDs: string[] = [];
16971703

@@ -1718,13 +1724,13 @@ export class Install {
17181724
if (instance !== undefined) {
17191725
// Check if there are meta files that would be deleted
17201726
const hasMetaFiles = await this._hasInstanceMetaFiles(adapter, instance);
1721-
1727+
17221728
if (hasMetaFiles) {
17231729
// Check if adapter allows deletion of meta files without confirmation
17241730
const allowedByAdapter = await this._isMetaFileDeletionAllowed(adapter);
1725-
1731+
17261732
let shouldDeleteMeta = false;
1727-
1733+
17281734
if (allowedByAdapter) {
17291735
// Adapter allows deletion, proceed without asking
17301736
shouldDeleteMeta = true;
@@ -1735,7 +1741,7 @@ export class Install {
17351741
// Ask user interactively (will return false if not in TTY)
17361742
shouldDeleteMeta = await this._askUserToDeleteMetaFiles();
17371743
}
1738-
1744+
17391745
if (shouldDeleteMeta) {
17401746
await this._deleteInstanceFiles(adapter, instance);
17411747
} else {

0 commit comments

Comments
 (0)