ilabs-flir 2.0.5 → 2.0.6

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,6 +1,6 @@
1
1
  {
2
2
  "name": "ilabs-flir",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "FLIR Thermal SDK for React Native - iOS & Android (bundled at compile time via postinstall)",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -13,11 +13,9 @@
13
13
  "src/",
14
14
  "android/Flir/src/",
15
15
  "android/Flir/build.gradle.kts",
16
- "android/Flir/libs/",
17
16
  "ios/Flir/src/",
18
17
  "ios/Flir/SDKLoader/",
19
- "ios/Flir/Framework/",
20
- "ios/Flir/Frameworks/",
18
+
21
19
  "app.plugin.js",
22
20
  "Flir.podspec",
23
21
  "sdk-manifest.json",
@@ -96,7 +96,7 @@ function extractZip(zipPath, dest) {
96
96
 
97
97
  if (cmdExists('unzip')) {
98
98
  try {
99
- execSync(`unzip -o '${zipPath}' -d '${TMP_DIR}'`, { stdio: 'inherit' });
99
+ execSync(`unzip -o "${zipPath}" -d "${TMP_DIR}"`, { stdio: 'inherit' });
100
100
  return;
101
101
  } catch (err) {
102
102
  throw new Error(`Failed to extract zip using 'unzip'. Consider installing 'unzip' or adding 'adm-zip' package. Original error: ${err.message}`);
@@ -106,7 +106,11 @@ function extractZip(zipPath, dest) {
106
106
  // 'tar' can sometimes extract zip files (via bsdtar). Try it as a last resort.
107
107
  if (cmdExists('tar')) {
108
108
  try {
109
- execSync(`tar -xf '${zipPath}' -C '${TMP_DIR}'`, { stdio: 'inherit' });
109
+ if (process.platform === 'win32') {
110
+ execSync(`tar -xf "${zipPath}" -C "${TMP_DIR}"`, { stdio: 'inherit' });
111
+ } else {
112
+ execSync(`tar -xf '${zipPath}' -C '${TMP_DIR}'`, { stdio: 'inherit' });
113
+ }
110
114
  return;
111
115
  } catch (err) {
112
116
  throw new Error(`Failed to extract zip using 'tar'. Consider installing 'unzip' or add 'adm-zip' package. Original error: ${err.message}`);
@@ -172,27 +176,67 @@ async function run() {
172
176
  return;
173
177
  }
174
178
 
175
- // Ensure target folders exist - but do NOT create them automatically.
176
- if (!fs.existsSync(DEST_ANDROID)) {
177
- throw new Error(`Android libs folder ${DEST_ANDROID} does not exist. Please create it (e.g. npm pack or ensure published package includes it).`);
178
- }
179
- if (!fs.existsSync(DEST_IOS)) {
180
- throw new Error(`iOS Frameworks folder ${DEST_IOS} does not exist. Please create it before install.`);
181
- }
179
+ // (previous 'ensure target folders exist' logic removed; handling now occurs after args parsing)
182
180
 
183
181
  ensureTmp();
184
182
 
185
183
  const argv = process.argv.slice(2);
186
- const args = argv.reduce((acc, cur) => {
187
- if (cur.startsWith('--')) acc[cur.replace(/^--/, '')] = true;
188
- else acc[cur] = true;
189
- return acc;
190
- }, {});
184
+ const args = {};
185
+ for (let i = 0; i < argv.length; i++) {
186
+ const cur = argv[i];
187
+ if (cur.startsWith('--')) {
188
+ if (cur.includes('=')) {
189
+ const parts = cur.split('=');
190
+ const key = parts.shift().replace(/^--/, '');
191
+ const value = parts.join('=');
192
+ args[key] = value;
193
+ } else {
194
+ // if following arg exists and doesn't start with '-', use it as the value
195
+ const next = argv[i+1];
196
+ if (next && !next.startsWith('-')) {
197
+ args[cur.replace(/^--/, '')] = next;
198
+ i++;
199
+ } else {
200
+ args[cur.replace(/^--/, '')] = true;
201
+ }
202
+ }
203
+ } else if (cur.startsWith('-')) {
204
+ const key = cur.replace(/^-+/, '');
205
+ const next = argv[i+1];
206
+ if (next && !next.startsWith('-')) {
207
+ args[key] = next;
208
+ i++;
209
+ } else {
210
+ args[key] = true;
211
+ }
212
+ } else {
213
+ args[cur] = true;
214
+ }
215
+ }
191
216
 
192
217
  // Skip if present per-platform
193
218
  const skipIfPresent = args['skip-if-present'] || args['skipIfPresent'] || false;
194
219
  const platformArg = args['platform'] || args['p'] || 'all';
195
220
 
221
+ // Determine whether to create missing dest directories automatically; default is true unless explicitly disabled
222
+ const noCreate = process.env.FLIR_SDK_NO_CREATE_DEST === '1' || process.env.FLIR_SDK_NO_CREATE_DEST === 'true' || args['no-create-dest'] || args['noCreateDest'];
223
+ if ((platformArg === 'all' || platformArg === 'android') && !fs.existsSync(DEST_ANDROID)) {
224
+ if (noCreate) {
225
+ throw new Error(`Android libs folder ${DEST_ANDROID} does not exist. Please create it (e.g. npm pack or ensure published package includes it).`);
226
+ } else {
227
+ console.log(`Android libs folder ${DEST_ANDROID} not found — creating it.`);
228
+ fs.mkdirSync(DEST_ANDROID, { recursive: true });
229
+ }
230
+ }
231
+ if ((platformArg === 'all' || platformArg === 'ios') && !fs.existsSync(DEST_IOS)) {
232
+ if (noCreate) {
233
+ throw new Error(`iOS Frameworks folder ${DEST_IOS} does not exist. Please create it before install.`);
234
+ } else {
235
+ console.log(`iOS Frameworks folder ${DEST_IOS} not found — creating it.`);
236
+ fs.mkdirSync(DEST_IOS, { recursive: true });
237
+ }
238
+ }
239
+
196
240
  // Short circuit checks: if skipIfPresent set and files exist, skip per platform
197
241
  if (skipIfPresent && platformArg !== 'ios' && hasAndroidAar(DEST_ANDROID)) {
198
242
  console.log('Android AAR(s) detected in libs folder; skipping Android fetch.');