How to use the resolve-bin.sync function in resolve-bin

To help you get started, we’ve selected a few resolve-bin 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 WordPress / gutenberg / packages / scripts / scripts / lint-pkg-json.js View on Github external
hasPackageProp( 'npmPackageJsonLintConfig' );

const defaultConfigArgs = ! hasLintConfig ?
	[ '--configFile', fromConfigRoot( 'npmpackagejsonlint.json' ) ] :
	[];

// See: https://github.com/tclindner/npm-package-json-lint/#cli-commands-and-configuration.
const hasIgnoredFiles = hasCliArg( '--ignorePath' ) ||
	hasProjectFile( '.npmpackagejsonlintignore' );

const defaultIgnoreArgs = ! hasIgnoredFiles ?
	[ '--ignorePath', fromConfigRoot( '.npmpackagejsonlintignore' ) ] :
	[];

const result = spawn(
	resolveBin( 'npm-package-json-lint', { executable: 'npmPkgJsonLint' } ),
	[ ...defaultConfigArgs, ...defaultIgnoreArgs, ...args, defaultFilesArgs ],
	{ stdio: 'inherit' }
);

process.exit( result.status );
github WordPress / gutenberg / packages / scripts / scripts / format-js.js View on Github external
// forward the --require-pragma option that formats only files that already have the @format
// pragma in the first docblock.
const pragmaArgs = hasArgInCLI( '--require-pragma' ) ? [ '--require-pragma' ] : [];

// Get the files and directories to format and convert them to globs
let fileArgs = getFileArgsFromCLI();
if ( fileArgs.length === 0 ) {
	fileArgs = [ '.' ];
}

// Converts `foo/bar` directory to `foo/bar/**/*.js`
const globArgs = dirGlob( fileArgs, { extensions: [ 'js' ] } );

const result = spawn(
	resolveBin( 'prettier' ),
	[ '--write', ...ignoreArgs, ...pragmaArgs, ...globArgs ],
	{ stdio: 'inherit' }
);

process.exit( result.status );
github ipfs / aegir / src / build / experimental-browser.js View on Github external
'use strict'
const resolveBin = require('resolve-bin')
const execa = require('execa')
const { fromAegir } = require('./../utils')
const bin = resolveBin.sync('webpack-cli')
const rimraf = require('rimraf')
const path = require('path')

// Clean dist
rimraf.sync(path.join(process.cwd(), 'dist'))

// Run webpack
module.exports = (argv) => {
  const analyze = Boolean(process.env.AEGIR_BUILD_ANALYZE || argv.analyze)
  const input = argv._.slice(1)
  const useBuiltinConfig = !input.includes('--config')
  const config = useBuiltinConfig
    ? ['--config', fromAegir('src/config/webpack.config.js')]
    : []
  return execa(bin, [
    ...config,
github rtsao / unitest / test / index.js View on Github external
const fs = require('fs');
const test = require('tape');
const path = require('path');
const http = require('http');
const spawn = require('child_process').spawn;
const Parser = require('tap-parser');
const resolveBin = require('resolve-bin');
const concat = require('concat-stream');

const unitest = require('..');
const runNode = require('../lib/run-node');
const runChrome = require('../lib/run-chrome');

const cliPath = path.join(process.cwd(), 'bin/cli.js');
const nycPath = resolveBin.sync('nyc');

const passingEntry = path.resolve(__dirname, '../fixtures/passing.js');
const failingEntry = path.resolve(__dirname, '../fixtures/failing.js');
const mockEntry = path.resolve(__dirname, '../fixtures/mock-entry.js');
const errorEntry = path.resolve(__dirname, '../fixtures/error.js');
const unhandledEntry = path.resolve(
  __dirname,
  '../fixtures/unhandled-rejection.js'
);
const exit123Entry = path.resolve(__dirname, '../fixtures/exit-123.js');
const slowPassingEntry = path.resolve(__dirname, '../fixtures/slow-passing.js');

const passingEntryBrowser = path.resolve(
  __dirname,
  '../fixtures/browser/passing.js'
);
github WordPress / gutenberg / packages / scripts / scripts / check-engines.js View on Github external
const args = getArgsFromCLI();

const hasConfig = hasArgInCLI( '--package' ) ||
	hasArgInCLI( '--node' ) ||
	hasArgInCLI( '--npm' ) ||
	hasArgInCLI( '--yarn' );
const config = ! hasConfig ?
	[
		'--node', '>=10.0.0',
		'--npm', '>=6.0.0',
	] :
	[];

const result = spawn(
	resolveBin( 'check-node-version' ),
	[ ...config, ...args ],
	{ stdio: 'inherit' }
);

process.exit( result.status );
github WordPress / gutenberg / packages / scripts / scripts / start.js View on Github external
/**
 * External dependencies
 */
const { sync: spawn } = require( 'cross-spawn' );
const { sync: resolveBin } = require( 'resolve-bin' );

/**
 * Internal dependencies
 */
const { getWebpackArgs } = require( '../utils' );

const { status } = spawn(
	resolveBin( 'webpack' ),
	getWebpackArgs( [ '--watch' ] ),
	{ stdio: 'inherit' }
);
process.exit( status );
github umijs / umi-lint / src / index.js View on Github external
constructor(rawArgv) {
    super(rawArgv);

    this.options = require('./options');
    this.eslint = resolveBin('eslint');
    this.stylelint = resolveBin('stylelint');
    this.prettier = resolveBin('prettier');

    this.usage = `
      Usage: umi-lint [options] file.js [file.js] [dir]
        umi-lint --prettier --stylelint src/
        umi-lint --staged --prettier --stylelint
        umi-lint --eslint.debug --tslint.force -s.formatter=json -p.no-semi src/ test/
    `;
  }
github umijs / umi-plugin-library / packages / umi-plugin-library / src / plugins / library-build / index.ts View on Github external
constructor(api) {
    this.api = api;
    this.cwd = api.paths.cwd || process.cwd();
    this.babel = resolveBin('@babel/cli', { executable: 'babel' });
    this.babelRc = join(__dirname, 'babel.config');
    this.baseFolder = this.getBaseFolder();
    this.hasIndex = fs.existsSync(join(this.baseFolder, 'index.js'));
  }
github umijs / umi-plugin-library / packages / umi-plugin-docz / src / index.ts View on Github external
constructor(api: IApi) {
    this.doczPath = resolveBin('docz', { executable: 'docz' });
    this.rcPath = path.join(__dirname, 'doczrc.js');
    this.distDir = path.join(api.cwd, '.docz/dist');
    this.api = api;
  }
github umijs / umi-plugin-library / packages / umi-plugin-library / src / build / babel / index.ts View on Github external
constructor(api: IApi) {
    this.api = api;
    this.cwd = api.cwd;
    this.babel = resolveBin('@babel/cli', { executable: 'babel' });
    this.babelRc = join(__dirname, 'babel.config');
  }

resolve-bin

Resolves the full path to the bin file of a given package by inspecting the "bin" field in its package.json.

MIT
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis

Popular resolve-bin functions