codeplay-common 4.3.6 → 4.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,8 +17,6 @@ const projectDirectory = scriptDirectory;
17
17
  const temporaryDirectory = path.join(projectDirectory, 'agent-temp', 'store-video');
18
18
  const outputDirectory = path.join(projectDirectory, 'Auto-Screenshot', 'Video', 'Output');
19
19
  const deviceRecordingPath = '/sdcard/codeplay_store_video.mp4';
20
- const ffmpegFallbackDirectory = 'W:\\Tools\\ffmpeg\\bin';
21
- const scrcpyFallbackPath = 'W:\\Tools\\scrcpy\\scrcpy.exe';
22
20
  const capacitorConfigPath = path.join(projectDirectory, 'capacitor.config.json');
23
21
 
24
22
  const videoProfiles = {
@@ -85,16 +83,7 @@ function commandExists(command) {
85
83
  }
86
84
 
87
85
  function getExecutable(command) {
88
- if (commandExists(command)) {
89
- return command;
90
- }
91
-
92
- const fallbackPath = path.join(ffmpegFallbackDirectory, `${command}.exe`);
93
- if (fs.existsSync(fallbackPath)) {
94
- return fallbackPath;
95
- }
96
-
97
- return '';
86
+ return commandExists(command) ? command : '';
98
87
  }
99
88
 
100
89
  function wait(milliseconds) {
@@ -134,6 +123,17 @@ function getConnectedDevice() {
134
123
  return devices[0];
135
124
  }
136
125
 
126
+ function stopScreenRecording(recording) {
127
+ // Allocate a remote pseudo-terminal so Ctrl+C is delivered as an interrupt
128
+ // to screenrecord. Without a PTY, adb treats it as ordinary pipe data.
129
+ try {
130
+ recording.child.stdin.write('\u0003');
131
+ recording.child.stdin.end();
132
+ } catch {
133
+ // The adb shell may already have closed its input stream.
134
+ }
135
+ }
136
+
137
137
  function sanitizeName(value) {
138
138
  const name = String(value || '')
139
139
  .trim()
@@ -296,8 +296,7 @@ function waitForManualStop(recordingCompletion, duration) {
296
296
  }
297
297
 
298
298
  function getScrcpyCommand() {
299
- if (commandExists('scrcpy')) return 'scrcpy';
300
- return fs.existsSync(scrcpyFallbackPath) ? scrcpyFallbackPath : '';
299
+ return commandExists('scrcpy') ? 'scrcpy' : '';
301
300
  }
302
301
 
303
302
  async function recordConnectedDevice(options, destinationPath) {
@@ -328,7 +327,7 @@ async function recordConnectedDevice(options, destinationPath) {
328
327
  const scrcpyCommand = getScrcpyCommand();
329
328
  if (!scrcpyCommand) {
330
329
  throw new Error(
331
- 'Audio recording requires scrcpy. Install it at W:\\Tools\\scrcpy or add it to PATH.',
330
+ 'Audio recording requires scrcpy. Install scrcpy and add it to PATH.',
332
331
  );
333
332
  }
334
333
 
@@ -347,11 +346,11 @@ async function recordConnectedDevice(options, destinationPath) {
347
346
  } else {
348
347
  recording = runAsync('adb', [
349
348
  '-s', deviceId,
350
- 'shell', 'screenrecord',
349
+ 'shell', '-t', 'screenrecord',
351
350
  '--bit-rate', '12000000',
352
351
  '--time-limit', String(duration),
353
352
  deviceRecordingPath,
354
- ]);
353
+ ], { stdio: ['pipe', 'inherit', 'inherit'] });
355
354
  }
356
355
 
357
356
  let manualStopRequested = false;
@@ -367,16 +366,19 @@ async function recordConnectedDevice(options, destinationPath) {
367
366
  'shell', 'pkill', '-TERM', '-f', 'com.genymobile.scrcpy.Server',
368
367
  ]);
369
368
  } else {
370
- run('adb', ['-s', deviceId, 'shell', 'pkill', '-INT', 'screenrecord']);
369
+ stopScreenRecording(recording);
371
370
  }
372
371
  } else if (stopReason === 'maximum-duration') {
373
372
  console.log(`Safety maximum reached after ${duration} seconds.`);
374
373
  }
375
374
 
