feat(smart-app): implement complete mobile app MVP

- 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
This commit is contained in:
Eric FELIXINE
2026-06-01 18:00:35 -04:00
parent 08ca495bde
commit e30ae8ed09
35578 changed files with 3703534 additions and 43 deletions

View File

@@ -0,0 +1,9 @@
/**
* Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
*
* Similar to Object.assign(), but it doesn't execute getters. This allows us to have
* lazy properties on an object and still be able to merge them together
*
*/
export default function assign(target: Object, ...sources: Object[]): Object;
//# sourceMappingURL=assign.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"assign.d.ts","sourceRoot":"","sources":["../src/assign.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,UAmBlE"}

View File

@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = assign;
/**
* Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
*
* Similar to Object.assign(), but it doesn't execute getters. This allows us to have
* lazy properties on an object and still be able to merge them together
*
*/
function assign(target, ...sources) {
sources.forEach(source => {
let descriptors = Object.keys(source).reduce((acc, key) => {
const propertyDescriptor = Object.getOwnPropertyDescriptor(source, key);
if (propertyDescriptor !== undefined) {
acc[key] = propertyDescriptor;
}
return acc;
}, {});
// by default, Object.assign copies enumerable Symbols too
Object.getOwnPropertySymbols(source).forEach(sym => {
let descriptor = Object.getOwnPropertyDescriptor(source, sym);
if (descriptor && descriptor.enumerable) {
descriptors[sym.toString()] = descriptor;
}
});
Object.defineProperties(target, descriptors);
});
return target;
}
//# sourceMappingURL=assign.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["assign","target","sources","forEach","source","descriptors","Object","keys","reduce","acc","key","propertyDescriptor","getOwnPropertyDescriptor","undefined","getOwnPropertySymbols","sym","descriptor","enumerable","toString","defineProperties"],"sources":["../src/assign.ts"],"sourcesContent":["/**\n * Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n *\n * Similar to Object.assign(), but it doesn't execute getters. This allows us to have\n * lazy properties on an object and still be able to merge them together\n *\n */\nexport default function assign(target: Object, ...sources: Object[]) {\n sources.forEach((source) => {\n let descriptors = Object.keys(source).reduce((acc, key) => {\n const propertyDescriptor = Object.getOwnPropertyDescriptor(source, key);\n if (propertyDescriptor !== undefined) {\n acc[key] = propertyDescriptor;\n }\n return acc;\n }, {} as PropertyDescriptorMap);\n // by default, Object.assign copies enumerable Symbols too\n Object.getOwnPropertySymbols(source).forEach((sym) => {\n let descriptor = Object.getOwnPropertyDescriptor(source, sym);\n if (descriptor && descriptor.enumerable) {\n descriptors[sym.toString()] = descriptor;\n }\n });\n Object.defineProperties(target, descriptors);\n });\n return target;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,MAAM,CAACC,MAAc,EAAE,GAAGC,OAAiB,EAAE;EACnEA,OAAO,CAACC,OAAO,CAAEC,MAAM,IAAK;IAC1B,IAAIC,WAAW,GAAGC,MAAM,CAACC,IAAI,CAACH,MAAM,CAAC,CAACI,MAAM,CAAC,CAACC,GAAG,EAAEC,GAAG,KAAK;MACzD,MAAMC,kBAAkB,GAAGL,MAAM,CAACM,wBAAwB,CAACR,MAAM,EAAEM,GAAG,CAAC;MACvE,IAAIC,kBAAkB,KAAKE,SAAS,EAAE;QACpCJ,GAAG,CAACC,GAAG,CAAC,GAAGC,kBAAkB;MAC/B;MACA,OAAOF,GAAG;IACZ,CAAC,EAAE,CAAC,CAAC,CAA0B;IAC/B;IACAH,MAAM,CAACQ,qBAAqB,CAACV,MAAM,CAAC,CAACD,OAAO,CAAEY,GAAG,IAAK;MACpD,IAAIC,UAAU,GAAGV,MAAM,CAACM,wBAAwB,CAACR,MAAM,EAAEW,GAAG,CAAC;MAC7D,IAAIC,UAAU,IAAIA,UAAU,CAACC,UAAU,EAAE;QACvCZ,WAAW,CAACU,GAAG,CAACG,QAAQ,EAAE,CAAC,GAAGF,UAAU;MAC1C;IACF,CAAC,CAAC;IACFV,MAAM,CAACa,gBAAgB,CAAClB,MAAM,EAAEI,WAAW,CAAC;EAC9C,CAAC,CAAC;EACF,OAAOJ,MAAM;AACf"}

View File

@@ -0,0 +1,8 @@
import { Config } from '@react-native-community/cli-types';
declare const _default: {
name: string;
description: string;
func: (_argv: string[], ctx: Config) => Promise<void>;
};
export default _default;
//# sourceMappingURL=config.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAmB,MAAM,mCAAmC,CAAC;;;;kBAuBrD,MAAM,EAAE,OAAO,MAAM;;AAH3C,wBAME"}

