How to use the ern-core.log.warn 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-api-gen / src / DefaultCodegen.ts View on Github external
public updatePropertyForMap(property, innerProperty) {
    if (innerProperty == null) {
      log.warn(`skipping invalid map property ${Json.pretty(property)}`)
      return
    } else {
      if (!this.__languageSpecificPrimitives.contains(innerProperty.baseType)) {
        property.complexType = innerProperty.baseType
      } else {
        property.isPrimitiveType = true
      }
      property.items = innerProperty
      if (this.isPropertyInnerMostEnum(property)) {
        property.isEnum = true
        this.updateDataTypeWithEnumForMap(property)
        property.allowableValues = this.getInnerEnumAllowableValues(property)
      }
    }
  }
github electrode-io / electrode-native / ern-container-gen-android / src / AndroidGenerator.ts View on Github external
public async addAndroidPluginHookClasses(
    plugins: PackagePath[],
    outDir: string
  ): Promise {
    for (const plugin of plugins) {
      if (plugin.basePath === 'react-native') {
        continue
      }
      const pluginConfig = await manifest.getPluginConfig(plugin)
      if (!pluginConfig) {
        continue
      }
      if (!pluginConfig.android) {
        log.warn(
          `Skipping ${
            plugin.basePath
          } as it does not have an Android configuration`
        )
        continue
      }
      const androidPluginHook = pluginConfig.android.pluginHook
      if (androidPluginHook) {
        log.debug(`Adding ${androidPluginHook.name}.java`)
        if (!pluginConfig.path) {
          throw new Error('No plugin config path was set. Cannot proceed.')
        }
        const pathToPluginConfigHook = path.join(
          pluginConfig.path,
          `${androidPluginHook.name}.java`
        )
github electrode-io / electrode-native / ern-local-cli / src / commands / platform / config / get.ts View on Github external
export const commandHandler = async ({ key }: { key: string }) => {
  await logErrorAndExitIfNotSatisfied({
    isValidPlatformConfig: {
      key,
    },
  })
  if (ernConfig.get(key)) {
    log.info(`Configuration value for ${key} is ${ernConfig.get(key)}`)
  } else {
    log.warn(`${key} was not found in config`)
  }
}
github electrode-io / electrode-native / ern-api-gen / src / DefaultCodegen.ts View on Github external
property = new MapProperty(inner)
        collectionFormat = qp.getCollectionFormat()
        const pr = this.fromProperty('inner', inner)
        p.baseType = pr.datatype
        p.isContainer = true
        p.isMapContainer = true
        imports.add(pr.baseType)
      } else {
        property = PropertyBuilder.build(
          type,
          qp.getFormat(),
          newHashMap(['enum', qp.getEnum()])
        )
      }
      if (property == null) {
        log.warn(
          `warning!  Property type "${type}" not found for parameter "${(param as any).getName()}", using String`
        )
        property = (new StringProperty() as any).description(
          '//TODO automatically added by swagger-codegen.  Type was ' +
            type +
            ' but not supported'
        )
      }
      property.setRequired((param as any).getRequired())
      const cp = this.fromProperty(qp.getName(), property)
      this.setParameterBooleanFlagWithCodegenProperty(p, cp)
      p.dataType = cp.datatype
      p.dataFormat = cp.dataFormat
      if (cp.isEnum) {
        p.datatypeWithEnum = cp.datatypeWithEnum
      }
github electrode-io / electrode-native / ern-api-gen / src / languages / JavascriptClientCodegen.ts View on Github external
name = this.modelNamePrefix + '_' + name
    }
    if (!isEmpty(this.modelNameSuffix)) {
      name = name + '_' + this.modelNameSuffix
    }
    name = DefaultCodegen.camelize(name)
    if (this.isReservedWord(name)) {
      const modelName = 'Model' + name
      log.warn(
        `${name} (reserved word) cannot be used as model name. Renamed to ${modelName}`
      )
      return modelName
    }
    if (name.match('^\\d.*')) {
      const modelName = 'Model' + name
      log.warn(
        `${name} (model name starts with number) cannot be used as model name. Renamed to ${modelName}`
      )
      return modelName
    }
    return name
  }
github electrode-io / electrode-native / ern-api-gen / src / java / ServiceLoader.ts View on Github external
const tryNewRequire = mod => {
  try {
    const Clz = require(mod).default
    return new Clz()
  } catch (e) {
    log.warn(`could not require ${mod}. error: ${e}`)
  }
}
export const SEARCH_PATH = [path.join(__dirname, '..', '..', 'resources')]
github electrode-io / electrode-native / ern-container-gen / src / utils.ts View on Github external
}
      if (
        excludeNativeImpl &&
        packageJson.ern.moduleType === ModuleTypes.NATIVE_API_IMPL
      ) {
        continue
      }
      const api = {
        apiName,
        apiVariableName: utils.camelize(apiName, true),
        hasConfig: containerGenConfig.hasConfig,
      }
      mustacheView.apiImplementations.push(api)
    }
  } else {
    log.warn(
      `!!!!! containerGen entry not valid for api implementation, skipping api-impl code gen in container for ${
        packageJson.name
      } !!!!`
    )
  }
}
github electrode-io / electrode-native / ern-local-cli / src / lib / logNativeDependenciesConflicts.ts View on Github external
      conflictingDependencies.foreach(p => log.warn(`- ${p}`))
      log.warn('Ignoring due to the use of the --force flag')
github electrode-io / electrode-native / ern-api-gen / src / languages / SwiftCodegen.ts View on Github external
name = name + '_' + this.modelNameSuffix
    }
    if (!StringUtils.isEmpty(this.modelNamePrefix)) {
      name = this.modelNamePrefix + '_' + name
    }
    name = DefaultCodegen.camelize(name)
    if (this.isReservedWord(name)) {
      const modelName = 'Model' + name
      log.warn(
        `${name} (reserved word) cannot be used as model name. Renamed to ${modelName}`
      )
      return modelName
    }
    if (name.match('^\\d.*')) {
      const modelName = 'Model' + name
      log.warn(
        `${name} (model name starts with number) cannot be used as model name. Renamed to ${modelName}`
      )
      return modelName
    }
    return name
  }
github electrode-io / electrode-native / ern-local-cli / src / commands / platform / plugins / search.ts View on Github external
platformVersion?: string
}) => {
  if (manifestId) {
    await logErrorAndExitIfNotSatisfied({
      manifestIdExists: {
        id: manifestId,
      },
    })
  }

  const plugin = await manifest.getNativeDependency(
    PackagePath.fromString(name),
    { manifestId, platformVersion }
  )
  if (!plugin) {
    return log.warn(
      `No plugin named ${name} was found for platform version ${platformVersion}`
    )
  }

  log.info(
    `${chalk.yellow(plugin.basePath)}@${chalk.magenta(plugin.version || '?')}`
  )
}