How to use the npm-which function in npm-which

To help you get started, we’ve selected a few npm-which 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 spockjs / spockjs / integration-tests / utils.ts View on Github external
thing, it runs in ts-node as well.

  Either way, runners needs to be started with cache disabled,
  because the transform cache is only invalidated when the
  test files that use assertion blocks etc. change,
  but not when the babel plugin that transforms them changes.
*/

// paths

export const modulePath = (packageName: string) =>
  getInstalledPathSync(packageName, { local: true });

const tsconfigPath = resolve(__dirname, '..', 'tsconfig.json');

const tsNodePath = which(__dirname).sync('ts-node');

// babel / typescript helpers

/**
 * Preferred way to use JIT TypeScript compilation,
 * available when @babel/register is not required.
 * No further arguments or environment overrides required.
 * If JIT Babel compilation is also required,
 * fall back to the JitArgs/JitEnv this file exports as well.
 */
export const runWithTypescriptJit = (
  args: string[],
  options?: SpawnSyncOptions,
) => run(tsNodePath, ['--project', tsconfigPath, ...args], options);

export const requireBabelJitArgs = ['--require', '@babel/register'];

npm-which

Locate a program or locally installed node module's executable

MIT
Latest version published 8 years ago

Package Health Score

53 / 100
Full package analysis

Popular npm-which functions