View File

@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function isValidRNDependency(config) {
return Object.keys(config.platforms).filter(key => Boolean(config.platforms[key])).length !== 0;
}
function filterConfig(config) {
const filtered = {
...config
};
Object.keys(filtered.dependencies).forEach(item => {
if (!isValidRNDependency(filtered.dependencies[item])) {
delete filtered.dependencies[item];
}
});
return filtered;
}
var _default = {
name: 'config',
description: 'Print CLI configuration',
func: async (_argv, ctx) => {
console.log(JSON.stringify(filterConfig(ctx), null, 2));
}
};
exports.default = _default;
//# sourceMappingURL=config.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["isValidRNDependency","config","Object","keys","platforms","filter","key","Boolean","length","filterConfig","filtered","dependencies","forEach","item","name","description","func","_argv","ctx","console","log","JSON","stringify"],"sources":["../../src/commands/config.ts"],"sourcesContent":["import {Config, DependencyConfig} from '@react-native-community/cli-types';\n\nfunction isValidRNDependency(config: DependencyConfig) {\n return (\n Object.keys(config.platforms).filter((key) =>\n Boolean(config.platforms[key]),\n ).length !== 0\n );\n}\n\nfunction filterConfig(config: Config) {\n const filtered = {...config};\n Object.keys(filtered.dependencies).forEach((item) => {\n if (!isValidRNDependency(filtered.dependencies[item])) {\n delete filtered.dependencies[item];\n }\n });\n return filtered;\n}\n\nexport default {\n name: 'config',\n description: 'Print CLI configuration',\n func: async (_argv: string[], ctx: Config) => {\n console.log(JSON.stringify(filterConfig(ctx), null, 2));\n },\n};\n"],"mappings":";;;;;;AAEA,SAASA,mBAAmB,CAACC,MAAwB,EAAE;EACrD,OACEC,MAAM,CAACC,IAAI,CAACF,MAAM,CAACG,SAAS,CAAC,CAACC,MAAM,CAAEC,GAAG,IACvCC,OAAO,CAACN,MAAM,CAACG,SAAS,CAACE,GAAG,CAAC,CAAC,CAC/B,CAACE,MAAM,KAAK,CAAC;AAElB;AAEA,SAASC,YAAY,CAACR,MAAc,EAAE;EACpC,MAAMS,QAAQ,GAAG;IAAC,GAAGT;EAAM,CAAC;EAC5BC,MAAM,CAACC,IAAI,CAACO,QAAQ,CAACC,YAAY,CAAC,CAACC,OAAO,CAAEC,IAAI,IAAK;IACnD,IAAI,CAACb,mBAAmB,CAACU,QAAQ,CAACC,YAAY,CAACE,IAAI,CAAC,CAAC,EAAE;MACrD,OAAOH,QAAQ,CAACC,YAAY,CAACE,IAAI,CAAC;IACpC;EACF,CAAC,CAAC;EACF,OAAOH,QAAQ;AACjB;AAAC,eAEc;EACbI,IAAI,EAAE,QAAQ;EACdC,WAAW,EAAE,yBAAyB;EACtCC,IAAI,EAAE,OAAOC,KAAe,EAAEC,GAAW,KAAK;IAC5CC,OAAO,CAACC,GAAG,CAACC,IAAI,CAACC,SAAS,CAACb,YAAY,CAACS,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;EACzD;AACF,CAAC;AAAA"}

View File

@@ -0,0 +1,6 @@
import { CLIError } from '@react-native-community/cli-tools';
import { ValidationError } from 'joi';
export declare class JoiError extends CLIError {
constructor(joiError: ValidationError);
}
//# sourceMappingURL=errors.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAC,eAAe,EAAC,MAAM,KAAK,CAAC;AAEpC,qBAAa,QAAS,SAAQ,QAAQ;gBACxB,QAAQ,EAAE,eAAe;CA0BtC"}

View File

