- App.tsx: full navigation (Auth stack + Main tabs with 5 screens) - Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen - HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors - MapScreen: interactive map with layer toggles (6 layers) - MarketplaceScreen: categories (6), products (5), search - ChatScreen: AI chat with quick prompts (4), bot responses - ProfileScreen: user info, stats, menu (9 items), logout - AlertsScreen: alert list with severity, acknowledge - SensorsScreen: sensor list with type filters (6 types), search - ZonesScreen: zone cards with stats - SettingsScreen: language picker (FR/EN/ES/DE), privacy, about - Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n - Hooks: useSensors, useAlerts, useNotifications, useLocation - Components: Card, Button, LoadingSpinner, ErrorBoundary, Header - Services: iotService, notificationService (with axios API client) - Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN) - Theme: colors.ts with full design system (Blue Ocean palette) - Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
117 lines
5.1 KiB
JavaScript
117 lines
5.1 KiB
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.resolveAppProjectConfigAsync = exports.resolveDependencyConfigAsync = exports.findDependencyRootsAsync = exports.createReactNativeConfigAsync = void 0;
|
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
const path_1 = __importDefault(require("path"));
|
|
const androidResolver_1 = require("./androidResolver");
|
|
const config_1 = require("./config");
|
|
const iosResolver_1 = require("./iosResolver");
|
|
const utils_1 = require("./utils");
|
|
const utils_2 = require("../autolinking/utils");
|
|
/**
|
|
* Create config for react-native core autolinking.
|
|
*/
|
|
async function createReactNativeConfigAsync({ platform, projectRoot, searchPaths, }) {
|
|
const projectConfig = await (0, config_1.loadConfigAsync)(projectRoot);
|
|
const dependencyRoots = await findDependencyRootsAsync(projectRoot, searchPaths);
|
|
const reactNativePath = dependencyRoots['react-native'];
|
|
const dependencyConfigs = await Promise.all(Object.entries(dependencyRoots).map(async ([name, packageRoot]) => {
|
|
const config = await resolveDependencyConfigAsync(platform, name, packageRoot, projectConfig);
|
|
return [name, config];
|
|
}));
|
|
const dependencyResults = Object.fromEntries(dependencyConfigs.filter(([, config]) => config != null));
|
|
const projectData = await resolveAppProjectConfigAsync(projectRoot, platform);
|
|
return {
|
|
root: projectRoot,
|
|
reactNativePath,
|
|
dependencies: dependencyResults,
|
|
project: projectData,
|
|
};
|
|
}
|
|
exports.createReactNativeConfigAsync = createReactNativeConfigAsync;
|
|
/**
|
|
* Find all dependencies and their directories from the project.
|
|
*/
|
|
async function findDependencyRootsAsync(projectRoot, searchPaths) {
|
|
const packageJson = JSON.parse(await promises_1.default.readFile(path_1.default.join(projectRoot, 'package.json'), 'utf8'));
|
|
const dependencies = [
|
|
...Object.keys(packageJson.dependencies ?? {}),
|
|
...Object.keys(packageJson.devDependencies ?? {}),
|
|
];
|
|
const results = {};
|
|
// `searchPathSet` can be mutated to discover all "isolated modules groups", when using isolated modules
|
|
const searchPathSet = new Set(searchPaths);
|
|
for (const name of dependencies) {
|
|
for (const searchPath of searchPathSet) {
|
|
const packageConfigPath = path_1.default.resolve(searchPath, name, 'package.json');
|
|
if (await (0, utils_1.fileExistsAsync)(packageConfigPath)) {
|
|
const packageRoot = path_1.default.dirname(packageConfigPath);
|
|
results[name] = packageRoot;
|
|
const maybeIsolatedModulesPath = (0, utils_2.getIsolatedModulesPath)(packageRoot, name);
|
|
if (maybeIsolatedModulesPath) {
|
|
searchPathSet.add(maybeIsolatedModulesPath);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return results;
|
|
}
|
|
exports.findDependencyRootsAsync = findDependencyRootsAsync;
|
|
async function resolveDependencyConfigAsync(platform, name, packageRoot, projectConfig) {
|
|
const libraryConfig = await (0, config_1.loadConfigAsync)(packageRoot);
|
|
const reactNativeConfig = {
|
|
...libraryConfig?.dependency,
|
|
...projectConfig?.dependencies[name],
|
|
};
|
|
if (Object.keys(libraryConfig?.platforms ?? {}).length > 0) {
|
|
// Package defines platforms would be a platform host package.
|
|
// The rnc-cli will skip this package.
|
|
// For example, the `react-native` package.
|
|
return null;
|
|
}
|
|
let platformData = null;
|
|
if (platform === 'android') {
|
|
platformData = await (0, androidResolver_1.resolveDependencyConfigImplAndroidAsync)(packageRoot, reactNativeConfig.platforms?.android);
|
|
}
|
|
else if (platform === 'ios') {
|
|
platformData = await (0, iosResolver_1.resolveDependencyConfigImplIosAsync)(packageRoot, reactNativeConfig.platforms?.ios);
|
|
}
|
|
if (!platformData) {
|
|
return null;
|
|
}
|
|
return {
|
|
root: packageRoot,
|
|
name,
|
|
platforms: {
|
|
[platform]: platformData,
|
|
},
|
|
};
|
|
}
|
|
exports.resolveDependencyConfigAsync = resolveDependencyConfigAsync;
|
|
async function resolveAppProjectConfigAsync(projectRoot, platform) {
|
|
if (platform === 'android') {
|
|
const androidDir = path_1.default.join(projectRoot, 'android');
|
|
const { gradle, manifest } = await (0, androidResolver_1.findGradleAndManifestAsync)({ androidDir, isLibrary: false });
|
|
const packageName = await (0, androidResolver_1.parsePackageNameAsync)(path_1.default.join(androidDir, manifest), path_1.default.join(androidDir, gradle));
|
|
return {
|
|
android: {
|
|
packageName: packageName ?? '',
|
|
sourceDir: path_1.default.join(projectRoot, 'android'),
|
|
},
|
|
};
|
|
}
|
|
if (platform === 'ios') {
|
|
return {
|
|
ios: {
|
|
sourceDir: path_1.default.join(projectRoot, 'ios'),
|
|
},
|
|
};
|
|
}
|
|
return {};
|
|
}
|
|
exports.resolveAppProjectConfigAsync = resolveAppProjectConfigAsync;
|
|
//# sourceMappingURL=reactNativeConfig.js.map
|