Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Figure out the list of all git MiniApps that have been updated (new HEAD sha)
const updatedGitMiniApps = await cauldron.getLatestShasForMiniAppsBranches(
descriptor
)
if (updatedGitMiniApps.length === 0) {
log.info('No Changes ...')
if (fullRegen) {
log.info('Performing regen anyway [--fullRegen]')
} else {
log.info('Skipping regen. To regenerate use the --fullRegen option.')
return
}
}
await syncCauldronContainer(
async () => {
for (const updatedGitMiniApp of updatedGitMiniApps) {
await cauldron.updateMiniAppVersionInContainer(
descriptor!,
updatedGitMiniApp,
{ keepBranch: true }
)
}
},
descriptor,
`Regenerate Container of ${descriptor} native application`,
{
containerVersion,
sourceMapOutput,
}
)
extraErrorMessage:
'This command cannot work on a non existing native application version',
},
})
const cauldronCommitMessage = [
`${
jsapiimpls.length === 1
? `Remove ${jsapiimpls[0]} JS API implementation from ${descriptor}`
: `Remove multiple JS API implementations from ${descriptor}`
}`,
]
if (!(await emptyContainerIfSingleMiniAppOrJsApiImpl(descriptor))) {
const cauldron = await getActiveCauldron()
await syncCauldronContainer(
async () => {
for (const jsApiImpl of jsapiimpls) {
await cauldron.removeJsApiImplFromContainer(descriptor!, jsApiImpl)
cauldronCommitMessage.push(
`- Remove ${jsApiImpl} JS API implementation`
)
}
},
descriptor,
cauldronCommitMessage,
{ containerVersion }
)
}
log.info(`JS API implementation(s) successfully removed from ${descriptor}`)
}
extraErrorMessage:
'You cannot provide dependency(ies) using git or file schme for this command. Only the form dependency@version is allowed.',
obj: dependencies,
},
})
const cauldronCommitMessage = [
`${
dependencies.length === 1
? `Remove ${dependencies[0]} native dependency from ${descriptor}`
: `Remove multiple native dependencies from ${descriptor}`
}`,
]
const cauldron = await getActiveCauldron()
await syncCauldronContainer(
async () => {
for (const dependency of dependencies) {
await cauldron.removeNativeDependencyFromContainer(
descriptor!,
dependency
)
cauldronCommitMessage.push(`- Remove ${dependency} native dependency`)
}
},
descriptor,
cauldronCommitMessage,
{ containerVersion }
)
log.info(`Dependency(ies) successfully removed from ${descriptor}`)
}
extraErrorMessage:
'You can only add dependencies versions that have been published to NPM',
obj: dependencies,
},
})
const cauldronCommitMessage = [
`${
dependencies.length === 1
? `Add ${dependencies[0]} native dependency to ${descriptor}`
: `Add multiple native dependencies to ${descriptor}`
}`,
]
const cauldron = await getActiveCauldron()
await syncCauldronContainer(
async () => {
for (const dependency of dependencies) {
await cauldron.addNativeDependencyToContainer(descriptor!, dependency)
cauldronCommitMessage.push(`- Add ${dependency} native dependency`)
}
},
descriptor,
cauldronCommitMessage,
{ containerVersion }
)
log.info(`Dependency(ies) successfully added to ${descriptor}`)
}
'This command cannot work on a non existing native application version',
},
})
const cauldronCommitMessage = [
`${
jsapiimpls.length === 1
? `Update ${
jsapiimpls[0]
} JS API implementation version in ${descriptor}`
: `Update multiple JS API implementations in ${descriptor}`
}`,
]
const cauldron = await getActiveCauldron()
await syncCauldronContainer(
async () => {
for (const jsapiimpl of jsapiimpls) {
cauldronCommitMessage.push(
`- Update ${jsapiimpl.basePath} JS API implementation version`
)
}
await cauldron.syncContainerJsApiImpls(descriptor!, jsapiimpls)
},
descriptor,
cauldronCommitMessage,
{ containerVersion }
)
log.info(`JS API implementation(s) successfully updated in ${descriptor}`)
}
obj: dependencies,
},
})
const cauldronCommitMessage = [
`${
dependencies.length === 1
? `Update ${
dependencies[0].basePath
} native dependency version in v${descriptor}`
: `Update multiple native dependencies versions in ${descriptor}`
}`,
]
const cauldron = await getActiveCauldron()
await syncCauldronContainer(
async () => {
for (const dependency of dependencies) {
await cauldron.updateNativeDependencyVersionInContainer(
descriptor!,
dependency
)
cauldronCommitMessage.push(
`- Update ${dependency.basePath} native dependency to v${
dependency.version
}`
)
}
},
descriptor,
cauldronCommitMessage,
{ containerVersion }
if (fullRegen) {
log.info('Performing regen anyway [--fullRegen]')
} else {
log.info(
`Skipping Container regen.
Only updating Cauldron with new MiniApps versions.
To regenerate anyway use the --fullRegen option.`
)
await cauldron.beginTransaction()
await cauldron.syncContainerMiniApps(descriptor!, miniapps)
await cauldron.commitTransaction(cauldronCommitMessage)
return
}
}
await syncCauldronContainer(
async () => {
for (const miniApp of miniapps) {
cauldronCommitMessage.push(
`- Update ${miniApp.basePath} MiniApp version to v${miniApp.version}`
)
}
await cauldron.syncContainerMiniApps(descriptor!, miniapps)
},
descriptor,
cauldronCommitMessage,
{
containerVersion,
}
)
log.info(`MiniApp(s) version(s) successfully updated in ${descriptor}`)
}
extraErrorMessage:
'This command cannot work on a non existing native application version',
},
})
const cauldronCommitMessage = [
`${
miniapps.length === 1
? `Remove ${miniapps[0]} MiniApp from ${descriptor}`
: `Remove multiple MiniApps from ${descriptor}`
}`,
]
if (!(await emptyContainerIfSingleMiniAppOrJsApiImpl(descriptor))) {
const cauldron = await getActiveCauldron()
await syncCauldronContainer(
async () => {
for (const miniapp of miniapps) {
await cauldron.removeMiniAppFromContainer(descriptor!, miniapp)
cauldronCommitMessage.push(`- Remove ${miniapp} MiniApp`)
}
},
descriptor,
cauldronCommitMessage,
{ containerVersion }
)
}
log.info(`MiniApp(s) successfully removed from ${descriptor}`)
}
descriptor,
extraErrorMessage:
'This command cannot work on a non existing native application version',
},
})
const cauldronCommitMessage = [
`${
jsapiimpls.length === 1
? `Add ${jsapiimpls[0]} JS API implementation to ${descriptor}`
: `Add multiple JS API implementations to ${descriptor}`
}`,
]
const cauldron = await getActiveCauldron()
await syncCauldronContainer(
async () => {
for (const jsApiImpl of jsapiimpls) {
cauldronCommitMessage.push(`- Add ${jsApiImpl} JS API Implementation`)
}
await cauldron.syncContainerJsApiImpls(descriptor!, jsapiimpls)
},
descriptor,
cauldronCommitMessage,
{ containerVersion }
)
log.info(`JS API implementation(s) successfully added to ${descriptor}`)
}
extraErrorMessage:
'This command cannot work on a non existing native application version',
},
})
const cauldron = await getActiveCauldron()
const cauldronCommitMessage = [
`${
miniapps.length === 1
? `Add ${miniapps[0]} MiniApp to ${descriptor}`
: `Add multiple MiniApps to ${descriptor}`
}`,
]
await syncCauldronContainer(
async () => {
for (const miniApp of miniapps) {
cauldronCommitMessage.push(`- Add ${miniApp.basePath} MiniApp`)
}
await cauldron.syncContainerMiniApps(descriptor!, miniapps)
},
descriptor,
cauldronCommitMessage,
{ containerVersion }
)
log.debug(`MiniApp(s) successfully added to ${descriptor}`)
}