@@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.JoiError = void 0;
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
class JoiError extends _cliTools().CLIError {
constructor(joiError) {
const message = joiError.details.map(error => {
const name = error.path.join('.');
switch (error.type) {
case 'object.allowUnknown':
{
const value = JSON.stringify(error.context && error.context.value);
return `
Unknown option ${name} with value "${value}" was found.
This is either a typing error or a user mistake. Fixing it will remove this message.
`;
}
default:
return error.message;
}
}).join().trim();
super(message);
this.name = 'Config Validation Error';
if (Error.captureStackTrace) {
Error.captureStackTrace(this, JoiError);
}
}
}
exports.JoiError = JoiError;
//# sourceMappingURL=errors.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["JoiError","CLIError","constructor","joiError","message","details","map","error","name","path","join","type","value","JSON","stringify","context","trim","Error","captureStackTrace"],"sources":["../src/errors.ts"],"sourcesContent":["import {CLIError} from '@react-native-community/cli-tools';\nimport {ValidationError} from 'joi';\n\nexport class JoiError extends CLIError {\n constructor(joiError: ValidationError) {\n const message = joiError.details\n .map((error) => {\n const name = error.path.join('.');\n switch (error.type) {\n case 'object.allowUnknown': {\n const value = JSON.stringify(error.context && error.context.value);\n return `\n Unknown option ${name} with value \"${value}\" was found.\n This is either a typing error or a user mistake. Fixing it will remove this message.\n `;\n }\n default:\n return error.message;\n }\n })\n .join()\n .trim();\n\n super(message);\n this.name = 'Config Validation Error';\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, JoiError);\n }\n }\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,MAAMA,QAAQ,SAASC,oBAAQ,CAAC;EACrCC,WAAW,CAACC,QAAyB,EAAE;IACrC,MAAMC,OAAO,GAAGD,QAAQ,CAACE,OAAO,CAC7BC,GAAG,CAAEC,KAAK,IAAK;MACd,MAAMC,IAAI,GAAGD,KAAK,CAACE,IAAI,CAACC,IAAI,CAAC,GAAG,CAAC;MACjC,QAAQH,KAAK,CAACI,IAAI;QAChB,KAAK,qBAAqB;UAAE;YAC1B,MAAMC,KAAK,GAAGC,IAAI,CAACC,SAAS,CAACP,KAAK,CAACQ,OAAO,IAAIR,KAAK,CAACQ,OAAO,CAACH,KAAK,CAAC;YAClE,OAAQ;AACpB,+BAA+BJ,IAAK,gBAAeI,KAAM;AACzD;AACA,aAAa;UACH;QACA;UACE,OAAOL,KAAK,CAACH,OAAO;MAAC;IAE3B,CAAC,CAAC,CACDM,IAAI,EAAE,CACNM,IAAI,EAAE;IAET,KAAK,CAACZ,OAAO,CAAC;IACd,IAAI,CAACI,IAAI,GAAG,yBAAyB;IAErC,IAAIS,KAAK,CAACC,iBAAiB,EAAE;MAC3BD,KAAK,CAACC,iBAAiB,CAAC,IAAI,EAAElB,QAAQ,CAAC;IACzC;EACF;AACF;AAAC"}

View File

@@ -0,0 +1,5 @@
/**
* Returns an array of dependencies from project's package.json
*/
export default function findDependencies(root: string): Array<string>;
//# sourceMappingURL=findDependencies.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"findDependencies.d.ts","sourceRoot":"","sources":["../src/findDependencies.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAiBpE"}

View File

@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = findDependencies;
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Returns an array of dependencies from project's package.json
*/
function findDependencies(root) {
let pjson;
try {
pjson = JSON.parse(_fs().default.readFileSync(_path().default.join(root, 'package.json'), 'utf8'));
} catch (e) {
return [];
}
const deps = [...Object.keys(pjson.dependencies || {}), ...Object.keys(pjson.devDependencies || {})];
return deps;
}
//# sourceMappingURL=findDependencies.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["findDependencies","root","pjson","JSON","parse","fs","readFileSync","path","join","e","deps","Object","keys","dependencies","devDependencies"],"sources":["../src/findDependencies.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs';\n\n/**\n * Returns an array of dependencies from project's package.json\n */\nexport default function findDependencies(root: string): Array<string> {\n let pjson;\n\n try {\n pjson = JSON.parse(\n fs.readFileSync(path.join(root, 'package.json'), 'utf8'),\n );\n } catch (e) {\n return [];\n }\n\n const deps = [\n ...Object.keys(pjson.dependencies || {}),\n ...Object.keys(pjson.devDependencies || {}),\n ];\n\n return deps;\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAoB;AAEpB;AACA;AACA;AACe,SAASA,gBAAgB,CAACC,IAAY,EAAiB;EACpE,IAAIC,KAAK;EAET,IAAI;IACFA,KAAK,GAAGC,IAAI,CAACC,KAAK,CAChBC,aAAE,CAACC,YAAY,CAACC,eAAI,CAACC,IAAI,CAACP,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CACzD;EACH,CAAC,CAAC,OAAOQ,CAAC,EAAE;IACV,OAAO,EAAE;EACX;EAEA,MAAMC,IAAI,GAAG,CACX,GAAGC,MAAM,CAACC,IAAI,CAACV,KAAK,CAACW,YAAY,IAAI,CAAC,CAAC,CAAC,EACxC,GAAGF,MAAM,CAACC,IAAI,CAACV,KAAK,CAACY,eAAe,IAAI,CAAC,CAAC,CAAC,CAC5C;EAED,OAAOJ,IAAI;AACb"}

View File

