Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
// React-native plugin should be first in the dependencies
// Otherwise any module dependent on r-n won't be able to use it
config.plugins = [
...(reactNativePlugin ? [reactNativePlugin] : []),
...config.plugins.filter(plugin => plugin !== reactNativePlugin),
]
shell.pushd(config.outDir)
try {
if (fillContainerHull) {
await fillContainerHull(config)
}
} finally {
shell.popd()
}
const bundlingResult: BundlingResult = await kax
.task('Bundling MiniApps')
.run(
bundleMiniAppsFromComposite({
compositeDir: config.composite.path,
outDir: config.outDir,
platform: config.targetPlatform,
sourceMapOutput: config.sourceMapOutput,
})
)
if (postBundle) {
await postBundle(config, bundlingResult)
}
await logErrorAndExitIfNotSatisfied({
manifestIdExists: {
id: manifestId,
},
})
}
let pathToModule = process.cwd()
if (module) {
pathToModule = createTmpDir()
shell.pushd(pathToModule)
try {
await yarn.init()
await yarn.add(PackagePath.fromString(module))
} finally {
shell.popd()
}
}
const dependencies = await findNativeDependencies(
path.join(pathToModule, 'node_modules'),
{ manifestId }
)
if (json) {
process.stdout.write(JSON.stringify(dependencies))
} else {
console.log(chalk.bold.yellow('Native dependencies :'))
logDependencies(dependencies.apis, 'APIs')
logDependencies(dependencies.nativeApisImpl, 'Native API Implementations')
logDependencies(
dependencies.thirdPartyInManifest,
'Third party declared in Manifest'
const git = gitCli()
log.debug(`Cloning git repository(${config.url}) to ${workingGitDir}`)
await gitCli().cloneAsync(config.url, '.')
shell.rm('-rf', `${workingGitDir}/*`)
shell.cp('-Rf', path.join(config.containerPath, '{.*,*}'), workingGitDir)
await git.addAsync('./*')
await git.commitAsync(`Container v${config.containerVersion}`)
await git.tagAsync([`v${config.containerVersion}`])
await git.pushAsync('origin', 'master')
await git.pushTagsAsync('origin')
log.info('[=== Completed publication of the Container ===]')
log.info(`[Publication url : ${config.url}]`)
log.info('[Git Branch: master]')
log.info(`[Git Tag: v${config.containerVersion}]`)
} finally {
shell.popd()
}
}
}
mustacheConfig,
path.join(config.containerPath, 'lib', 'jcenter-publish.gradle')
)
try {
log.info('[=== Starting build and jcenter publication ===]')
shell.pushd(config.containerPath)
await this.buildAndUploadArchive()
log.info('[=== Completed build and publication of the Container ===]')
log.info(
`[Artifact: ${config.extra.groupId}:${config.extra.artifactId}:${
config.containerVersion
} ]`
)
} finally {
shell.popd()
}
}
await kax
.task('Building iOS Runner project')
.run(buildIosRunner(pathToIosRunner, iPhoneSim.udid))
await kax
.task('Installing iOS Runner on Simulator')
.run(
ios.installApplicationOnSimulator(
iPhoneSim.udid,
`${pathToIosRunner}/build/Debug-iphonesimulator/ErnRunner.app`
)
)
await kax
.task('Launching Runner')
.run(ios.launchApplication(iPhoneSim.udid, 'com.yourcompany.ernrunner'))
} finally {
shell.popd()
}
}
`
)
try {
log.info('[=== Starting build and publication ===]')
shell.pushd(config.containerPath)
await this.buildAndUploadArchive()
log.info('[=== Completed build and publication of the Container ===]')
log.info(`[Publication url : ${config.url}]`)
log.info(
`[Artifact: ${config.extra.groupId}:${config.extra.artifactId}:${
config.containerVersion
} ]`
)
} finally {
shell.popd()
}
}
paths,
srcOutputDirectory,
pluginPath,
pluginConfig
)
}
}
const editableFiles = await this.generateRequestHandlerClasses(
apiDependency,
paths,
apis
)
await this.updateGradleProperties(paths, outputDirectory)
await this.updateBuildGradle(paths, reactNativeVersion, outputDirectory)
} finally {
shell.popd()
}
}
const unzipper = new DecompressZip(jscAARPath)
const unzipOutDir = createTmpDir()
const containerJniLibsPath = path.join(
config.outDir,
'lib/src/main/jniLibs'
)
const unzippedJniPath = path.join(unzipOutDir, 'jni')
unzipper.on('error', err => reject(err))
unzipper.on('extract', () => {
shell.cp('-Rf', unzippedJniPath, containerJniLibsPath)
resolve()
})
unzipper.extract({ path: unzipOutDir })
})
} finally {
shell.popd()
}
}
}
const indexMustacheFile = path.join(
Platform.currentPlatformVersionPath,
'ern-api-impl-gen/resources/js/index.mustache'
)
const apisMustacheView = {
apis,
}
await mustacheUtils.mustacheRenderToOutputFileUsingTemplateFile(
indexMustacheFile,
apisMustacheView,
path.join(paths.outDirectory, 'index.js')
)
} finally {
shell.popd()
}
}
}