How to use the ern-core.shell.pushd 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 / reactNativeBundleIos.ts View on Github external
if (fs.existsSync(assetsDest)) {
    shell.rm('-rf', path.join(assetsDest, '{.*,*}'))
    shell.mkdir('-p', path.join(assetsDest, 'assets'))
    // Write a dummy file to the empty `assets` directory,
    // otherwise empty directories are not pushed to git repositories
    // which will lead to issues when building the iOS Container
    // if the assets directory is missing
    fs.writeFileSync(
      path.join(assetsDest, 'assets/README.md'),
      'React Native bundled assets will be stored in this directory'
    )
  }

  await fs.ensureDir(miniAppOutPath)

  shell.pushd(cwd)

  const entryFile = fs.existsSync(path.join(cwd, 'index.ios.js'))
    ? 'index.ios.js'
    : 'index.js'

  try {
    const result = await reactnative.bundle({
      assetsDest,
      bundleOutput,
      dev: !!dev,
      entryFile,
      platform: 'ios',
      sourceMapOutput,
    })
    return result
  } finally {
github electrode-io / electrode-native / ern-container-publisher-maven / src / index.ts View on Github external
pom.version = '${containerVersion}'
              pom.artifactId = '${extra.artifactId}'
              pom.groupId = '${extra.groupId}'
              ${MavenUtils.targetRepositoryGradleStatement(url, {
                mavenPassword: extra && extra.mavenPassword,
                mavenUser: extra && extra.mavenUser,
              })}
          }
      }
  }
  `
    )

    try {
      log.info('[=== Starting build and publication ===]')
      shell.pushd(containerPath)
      await this.buildAndUploadArchive()
      log.info('[=== Completed build and publication of the Container ===]')
      log.info(`[Publication url : ${url}]`)
      log.info(
        `[Artifact: ${extra.groupId}:${extra.artifactId}:${containerVersion} ]`
      )
    } finally {
      shell.popd()
    }
  }
github electrode-io / electrode-native / ern-container-gen / src / publishers / MavenPublisher.ts View on Github external
pom.version = '${config.containerVersion}'
              pom.artifactId = '${config.extra.artifactId}'
              pom.groupId = '${config.extra.groupId}'
              ${MavenUtils.targetRepositoryGradleStatement(config.url, {
                mavenPassword: config.extra && config.extra.mavenPassword,
                mavenUser: config.extra && config.extra.mavenUser,
              })}
          }
      }
  }
  `
    )

    try {
      log.info('[=== Starting build and publication ===]')
      shell.pushd(config.containerPath)
      await this.buildAndUploadArchive()
      log.info('[=== Completed build and publication of the Container ===]')
      log.info(`[Publication url : ${config.url}]`)
      log.info(
        `[Artifact: ${config.extra.groupId}:${config.extra.artifactId}:${
          config.containerVersion
        } ]`
      )
    } finally {
      shell.popd()
    }
  }