@@ -0,0 +1,7 @@
export { default } from './loadConfig';
export declare const commands: {
name: string;
description: string;
func: (_argv: string[], ctx: import("@react-native-community/cli-types").Config) => Promise<void>;
}[];
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAErC,eAAO,MAAM,QAAQ;;;;GAAW,CAAC"}

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.commands = void 0;
Object.defineProperty(exports, "default", {
enumerable: true,
get: function () {
return _loadConfig.default;
}
});
var _config = _interopRequireDefault(require("./commands/config"));
var _loadConfig = _interopRequireDefault(require("./loadConfig"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const commands = [_config.default];
exports.commands = commands;
//# sourceMappingURL=index.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["commands","config"],"sources":["../src/index.ts"],"sourcesContent":["import config from './commands/config';\n\nexport {default} from './loadConfig';\n\nexport const commands = [config];\n"],"mappings":";;;;;;;;;;;;AAAA;AAEA;AAAqC;AAE9B,MAAMA,QAAQ,GAAG,CAACC,eAAM,CAAC;AAAC"}

View File

@@ -0,0 +1,7 @@
import { Config } from '@react-native-community/cli-types';
/**
* Loads CLI configuration
*/
declare function loadConfig(projectRoot?: string): Config;
export default loadConfig;
//# sourceMappingURL=loadConfig.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"loadConfig.d.ts","sourceRoot":"","sources":["../src/loadConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,MAAM,EAEP,MAAM,mCAAmC,CAAC;AA6E3C;;GAEG;AACH,iBAAS,UAAU,CAAC,WAAW,GAAE,MAA0B,GAAG,MAAM,CAoFnE;AAED,eAAe,UAAU,CAAC"}

View File

@@ -0,0 +1,127 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
var _findDependencies = _interopRequireDefault(require("./findDependencies"));
var _resolveReactNativePath = _interopRequireDefault(require("./resolveReactNativePath"));
var _readConfigFromDisk = require("./readConfigFromDisk");
var _assign = _interopRequireDefault(require("./assign"));
var _merge = _interopRequireDefault(require("./merge"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getDependencyConfig(root, dependencyName, finalConfig, config, userConfig, isPlatform) {
return (0, _merge.default)({
root,
name: dependencyName,
platforms: Object.keys(finalConfig.platforms).reduce((dependency, platform) => {
const platformConfig = finalConfig.platforms[platform];
dependency[platform] =
// Linking platforms is not supported
isPlatform || !platformConfig ? null : platformConfig.dependencyConfig(root, config.dependency.platforms[platform]);
return dependency;
}, {})
}, userConfig.dependencies[dependencyName] || {});
}
// Try our best to figure out what version of React Native we're running. This is
// currently being used to get our deeplinks working, so it's only worried with
// the major and minor version.
function getReactNativeVersion(reactNativePath) {
try {
let semver = _cliTools().version.current(reactNativePath);
if (semver) {
// Retain only these version, since they correspond with our documentation.
return `${semver.major}.${semver.minor}`;
}
} catch (e) {
// If we don't seem to be in a well formed project, give up quietly.
if (!(e instanceof _cliTools().UnknownProjectError)) {
throw e;
}
}
return 'unknown';
}
const removeDuplicateCommands = commands => {
const uniqueCommandsMap = new Map();
commands.forEach(command => {
uniqueCommandsMap.set(command.name, command);
});
return Array.from(uniqueCommandsMap.values());
};
/**
* Loads CLI configuration
*/
function loadConfig(projectRoot = (0, _cliTools().findProjectRoot)()) {
let lazyProject;
const userConfig = (0, _readConfigFromDisk.readConfigFromDisk)(projectRoot);
const initialConfig = {
root: projectRoot,
get reactNativePath() {
return userConfig.reactNativePath ? _path().default.resolve(projectRoot, userConfig.reactNativePath) : (0, _resolveReactNativePath.default)(projectRoot);
},
get reactNativeVersion() {
return getReactNativeVersion(initialConfig.reactNativePath);
},
dependencies: userConfig.dependencies,
commands: userConfig.commands,
healthChecks: [],
platforms: userConfig.platforms,
get project() {
if (lazyProject) {
return lazyProject;
}
lazyProject = {};
for (const platform in finalConfig.platforms) {
const platformConfig = finalConfig.platforms[platform];
if (platformConfig) {
lazyProject[platform] = platformConfig.projectConfig(projectRoot, userConfig.project[platform] || {});
}
}
return lazyProject;
}
};
const finalConfig = Array.from(new Set([...Object.keys(userConfig.dependencies), ...(0, _findDependencies.default)(projectRoot)])).reduce((acc, dependencyName) => {
const localDependencyRoot = userConfig.dependencies[dependencyName] && userConfig.dependencies[dependencyName].root;
try {
let root = localDependencyRoot || (0, _cliTools().resolveNodeModuleDir)(projectRoot, dependencyName);
let config = (0, _readConfigFromDisk.readDependencyConfigFromDisk)(root, dependencyName);
const isPlatform = Object.keys(config.platforms).length > 0;
return (0, _assign.default)({}, acc, {
dependencies: (0, _assign.default)({}, acc.dependencies, {
get [dependencyName]() {
return getDependencyConfig(root, dependencyName, finalConfig, config, userConfig, isPlatform);
}
}),
commands: removeDuplicateCommands([...config.commands, ...acc.commands]),
platforms: {
...acc.platforms,
...config.platforms
},
healthChecks: [...acc.healthChecks, ...config.healthChecks]
});
} catch {
return acc;
}
}, initialConfig);
return finalConfig;
}
var _default = loadConfig;
exports.default = _default;
//# sourceMappingURL=loadConfig.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,6 @@
/**
* `deepmerge` concatenates arrays by default instead of overwriting them.
* We define custom merging function for arrays to change that behaviour
*/
export default function merge<X, Y>(x: Partial<X>, y: Partial<Y>): X & Y;
//# sourceMappingURL=merge.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../src/merge.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,SAK/D"}

View File

@@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = merge;
function _deepmerge() {
const data = _interopRequireDefault(require("deepmerge"));
_deepmerge = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* `deepmerge` concatenates arrays by default instead of overwriting them.
* We define custom merging function for arrays to change that behaviour
*/
function merge(x, y) {
return (0, _deepmerge().default)(x, y, {
arrayMerge: (_destinationArray, sourceArray) => sourceArray
});
}
//# sourceMappingURL=merge.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["merge","x","y","deepmerge","arrayMerge","_destinationArray","sourceArray"],"sources":["../src/merge.ts"],"sourcesContent":["import deepmerge from 'deepmerge';\n\n/**\n * `deepmerge` concatenates arrays by default instead of overwriting them.\n * We define custom merging function for arrays to change that behaviour\n */\nexport default function merge<X, Y>(x: Partial<X>, y: Partial<Y>) {\n return deepmerge(x, y, {\n arrayMerge: (_destinationArray: any[], sourceArray: any[]): any[] =>\n sourceArray,\n });\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAkC;AAElC;AACA;AACA;AACA;AACe,SAASA,KAAK,CAAOC,CAAa,EAAEC,CAAa,EAAE;EAChE,OAAO,IAAAC,oBAAS,EAACF,CAAC,EAAEC,CAAC,EAAE;IACrBE,UAAU,EAAE,CAACC,iBAAwB,EAAEC,WAAkB,KACvDA;EACJ,CAAC,CAAC;AACJ"}

View File

@@ -0,0 +1,12 @@
import { UserConfig, UserDependencyConfig } from '@react-native-community/cli-types';
/**
* Reads a project configuration as defined by the user in the current
* workspace.
*/
export declare function readConfigFromDisk(rootFolder: string): UserConfig;
/**
* Reads a dependency configuration as defined by the developer
* inside `node_modules`.
*/
export declare function readDependencyConfigFromDisk(rootFolder: string, dependencyName: string): UserDependencyConfig;
//# sourceMappingURL=readConfigFromDisk.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"readConfigFromDisk.d.ts","sourceRoot":"","sources":["../src/readConfigFromDisk.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,UAAU,EACV,oBAAoB,EACrB,MAAM,mCAAmC,CAAC;AAS3C;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,CAejE;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,GACrB,oBAAoB,CA0BtB"}

View File

@@ -0,0 +1,88 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.readConfigFromDisk = readConfigFromDisk;
exports.readDependencyConfigFromDisk = readDependencyConfigFromDisk;
function _cosmiconfig() {
const data = _interopRequireDefault(require("cosmiconfig"));
_cosmiconfig = function () {
return data;
};
return data;
}
var _errors = require("./errors");
var schema = _interopRequireWildcard(require("./schema"));
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Places to look for the configuration file.
*/
const searchPlaces = ['react-native.config.js'];
/**
* Reads a project configuration as defined by the user in the current
* workspace.
*/
function readConfigFromDisk(rootFolder) {
const explorer = (0, _cosmiconfig().default)('react-native', {
searchPlaces,
stopDir: rootFolder
});
const searchResult = explorer.searchSync(rootFolder);
const config = searchResult ? searchResult.config : undefined;
const result = schema.projectConfig.validate(config);
if (result.error) {
throw new _errors.JoiError(result.error);
}
return result.value;
}
/**
* Reads a dependency configuration as defined by the developer
* inside `node_modules`.
*/
function readDependencyConfigFromDisk(rootFolder, dependencyName) {
const explorer = (0, _cosmiconfig().default)('react-native', {
stopDir: rootFolder,
searchPlaces
});
const searchResult = explorer.searchSync(rootFolder);
const config = searchResult ? searchResult.config : emptyDependencyConfig;
const result = schema.dependencyConfig.validate(config, {
abortEarly: false
});
if (result.error) {
const validationError = new _errors.JoiError(result.error);
_cliTools().logger.warn((0, _cliTools().inlineString)(`
Package ${_chalk().default.bold(dependencyName)} contains invalid configuration: ${_chalk().default.bold(validationError.message)}.
Please verify it's properly linked using "npx react-native config" command and contact the package maintainers about this.`));
}
return result.value;
}
const emptyDependencyConfig = {
dependency: {
platforms: {}
},
commands: [],
platforms: {}
};
//# sourceMappingURL=readConfigFromDisk.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["searchPlaces","readConfigFromDisk","rootFolder","explorer","cosmiconfig","stopDir","searchResult","searchSync","config","undefined","result","schema","projectConfig","validate","error","JoiError","value","readDependencyConfigFromDisk","dependencyName","emptyDependencyConfig","dependencyConfig","abortEarly","validationError","logger","warn","inlineString","chalk","bold","message","dependency","platforms","commands"],"sources":["../src/readConfigFromDisk.ts"],"sourcesContent":["import cosmiconfig from 'cosmiconfig';\nimport {JoiError} from './errors';\nimport * as schema from './schema';\nimport {\n UserConfig,\n UserDependencyConfig,\n} from '@react-native-community/cli-types';\nimport {logger, inlineString} from '@react-native-community/cli-tools';\nimport chalk from 'chalk';\n\n/**\n * Places to look for the configuration file.\n */\nconst searchPlaces = ['react-native.config.js'];\n\n/**\n * Reads a project configuration as defined by the user in the current\n * workspace.\n */\nexport function readConfigFromDisk(rootFolder: string): UserConfig {\n const explorer = cosmiconfig('react-native', {\n searchPlaces,\n stopDir: rootFolder,\n });\n\n const searchResult = explorer.searchSync(rootFolder);\n const config = searchResult ? searchResult.config : undefined;\n const result = schema.projectConfig.validate(config);\n\n if (result.error) {\n throw new JoiError(result.error);\n }\n\n return result.value as UserConfig;\n}\n\n/**\n * Reads a dependency configuration as defined by the developer\n * inside `node_modules`.\n */\nexport function readDependencyConfigFromDisk(\n rootFolder: string,\n dependencyName: string,\n): UserDependencyConfig {\n const explorer = cosmiconfig('react-native', {\n stopDir: rootFolder,\n searchPlaces,\n });\n\n const searchResult = explorer.searchSync(rootFolder);\n const config = searchResult ? searchResult.config : emptyDependencyConfig;\n\n const result = schema.dependencyConfig.validate(config, {abortEarly: false});\n\n if (result.error) {\n const validationError = new JoiError(result.error);\n logger.warn(\n inlineString(`\n Package ${chalk.bold(\n dependencyName,\n )} contains invalid configuration: ${chalk.bold(\n validationError.message,\n )}.\n \n Please verify it's properly linked using \"npx react-native config\" command and contact the package maintainers about this.`),\n );\n }\n\n return result.value as UserDependencyConfig;\n}\n\nconst emptyDependencyConfig = {\n dependency: {\n platforms: {},\n },\n commands: [],\n platforms: {},\n};\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AACA;AAKA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA0B;AAAA;AAAA;AAE1B;AACA;AACA;AACA,MAAMA,YAAY,GAAG,CAAC,wBAAwB,CAAC;;AAE/C;AACA;AACA;AACA;AACO,SAASC,kBAAkB,CAACC,UAAkB,EAAc;EACjE,MAAMC,QAAQ,GAAG,IAAAC,sBAAW,EAAC,cAAc,EAAE;IAC3CJ,YAAY;IACZK,OAAO,EAAEH;EACX,CAAC,CAAC;EAEF,MAAMI,YAAY,GAAGH,QAAQ,CAACI,UAAU,CAACL,UAAU,CAAC;EACpD,MAAMM,MAAM,GAAGF,YAAY,GAAGA,YAAY,CAACE,MAAM,GAAGC,SAAS;EAC7D,MAAMC,MAAM,GAAGC,MAAM,CAACC,aAAa,CAACC,QAAQ,CAACL,MAAM,CAAC;EAEpD,IAAIE,MAAM,CAACI,KAAK,EAAE;IAChB,MAAM,IAAIC,gBAAQ,CAACL,MAAM,CAACI,KAAK,CAAC;EAClC;EAEA,OAAOJ,MAAM,CAACM,KAAK;AACrB;;AAEA;AACA;AACA;AACA;AACO,SAASC,4BAA4B,CAC1Cf,UAAkB,EAClBgB,cAAsB,EACA;EACtB,MAAMf,QAAQ,GAAG,IAAAC,sBAAW,EAAC,cAAc,EAAE;IAC3CC,OAAO,EAAEH,UAAU;IACnBF;EACF,CAAC,CAAC;EAEF,MAAMM,YAAY,GAAGH,QAAQ,CAACI,UAAU,CAACL,UAAU,CAAC;EACpD,MAAMM,MAAM,GAAGF,YAAY,GAAGA,YAAY,CAACE,MAAM,GAAGW,qBAAqB;EAEzE,MAAMT,MAAM,GAAGC,MAAM,CAACS,gBAAgB,CAACP,QAAQ,CAACL,MAAM,EAAE;IAACa,UAAU,EAAE;EAAK,CAAC,CAAC;EAE5E,IAAIX,MAAM,CAACI,KAAK,EAAE;IAChB,MAAMQ,eAAe,GAAG,IAAIP,gBAAQ,CAACL,MAAM,CAACI,KAAK,CAAC;IAClDS,kBAAM,CAACC,IAAI,CACT,IAAAC,wBAAY,EAAE;AACpB,kBAAkBC,gBAAK,CAACC,IAAI,CAClBT,cAAc,CACd,oCAAmCQ,gBAAK,CAACC,IAAI,CAC/CL,eAAe,CAACM,OAAO,CACvB;AACR;AACA,iIAAiI,CAAC,CAC7H;EACH;EAEA,OAAOlB,MAAM,CAACM,KAAK;AACrB;AAEA,MAAMG,qBAAqB,GAAG;EAC5BU,UAAU,EAAE;IACVC,SAAS,EAAE,CAAC;EACd,CAAC;EACDC,QAAQ,EAAE,EAAE;EACZD,SAAS,EAAE,CAAC;AACd,CAAC"}

View File

@@ -0,0 +1,6 @@
/**
* Finds path to React Native inside `node_modules` or throws
* an error otherwise.
*/
export default function resolveReactNativePath(root: string): string;
//# sourceMappingURL=resolveReactNativePath.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"resolveReactNativePath.d.ts","sourceRoot":"","sources":["../src/resolveReactNativePath.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,IAAI,EAAE,MAAM,UAe1D"}

View File

@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = resolveReactNativePath;
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
/**
* Finds path to React Native inside `node_modules` or throws
* an error otherwise.
*/
function resolveReactNativePath(root) {
try {
return (0, _cliTools().resolveNodeModuleDir)(root, 'react-native');
} catch (_ignored) {
throw new (_cliTools().CLIError)(`
Unable to find React Native files looking up from ${root}. Make sure "react-native" module is installed
in your project dependencies.
If you are using React Native from a non-standard location, consider setting:
{
reactNativePath: "./path/to/react-native"
}
in your \`react-native.config.js\`.
`);
}
}
//# sourceMappingURL=resolveReactNativePath.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["resolveReactNativePath","root","resolveNodeModuleDir","_ignored","CLIError"],"sources":["../src/resolveReactNativePath.ts"],"sourcesContent":["import {\n CLIError,\n resolveNodeModuleDir,\n} from '@react-native-community/cli-tools';\n\n/**\n * Finds path to React Native inside `node_modules` or throws\n * an error otherwise.\n */\nexport default function resolveReactNativePath(root: string) {\n try {\n return resolveNodeModuleDir(root, 'react-native');\n } catch (_ignored) {\n throw new CLIError(`\n Unable to find React Native files looking up from ${root}. Make sure \"react-native\" module is installed\n in your project dependencies.\n\n If you are using React Native from a non-standard location, consider setting:\n {\n reactNativePath: \"./path/to/react-native\"\n }\n in your \\`react-native.config.js\\`.\n `);\n }\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAKA;AACA;AACA;AACA;AACe,SAASA,sBAAsB,CAACC,IAAY,EAAE;EAC3D,IAAI;IACF,OAAO,IAAAC,gCAAoB,EAACD,IAAI,EAAE,cAAc,CAAC;EACnD,CAAC,CAAC,OAAOE,QAAQ,EAAE;IACjB,MAAM,KAAIC,oBAAQ,EAAE;AACxB,0DAA0DH,IAAK;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ;AACF"}

View File

@@ -0,0 +1,17 @@
/**
* This schema is used by `cli-config` to validate the structure. Make sure
* this file stays up to date with `cli-types` package.
*
* In the future, it would be great to generate this file automatically from the
* Typescript types.
*/
import t from 'joi';
/**
* Schema for UserDependencyConfig
*/
export declare const dependencyConfig: t.ObjectSchema<any>;
/**
* Schema for ProjectConfig
*/
export declare const projectConfig: t.ObjectSchema<any>;
//# sourceMappingURL=schema.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,CAAe,MAAM,KAAK,CAAC;AAoDlC;;GAEG;AACH,eAAO,MAAM,gBAAgB,qBAgDjB,CAAC;AAEb;;GAEG;AACH,eAAO,MAAM,aAAa,qBAiFd,CAAC"}

View File

@@ -0,0 +1,170 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.projectConfig = exports.dependencyConfig = void 0;
function _joi() {
const data = _interopRequireDefault(require("joi"));
_joi = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* This schema is used by `cli-config` to validate the structure. Make sure
* this file stays up to date with `cli-types` package.
*
* In the future, it would be great to generate this file automatically from the
* Typescript types.
*/
const map = (key, value) => _joi().default.object().unknown(true).pattern(key, value);
/**
* Schema for CommandT
*/
const command = _joi().default.object({
name: _joi().default.string().required(),
description: _joi().default.string(),
usage: _joi().default.string(),
func: _joi().default.func().required(),
options: _joi().default.array().items(_joi().default.object({
name: _joi().default.string().required(),
description: _joi().default.string(),
parse: _joi().default.func(),
default: _joi().default.alternatives().try(_joi().default.bool(), _joi().default.number(), _joi().default.string().allow(''), _joi().default.func())
}).rename('command', 'name', {
ignoreUndefined: true
})),
examples: _joi().default.array().items(_joi().default.object({
desc: _joi().default.string().required(),
cmd: _joi().default.string().required()
}))
});
/**
* Schema for HealthChecksT
*/
const healthCheck = _joi().default.object({
label: _joi().default.string().required(),
healthchecks: _joi().default.array().items(_joi().default.object({
label: _joi().default.string().required(),
isRequired: _joi().default.bool(),
description: _joi().default.string(),
getDiagnostics: _joi().default.func(),
win32AutomaticFix: _joi().default.func(),
darwinAutomaticFix: _joi().default.func(),
linuxAutomaticFix: _joi().default.func(),
runAutomaticFix: _joi().default.func().required()
}))
});
/**
* Schema for UserDependencyConfig
*/
const dependencyConfig = _joi().default.object({
dependency: _joi().default.object({
platforms: map(_joi().default.string(), _joi().default.any()).keys({
ios: _joi().default
// IOSDependencyParams
.object({
scriptPhases: _joi().default.array().items(_joi().default.object()),
configurations: _joi().default.array().items(_joi().default.string()).default([])
}).allow(null),
android: _joi().default
// AndroidDependencyParams
.object({
sourceDir: _joi().default.string(),
manifestPath: _joi().default.string(),
packageName: _joi().default.string(),
packageImportPath: _joi().default.string(),
packageInstance: _joi().default.string(),
dependencyConfiguration: _joi().default.string(),
buildTypes: _joi().default.array().items(_joi().default.string()).default([]),
libraryName: _joi().default.string().allow(null),
componentDescriptors: _joi().default.array().items(_joi().default.string()).allow(null),
cmakeListsPath: _joi().default.string().allow(null),
cxxModuleCMakeListsModuleName: _joi().default.string().allow(null),
cxxModuleCMakeListsPath: _joi().default.string().allow(null),
cxxModuleHeaderName: _joi().default.string().allow(null)
}).allow(null)
}).default()
}).default(),
platforms: map(_joi().default.string(), _joi().default.object({
npmPackageName: _joi().default.string().optional(),
dependencyConfig: _joi().default.func(),
projectConfig: _joi().default.func(),
linkConfig: _joi().default.func()
})).default({}),
commands: _joi().default.array().items(command).default([]),
healthChecks: _joi().default.array().items(healthCheck).default([])
}).unknown(true).default();
/**
* Schema for ProjectConfig
*/
exports.dependencyConfig = dependencyConfig;
const projectConfig = _joi().default.object({
dependencies: map(_joi().default.string(), _joi().default.object({
root: _joi().default.string(),
platforms: map(_joi().default.string(), _joi().default.any()).keys({
ios: _joi().default
// IOSDependencyConfig
.object({
podspecPath: _joi().default.string(),
version: _joi().default.string(),
configurations: _joi().default.array().items(_joi().default.string()).default([]),
scriptPhases: _joi().default.array().items(_joi().default.object()).default([])
}).allow(null),
android: _joi().default
// AndroidDependencyConfig
.object({
sourceDir: _joi().default.string(),
packageImportPath: _joi().default.string(),
packageInstance: _joi().default.string(),
dependencyConfiguration: _joi().default.string(),
buildTypes: _joi().default.array().items(_joi().default.string()).default([]),
libraryName: _joi().default.string().allow(null),
componentDescriptors: _joi().default.array().items(_joi().default.string()).allow(null),
cmakeListsPath: _joi().default.string().allow(null)
}).allow(null)
})
}).allow(null)).default({}),
reactNativePath: _joi().default.string(),
project: map(_joi().default.string(), _joi().default.any()).keys({
ios: _joi().default
// IOSProjectParams
.object({
sourceDir: _joi().default.string(),
watchModeCommandParams: _joi().default.array().items(_joi().default.string()),
// @todo remove for RN 0.75
unstable_reactLegacyComponentNames: _joi().default.array().items(_joi().default.string()).optional(),
automaticPodsInstallation: _joi().default.bool().default(false)
}).default({}),
android: _joi().default
// AndroidProjectParams
.object({
sourceDir: _joi().default.string(),
appName: _joi().default.string(),
manifestPath: _joi().default.string(),
packageName: _joi().default.string(),
dependencyConfiguration: _joi().default.string(),
watchModeCommandParams: _joi().default.array().items(_joi().default.string()),
// @todo remove for RN 0.75
unstable_reactLegacyComponentNames: _joi().default.array().items(_joi().default.string()).optional()
}).default({})
}).default(),
assets: _joi().default.array().items(_joi().default.string()).default([]),
commands: _joi().default.array().items(command).default([]),
platforms: map(_joi().default.string(), _joi().default.object({
npmPackageName: _joi().default.string().optional(),
dependencyConfig: _joi().default.func(),
projectConfig: _joi().default.func(),
linkConfig: _joi().default.func()
})).default({})
}).unknown(true).default();
exports.projectConfig = projectConfig;
//# sourceMappingURL=schema.ts.map

File diff suppressed because one or more lines are too long