codeplay-common 1.0.49 → 1.0.51

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 CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "1.0.49",
3
+ "version": "1.0.51",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
-
6
+ "postinstall":"node scripts/sync-files.js",
7
7
  "preinstall": "node scripts/uninstall.js"
8
8
  },
9
9
  "repository": {
@@ -5,16 +5,10 @@ const projectRoot = path.resolve(__dirname, "../../../");;//process.cwd(); // Yo
5
5
  const commonBuildPath = path.join(__dirname, "../files"); // Path to common files
6
6
  const packageJsonPath = path.join(projectRoot, "package.json");
7
7
 
8
- console.log("PROJECT ROOT IS ",projectRoot)
9
- console.log("commonBuildPath IS ",commonBuildPath)
10
- console.log("PROJECT ROOT IS PACKAGE.JSON",packageJsonPath)
11
-
12
-
13
-
14
8
 
15
9
  // Ensure package.json exists
16
10
  if (!fs.existsSync(packageJsonPath)) {
17
- console.error("❌ package.json not found!");
11
+ process.stderr.write("❌ package.json not found!");
18
12
  process.exit(1);
19
13
  }
20
14
 
@@ -22,9 +16,9 @@ if (!fs.existsSync(packageJsonPath)) {
22
16
  function copyFolderSync(source, destination) {
23
17
  try {
24
18
  fs.cpSync(source, destination, { recursive: true });
25
- console.log(`✅ Copied folder: ${source} -> ${destination}`);
19
+ process.stdout.write(`✅ Copied folder: ${source} -> ${destination}`);
26
20
  } catch (error) {
27
- console.warn(`⚠️ Failed to copy folder: ${source} - ${error.message}`);
21
+ process.stderr.write(`⚠️ Failed to copy folder: ${source} - ${error.message}`);
28
22
  }
29
23
  }
30
24
 
@@ -39,10 +33,10 @@ fs.readdirSync(commonBuildPath).forEach(file => {
39
33
  } else {
40
34
  try {
41
35
  fs.copyFileSync(sourcePath, destPath);
42
- console.log(`✅ Copied file: ${file}`);
36
+ process.stdout.write(`✅ Copied file: ${file}`);
43
37
  }
44
38
  catch (error) {
45
- console.warn(`⚠️ Failed to copy file: ${file} - ${error.message}`);
39
+ process.stderr.write(`⚠️ Failed to copy file: ${file} - ${error.message}`);
46
40
  }
47
41
  }
48
42
  });
@@ -91,4 +85,4 @@ packageJson.scripts["build:storeid7"] = "vite build --mode storeid7";
91
85
 
92
86
  // Save changes
93
87
  fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf8");
94
- console.log("✅ package.json updated!");
88
+ process.stdout.write("✅ package.json updated!");
@@ -4,7 +4,7 @@ const path = require("path");
4
4
  const projectRoot = path.resolve(__dirname, "../../../"); // Project root
5
5
  const commonBuildPath = path.join(__dirname, "../files"); // Path where files were copied from
6
6
 
7
- console.log("🚀 Uninstalling: Removing old and copied files...");
7
+ process.stdout.write("🚀 Uninstalling: Removing old and copied files...");
8
8
 
9
9
  // Helper function to extract version from filename
10
10
  const extractVersion = (filename) => {
@@ -33,25 +33,6 @@ filesInProject.forEach(file => {
33
33
  }
34
34
  });
35
35
 
36
- // Step 3: Remove ALL outdated versions, even if latest is missing
37
- /*
38
- filesInProject.forEach(file => {
39
- const baseName = getBaseName(file);
40
- const version = extractVersion(file);
41
- const filePath = path.join(projectRoot, file);
42
-
43
- if (version !== null && latestVersions[baseName] && version < latestVersions[baseName].version) {
44
- try {
45
- fs.unlinkSync(filePath);
46
- console.log(`🗑️ Removed outdated file: ${filePath}`);
47
- } catch (error) {
48
- console.warn(`⚠️ Failed to remove ${filePath}: ${error.message}`);
49
- }
50
- }
51
- });
52
- */
53
-
54
-
55
36
 
56
37
  // Define file prefixes to delete
57
38
  const filePrefixes = ["add-splash-screen", "setSplashAnimation", "codeplayBeforeBuild"];
@@ -64,9 +45,9 @@ filesInProject1.forEach(file => {
64
45
  const filePath = path.join(projectRoot, file);
65
46
  try {
66
47
  fs.unlinkSync(filePath);
67
- console.log(`🗑️ Removed file: ${filePath}`);
48
+ process.stdout.write(`🗑️ Removed file: ${filePath}`);
68
49
  } catch (error) {
69
- console.warn(`⚠️ Failed to remove ${filePath}: ${error.message}`);
50
+ process.stderr.write(`⚠️ Failed to remove ${filePath}: ${error.message}`);
70
51
  }
71
52
  });
72
53
 
@@ -74,19 +55,19 @@ filesInProject1.forEach(file => {
74
55
 
75
56
 
76
57
 
77
- // Step 4: Remove files listed in commonBuildPath
58
+ // Remove files listed in commonBuildPath
78
59
  if (fs.existsSync(commonBuildPath)) {
79
60
  fs.readdirSync(commonBuildPath).forEach(file => {
80
61
  const destPath = path.join(projectRoot, file);
81
62
  if (fs.existsSync(destPath)) {
82
63
  try {
83
64
  fs.unlinkSync(destPath);
84
- console.log(`🗑️ Removed file: ${destPath}`);
65
+ process.stdout.write(`🗑️ Removed file: ${destPath}`);
85
66
  } catch (error) {
86
- console.warn(`⚠️ Failed to remove ${destPath}: ${error.message}`);
67
+ process.stderr.write(`⚠️ Failed to remove ${destPath}: ${error.message}`);
87
68
  }
88
69
  }
89
70
  });
90
71
  }
91
72
 
92
- console.log("✅ Uninstall cleanup complete!");
73
+ process.stdout.write("✅ Uninstall cleanup complete!");