codeplay-common 1.4.3 → 1.4.5
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.
|
@@ -86,8 +86,86 @@ try {
|
|
|
86
86
|
|
|
87
87
|
|
|
88
88
|
|
|
89
|
+
// saveToGalleryAndSaveAnyFile-x.x-ios.js file check for android and return error if exists START
|
|
90
|
+
|
|
91
|
+
// saveToGalleryAndSaveAnyFile-x.x-ios.js file check based on platform START
|
|
92
|
+
|
|
93
|
+
const os = require('os');
|
|
94
|
+
|
|
95
|
+
const saveToGalleryAndSaveFileCheck_iOS = () => {
|
|
96
|
+
const ROOT_DIR = path.resolve(__dirname, '../src');
|
|
97
|
+
|
|
98
|
+
const IOS_FILE_REGEX = /(?:import|require)?\s*\(?['"].*saveToGalleryAndSaveAnyFile-\d+(\.\d+)?-ios\.js['"]\)?/;
|
|
99
|
+
const ALLOWED_EXTENSIONS = ['.js', '.f7'];
|
|
100
|
+
const isMac = os.platform() === 'darwin';
|
|
101
|
+
|
|
102
|
+
let iosImportFound = false;
|
|
103
|
+
|
|
104
|
+
function scanDirectory(dir) {
|
|
105
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
106
|
+
|
|
107
|
+
for (let entry of entries) {
|
|
108
|
+
const fullPath = path.join(dir, entry.name);
|
|
109
|
+
|
|
110
|
+
if (entry.isDirectory()) {
|
|
111
|
+
if (entry.name === 'node_modules') continue;
|
|
112
|
+
scanDirectory(fullPath);
|
|
113
|
+
} else if (
|
|
114
|
+
entry.isFile() &&
|
|
115
|
+
ALLOWED_EXTENSIONS.some(ext => fullPath.endsWith(ext))
|
|
116
|
+
) {
|
|
117
|
+
const content = fs.readFileSync(fullPath, 'utf8');
|
|
118
|
+
const matches = content.match(IOS_FILE_REGEX);
|
|
119
|
+
if (matches) {
|
|
120
|
+
iosImportFound = true;
|
|
121
|
+
console.error(`\n❌❌❌ BIG ERROR: iOS-specific import detected in: ${fullPath}`);
|
|
122
|
+
console.error(`🔍 Matched: ${matches[0]}\n`);
|
|
123
|
+
if (!isMac) {
|
|
124
|
+
console.error(`🚫 STOPPED: This file should not be imported in Android/Windows/Linux builds.\n`);
|
|
125
|
+
process.exit(1);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Check if src folder exists first
|
|
133
|
+
if (!fs.existsSync(ROOT_DIR)) {
|
|
134
|
+
console.warn(`⚠️ Warning: 'src' directory not found at: ${ROOT_DIR}`);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
scanDirectory(ROOT_DIR);
|
|
139
|
+
|
|
140
|
+
if (isMac && !iosImportFound) {
|
|
141
|
+
console.warn(`\x1b[31m\n⚠️⚠️⚠️ WARNING: You're on macOS but no iOS-specific file (saveToGalleryAndSaveAnyFile-x.x-ios.js) was found.\x1b[0m`);
|
|
142
|
+
console.warn(`👉 You may want to double-check your imports for the iOS platform.\n`);
|
|
143
|
+
} else if (isMac && iosImportFound) {
|
|
144
|
+
console.log('✅ iOS file detected as expected for macOS.');
|
|
145
|
+
} else if (!iosImportFound) {
|
|
146
|
+
console.log('✅ No iOS-specific file imports detected for non-macOS.');
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
saveToGalleryAndSaveFileCheck_iOS();
|
|
151
|
+
// saveToGalleryAndSaveAnyFile-x.x-ios.js file check based on platform END
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
// saveToGalleryAndSaveAnyFile-x.x-ios.js file check for android and return error if exists END
|
|
155
|
+
|
|
89
156
|
|
|
90
157
|
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
/*
|
|
91
169
|
// Clean up AppleDouble files (._*) created by macOS START
|
|
92
170
|
if (process.platform === 'darwin') {
|
|
93
171
|
try {
|
|
@@ -102,7 +180,7 @@ if (process.platform === 'darwin') {
|
|
|
102
180
|
}
|
|
103
181
|
|
|
104
182
|
// Clean up AppleDouble files (._*) created by macOS END
|
|
105
|
-
|
|
183
|
+
*/
|
|
106
184
|
|
|
107
185
|
|
|
108
186
|
|