How to use the @ionic/utils-process.getPathParts function in @ionic/utils-process

To help you get started, we’ve selected a few @ionic/utils-process 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 ionic-team / ionic-cli / packages / @ionic / utils-subprocess / src / index.ts View on Github external
async function _findExecutables(program: string, { PATH = process.env.PATH, PATHEXT = process.env.PATHEXT || DEFAULT_PATHEXT }: WhichOptions = {}): Promise {
  const pathParts = getPathParts(PATH);
  let programNames: string[];

  // if windows, cycle through all possible executable extensions
  // ex: node.exe, npm.cmd, etc.
  if (TERMINAL_INFO.windows) {
    const exts = getPathParts(PATHEXT).map(ext => ext.toLowerCase());
    // don't append extensions if one has already been provided
    programNames = exts.includes(pathlib.extname(program).toLowerCase()) ? [program] : exts.map(ext => program + ext);
  } else {
    programNames = [program];
  }

  return ([] as string[]).concat(...await map(programNames, async (programName): Promise =>
    concurrentFilter(pathParts.map(p => pathlib.join(p, programName)), async p => isExecutableFile(p))));
}
github ionic-team / ionic-cli / packages / @ionic / utils-subprocess / src / index.ts View on Github external
async function _findExecutables(program: string, { PATH = process.env.PATH, PATHEXT = process.env.PATHEXT || DEFAULT_PATHEXT }: WhichOptions = {}): Promise {
  const pathParts = getPathParts(PATH);
  let programNames: string[];

  // if windows, cycle through all possible executable extensions
  // ex: node.exe, npm.cmd, etc.
  if (TERMINAL_INFO.windows) {
    const exts = getPathParts(PATHEXT).map(ext => ext.toLowerCase());
    // don't append extensions if one has already been provided
    programNames = exts.includes(pathlib.extname(program).toLowerCase()) ? [program] : exts.map(ext => program + ext);
  } else {
    programNames = [program];
  }

  return ([] as string[]).concat(...await map(programNames, async (programName): Promise =>
    concurrentFilter(pathParts.map(p => pathlib.join(p, programName)), async p => isExecutableFile(p))));
}

@ionic/utils-process

Process utils for NodeJS

MIT
Latest version published 1 year ago

Package Health Score

68 / 100
Full package analysis

Similar packages