github electrode-io / electrode-native / ern-orchestrator / src / launchOnSimulator.ts View on Github external
export async function launchOnSimulator(pathToIosRunner: string) {
  const iPhoneSim = await ios.askUserToSelectAniPhoneSimulator()
  kax.info('Killing all running Simulators')
  ios.killAllRunningSimulators()
  await kax
    .task('Booting iOS Simulator')
    .run(ios.launchSimulator(iPhoneSim.udid))
  shell.pushd(pathToIosRunner)
  try {
    await kax
      .task('Building iOS Runner project')
      .run(buildIosRunner(pathToIosRunner, iPhoneSim.udid))
    await kax
      .task('Installing iOS Runner on Simulator')
      .run(
        ios.installApplicationOnSimulator(
          iPhoneSim.udid,
          `${pathToIosRunner}/build/Debug-iphonesimulator/ErnRunner.app`
        )
      )
    await kax
      .task('Launching Runner')
      .run(ios.launchApplication(iPhoneSim.udid, 'com.yourcompany.ernrunner'))
  } finally {
github electrode-io / electrode-native / ern-orchestrator / src / launchOnDevice.ts View on Github external
export async function launchOnDevice(
  pathToIosRunner: string,
  devices,
  {
    launchArgs,
    launchEnvVars,
  }: { launchArgs?: string; launchEnvVars?: string } = {}
) {
  const iPhoneDevice = await ios.askUserToSelectAniPhoneDevice(devices)
  shell.pushd(pathToIosRunner)

  try {
    await kax
      .task('Building iOS Runner project')
      .run(buildIosRunner(pathToIosRunner, iPhoneDevice.udid))

    const kaxDeployTask = kax.task(
      `Installing iOS Runner on ${iPhoneDevice.name}`
    )
    try {
      const iosDeployInstallArgs = [
        '--bundle',
        `${pathToIosRunner}/build/Debug-iphoneos/ErnRunner.app`,
        '--id',
        iPhoneDevice.udid,
        '--justlaunch',
github electrode-io / electrode-native / ern-container-publisher-git / src / index.ts View on Github external
containerPath,
    containerVersion,
    url,
  }: {
    containerPath: string
    containerVersion: string
    url?: string
  }) {
    const workingGitDir = createTmpDir()

    if (!url) {
      throw new Error('url is required')
    }

    try {
      shell.pushd(workingGitDir)
      const git = gitCli()
      log.debug(`Cloning git repository(${url}) to ${workingGitDir}`)
      await gitCli().cloneAsync(url, '.')
      shell.rm('-rf', `${workingGitDir}/*`)
      shell.cp('-Rf', path.join(containerPath, '{.*,*}'), workingGitDir)
      await git.addAsync('./*')
      await git.commitAsync(`Container v${containerVersion}`)
      await git.tagAsync([`v${containerVersion}`])
      await git.pushAsync('origin', 'master')
      await git.pushTagsAsync('origin')
      log.info('[=== Completed publication of the Container ===]')
      log.info(`[Publication url : ${url}]`)
      log.info('[Git Branch: master]')
      log.info(`[Git Tag: v${containerVersion}]`)
    } finally {
      shell.popd()
github electrode-io / electrode-native / ern-container-publisher-jcenter / src / index.ts View on Github external
}`
    )

    shell.cp(
      path.join(__dirname, 'supplements', 'jcenter-publish.gradle'),
      path.join(containerPath, 'lib')
    )
    mustacheUtils.mustacheRenderToOutputFileUsingTemplateFile(
      path.join(containerPath, 'lib', 'jcenter-publish.gradle'),
      mustacheConfig,
      path.join(containerPath, 'lib', 'jcenter-publish.gradle')
    )

    try {
      log.info('[=== Starting build and jcenter publication ===]')
      shell.pushd(containerPath)
      await this.buildAndUploadArchive()
      log.info('[=== Completed build and publication of the Container ===]')
      log.info(
        `[Artifact: ${extra.groupId}:${extra.artifactId}:${containerVersion} ]`
      )
    } finally {
      shell.popd()
    }
  }
github electrode-io / electrode-native / ern-container-gen / src / publishers / GithubPublisher.ts View on Github external
public async publish(config: ContainerPublisherConfig) {
    const workingGitDir = createTmpDir()

    if (!config.url) {
      throw new Error('url is required for GitHub publisher')
    }

    try {
      shell.pushd(workingGitDir)
      const git = gitCli()
      log.debug(`Cloning git repository(${config.url}) to ${workingGitDir}`)
      await gitCli().cloneAsync(config.url, '.')
      shell.rm('-rf', `${workingGitDir}/*`)
      shell.cp('-Rf', path.join(config.containerPath, '{.*,*}'), workingGitDir)
      await git.addAsync('./*')
      await git.commitAsync(`Container v${config.containerVersion}`)
      await git.tagAsync([`v${config.containerVersion}`])
      await git.pushAsync('origin', 'master')
      await git.pushTagsAsync('origin')
      log.info('[=== Completed publication of the Container ===]')
      log.info(`[Publication url : ${config.url}]`)
      log.info('[Git Branch: master]')
      log.info(`[Git Tag: v${config.containerVersion}]`)
    } finally {
      shell.popd()
github electrode-io / electrode-native / ern-api-impl-gen / src / generators / android / ApiImplAndroidGenerator.ts View on Github external
public async fillHull(
    apiDependency: PackagePath,
    paths: any,
    reactNativeVersion: string,
    pluginsPaths: PackagePath[],
    apis: any[]
  ) {
    shell.pushd(ROOT_DIR)

    try {
      log.debug(
        `[=== Starting hull filling for api impl gen for ${this.platform} ===]`
      )

      const outputDirectory = path.join(paths.outDirectory, 'android')
      log.debug(
        `Creating out directory(${outputDirectory}) for android and copying container hull to it.`
      )

      fs.ensureDirSync(outputDirectory)

      fileUtils.chmodr('755', outputDirectory)
      shell.cp(
        '-Rf',
github electrode-io / electrode-native / ern-api-impl-gen / src / generators / js / ApiImplJsGenerator.ts View on Github external
public async fillHull(apiDependency: PackagePath, paths: any, apis: any[]) {
    shell.pushd(shell.pwd())
    try {
      const outputDirectory = path.join(paths.outDirectory, 'js')
      log.debug(`Creating out directory(${outputDirectory}) for JS.`)
      await fs.ensureDir(outputDirectory)
      const mustacheFile = path.join(
        Platform.currentPlatformVersionPath,
        'ern-api-impl-gen/resources/js/apiimpl.mustache'
      )

      for (const api of apis) {
        api.packageName = apiDependency.basePath
        await mustacheUtils.mustacheRenderToOutputFileUsingTemplateFile(
          mustacheFile,
          api,
          path.join(outputDirectory, `${api.apiName}ApiImpl.js`)
        )