Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 );
// 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 );
'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,
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'
);
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 );
/**
* 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 );
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/
`;
}
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'));
}
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;
}
constructor(api: IApi) {
this.api = api;
this.cwd = api.cwd;
this.babel = resolveBin('@babel/cli', { executable: 'babel' });
this.babelRc = join(__dirname, 'babel.config');
}