codeplay-common 1.0.20 → 1.0.21
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.
- package/package.json +1 -1
- package/scripts/remove-files.js +15 -5
package/package.json
CHANGED
package/scripts/remove-files.js
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const path = require("path");
|
|
3
3
|
|
|
4
|
-
const projectRoot = path.resolve(__dirname, "../../../");
|
|
5
|
-
const commonBuildPath = path.join(__dirname, "../files");
|
|
4
|
+
const projectRoot = path.resolve(__dirname, "../../../"); // Project root
|
|
5
|
+
const commonBuildPath = path.join(__dirname, "../files"); // Path where files were copied from
|
|
6
6
|
|
|
7
7
|
console.log("🚀 Uninstalling: Removing copied files...");
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// Check if commonBuildPath exists
|
|
10
|
+
if (!fs.existsSync(commonBuildPath)) {
|
|
11
|
+
console.warn("⚠️ Common build path does not exist, skipping removal.");
|
|
12
|
+
process.exit(0);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Read the common build folder and remove copied files
|
|
10
16
|
fs.readdirSync(commonBuildPath).forEach(file => {
|
|
11
17
|
const destPath = path.join(projectRoot, file);
|
|
12
18
|
|
|
13
19
|
if (fs.existsSync(destPath)) {
|
|
14
20
|
try {
|
|
15
|
-
|
|
21
|
+
const stats = fs.statSync(destPath);
|
|
22
|
+
|
|
23
|
+
if (stats.isDirectory()) {
|
|
16
24
|
fs.rmSync(destPath, { recursive: true, force: true });
|
|
17
25
|
console.log(`🗑️ Removed folder: ${destPath}`);
|
|
18
26
|
} else {
|
|
@@ -22,7 +30,9 @@ fs.readdirSync(commonBuildPath).forEach(file => {
|
|
|
22
30
|
} catch (error) {
|
|
23
31
|
console.warn(`⚠️ Failed to remove ${destPath}: ${error.message}`);
|
|
24
32
|
}
|
|
33
|
+
} else {
|
|
34
|
+
console.log(`✅ Already removed: ${destPath}`);
|
|
25
35
|
}
|
|
26
36
|
});
|
|
27
37
|
|
|
28
|
-
console.log("✅ Uninstall cleanup complete!");
|
|
38
|
+
console.log("✅ Uninstall cleanup complete!");
|