376
- try {
375
+ if (manualStopRequested) {
376
+ // Vendor recorder services can leave adb.exe waiting after the recording
377
+ // file has already been finalized. Give the device a moment, but do not
378
+ // block the pull forever on that wrapper process.
379
+ wait(2000);
380
+ } else {
377
381
  await recording.completion;
378
- } catch (error) {
379
- if (!manualStopRequested) throw error;
380
382
  }
381
383
 
382
384
  if (audio === 'without') {
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
- {
2
- "name": "codeplay-common",
3
- "version": "4.3.6",
4
- "description": "Common build scripts and files",
5
- "scripts": {
6
- "postinstall": "node scripts/sync-files.js",
7
- "preinstall": "node scripts/uninstall.js"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/merbin2012/codeplay-common.git"
12
- },
13
- "author": "Codeplay Technologies",
14
- "license": "MIT"
15
- }
1
+ {
2
+ "name": "codeplay-common",
3
+ "version": "4.3.7",
4
+ "description": "Common build scripts and files",
5
+ "scripts": {
6
+ "postinstall": "node scripts/sync-files.js",
7
+ "preinstall": "node scripts/uninstall.js"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/merbin2012/codeplay-common.git"
12
+ },
13
+ "author": "Codeplay Technologies",
14
+ "license": "MIT"
15
+ }
@@ -1,104 +1,104 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
-
4
- const projectRoot = path.resolve(__dirname, "../../../"); // Your project's root
5
- const commonBuildPath = path.join(__dirname, "../files"); // Path to common files
6
- const buildCodeplayPath = path.join(commonBuildPath, "buildCodeplay"); // Correct path
7
- const packageJsonPath = path.join(projectRoot, "package.json");
8
-
9
- // Ensure package.json exists
10
- if (!fs.existsSync(packageJsonPath)) {
11
- process.stderr.write("❌ package.json not found!\n");
12
- process.exit(1);
13
- }
14
-
15
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
16
-
17
- function copyFolderSync(source, destination) {
18
- try {
19
- fs.cpSync(source, destination, { recursive: true });
20
- process.stdout.write(`✅ Copied folder: ${source} -> ${destination}\n`);
21
- } catch (error) {
22
- process.stderr.write(`⚠️ Failed to copy folder: ${source} - ${error.message}\n`);
23
- }
24
- }
25
-
26
- // Copy all files from `common-build-files/files/` to the project root
27
- fs.readdirSync(commonBuildPath).forEach(file => {
28
- const sourcePath = path.join(commonBuildPath, file);
29
- const destPath = path.join(projectRoot, file);
30
-
31
- if (fs.statSync(sourcePath).isDirectory()) {
32
- copyFolderSync(sourcePath, destPath);
33
- } else {
34
- try {
35
- fs.copyFileSync(sourcePath, destPath);
36
- process.stdout.write(`✅ Copied file: ${file}\n`);
37
- } catch (error) {
38
- process.stderr.write(`⚠️ Failed to copy file: ${file} - ${error.message}\n`);
39
- }
40
- }
41
- });
42
-
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+
4
+ const projectRoot = path.resolve(__dirname, "../../../"); // Your project's root
5
+ const commonBuildPath = path.join(__dirname, "../files"); // Path to common files
6
+ const buildCodeplayPath = path.join(commonBuildPath, "buildCodeplay"); // Correct path
7
+ const packageJsonPath = path.join(projectRoot, "package.json");
8
+
9
+ // Ensure package.json exists
10
+ if (!fs.existsSync(packageJsonPath)) {
11
+ process.stderr.write("❌ package.json not found!\n");
12
+ process.exit(1);
13
+ }
14
+
15
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
16
+
17
+ function copyFolderSync(source, destination) {
18
+ try {
19
+ fs.cpSync(source, destination, { recursive: true });
20
+ process.stdout.write(`✅ Copied folder: ${source} -> ${destination}\n`);
21
+ } catch (error) {
22
+ process.stderr.write(`⚠️ Failed to copy folder: ${source} - ${error.message}\n`);
23
+ }
24
+ }
25
+
26
+ // Copy all files from `common-build-files/files/` to the project root
27
+ fs.readdirSync(commonBuildPath).forEach(file => {
28
+ const sourcePath = path.join(commonBuildPath, file);
29
+ const destPath = path.join(projectRoot, file);
30
+
31
+ if (fs.statSync(sourcePath).isDirectory()) {
32
+ copyFolderSync(sourcePath, destPath);
33
+ } else {
34
+ try {
35
+ fs.copyFileSync(sourcePath, destPath);
36
+ process.stdout.write(`✅ Copied file: ${file}\n`);
37
+ } catch (error) {
38
+ process.stderr.write(`⚠️ Failed to copy file: ${file} - ${error.message}\n`);
39
+ }
40
+ }
41
+ });
42
+
43
43
  // Function to get the latest versioned file from files/buildCodeplay
44
- function getLatestFile(prefix) {
45
- if (!fs.existsSync(buildCodeplayPath)) return null; // Ensure directory exists
46
-
47
- const files = fs.readdirSync(buildCodeplayPath).filter(file => file.startsWith(prefix));
48
- if (files.length === 0) return null;
49
- files.sort((a, b) => b.localeCompare(a, undefined, { numeric: true }));
50
- return files[0];
51
- }
52
-
53
- // Detect latest script versions
54
- const latestSplashScreen = getLatestFile("add-splash-screen-");
55
- const latestSplashAnimation = getLatestFile("setSplashAnimation-");
56
- const latestCodeplayBuild = getLatestFile("codeplayBeforeBuild-");
57
-
58
- const latestPackageIdModification = getLatestFile("packageidBaseModification-");
59
- const baselineProfileSetupScript = "node scripts/setup-baseline-profile.js";
60
- const baselineProfileGenerateScript = "cd android && gradlew.bat :app:generateBaselineProfile --console=plain";
61
-
62
- function appendIfMissing(base, suffix) {
63
- if (!suffix) return base;
64
- if (!base || typeof base !== "string") return suffix;
65
- if (base.includes(suffix)) return base;
66
- return `${base} && ${suffix}`;
67
- }
68
-
69
-
70
- // Ensure scripts object exists
71
- packageJson.scripts = packageJson.scripts || {};
72
-
73
- // Update or add necessary scripts
74
- if (latestCodeplayBuild) {
75
- packageJson.scripts["build"] = `node buildCodeplay/${latestCodeplayBuild} && node buildCodeplay/${latestPackageIdModification} && cross-env NODE_ENV=production vite build --logLevel warn`;
76
- }
77
- if (latestSplashScreen && latestSplashAnimation) {
78
- packageJson.scripts["capacitor:sync:after"] = appendIfMissing(
79
- `node buildCodeplay/${latestSplashScreen} && node buildCodeplay/${latestSplashAnimation} && node buildCodeplay/manifestModification.js`,
80
- baselineProfileSetupScript
81
- );
82
- //node buildCodeplay/ios-emi-admob-modification.js &&
83
- } else if (packageJson.scripts["capacitor:sync:after"]) {
84
- packageJson.scripts["capacitor:sync:after"] = appendIfMissing(
85
- packageJson.scripts["capacitor:sync:after"],
86
- baselineProfileSetupScript
87
- );
88
- }
89
- packageJson.scripts["baseline-profile:setup"] = baselineProfileSetupScript;
90
- packageJson.scripts["baseline-profile:generate"] = baselineProfileGenerateScript;
91
-
92
- packageJson.scripts["ionic:build"] = "npm run build";
93
- packageJson.scripts["ionic:serve"] = "cross-env NODE_ENV=development vite";
94
- packageJson.scripts["build:storeid1"] = "vite build --mode storeid1";
95
- packageJson.scripts["build:storeid2"] = "vite build --mode storeid2";
96
- packageJson.scripts["build:storeid3"] = "vite build --mode storeid3";
97
- packageJson.scripts["build:storeid4"] = "vite build --mode storeid4";
98
- packageJson.scripts["build:storeid5"] = "vite build --mode storeid5";
99
- //packageJson.scripts["build:storeid6"] = "vite build --mode storeid6";
100
- packageJson.scripts["build:storeid7"] = "vite build --mode storeid7";
101
- packageJson.scripts["build:storeid8"] = "vite build --mode storeid8";
102
- // Save changes
103
- fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf8");
104
- process.stdout.write("✅ package.json updated!\n");
44
+ function getLatestFile(prefix) {
45
+ if (!fs.existsSync(buildCodeplayPath)) return null; // Ensure directory exists
46
+
47
+ const files = fs.readdirSync(buildCodeplayPath).filter(file => file.startsWith(prefix));
48
+ if (files.length === 0) return null;
49
+ files.sort((a, b) => b.localeCompare(a, undefined, { numeric: true }));
50
+ return files[0];
51
+ }
52
+
53
+ // Detect latest script versions
54
+ const latestSplashScreen = getLatestFile("add-splash-screen-");
55
+ const latestSplashAnimation = getLatestFile("setSplashAnimation-");
56
+ const latestCodeplayBuild = getLatestFile("codeplayBeforeBuild-");
57
+
58
+ const latestPackageIdModification = getLatestFile("packageidBaseModification-");
59
+ const baselineProfileSetupScript = "node scripts/setup-baseline-profile.js";
60
+ const baselineProfileGenerateScript = "cd android && gradlew.bat :app:generateBaselineProfile --console=plain";
61
+
62
+ function appendIfMissing(base, suffix) {
63
+ if (!suffix) return base;
64
+ if (!base || typeof base !== "string") return suffix;
65
+ if (base.includes(suffix)) return base;
66
+ return `${base} && ${suffix}`;
67
+ }
68
+
69
+
70
+ // Ensure scripts object exists
71
+ packageJson.scripts = packageJson.scripts || {};
72
+
73
+ // Update or add necessary scripts
74
+ if (latestCodeplayBuild) {
75
+ packageJson.scripts["build"] = `node buildCodeplay/${latestCodeplayBuild} && node buildCodeplay/${latestPackageIdModification} && cross-env NODE_ENV=production vite build --logLevel warn`;
76
+ }
77
+ if (latestSplashScreen && latestSplashAnimation) {
78
+ packageJson.scripts["capacitor:sync:after"] = appendIfMissing(
79
+ `node buildCodeplay/${latestSplashScreen} && node buildCodeplay/${latestSplashAnimation} && node buildCodeplay/manifestModification.js`,
80
+ baselineProfileSetupScript
81
+ );
82
+ //node buildCodeplay/ios-emi-admob-modification.js &&
83
+ } else if (packageJson.scripts["capacitor:sync:after"]) {
84
+ packageJson.scripts["capacitor:sync:after"] = appendIfMissing(
85
+ packageJson.scripts["capacitor:sync:after"],
86
+ baselineProfileSetupScript
87
+ );
88
+ }
89
+ packageJson.scripts["baseline-profile:setup"] = baselineProfileSetupScript;
90
+ packageJson.scripts["baseline-profile:generate"] = baselineProfileGenerateScript;
91
+
92
+ packageJson.scripts["ionic:build"] = "npm run build";
93
+ packageJson.scripts["ionic:serve"] = "cross-env NODE_ENV=development vite";
94
+ packageJson.scripts["build:storeid1"] = "vite build --mode storeid1";
95
+ packageJson.scripts["build:storeid2"] = "vite build --mode storeid2";
96
+ packageJson.scripts["build:storeid3"] = "vite build --mode storeid3";
97
+ packageJson.scripts["build:storeid4"] = "vite build --mode storeid4";
98
+ packageJson.scripts["build:storeid5"] = "vite build --mode storeid5";
99
+ //packageJson.scripts["build:storeid6"] = "vite build --mode storeid6";
100
+ packageJson.scripts["build:storeid7"] = "vite build --mode storeid7";
101
+ packageJson.scripts["build:storeid8"] = "vite build --mode storeid8";
102
+ // Save changes
103
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf8");
104
+ process.stdout.write("✅ package.json updated!\n");
@@ -1,109 +1,109 @@
1
- // Define file prefixes to delete
2
- const filePrefixes = [
3
- "add-splash-screen",
4
- "setSplashAnimation",
5
- "codeplayBeforeBuild",
6
- "finalrelease"
7
- ];
8
-
9
- const fs = require("fs");
10
- const path = require("path");
11
-
12
- const projectRoot = path.resolve(__dirname, "../../../"); // Project root
13
- const commonBuildPath = path.join(__dirname, "../files"); // Path where files were copied from
14
- const splashXmlPath = path.join(projectRoot, "buildCodeplay"); // Path to splashxml folder
15
- const baselineProfileSetupScript = path.join(projectRoot, "scripts", "setup-baseline-profile.js");
16
- const baselineProfileBackup = path.join(projectRoot, "baselineProfiles", "baseline-prof.txt");
17
-
18
- const isAgentInstructionAsset = (file) => {
19
- const normalizedName = file.toLowerCase();
20
- return normalizedName === "agents" || normalizedName === "agents.md";
21
- };
22
-
23
- process.stdout.write("🚀 Uninstalling: Removing old and copied files...\n");
24
-
25
- const removeDirectory = (dirPath) => {
26
- if (fs.existsSync(dirPath)) {
27
- fs.readdirSync(dirPath).forEach(file => {
28
- const currentPath = path.join(dirPath, file);
29
- if (fs.lstatSync(currentPath).isDirectory()) {
30
- removeDirectory(currentPath);
31
- } else {
32
- fs.unlinkSync(currentPath);
33
- }
34
- });
35
- fs.rmdirSync(dirPath);
36
- process.stdout.write(`🗑️ Removed folder: ${dirPath}\n`);
37
- }
38
- };
39
-
40
- removeDirectory(splashXmlPath);
41
- removeDirectory(path.join(projectRoot, "splashxml")); // Remove old splashxml folder
42
-
43
- // Step 1: Find all matching files in the project directory
44
- const filePatternsToRemove = [
45
- /^add-splash-screen-.*$/,
46
- /^setSplashAnimation-.*$/,
47
- /^codeplayBeforeBuild-.*$/,
48
- /^modify-plugin-xml\.xml$/,
49
- /^finalrelease.*$/,
50
- /^iap-install-\d+(\.\d+)?\.js$/,
51
- /^\.env\.storeid[1-7]$/,
52
- /^modify-plugin-xml\.js$/
53
- ];
54
-
55
- const filesInProject = fs.readdirSync(projectRoot);
56
-
57
- filesInProject.forEach(file => {
58
- if (filePatternsToRemove.some(pattern => pattern.test(file))) {
59
- const filePath = path.join(projectRoot, file);
60
- try {
61
- fs.unlinkSync(filePath);
62
- process.stdout.write(`🗑️ Removed file: ${filePath}\n`);
63
- } catch (error) {
64
- process.stderr.write(`⚠️ Failed to remove ${filePath}: ${error.message}\n`);
65
- }
66
- }
67
- });
68
-
69
- // Remove files and folders listed in commonBuildPath
70
- if (fs.existsSync(commonBuildPath)) {
71
- fs.readdirSync(commonBuildPath).forEach(file => {
72
- const destPath = path.join(projectRoot, file);
73
- if (file === "scripts" || isAgentInstructionAsset(file)) {
74
- return;
75
- }
76
- if (fs.existsSync(destPath)) {
77
- try {
78
- if (fs.lstatSync(destPath).isDirectory()) {
79
- removeDirectory(destPath);
80
- } else {
81
- fs.unlinkSync(destPath);
82
- process.stdout.write(`🗑️ Removed file: ${destPath}\n`);
83
- }
84
- } catch (error) {
85
- process.stderr.write(`⚠️ Failed to remove ${destPath}: ${error.message}\n`);
86
- }
87
- }
88
- });
89
- }
90
-
91
- if (fs.existsSync(baselineProfileSetupScript)) {
92
- try {
93
- fs.unlinkSync(baselineProfileSetupScript);
94
- process.stdout.write(`🗑️ Removed file: ${baselineProfileSetupScript}\n`);
95
- } catch (error) {
96
- process.stderr.write(`⚠️ Failed to remove ${baselineProfileSetupScript}: ${error.message}\n`);
97
- }
98
- }
99
-
100
- if (fs.existsSync(baselineProfileBackup)) {
101
- try {
102
- fs.unlinkSync(baselineProfileBackup);
103
- process.stdout.write(`🗑️ Removed file: ${baselineProfileBackup}\n`);
104
- } catch (error) {
105
- process.stderr.write(`⚠️ Failed to remove ${baselineProfileBackup}: ${error.message}\n`);
106
- }
107
- }
108
-
109
- process.stdout.write("✅ Uninstall cleanup complete!\n");
1
+ // Define file prefixes to delete
2
+ const filePrefixes = [
3
+ "add-splash-screen",
4
+ "setSplashAnimation",
5
+ "codeplayBeforeBuild",
6
+ "finalrelease"
7
+ ];
8
+
9
+ const fs = require("fs");
10
+ const path = require("path");
11
+
12
+ const projectRoot = path.resolve(__dirname, "../../../"); // Project root
13
+ const commonBuildPath = path.join(__dirname, "../files"); // Path where files were copied from
14
+ const splashXmlPath = path.join(projectRoot, "buildCodeplay"); // Path to splashxml folder
15
+ const baselineProfileSetupScript = path.join(projectRoot, "scripts", "setup-baseline-profile.js");
16
+ const baselineProfileBackup = path.join(projectRoot, "baselineProfiles", "baseline-prof.txt");
17
+
18
+ const isAgentInstructionAsset = (file) => {
19
+ const normalizedName = file.toLowerCase();
20
+ return normalizedName === "agents" || normalizedName === "agents.md";
21
+ };
22
+
23
+ process.stdout.write("🚀 Uninstalling: Removing old and copied files...\n");
24
+
25
+ const removeDirectory = (dirPath) => {
26
+ if (fs.existsSync(dirPath)) {
27
+ fs.readdirSync(dirPath).forEach(file => {
28
+ const currentPath = path.join(dirPath, file);
29
+ if (fs.lstatSync(currentPath).isDirectory()) {
30
+ removeDirectory(currentPath);
31
+ } else {
32
+ fs.unlinkSync(currentPath);
33
+ }
34
+ });
35
+ fs.rmdirSync(dirPath);
36
+ process.stdout.write(`🗑️ Removed folder: ${dirPath}\n`);
37
+ }
38
+ };
39
+
40
+ removeDirectory(splashXmlPath);
41
+ removeDirectory(path.join(projectRoot, "splashxml")); // Remove old splashxml folder
42
+
43
+ // Step 1: Find all matching files in the project directory
44
+ const filePatternsToRemove = [
45
+ /^add-splash-screen-.*$/,
46
+ /^setSplashAnimation-.*$/,
47
+ /^codeplayBeforeBuild-.*$/,
48
+ /^modify-plugin-xml\.xml$/,
49
+ /^finalrelease.*$/,
50
+ /^iap-install-\d+(\.\d+)?\.js$/,
51
+ /^\.env\.storeid[1-7]$/,
52
+ /^modify-plugin-xml\.js$/
53
+ ];
54
+
55
+ const filesInProject = fs.readdirSync(projectRoot);
56
+
57
+ filesInProject.forEach(file => {
58
+ if (filePatternsToRemove.some(pattern => pattern.test(file))) {
59
+ const filePath = path.join(projectRoot, file);
60
+ try {
61
+ fs.unlinkSync(filePath);
62
+ process.stdout.write(`🗑️ Removed file: ${filePath}\n`);
63
+ } catch (error) {
64
+ process.stderr.write(`⚠️ Failed to remove ${filePath}: ${error.message}\n`);
65
+ }
66
+ }
67
+ });
68
+
69
+ // Remove files and folders listed in commonBuildPath
70
+ if (fs.existsSync(commonBuildPath)) {
71
+ fs.readdirSync(commonBuildPath).forEach(file => {
72
+ const destPath = path.join(projectRoot, file);
73
+ if (file === "scripts" || isAgentInstructionAsset(file)) {
74
+ return;
75
+ }
76
+ if (fs.existsSync(destPath)) {
77
+ try {
78
+ if (fs.lstatSync(destPath).isDirectory()) {
79
+ removeDirectory(destPath);
80
+ } else {
81
+ fs.unlinkSync(destPath);
82
+ process.stdout.write(`🗑️ Removed file: ${destPath}\n`);
83
+ }
84
+ } catch (error) {
85
+ process.stderr.write(`⚠️ Failed to remove ${destPath}: ${error.message}\n`);
86
+ }
87
+ }
88
+ });
89
+ }
90
+
91
+ if (fs.existsSync(baselineProfileSetupScript)) {
92
+ try {
93
+ fs.unlinkSync(baselineProfileSetupScript);
94
+ process.stdout.write(`🗑️ Removed file: ${baselineProfileSetupScript}\n`);
95
+ } catch (error) {
96
+ process.stderr.write(`⚠️ Failed to remove ${baselineProfileSetupScript}: ${error.message}\n`);
97
+ }
98
+ }
99
+
100
+ if (fs.existsSync(baselineProfileBackup)) {
101
+ try {
102
+ fs.unlinkSync(baselineProfileBackup);
103
+ process.stdout.write(`🗑️ Removed file: ${baselineProfileBackup}\n`);
104
+ } catch (error) {
105
+ process.stderr.write(`⚠️ Failed to remove ${baselineProfileBackup}: ${error.message}\n`);
106
+ }
107
+ }
108
+
109
+ process.stdout.write("✅ Uninstall cleanup complete!\n");