How to use the ern-core.log.debug 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-container-gen / src / utils.ts View on Github external
// 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)
}
github electrode-io / electrode-native / ern-container-gen / src / generators / ios / IosGenerator.ts View on Github external
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
    }
  }
github electrode-io / electrode-native / ern-container-gen / src / generators / android / AndroidGenerator.ts View on Github external
'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
    }
  }
github electrode-io / electrode-native / ern-container-gen / src / publishers / JcenterPublisher.ts View on Github external
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'
github electrode-io / electrode-native / ern-api-impl-gen / src / generators / ios / ApiImplIosGenerator.ts View on Github external
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)
      })
    })
  }
github electrode-io / electrode-native / ern-api-impl-gen / src / generators / ios / ApiImplIosGenerator.ts View on Github external
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
      )
github electrode-io / electrode-native / ern-orchestrator / src / composite.ts View on Github external
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'
  )
}
github electrode-io / electrode-native / ern-container-gen-android / src / AndroidGenerator.ts View on Github external
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',
                })
              })
            }
github electrode-io / electrode-native / ern-container-gen-ios / src / IosGenerator.ts View on Github external
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' })
        )
      }
    }
  }
github electrode-io / electrode-native / ern-container-gen / src / generators / ios / IosGenerator.ts View on Github external
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
    }
  }