codeplay-common 3.2.18 → 4.0.0

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.
@@ -1,77 +1,77 @@
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
-
16
- process.stdout.write("🚀 Uninstalling: Removing old and copied files...\n");
17
-
18
- const removeDirectory = (dirPath) => {
19
- if (fs.existsSync(dirPath)) {
20
- fs.readdirSync(dirPath).forEach(file => {
21
- const currentPath = path.join(dirPath, file);
22
- if (fs.lstatSync(currentPath).isDirectory()) {
23
- removeDirectory(currentPath);
24
- } else {
25
- fs.unlinkSync(currentPath);
26
- }
27
- });
28
- fs.rmdirSync(dirPath);
29
- process.stdout.write(`🗑️ Removed folder: ${dirPath}\n`);
30
- }
31
- };
32
-
33
- removeDirectory(splashXmlPath);
34
- removeDirectory(path.join(projectRoot, "splashxml")); // Remove old splashxml folder
35
-
36
- // Step 1: Find all matching files in the project directory
37
- const filePatternsToRemove = [
38
- /^add-splash-screen-.*$/,
39
- /^setSplashAnimation-.*$/,
40
- /^codeplayBeforeBuild-.*$/,
41
- /^modify-plugin-xml\.xml$/,
42
- /^finalrelease.*$/,
43
- /^iap-install-\d+(\.\d+)?\.js$/,
44
- /^\.env\.storeid[1-7]$/,
45
- /^modify-plugin-xml\.js$/
46
- ];
47
-
48
- const filesInProject = fs.readdirSync(projectRoot);
49
-
50
- filesInProject.forEach(file => {
51
- if (filePatternsToRemove.some(pattern => pattern.test(file))) {
52
- const filePath = path.join(projectRoot, file);
53
- try {
54
- fs.unlinkSync(filePath);
55
- process.stdout.write(`🗑️ Removed file: ${filePath}\n`);
56
- } catch (error) {
57
- process.stderr.write(`⚠️ Failed to remove ${filePath}: ${error.message}\n`);
58
- }
59
- }
60
- });
61
-
62
- // Remove files listed in commonBuildPath
63
- if (fs.existsSync(commonBuildPath)) {
64
- fs.readdirSync(commonBuildPath).forEach(file => {
65
- const destPath = path.join(projectRoot, file);
66
- if (fs.existsSync(destPath)) {
67
- try {
68
- fs.unlinkSync(destPath);
69
- process.stdout.write(`🗑️ Removed file: ${destPath}\n`);
70
- } catch (error) {
71
- process.stderr.write(`⚠️ Failed to remove ${destPath}: ${error.message}\n`);
72
- }
73
- }
74
- });
75
- }
76
-
77
- 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
+
16
+ process.stdout.write("🚀 Uninstalling: Removing old and copied files...\n");
17
+
18
+ const removeDirectory = (dirPath) => {
19
+ if (fs.existsSync(dirPath)) {
20
+ fs.readdirSync(dirPath).forEach(file => {
21
+ const currentPath = path.join(dirPath, file);
22
+ if (fs.lstatSync(currentPath).isDirectory()) {
23
+ removeDirectory(currentPath);
24
+ } else {
25
+ fs.unlinkSync(currentPath);
26
+ }
27
+ });
28
+ fs.rmdirSync(dirPath);
29
+ process.stdout.write(`🗑️ Removed folder: ${dirPath}\n`);
30
+ }
31
+ };
32
+
33
+ removeDirectory(splashXmlPath);
34
+ removeDirectory(path.join(projectRoot, "splashxml")); // Remove old splashxml folder
35
+
36
+ // Step 1: Find all matching files in the project directory
37
+ const filePatternsToRemove = [
38
+ /^add-splash-screen-.*$/,
39
+ /^setSplashAnimation-.*$/,
40
+ /^codeplayBeforeBuild-.*$/,
41
+ /^modify-plugin-xml\.xml$/,
42
+ /^finalrelease.*$/,
43
+ /^iap-install-\d+(\.\d+)?\.js$/,
44
+ /^\.env\.storeid[1-7]$/,
45
+ /^modify-plugin-xml\.js$/
46
+ ];
47
+
48
+ const filesInProject = fs.readdirSync(projectRoot);
49
+
50
+ filesInProject.forEach(file => {
51
+ if (filePatternsToRemove.some(pattern => pattern.test(file))) {
52
+ const filePath = path.join(projectRoot, file);
53
+ try {
54
+ fs.unlinkSync(filePath);
55
+ process.stdout.write(`🗑️ Removed file: ${filePath}\n`);
56
+ } catch (error) {
57
+ process.stderr.write(`⚠️ Failed to remove ${filePath}: ${error.message}\n`);
58
+ }
59
+ }
60
+ });
61
+
62
+ // Remove files listed in commonBuildPath
63
+ if (fs.existsSync(commonBuildPath)) {
64
+ fs.readdirSync(commonBuildPath).forEach(file => {
65
+ const destPath = path.join(projectRoot, file);
66
+ if (fs.existsSync(destPath)) {
67
+ try {
68
+ fs.unlinkSync(destPath);
69
+ process.stdout.write(`🗑️ Removed file: ${destPath}\n`);
70
+ } catch (error) {
71
+ process.stderr.write(`⚠️ Failed to remove ${destPath}: ${error.message}\n`);
72
+ }
73
+ }
74
+ });
75
+ }
76
+
77
+ process.stdout.write("✅ Uninstall cleanup complete!\n");
@@ -1,36 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
-
4
- // Path to the plugin.xml file
5
- const pluginXmlPath = path.join('node_modules', 'emi-indo-cordova-plugin-admob', 'plugin.xml');
6
-
7
- // Get the store ID from the environment variable
8
- const storeId = process.env.VITE_STORE_ID || '1';
9
-
10
- // Determine the framework to use based on storeId
11
- const framework = storeId === '7'
12
- ? '<framework src="com.google.android.gms:play-services-ads:$PLAY_SERVICES_VERSION" />'
13
- : '<framework src="com.google.android.gms:play-services-ads-lite:24.6.0" />';
14
-
15
- // Read and modify the plugin.xml file
16
- fs.readFile(pluginXmlPath, 'utf8', (err, data) => {
17
- if (err) {
18
- console.error('Error reading plugin.xml:', err);
19
- process.exit(1);
20
- }
21
-
22
- // Replace the existing framework line with the selected one
23
- const modifiedData = data.replace(
24
- /<framework src="com.google.android.gms:play-services-ads.*" \/>\n/,
25
- `${framework}\n`
26
- );
27
-
28
- // Write the modified content back to plugin.xml
29
- fs.writeFile(pluginXmlPath, modifiedData, 'utf8', (err) => {
30
- if (err) {
31
- console.error('Error writing plugin.xml:', err);
32
- process.exit(1);
33
- }
34
- console.log('plugin.xml updated successfully.');
35
- });
36
- });