Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// code push is not making a real use of this data
// Investigate further.
// https://github.com/Microsoft/code-push/blob/master/cli/script/command-executor.ts#L1246
compositePackageJson.dependencies['react-native'] =
reactNativePackageJson.version
compositePackageJson.name = 'container'
compositePackageJson.version = '0.0.1'
fs.writeFileSync(
'package.json',
JSON.stringify(compositePackageJson, null, 2)
)
}
log.debug('Creating index.android.js')
await writeFile('index.android.js', entryIndexJsContent)
log.debug('Creating index.ios.js')
await writeFile('index.ios.js', entryIndexJsContent)
}
log.debug(`Adding ${iOSPluginHook.name}.m`)
const pathToPluginHookSource = path.join(
pluginConfigPath,
`${iOSPluginHook.name}.m`
)
shell.cp(pathToPluginHookSource, pathToCopyPluginHooksTo)
containerIosProject.addSourceFile(
`${iOSPluginHook.name}.m`,
null,
containerIosProject.findPBXGroupKey({ name: 'ElectrodeContainer' })
)
}
}
log.debug('[=== iOS: Done adding plugin hook classes ===]')
} catch (e) {
log.error(`[addiOSPluginHookClasses] Something went wrong: ${e}`)
throw e
}
}
'MiniAppActivity.mustache'
)
const pathToOutputActivityFile = path.join(
config.outDir,
pathLibSrcMainJavaComWalmartlabsErnContainer,
'miniapps',
activityFileName
)
await mustacheUtils.mustacheRenderToOutputFileUsingTemplateFile(
pathToMiniAppActivityMustacheTemplate,
miniApp,
pathToOutputActivityFile
)
}
log.debug('[=== Completed container hull filling ===]')
} catch (e) {
log.error('[fillContainerHull] Something went wrong: ' + e)
throw e
}
}
public async publish(config: ContainerPublisherConfig): Promise {
if (!config.extra) {
config.extra = {}
}
if (!config.extra.artifactId) {
log.debug(
`Using default artifactId: ${JcenterPublisher.DEFAULT_ARTIFACT_ID}`
)
config.extra.artifactId = JcenterPublisher.DEFAULT_ARTIFACT_ID
}
if (!config.extra.groupId) {
log.debug(`Using default groupId: ${JcenterPublisher.DEFAULT_GROUP_ID}`)
config.extra.groupId = JcenterPublisher.DEFAULT_GROUP_ID
}
const mustacheConfig: any = {}
mustacheConfig.artifactId = config.extra.artifactId
mustacheConfig.groupId = config.extra.groupId
mustacheConfig.containerVersion = config.containerVersion
fs.appendFileSync(
path.join(config.containerPath, 'lib', 'build.gradle'),
`
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
include '**/*.java'
public async getIosApiImplProject(apiImplProjectPath: string): Promise {
log.debug(apiImplProjectPath)
const containerProject = xcode.project(apiImplProjectPath)
return new Promise((resolve, reject) => {
containerProject.parse(err => {
if (err) {
reject(err)
}
resolve(containerProject)
})
})
}
public async generateRequestHandlerClasses(
iosProject: any,
pathSpec: any,
projectSpec: any,
apis: any
) {
log.debug('=== updating request handler implementation class ===')
const {
outputDir,
resourceDir,
} = this.createImplDirectoryAndCopyCommonClasses(
pathSpec,
projectSpec,
iosProject
)
const editableFiles: string[] = []
for (const api of apis) {
const { files, classNames } = ApiImplIosGenerator.getMustacheFileNamesMap(
resourceDir,
api.apiName
)
export function logResolvedDependenciesTree(
composite: Composite,
resolution: any
) {
const parser = YarnLockParser.fromPath(path.join(composite.path, 'yarn.lock'))
log.debug('[ == RESOLVED NATIVE DEPENDENCIES ==]')
logDependenciesTree(
parser,
resolution.resolved.map(x => PackagePath.fromString(x.basePath)),
'debug'
)
}
replacements.push(() => {
log.debug(`Performing string replacement on ${r.path}`)
const pathToFile = path.join(config.outDir, r.path)
const fileContent = fs.readFileSync(pathToFile, 'utf8')
const patchedFileContent = fileContent.replace(
RegExp(r.string, 'g'),
r.replaceWith
)
fs.writeFileSync(pathToFile, patchedFileContent, {
encoding: 'utf8',
})
})
}
const pluginConfigPath = pluginConfig.path
const pathToCopyPluginHooksTo = path.join(outDir, 'ElectrodeContainer')
log.debug(`Adding ${iOSPluginHook.name}.h`)
const pathToPluginHookHeader = path.join(
pluginConfigPath,
`${iOSPluginHook.name}.h`
)
shell.cp(pathToPluginHookHeader, pathToCopyPluginHooksTo)
containerIosProject.addHeaderFile(
`${iOSPluginHook.name}.h`,
{ public: true },
containerIosProject.findPBXGroupKey({ name: 'ElectrodeContainer' })
)
log.debug(`Adding ${iOSPluginHook.name}.m`)
const pathToPluginHookSource = path.join(
pluginConfigPath,
`${iOSPluginHook.name}.m`
)
shell.cp(pathToPluginHookSource, pathToCopyPluginHooksTo)
containerIosProject.addSourceFile(
`${iOSPluginHook.name}.m`,
null,
containerIosProject.findPBXGroupKey({ name: 'ElectrodeContainer' })
)
}
}
}
jsApiImplDependencies
)
if (!config.ignoreRnpmAssets) {
await copyRnpmAssets(
config.miniApps,
config.compositeMiniAppDir,
config.outDir,
'ios'
)
this.addResources(config.outDir)
}
await addElectrodeNativeMetadataFile(config)
log.debug('Container generation completed!')
return {
bundlingResult,
}
} catch (e) {
log.error(
'[generateContainer] Something went wrong. Aborting Container Generation'
)
throw e
}
}