Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
await regenerateApiImpl({
api,
paths: {
apiImplHull: path.join(
Platform.currentPlatformVersionPath,
'ern-api-impl-gen',
'hull'
),
outDirectory: process.cwd(),
},
platforms: getPlatforms(),
reactNativeVersion,
})
log.info('Successfully regenerated api implementation!')
} catch (e) {
coreUtils.logErrorAndExitProcess(e)
}
async function readPackageJson(): Promise {
const packageJsonPath = path.join(process.cwd(), 'package.json')
log.debug(`Reading package json: ${packageJsonPath}`)
if (!(await fs.pathExists(packageJsonPath))) {
log.error(`${packageJsonPath} not found`)
throw new Error(ERROR_MSG_NOT_IN_IMPL)
}
const apiImplPackage = await fs.readJson(packageJsonPath)
if (
!apiImplPackage.ern ||
(apiImplPackage.ern.moduleType !== ModuleTypes.NATIVE_API_IMPL &&
apiImplPackage.ern.moduleType !== ModuleTypes.JS_API_IMPL)
) {
value?: string
}) {
try {
if (value) {
let valueToset =
value === 'true' ? true
: value === 'false' ? false
: value
ernConfig.setValue(key, valueToset)
log.info(`${key} set to ${ernConfig.getValue(key)}`)
} else {
log.info(`${key}: ${ernConfig.getValue(key)}`)
}
} catch (e) {
coreUtils.logErrorAndExitProcess(e)
}
}
]
const cauldron = await getActiveCauldron()
await utils.performContainerStateUpdateInCauldron(
async () => {
for (const dependencyObj: PackagePath of dependenciesObjs) {
await cauldron.removeContainerNativeDependency(napDescriptor, dependencyObj)
cauldronCommitMessage.push(`- Remove ${dependencyObj.toString()} native dependency`)
}
},
napDescriptor,
cauldronCommitMessage,
{ containerVersion })
log.info(`Dependency(ies) was/were succesfully removed from ${napDescriptor.toString()}`)
} catch (e) {
coreUtils.logErrorAndExitProcess(e)
}
}
exports.handler = function ({
version
} : {
version: string
}) {
try {
Platform.installPlatform(version.toString().replace('v', ''))
} catch (e) {
coreUtils.logErrorAndExitProcess(e)
}
}
exports.handler = async function () {
try {
const cauldron = await getActiveCauldron({ignoreSchemaVersionMismatch: true})
if (!cauldron) {
throw new Error('A Cauldron must be active in order to use this command')
}
await cauldron.upgradeCauldronSchema()
log.debug('Cauldron was succesfully upgraded !')
} catch (e) {
coreUtils.logErrorAndExitProcess(e)
}
}
} = {}) {
try {
if (!bridgeVersion) {
const bridgeDep = await manifest.getNativeDependency(PackagePath.fromString('react-native-electrode-bridge'))
if (!bridgeDep) {
throw new Error('react-native-electrode-bridge not found in manifest. please provide explicit version')
}
if (!bridgeDep.version) {
throw new Error('react-native-electrode-bridge version not defined. This should not happen')
}
bridgeVersion = bridgeDep.version
}
await ApiGen.regenerateCode({bridgeVersion, skipVersion})
} catch (e) {
coreUtils.logErrorAndExitProcess(e)
}
}
const nativeDependencies = await resolver.resolveNativeDependenciesVersionsOfMiniApps([...updateMiniAppsObjs, ...addMiniAppsObjs, ...nonUpdatedMiniAppsInCauldronObjs])
const cauldronDependencies = await cauldron.getNativeDependencies(napDescriptor)
const finalNativeDependencies = resolver.retainHighestVersions(nativeDependencies.resolved, cauldronDependencies)
utils.logNativeDependenciesConflicts(nativeDependencies, { throwIfConflict: !force })
await cauldron.syncContainerMiniApps(napDescriptor, [...addMiniAppsDependencyPaths, ...updateMiniAppsDependencyPaths])
await cauldron.syncContainerNativeDependencies(napDescriptor, finalNativeDependencies)
},
napDescriptor,
cauldronCommitMessage,
{ containerVersion })
log.info(`Operations were succesfully performed for ${napDescriptor.toString()}`)
} catch (e) {
coreUtils.logErrorAndExitProcess(e)
}
}
]
const cauldron = await getActiveCauldron()
await utils.performContainerStateUpdateInCauldron(
async () => {
for (const jsApiImpl of jsapiimpls) {
await cauldron.removeContainerJsApiImpl(napDescriptor, PackagePath.fromString(jsApiImpl))
cauldronCommitMessage.push(`- Remove ${jsApiImpl} JS API implementation`)
}
},
napDescriptor,
cauldronCommitMessage,
{ containerVersion })
log.debug(`JS API implementation(s) was/were succesfully removed fron ${napDescriptor.toString()} in the Cauldron`)
} catch (e) {
coreUtils.logErrorAndExitProcess(e)
}
}
]
await utils.performContainerStateUpdateInCauldron(
async () => {
for (const miniAppObj of miniAppsObjs) {
cauldronCommitMessage.push(`- Add ${miniAppObj.packageDescriptor} MiniApp`)
}
await cauldron.syncContainerMiniApps(napDescriptor, miniAppsDependencyPaths)
await cauldron.syncContainerNativeDependencies(napDescriptor, finalNativeDependencies)
},
napDescriptor,
cauldronCommitMessage,
{ containerVersion })
log.debug(`MiniApp(s) was/were succesfully added to ${napDescriptor.toString()} in the Cauldron`)
} catch (e) {
coreUtils.logErrorAndExitProcess(e)
}
}
bundleStoreAccessKeyIsSet.extraErrorMessage
)
kaxTask.succeed()
}
if (metroServerIsNotRunning) {
kaxTask = kax.task(`Ensuring that metro server is not running`)
await Ensure.metroServerIsNotRunning(
metroServerIsNotRunning.host,
metroServerIsNotRunning.port,
metroServerIsNotRunning.extraErrorMessage
)
kaxTask.succeed()
}
} catch (e) {
kaxTask.fail()
utils.logErrorAndExitProcess(e, 1)
}
}