How to use ern-composite-gen - 7 common examples

To help you get started, we’ve selected a few ern-composite-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-orchestrator / src / start.ts View on Github external
resolutions = compositeGenConfig?.resolutions
  }

  // Because this command can only be stoped through `CTRL+C` (or killing the process)
  // we listen for the SIGINT signal and then just exit the process
  // This is needed for tmp module to do its cleanup, otherwise the temporary directory
  // is not removed after `CTRL+C` is done
  process.on('SIGINT', () => process.exit())

  compositeDir = compositeDir || createTmpDir()
  log.trace(`Temporary composite directory is ${compositeDir}`)

  const composite = await kax
    .task(`Generating composite in ${compositeDir}`)
    .run(
      Composite.generate({
        baseComposite,
        extraJsDependencies: extraJsDependencies || undefined,
        jsApiImplDependencies: jsApiImpls,
        miniApps: miniapps!,
        outDir: compositeDir,
        resolutions,
      })
    )

  // Third party native modules
  const nativeDependencies = await composite.getNativeDependencies()
  const nativeModules: PackagePath[] = [
    ...nativeDependencies.thirdPartyInManifest,
    ...nativeDependencies.thirdPartyNotInManifest,
  ].map(d => d.packagePath)
github electrode-io / electrode-native / ern-local-cli / src / commands / bundlestore / upload.ts View on Github external
log.debug(
          'Bypassing yarn.lock usage as bypassYarnLock flag is set in config'
        )
      }
      const compositeGenConfig = await cauldron.getCompositeGeneratorConfig(
        descriptor
      )
      baseComposite =
        baseComposite ||
        (compositeGenConfig && compositeGenConfig.baseComposite)
      resolutions = compositeGenConfig && compositeGenConfig.resolutions
    }

    const compositeDir = createTmpDir()
    await kax.task('Generating Composite').run(
      generateComposite({
        baseComposite,
        extraJsDependencies,
        jsApiImplDependencies: jsApiImpls,
        miniApps: miniapps!,
        outDir: compositeDir,
        pathToYarnLock,
        resolutions,
      })
    )

    for (const curPlatform of platforms) {
      const outDir = createTmpDir()
      const bundlePath = path.join(outDir, 'index.bundle')
      const sourceMapPath = path.join(outDir, 'index.map')
      await kax.task(`Bundling MiniApps for ${curPlatform}`).run(
        bundleMiniAppsFromComposite({
github electrode-io / electrode-native / ern-container-gen / src / bundleMiniApps.ts View on Github external
jsApiImplDependencies,
    resolutions,
    extraJsDependencies,
  }: {
    bundleOutput?: string
    pathToYarnLock?: string
    dev?: boolean
    sourceMapOutput?: string
    baseComposite?: PackagePath
    jsApiImplDependencies?: PackagePath[]
    resolutions?: { [pkg: string]: string }
    extraJsDependencies?: PackagePath[]
  } = {}
): Promise {
  await kax.task('Generating MiniApps Composite').run(
    generateComposite({
      baseComposite,
      extraJsDependencies,
      jsApiImplDependencies,
      miniApps,
      outDir: compositeDir,
      pathToYarnLock,
      resolutions,
    })
  )

  return bundleMiniAppsFromComposite({
    bundleOutput,
    compositeDir,
    dev,
    outDir,
    platform,
github electrode-io / electrode-native / ern-local-cli / src / commands / create-composite.ts View on Github external
pathToYarnLock = await cauldron.getPathToYarnLock(descriptor, 'container')
    } else {
      log.debug(
        'Bypassing yarn.lock usage as bypassYarnLock flag is set in config'
      )
    }
    const compositeGenConfig = await cauldron.getCompositeGeneratorConfig(
      descriptor
    )
    baseComposite =
      baseComposite || (compositeGenConfig && compositeGenConfig.baseComposite)
    resolutions = compositeGenConfig && compositeGenConfig.resolutions
  }

  await kax.task('Generating Composite').run(
    generateComposite({
      baseComposite,
      extraJsDependencies,
      jsApiImplDependencies: jsApiImpls,
      miniApps: miniapps!,
      outDir,
      pathToYarnLock,
      resolutions,
    })
  )

  log.info(`Composite successfully generated in ${outDir}`)
}
github electrode-io / electrode-native / ern-orchestrator / src / codepush.ts View on Github external
PackagePath.fromString(m.toString())
    )
    const pathToJsApiImplsToBeCodePushed = _.map(jsApiImplsToBeCodePushed, j =>
      PackagePath.fromString(j.toString())
    )

    const codePushConfig = await cauldron.getCodePushConfig(napDescriptor)
    if (codePushConfig && codePushConfig.bypassYarnLock) {
      pathToYarnLock = undefined
      log.debug(
        'Bypassing yarn.lock usage as bypassYarnLock flag is set in Cauldron config'
      )
    }

    await kax.task('Generating composite module').run(
      generateComposite({
        baseComposite,
        jsApiImplDependencies: pathToJsApiImplsToBeCodePushed,
        miniApps: pathsToMiniAppsToBeCodePushed,
        outDir: tmpWorkingDir,
        pathToYarnLock,
        resolutions: compositeGenConfig && compositeGenConfig.resolutions,
      })
    )

    const bundleOutputDirectory = path.join(tmpWorkingDir, 'bundleOut')
    shell.mkdir('-p', bundleOutputDirectory)
    const platform = napDescriptor.platform || ''
    const bundleOutputPath =
      platform === 'android'
        ? path.join(bundleOutputDirectory, 'index.android.bundle')
        : path.join(bundleOutputDirectory, 'MiniApp.jsbundle')
github electrode-io / electrode-native / ern-orchestrator / src / composite.ts View on Github external
miniappPackagesPaths: PackagePath[],
  {
    baseComposite,
    jsApiImpls,
    outDir,
    resolutions,
  }: {
    baseComposite?: PackagePath
    jsApiImpls?: PackagePath[]
    outDir?: string
    resolutions?: { [pkg: string]: string }
  }
): Promise {
  try {
    const composite = await kax.task('Generating Composite').run(
      Composite.generate({
        baseComposite,
        jsApiImplDependencies: jsApiImpls,
        miniApps: miniappPackagesPaths,
        outDir: outDir || createTmpDir(),
        resolutions,
      })
    )

    await validateCompositeNativeDependencies(composite)

    return composite
  } catch (e) {
    log.error(`runLocalCompositeGen failed: ${e}`)
    throw e
  }
}
github electrode-io / electrode-native / ern-orchestrator / src / composite.ts View on Github external
)
    let pathToYarnLock

    if (!containerGenConfig || !containerGenConfig.bypassYarnLock) {
      pathToYarnLock = await cauldron.getPathToYarnLock(
        napDescriptor,
        constants.CONTAINER_YARN_KEY
      )
    } else {
      log.debug(
        'Bypassing yarn.lock usage as bypassYarnLock flag is set in Cauldron config'
      )
    }

    const composite = await kax.task('Generating Composite').run(
      Composite.generate({
        baseComposite,
        jsApiImplDependencies: jsApiImpls,
        miniApps: miniapps,
        outDir: outDir || createTmpDir(),
        pathToYarnLock,
        resolutions: compositeGenConfig && compositeGenConfig.resolutions,
      })
    )

    await validateCompositeNativeDependencies(composite)

    return composite
  } catch (e) {
    log.error(`runCauldronCompositeGen failed: ${e}`)
    throw e
  }

ern-composite-gen

Electrode Native Composite Generator

Apache-2.0
Latest version published 5 months ago

Package Health Score

62 / 100
Full package analysis