codeplay-common 1.2.0 → 1.2.1
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/.gitattributes
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Merbin Joe
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# codeplay-common
|
|
2
|
+
Everything automatted in Capacitor apps, easy to maintain many apps in capacitor. It will reduce your 40% of work, with common file code.
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
Easy add splashscreen and set animation
|
|
6
|
+
Admob id automatically from capacitor.config.json file
|
|
7
|
+
Make three build file for different store as per our requirement
|
|
8
|
+
Based on store install various IAP plugins
|
|
9
|
+
Make it to ionic project
|
|
10
|
+
|
|
11
|
+
Donate to get full code including many common functions
|
|
12
|
+
https://ko-fi.com/codeplay
|
|
@@ -7,11 +7,44 @@ const androidPlatformPath = path.join(process.cwd(), 'android');
|
|
|
7
7
|
const iosPlatformPath = path.join(process.cwd(), 'ios');
|
|
8
8
|
const pluginPath = path.join(process.cwd(), 'node_modules', 'emi-indo-cordova-plugin-admob', 'plugin.xml');
|
|
9
9
|
const infoPlistPath = path.join(process.cwd(), 'ios', 'App', 'App', 'Info.plist');
|
|
10
|
+
const resourcesPath = path.join(process.cwd(), 'resources', 'res');
|
|
11
|
+
const androidResPath = path.join(process.cwd(), 'android', 'app', 'src', 'main', 'res');
|
|
12
|
+
const localNotificationsPluginPath = path.join(process.cwd(), 'node_modules', '@capacitor', 'local-notifications');
|
|
10
13
|
|
|
11
14
|
function fileExists(filePath) {
|
|
12
15
|
return fs.existsSync(filePath);
|
|
13
16
|
}
|
|
14
17
|
|
|
18
|
+
function copyFolderSync(source, target) {
|
|
19
|
+
if (!fs.existsSync(target)) {
|
|
20
|
+
fs.mkdirSync(target, { recursive: true });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
fs.readdirSync(source).forEach(file => {
|
|
24
|
+
const sourceFile = path.join(source, file);
|
|
25
|
+
const targetFile = path.join(target, file);
|
|
26
|
+
|
|
27
|
+
if (fs.lstatSync(sourceFile).isDirectory()) {
|
|
28
|
+
copyFolderSync(sourceFile, targetFile);
|
|
29
|
+
} else {
|
|
30
|
+
fs.copyFileSync(sourceFile, targetFile);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function checkAndCopyResources() {
|
|
36
|
+
if (fileExists(resourcesPath)) {
|
|
37
|
+
copyFolderSync(resourcesPath, androidResPath);
|
|
38
|
+
console.log('Successfully copied resources/res to android/app/src/main/res.');
|
|
39
|
+
} else {
|
|
40
|
+
console.log('resources/res folder not found.');
|
|
41
|
+
|
|
42
|
+
if (fileExists(localNotificationsPluginPath)) {
|
|
43
|
+
throw new Error('resources/res is required for @capacitor/local-notifications. Stopping execution.');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
15
48
|
function getAdMobConfig() {
|
|
16
49
|
if (!fileExists(configPath)) {
|
|
17
50
|
throw new Error('capacitor.config.json not found. Ensure this is a Capacitor project.');
|
|
@@ -43,7 +76,6 @@ function updatePluginXml(admobConfig) {
|
|
|
43
76
|
.replace(/<preference name="APP_ID_ANDROID" default=".*?" \/>/, `<preference name="APP_ID_ANDROID" default="${admobConfig.APP_ID_ANDROID}" />`)
|
|
44
77
|
.replace(/<preference name="APP_ID_IOS" default=".*?" \/>/, `<preference name="APP_ID_IOS" default="${admobConfig.APP_ID_IOS}" />`);
|
|
45
78
|
|
|
46
|
-
|
|
47
79
|
fs.writeFileSync(pluginPath, pluginContent, 'utf8');
|
|
48
80
|
console.log('AdMob IDs successfully updated in plugin.xml');
|
|
49
81
|
}
|
|
@@ -61,52 +93,6 @@ function updateInfoPlist(admobConfig) {
|
|
|
61
93
|
plistData.NSUserTrackingUsageDescription = 'This identifier will be used to deliver personalized ads to you.';
|
|
62
94
|
plistData.GADDelayAppMeasurementInit = true;
|
|
63
95
|
|
|
64
|
-
// https://developers.google.com/admob/ios/quick-start
|
|
65
|
-
plistData.SKAdNetworkItems = [
|
|
66
|
-
{ SKAdNetworkIdentifier: 'cstr6suwn9.skadnetwork' }, // Google
|
|
67
|
-
{ SKAdNetworkIdentifier: '4fzdc2evr5.skadnetwork' }, // Aarki
|
|
68
|
-
{ SKAdNetworkIdentifier: '2fnua5tdw4.skadnetwork' }, // Adform
|
|
69
|
-
{ SKAdNetworkIdentifier: 'ydx93a7ass.skadnetwork' }, // Adikteev
|
|
70
|
-
{ SKAdNetworkIdentifier: 'p78axxw29g.skadnetwork' }, // Amazon
|
|
71
|
-
{ SKAdNetworkIdentifier: 'v72qych5uu.skadnetwork' }, // Appier
|
|
72
|
-
{ SKAdNetworkIdentifier: 'ludvb6z3bs.skadnetwork' }, // Applovin
|
|
73
|
-
{ SKAdNetworkIdentifier: 'cp8zw746q7.skadnetwork' }, // Arpeely
|
|
74
|
-
{ SKAdNetworkIdentifier: '3sh42y64q3.skadnetwork' }, // Basis
|
|
75
|
-
{ SKAdNetworkIdentifier: 'c6k4g5qg8m.skadnetwork' }, // Beeswax.io
|
|
76
|
-
{ SKAdNetworkIdentifier: 's39g8k73mm.skadnetwork' }, // Bidease
|
|
77
|
-
{ SKAdNetworkIdentifier: '3qy4746246.skadnetwork' }, // Bigabid
|
|
78
|
-
{ SKAdNetworkIdentifier: 'hs6bdukanm.skadnetwork' }, // Criteo
|
|
79
|
-
{ SKAdNetworkIdentifier: 'mlmmfzh3r3.skadnetwork' }, // Digital Turbine DSP
|
|
80
|
-
{ SKAdNetworkIdentifier: 'v4nxqhlyqp.skadnetwork' }, // i-mobile
|
|
81
|
-
{ SKAdNetworkIdentifier: 'wzmmz9fp6w.skadnetwork' }, // InMobi
|
|
82
|
-
{ SKAdNetworkIdentifier: 'su67r6k2v3.skadnetwork' }, // ironSource Ads
|
|
83
|
-
{ SKAdNetworkIdentifier: 'yclnxrl5pm.skadnetwork' }, // Jampp
|
|
84
|
-
{ SKAdNetworkIdentifier: '7ug5zh24hu.skadnetwork' }, // Liftoff
|
|
85
|
-
{ SKAdNetworkIdentifier: 'gta9lk7p23.skadnetwork' }, // Liftoff Monetize
|
|
86
|
-
{ SKAdNetworkIdentifier: 'vutu7akeur.skadnetwork' }, // LINE
|
|
87
|
-
{ SKAdNetworkIdentifier: 'y5ghdn5j9k.skadnetwork' }, // Mediaforce
|
|
88
|
-
{ SKAdNetworkIdentifier: 'v9wttpbfk9.skadnetwork' }, // Meta (1 of 2)
|
|
89
|
-
{ SKAdNetworkIdentifier: 'n38lu8286q.skadnetwork' }, // Meta (2 of 2)
|
|
90
|
-
{ SKAdNetworkIdentifier: '47vhws6wlr.skadnetwork' }, // MicroAd
|
|
91
|
-
{ SKAdNetworkIdentifier: 'kbd757ywx3.skadnetwork' }, // Mintegral / Mobvista
|
|
92
|
-
{ SKAdNetworkIdentifier: '9t245vhmpl.skadnetwork' }, // Moloco
|
|
93
|
-
{ SKAdNetworkIdentifier: 'a2p9lx4jpn.skadnetwork' }, // Opera
|
|
94
|
-
{ SKAdNetworkIdentifier: '22mmun2rn5.skadnetwork' }, // Pangle
|
|
95
|
-
{ SKAdNetworkIdentifier: '4468km3ulz.skadnetwork' }, // Realtime Technologies GmbH
|
|
96
|
-
{ SKAdNetworkIdentifier: '2u9pt9hc89.skadnetwork' }, // Remerge
|
|
97
|
-
{ SKAdNetworkIdentifier: '8s468mfl3y.skadnetwork' }, // RTB House
|
|
98
|
-
{ SKAdNetworkIdentifier: 'ppxm28t8ap.skadnetwork' }, // Smadex
|
|
99
|
-
{ SKAdNetworkIdentifier: 'uw77j35x4d.skadnetwork' }, // The Trade Desk
|
|
100
|
-
{ SKAdNetworkIdentifier: 'pwa73g5rt2.skadnetwork' }, // Tremor
|
|
101
|
-
{ SKAdNetworkIdentifier: '578prtvx9j.skadnetwork' }, // Unicorn
|
|
102
|
-
{ SKAdNetworkIdentifier: '4dzt52r2t5.skadnetwork' }, // Unity Ads
|
|
103
|
-
{ SKAdNetworkIdentifier: 'tl55sbb4fm.skadnetwork' }, // Verve
|
|
104
|
-
{ SKAdNetworkIdentifier: 'e5fvkxwrpn.skadnetwork' }, // Yahoo!
|
|
105
|
-
{ SKAdNetworkIdentifier: '8c4e2ghe7u.skadnetwork' }, // Yahoo! Japan Ads
|
|
106
|
-
{ SKAdNetworkIdentifier: '3rd42ekr43.skadnetwork' }, // YouAppi
|
|
107
|
-
{ SKAdNetworkIdentifier: '3qcr597p9d.skadnetwork' }, // Zucks
|
|
108
|
-
];
|
|
109
|
-
|
|
110
96
|
const updatedPlistContent = plist.build(plistData);
|
|
111
97
|
fs.writeFileSync(infoPlistPath, updatedPlistContent, 'utf8');
|
|
112
98
|
console.log('AdMob IDs and additional configurations successfully updated in Info.plist');
|
|
@@ -121,6 +107,8 @@ try {
|
|
|
121
107
|
throw new Error('Neither Android nor iOS platforms are found. Ensure platforms are added to your Capacitor project.');
|
|
122
108
|
}
|
|
123
109
|
|
|
110
|
+
checkAndCopyResources();
|
|
111
|
+
|
|
124
112
|
const admobConfig = getAdMobConfig();
|
|
125
113
|
|
|
126
114
|
if (fileExists(androidPlatformPath)) {
|
|
@@ -132,8 +120,5 @@ try {
|
|
|
132
120
|
}
|
|
133
121
|
} catch (error) {
|
|
134
122
|
console.error(error.message);
|
|
123
|
+
process.exit(1); // Stop execution if there's a critical error
|
|
135
124
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|