How to use the ern-container-gen.getContainerMetadataPath 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-orchestrator / src / performContainerStateUpdateInCauldron.ts View on Github external
)
        log.info('Regenerating JS bundle only')
        await runCaudronBundleGen(napDescriptor, {
          compositeMiniAppDir,
          outDir,
        })
        // Update container metadata
        const metadata = await fileUtils.readJSON(
          getContainerMetadataPath(outDir)
        )
        const miniapps = await cauldron.getContainerMiniApps(napDescriptor)
        const jsApiImpls = await cauldron.getContainerJsApiImpls(napDescriptor)
        metadata.miniApps = miniapps.map(m => m.fullPath)
        metadata.jsApiImpls = jsApiImpls.map(j => j.fullPath)
        metadata.ernVersion = Platform.currentVersion
        await fileUtils.writeJSON(getContainerMetadataPath(outDir), metadata)
      } catch (e) {
        log.error(`Something went wrong trying to regenerate JS bundle only`)
        log.error(e)
        log.error(`Falling back to full Container generation`)
        jsBundleOnly = false
      }
    } else if (publishOnly) {
      log.info(`No changes from ${currentContainerVersion}`)
      log.info('Only publishing')
      // Update container metadata
      const metadata = await fileUtils.readJSON(
        getContainerMetadataPath(outDir)
      )
      metadata.ernVersion = Platform.currentVersion
      await fileUtils.writeJSON(getContainerMetadataPath(outDir), metadata)
    }
github electrode-io / electrode-native / ern-orchestrator / src / performContainerStateUpdateInCauldron.ts View on Github external
const compositeMiniAppDir = createTmpDir()

    // Only regenerate bundle if possible
    if (jsBundleOnly) {
      try {
        log.info(
          `No native dependencies changes from ${currentContainerVersion}`
        )
        log.info('Regenerating JS bundle only')
        await runCaudronBundleGen(napDescriptor, {
          compositeMiniAppDir,
          outDir,
        })
        // Update container metadata
        const metadata = await fileUtils.readJSON(
          getContainerMetadataPath(outDir)
        )
        const miniapps = await cauldron.getContainerMiniApps(napDescriptor)
        const jsApiImpls = await cauldron.getContainerJsApiImpls(napDescriptor)
        metadata.miniApps = miniapps.map(m => m.fullPath)
        metadata.jsApiImpls = jsApiImpls.map(j => j.fullPath)
        metadata.ernVersion = Platform.currentVersion
        await fileUtils.writeJSON(getContainerMetadataPath(outDir), metadata)
      } catch (e) {
        log.error(`Something went wrong trying to regenerate JS bundle only`)
        log.error(e)
        log.error(`Falling back to full Container generation`)
        jsBundleOnly = false
      }
    } else if (publishOnly) {
      log.info(`No changes from ${currentContainerVersion}`)
      log.info('Only publishing')
github electrode-io / electrode-native / ern-orchestrator / src / Ensure.ts View on Github external
public static isContainerPath(path: string, extraErrorMessage: string = '') {
    if (!fs.existsSync(getContainerMetadataPath(path))) {
      throw new Error(
        `${path} is not a path to a Container\n${extraErrorMessage}`
      )
    }
  }