"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = require("@grund/path");
const tools_1 = require("@grund/tools");
const utils_1 = require("../../../utils");
const helpers_1 = require("../helpers");
function createRnConfig() {
    const currentConfig = utils_1.CONFIGS.RN_CONFIG.config;
    const assets = helpers_1.getAssets();
    const overrides = {};
    if (assets)
        Object.assign(overrides, { assets });
    const mergedConfig = tools_1.merge(currentConfig);
    return Object.assign(mergedConfig, { assets });
}
function writeRnConfig(config) {
    const configString = JSON.stringify(config, null, 4);
    const content = `module.exports = ${configString}`;
    const { filePath } = utils_1.CONFIGS.RN_CONFIG;
    path_1.fs.writeFileSync(filePath, content, 'utf-8');
}
helpers_1.createRnCommand('rn:sync:config', true)
    .description('Syncs the react-native.config.js with what is defined in app.json.')
    .action(async () => {
    const newConfig = createRnConfig();
    writeRnConfig(newConfig);
});
//# sourceMappingURL=sync.config.js.map