codeplay-common 4.4.3 → 4.4.4
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/files/finalrelease +123 -9
- package/package.json +1 -1
package/files/finalrelease
CHANGED
|
@@ -16,11 +16,128 @@ import { dirname } from 'path';
|
|
|
16
16
|
/* const path = require('path');
|
|
17
17
|
const fs = require('fs'); */
|
|
18
18
|
|
|
19
|
-
import fs from 'fs';
|
|
20
|
-
import path from 'path';
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
import fs from 'fs';
|
|
20
|
+
import path from 'path';
|
|
21
|
+
|
|
22
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
23
|
+
const __dirname = dirname(__filename);
|
|
24
|
+
|
|
25
|
+
function stripJavaScriptComments(content) {
|
|
26
|
+
let result = '';
|
|
27
|
+
let state = 'code';
|
|
28
|
+
|
|
29
|
+
for (let index = 0; index < content.length; index++) {
|
|
30
|
+
const character = content[index];
|
|
31
|
+
const nextCharacter = content[index + 1];
|
|
32
|
+
|
|
33
|
+
if (state === 'lineComment') {
|
|
34
|
+
if (character === '\n') {
|
|
35
|
+
result += character;
|
|
36
|
+
state = 'code';
|
|
37
|
+
} else {
|
|
38
|
+
result += ' ';
|
|
39
|
+
}
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (state === 'blockComment') {
|
|
44
|
+
if (character === '*' && nextCharacter === '/') {
|
|
45
|
+
result += ' ';
|
|
46
|
+
index++;
|
|
47
|
+
state = 'code';
|
|
48
|
+
} else {
|
|
49
|
+
result += character === '\n' ? '\n' : ' ';
|
|
50
|
+
}
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (state !== 'code') {
|
|
55
|
+
result += character;
|
|
56
|
+
|
|
57
|
+
if (character === '\\') {
|
|
58
|
+
if (nextCharacter !== undefined) {
|
|
59
|
+
result += nextCharacter;
|
|
60
|
+
index++;
|
|
61
|
+
}
|
|
62
|
+
} else if (
|
|
63
|
+
(state === 'singleQuote' && character === "'") ||
|
|
64
|
+
(state === 'doubleQuote' && character === '"') ||
|
|
65
|
+
(state === 'templateLiteral' && character === '`')
|
|
66
|
+
) {
|
|
67
|
+
state = 'code';
|
|
68
|
+
}
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (character === '/' && nextCharacter === '/') {
|
|
73
|
+
result += ' ';
|
|
74
|
+
index++;
|
|
75
|
+
state = 'lineComment';
|
|
76
|
+
} else if (character === '/' && nextCharacter === '*') {
|
|
77
|
+
result += ' ';
|
|
78
|
+
index++;
|
|
79
|
+
state = 'blockComment';
|
|
80
|
+
} else {
|
|
81
|
+
result += character;
|
|
82
|
+
|
|
83
|
+
if (character === "'") state = 'singleQuote';
|
|
84
|
+
else if (character === '"') state = 'doubleQuote';
|
|
85
|
+
else if (character === '`') state = 'templateLiteral';
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function checkProductionAdmobAlias() {
|
|
93
|
+
const possibleConfigFiles = ['vite.config.mjs', 'vite.config.js'];
|
|
94
|
+
const viteConfigPath = possibleConfigFiles
|
|
95
|
+
.map(configFile => resolve(__dirname, configFile))
|
|
96
|
+
.find(filePath => existsSync(filePath));
|
|
97
|
+
|
|
98
|
+
if (!viteConfigPath) {
|
|
99
|
+
console.error('❌ FINAL RELEASE BLOCKED: No vite.config.mjs or vite.config.js file found.');
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const viteConfigContent = stripJavaScriptComments(readFileSync(viteConfigPath, 'utf8'));
|
|
104
|
+
const aliasPattern = /(['"])@admob\1\s*:\s*path\.resolve\(\s*__dirname\s*,\s*(['"])([^'"\r\n]+)\2\s*\)/g;
|
|
105
|
+
const activeAliases = [...viteConfigContent.matchAll(aliasPattern)].map(match => match[3]);
|
|
106
|
+
const productionAliasPattern = /^\.\/src\/js\/Ads\/admob-emi-nextgen-\d+(?:\.\d+)+\.js$/;
|
|
107
|
+
|
|
108
|
+
if (activeAliases.length === 0) {
|
|
109
|
+
console.error('❌ FINAL RELEASE BLOCKED: The production @admob alias is commented out or missing in the Vite config.');
|
|
110
|
+
console.error(" Enable: '@admob': path.resolve(__dirname, './src/js/Ads/admob-emi-nextgen-x.x.js')");
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (activeAliases.length > 1) {
|
|
115
|
+
console.error('❌ FINAL RELEASE BLOCKED: Multiple active @admob aliases were found in the Vite config.');
|
|
116
|
+
console.error(' Keep exactly one active production admob-emi-nextgen-x.x.js alias.');
|
|
117
|
+
process.exit(1);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const activeAlias = activeAliases[0];
|
|
121
|
+
if (!productionAliasPattern.test(activeAlias)) {
|
|
122
|
+
console.error(`❌ FINAL RELEASE BLOCKED: @admob currently points to '${activeAlias}'.`);
|
|
123
|
+
console.error(" It must point to './src/js/Ads/admob-emi-nextgen-x.x.js', not a test AdMob file.");
|
|
124
|
+
process.exit(1);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const productionAdmobPath = resolve(__dirname, activeAlias);
|
|
128
|
+
if (!existsSync(productionAdmobPath)) {
|
|
129
|
+
console.error(`❌ FINAL RELEASE BLOCKED: The production @admob file does not exist: ${productionAdmobPath}`);
|
|
130
|
+
process.exit(1);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
console.log(`✅ Production @admob alias verified: ${activeAlias}`);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// This must be the first release validation so test/no-ad builds cannot proceed.
|
|
137
|
+
checkProductionAdmobAlias();
|
|
138
|
+
|
|
139
|
+
// Define a mapping between store IDs and store names
|
|
140
|
+
/* const storeNames = {
|
|
24
141
|
"1": "PlayStore",
|
|
25
142
|
"2": "SamsungStore",
|
|
26
143
|
"7": "AmazonStore"
|
|
@@ -66,10 +183,7 @@ const _appPackageId=config.appId;
|
|
|
66
183
|
|
|
67
184
|
|
|
68
185
|
|
|
69
|
-
|
|
70
|
-
const __dirname = dirname(__filename);
|
|
71
|
-
|
|
72
|
-
function fileExists(filePath) {
|
|
186
|
+
function fileExists(filePath) {
|
|
73
187
|
return existsSync(filePath);
|
|
74
188
|
}
|
|
75
189
|
|