How to use the path-exists.sync function in path-exists

To help you get started, we’ve selected a few path-exists 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 OriginProtocol / origin / scripts / start.js View on Github external
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var historyApiFallback = require('connect-history-api-fallback');
var httpProxyMiddleware = require('http-proxy-middleware');
var detect = require('detect-port');
var clearConsole = require('react-dev-utils/clearConsole');
var checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
var formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
var getProcessForPort = require('react-dev-utils/getProcessForPort');
var openBrowser = require('react-dev-utils/openBrowser');
var prompt = require('react-dev-utils/prompt');
var pathExists = require('path-exists');
var config = require('../config/webpack.config.dev');
var paths = require('../config/paths');

var useYarn = pathExists.sync(paths.yarnLockFile);
var cli = useYarn ? 'yarn' : 'npm';
var isInteractive = process.stdout.isTTY;

// Warn and crash if required files are missing
if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
  process.exit(1);
}

// Tools like Cloud9 rely on this.
var DEFAULT_PORT = process.env.PORT || 3000;
var compiler;
var handleCompile;

// You can safely remove this after ejecting.
// We only use this block for testing of Create React App itself:
var isSmokeTest = process.argv.some(arg => arg.indexOf('--smoke-test') > -1);
github gnosis / safe-react / scripts / build.js View on Github external
require('dotenv').config({silent: true});

var chalk = require('chalk');
var fs = require('fs-extra');
var path = require('path');
var pathExists = require('path-exists');
var filesize = require('filesize');
var gzipSize = require('gzip-size').sync;
var webpack = require('webpack');
var config = require('../config/webpack.config.prod');
var paths = require('../config/paths');
var checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
var recursive = require('recursive-readdir');
var stripAnsi = require('strip-ansi');

var useYarn = pathExists.sync(paths.yarnLockFile);

// Warn and crash if required files are missing
if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
  process.exit(1);
}

// Input: /User/dan/app/build/static/js/main.82be8.js
// Output: /static/js/main.js
function removeFileNameHash(fileName) {
  return fileName
    .replace(paths.appBuild, '')
    .replace(/\/?(.*)(\.\w+)(\.js|\.css|\.jsx|\.scss)/, (match, p1, p2, p3) => p1 + p3);
}

// Input: 1024, 2048
// Output: "(+1 KB)"
github forcedotcom / salesforcedx-vscode / packages / salesforcedx-vscode-apex-replay-debugger / src / index.ts View on Github external
LAST_OPENED_LOG_FOLDER_KEY
    );
    if (lastOpenedLogFolder && pathExists.sync(lastOpenedLogFolder)) {
      return vscode.Uri.file(lastOpenedLogFolder);
    }
    // If lastOpenedLogFolder isn't defined or doesn't exist then use the
    // same directory that the SFDX download logs command would download to
    // if it exists.
    const sfdxCommandLogDir = path.join(
      vscode.workspace.workspaceFolders![0].uri.fsPath,
      '.sfdx',
      'tools',
      'debug',
      'logs'
    );
    if (pathExists.sync(sfdxCommandLogDir)) {
      return vscode.Uri.file(sfdxCommandLogDir);
    }
    // If all else fails, fallback to the .sfdx directory in the workspace
    return vscode.Uri.file(
      path.join(vscode.workspace.workspaceFolders[0].uri.fsPath, '.sfdx')
    );
  }
}
github dailymotion / webpack-multi-output / test / index.js View on Github external
it('should create all bundles and chunks', () => {
      expect(pathExists(mainBundlePathFR)).to.be.true
      expect(pathExists(mainBundlePathEN)).to.be.true
      expect(pathExists(secondBundlePathFR)).to.be.true
      expect(pathExists(secondBundlePathEN)).to.be.true
    })
github ironSource / node-generator-nom / test / util / index.js View on Github external
  let passed = files.filter(f => !exists.sync(f))
  t.deepEqual(passed, files, msg || ('not: ' + files.join(', ')))
github jus / jus / test / jus.js View on Github external
they("get a special non-filenamey key that can accessed within a handlebars template", function(){
      var file = __dirname + '/fixtures/other/nested/delicious_data.json'
      expect(exists(file)).to.be.true

      expect(context.datafiles).to.be.an('array')
      expect(context.datafiles.other_nested_delicious_data.data).to.be.an('object')
      expect(context.datafiles.other_nested_delicious_data.data.delicious).to.equal(true)
      expect(context.datafiles.other_nested_delicious_data.data.deliciousness).to.equal(9)
    })
github architect / architect / test / slow / hydrate / hydrate.js View on Github external
rm(join('**', 'node_modules'), function done(err) {
    if (err) t.fail(err)
    else t.notOk(exists(join(indexPath, 'node_modules')))
  })
}
github cappuccino / objjc / test / lib / utils.js View on Github external
exports.readFixture = name =>
{
    const parsed = path.parse(name);

    if (parsed.ext === ".map")
    {
        parsed.name = path.basename(parsed.name, path.extname(parsed.name));
        parsed.ext = ".js.map";
    }

    const fixturePath = path.join("test/fixtures", parsed.dir, parsed.base);

    expect(exists(fixturePath)).to.be.true();

    return fs.readFileSync(fixturePath, "utf8");
};
github GoogleContainerTools / kpt / docsy / node_modules / locate-path / index.js View on Github external
module.exports.sync = (iterable, opts) => {
	opts = Object.assign({
		cwd: process.cwd()
	}, opts);

	for (const el of iterable) {
		if (pathExists.sync(path.resolve(opts.cwd, el))) {
			return el;
		}
	}
};
github FredHutch / Oncoscape / client / node_modules / main-bower-files / lib / package_collection.js View on Github external
collectPackages: function() {
        if (!exists(this.opts.paths.bowerJson)) {
            throw new Error('bower.json does not exist at: ' + this.opts.paths.bowerJson);
        }

        var name,
            includeDev = this.opts.includeDev || false,
            includeSelf = this.opts.includeSelf || false,
            bowerJson = JSON.parse(stripJsonComments(readFile(this.opts.paths.bowerJson, 'utf8'))),
            devDependencies = bowerJson.devDependencies || {},
            dependencies = bowerJson.dependencies || {},
            main = bowerJson.main || {};

        includeDev = includeDev === true ? 'inclusive' : includeDev;

        this.overrides = extend(bowerJson.overrides || {}, this.overrides);

        if (includeDev !== 'exclusive') {

path-exists

Check if a path exists

MIT
Latest version published 3 years ago

Package Health Score

70 / 100
Full package analysis