How to use the ern-core.log.error function in ern-core

To help you get started, we’ve selected a few ern-core 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
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)
    }

    // Full container generation
github electrode-io / electrode-native / ern-orchestrator / src / container.ts View on Github external
return kax.task('Bundling MiniApps').run(
      bundleMiniApps(
        miniapps,
        compositeDir || createTmpDir(),
        outDir,
        napDescriptor.platform,
        {
          baseComposite,
          jsApiImplDependencies: jsApiImpls,
          pathToYarnLock: pathToYarnLock || undefined,
          resolutions,
        }
      )
    )
  } catch (e) {
    log.error(`runCauldronBundleGen failed: ${e}`)
    throw e
  }
}
github electrode-io / electrode-native / ern-container-gen / src / generators / ios / IosGenerator.ts View on Github external
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
    }
  }
github electrode-io / electrode-native / ern-orchestrator / src / runContainerPipeline.ts View on Github external
pipeline: any[]
  platform: 'android' | 'ios'
}) {
  const cauldron = await getActiveCauldron()

  let curIdx = 0
  for (const pipelineElt of pipeline || []) {
    curIdx++
    const pipelineEltPackage = PackagePath.fromString(pipelineElt.name)
    let pipelineEltType
    if (isPublisher(pipelineEltPackage)) {
      pipelineEltType = 'publisher'
    } else if (isTransformer(pipelineEltPackage)) {
      pipelineEltType = 'transformer'
    } else {
      log.error(
        `[${curIdx}/${pipeline.length}] Skipping non transformer/publisher pipeline element ${pipelineElt.name}`
      )
      continue
    }

    if (pipelineElt.disabled) {
      log.info(
        `[${curIdx}/${pipeline.length}] Skipping ${pipelineElt.name} ${pipelineEltType} [disabled]`
      )
      continue
    }

    let extra = pipelineElt.extra
    if (
      extra &&
      typeof extra === 'string' &&
github electrode-io / electrode-native / ern-orchestrator / src / composite.ts View on Github external
export function logDependenciesTree(
  parser: YarnLockParser,
  deps: PackagePath[],
  logLevel: 'debug' | 'error'
) {
  for (const dep of deps) {
    const depTree = parser.buildDependencyTree(dep)
    logLevel === 'debug'
      ? log.debug(treeify.asTree(depTree, true, true))
      : log.error(treeify.asTree(depTree, true, true))
  }
}
github electrode-io / electrode-native / ern-cauldron-api / src / CauldronHelper.ts View on Github external
public async getContainerMiniApps(
    napDescriptor: NativeApplicationDescriptor
  ): Promise {
    try {
      const miniApps = await this.cauldron.getContainerMiniApps(napDescriptor)
      return _.map(miniApps, PackagePath.fromString)
    } catch (e) {
      log.error(`[getContainerMiniApps] ${e}`)
      throw e
    }
  }
github electrode-io / electrode-native / ern-api-gen / src / DefaultCodegen.ts View on Github external
public setParameterBooleanFlagWithCodegenProperty(parameter, property) {
    if (parameter == null) {
      log.error('Codegen Parameter cannnot be null.')
      return
    }
    if (property == null) {
      log.error('Codegen Property cannot be null.')
      return
    }
    if (property.isString) {
      parameter.isString = true
      parameter.isPrimitiveType = true
    } else if (property.isBoolean) {
      parameter.isBoolean = true
      parameter.isPrimitiveType = true
    } else if (property.isLong) {
      parameter.isLong = true
      parameter.isPrimitiveType = true
    } else if (property.isInteger) {
      parameter.isInteger = true
      parameter.isPrimitiveType = true
    } else if (property.isDouble) {
      parameter.isDouble = true
github electrode-io / electrode-native / ern-orchestrator / src / composite.ts View on Github external
export function logMismatchingDependenciesTree(
  composite: Composite,
  resolution: any
) {
  const parser = YarnLockParser.fromPath(path.join(composite.path, 'yarn.lock'))
  log.error('[ == MISMATCHING NATIVE DEPENDENCIES ==]')
  logDependenciesTree(
    parser,
    resolution.pluginsWithMismatchingVersions.map(PackagePath.fromString),
    'error'
  )
}
github electrode-io / electrode-native / ern-orchestrator / src / container.ts View on Github external
)

    return kax.task('Generating Container').run(
      generator.generate({
        androidConfig: (extra && extra.androidConfig) || {},
        composite,
        ignoreRnpmAssets,
        jsMainModuleName,
        outDir,
        plugins: nativeDependencies,
        sourceMapOutput,
        targetPlatform: platform,
      })
    )
  } catch (e) {
    log.error(`runLocalContainerGen failed: ${e}`)
    throw e
  }
}
github electrode-io / electrode-native / ern-api-gen / src / DefaultCodegen.ts View on Github external
public sanitizeName(name) {
    if (name == null) {
      log.error('String to be sanitized is null. Default to ERROR_UNKNOWN')
      return 'ERROR_UNKNOWN'
    }
    if ('$' === name) {
      return 'value'
    }
    name = name.replace(new RegExp('\\[\\]', 'g'), '')
    name = name.replace(new RegExp('\\[', 'g'), '_')
    name = name.replace(new RegExp('\\]', 'g'), '')
    name = name.replace(new RegExp('\\(', 'g'), '_')
    name = name.replace(new RegExp('\\)', 'g'), '')
    name = name.replace(new RegExp('\\.', 'g'), '_')
    name = name.replace(new RegExp('-', 'g'), '_')
    name = name.replace(new RegExp(' ', 'g'), '_')
    return name.replace(new RegExp('[^a-zA-Z0-9_]', 'g'), '')
  }