codeplay-common 1.0.19 → 1.0.20
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 +3 -2
- package/scripts/remove-files.js +28 -0
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeplay-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"description": "Common build scripts and files",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"postinstall": "node scripts/sync-files.js"
|
|
7
|
+
"postinstall": "node scripts/sync-files.js",
|
|
8
|
+
"preuninstall": "node scripts/remove-files.js"
|
|
8
9
|
},
|
|
9
10
|
"repository": {
|
|
10
11
|
"type": "git",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
const projectRoot = path.resolve(__dirname, "../../../");
|
|
5
|
+
const commonBuildPath = path.join(__dirname, "../files");
|
|
6
|
+
|
|
7
|
+
console.log("🚀 Uninstalling: Removing copied files...");
|
|
8
|
+
|
|
9
|
+
// Remove all copied files and folders
|
|
10
|
+
fs.readdirSync(commonBuildPath).forEach(file => {
|
|
11
|
+
const destPath = path.join(projectRoot, file);
|
|
12
|
+
|
|
13
|
+
if (fs.existsSync(destPath)) {
|
|
14
|
+
try {
|
|
15
|
+
if (fs.statSync(destPath).isDirectory()) {
|
|
16
|
+
fs.rmSync(destPath, { recursive: true, force: true });
|
|
17
|
+
console.log(`🗑️ Removed folder: ${destPath}`);
|
|
18
|
+
} else {
|
|
19
|
+
fs.unlinkSync(destPath);
|
|
20
|
+
console.log(`🗑️ Removed file: ${destPath}`);
|
|
21
|
+
}
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.warn(`⚠️ Failed to remove ${destPath}: ${error.message}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
console.log("✅ Uninstall cleanup complete!");
|