How to use the ern-core.shell.rm 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.js View on Github external
export function clearReactPackagerCache () {
  const TMPDIR = process.env['TMPDIR']
  if (TMPDIR) {
    shell.rm('-rf', `${TMPDIR}/react-*`)
  }
}
github electrode-io / electrode-native / ern-container-gen / src / clearReactPackagerCache.ts View on Github external
export function clearReactPackagerCache() {
  const TMPDIR = process.env.TMPDIR
  if (TMPDIR) {
    shell.rm('-rf', path.join(TMPDIR, 'react-*'))
  }
}
github electrode-io / electrode-native / ern-cauldron-api / src / CauldronRepositories.ts View on Github external
private updateCauldronRepoInUse({ alias }: { alias?: string } = {}) {
    config.set('cauldronRepoInUse', alias)
    shell.rm('-rf', Platform.cauldronDirectory)
  }
github electrode-io / electrode-native / ern-api-gen / src / apigen.js View on Github external
export async function cleanGenerated (outFolder: string = process.cwd()) {
  const pkg = await validateApiNameAndGetPackageJson('This is not a properly named API directory. Naming convention is react-native-{name}-api')

  shell.rm('-rf', path.join(outFolder, 'javascript'))
  shell.rm('-rf', path.join(outFolder, 'swift'))
  shell.rm('-rf', path.join(outFolder, 'android'))
  shell.rm('-rf', path.join(outFolder, 'IOS'))
  shell.rm('-rf', path.join(outFolder, FLOW_CONFIG_FILE))
  shell.rm('-rf', path.join(outFolder, PKG_FILE))
  return pkg
}
github electrode-io / electrode-native / ern-api-impl-gen / src / ApiImpl.js View on Github external
message: `An implementation directory already exists in ${outputDirectoryPath}. Do you want to delete this and regenerate this project?`,
        default: false
      }
    )

    if (!shouldRegenerate) {
      throw Error('An implementation directory already exists')
    } else {
      forceGenerate = true
    }
  }

  if (forceGenerate && fs.existsSync(outputDirectoryPath)) {
    log.info(`Deleting the existing directory and recreating a new one in ${outputDirectoryPath}`)
    fileUtils.chmodr('777', outputDirectoryPath)
    shell.rm('-Rf', outputDirectoryPath)
  } else {
    log.debug(`creating output dir: ${outputDirectoryPath}`)
  }
  shell.mkdir('-p', outputDirectoryPath)
}
github electrode-io / electrode-native / ern-container-publisher-git / src / index.ts View on Github external
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-gen / src / utils.js View on Github external
function cleanupMiniAppsCompositeDir (dir: string) {
  shell.rm('-rf', [
    '.babelrc',
    'index.android.js',
    'index.ios.js',
    'node_modules',
    'package.json',
    'yarn.lock'
  ].map(file => path.join(dir, file)))
}
github electrode-io / electrode-native / ern-container-gen / src / generators / ios / IosGenerator.js View on Github external
prepareDirectories (config: ContainerGeneratorConfig) {
    if (!fs.existsSync(config.outDir)) {
      shell.mkdir('-p', config.outDir)
    } else {
      shell.rm('-rf', path.join(config.outDir, '{.*,*}'))
    }

    if (!fs.existsSync(config.compositeMiniAppDir)) {
      shell.mkdir('-p', config.compositeMiniAppDir)
    } else {
      shell.rm('-rf', path.join(config.compositeMiniAppDir, '{.*,*}'))
    }

    if (!fs.existsSync(config.pluginsDownloadDir)) {
      shell.mkdir('-p', config.pluginsDownloadDir)
    } else {
      shell.rm('-rf', path.join(config.pluginsDownloadDir, '{.*,*}'))
    }
  }