How to use the ern-container-gen.populateApiImplMustacheView function in ern-container-gen

To help you get started, we’ve selected a few ern-container-gen examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github electrode-io / electrode-native / ern-container-gen-android / src / AndroidGenerator.ts View on Github external
const pluginSourcePath = await config.composite.getNativeDependencyPath(
        plugin
      )
      if (!pluginSourcePath) {
        throw new Error(`path to ${plugin.basePath} not found in composite`)
      }

      if (await coreUtils.isDependencyPathNativeApiImpl(pluginSourcePath)) {
        // For native api implementations, if a 'ern.pluginConfig' object
        // exists in its package.json, replace pluginConfig with this one.
        const pluginPackageJson = await readPackageJson(pluginSourcePath)
        if (pluginPackageJson.ern.pluginConfig) {
          pluginConfig = pluginPackageJson.ern.pluginConfig
        }
        populateApiImplMustacheView(pluginSourcePath, mustacheView, true)
      }

      pathToPluginProject = path.join(
        pluginSourcePath,
        pluginConfig.android.root
      )

      shell.pushd(pathToPluginProject)
      try {
        if (await coreUtils.isDependencyPathNativeApiImpl(pluginSourcePath)) {
          // Special handling for native api implementation as we don't
          // want to copy the API and bridge code (part of native api implementations projects)
          const relPathToApiImplSource = path.normalize(
            'lib/src/main/java/com/ern'
          )
          const absPathToCopyPluginSourceTo = path.join(
github electrode-io / electrode-native / ern-container-gen-ios / src / IosGenerator.ts View on Github external
for (const plugin of plugins) {
      const pluginConfig = await manifest.getPluginConfig(
        plugin,
        projectSpec.projectName
      )
      if (!pluginConfig) {
        continue
      }

      const pluginSourcePath = await composite.getNativeDependencyPath(plugin)
      if (!pluginSourcePath) {
        throw new Error(`path to ${plugin.basePath} not found in composite`)
      }

      if (await utils.isDependencyPathNativeApiImpl(pluginSourcePath)) {
        populateApiImplMustacheView(pluginSourcePath, mustacheView, true)
      }
    }

    if (mustacheView.apiImplementations) {
      mustacheView.hasApiImpl = true
      for (const api of mustacheView.apiImplementations) {
        if (api.hasConfig) {
          mustacheView.hasAtleastOneApiImplConfig = true
          break
        }
      }
    }
  }
}