How to use find-root - 10 common examples

To help you get started, we’ve selected a few find-root 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 appium / appium / commands-yml / parse.js View on Github external
uiautomator2: ['?'],
  uiautomator: ['4.2'],
  windows: ['10'],
  mac: ['?'], // TODO
};

// When was the driver supported in Appium?
const appiumRanges = {
  xcuitest: ['1.6.0'],
  uiautomator2: ['1.6.0'],
  espresso: ['1.9.0'],
  windows: ['1.6.0'],
  mac: ['1.6.4'],
};

const rootFolder = findRoot(__dirname);

// Create Handlebars helper that shows a version range
Handlebars.registerHelper('versions', function versionHelper (object, name, driverName) {
  if (!object) {
    return 'None';
  }

  if (!_.isObject(object)) {
    object = {};
  }

  let min = object[name ? `${name}_min` : 'min'];
  let max = object[name ? `${name}_max` : 'max'];

  if (!min) {
    if (name === 'appium' && _.isArray(appiumRanges[driverName])) {
github patternplate / patternplate / packages / boilerplate-server / source / application / hooks / configure / index.js View on Github external
async start(application) {
    // Load boilerplate-server core configuration
    const core = load(
      resolve(findRoot(__dirname), this.configuration.path),
      this.configuration.filter,
      application.runtime.env
    );

    // Load package.jsons
    const corePkgPath = resolve(application.runtime.base, "package.json");
    const pkgPath = resolve(application.runtime.cwd, "package.json");

    const corePkg = require(corePkgPath);
    const userPkg = require(pkgPath);
    const pkg = merge({}, corePkg, userPkg);

    // Allow user to override core behaviour via cli and *rc files
    merge(core, { pkg }, application.runtime.api);

    // Find all node modules on the way from here to the top
github emotion-js / next / packages / babel-utils / src / get-target-class-name.js View on Github external
const getPackageRootPath = memoize(filename => findRoot(filename))
github Kibibit / achievibit / src / config / config.service.ts View on Github external
import { Logger } from '@nestjs/common';
import { classToPlain, Exclude } from 'class-transformer';
import { validateSync } from 'class-validator';
import findRoot from 'find-root';
import { readJSONSync, writeJson } from 'fs-extra';
import { camelCase, get } from 'lodash';
import nconf from 'nconf';
import { join } from 'path';
import SmeeClient from 'smee-client';

import { ConfigValidationError } from '@kb-errors';
import { PackageDetailsDto } from '@kb-models';

import { AchievibitConfig } from './achievibit-config.model';

const appRoot = findRoot(__dirname);
const environment = get(process, 'env.NODE_ENV', 'development');
const eventLogger: Logger = new Logger('SmeeEvents');
(eventLogger as any).info = eventLogger.log;
const configFilePath = join(appRoot, `${ environment }.env.json`);

const packageDetails = new PackageDetailsDto(readJSONSync(join(appRoot, 'package.json')));

nconf
  .argv({
    parseValues: true
  })
  .env({
    lowerCase: true,
    parseValues: true,
    transform: transformToLowerCase
  })
github patternplate / patternplate / packages / cli / source / application / tasks / build-interface / build-statics.js View on Github external
const packageResolve = (id, directory) =>
  path.resolve(findRoot(resolve(id)), directory);
github flood-io / element / packages / cli / index.ts View on Github external
#!/usr/bin/env node

import findRoot from 'find-root'
const root = findRoot(__dirname)
import { main } from './src/element'
main(root)
github patternplate / patternplate / packages / server / source / library / index.js View on Github external
export default async options => {
  const instance = await boilerplate({
    name: "patternplate-server",
    cwd: findRoot(__dirname),
    ...options
  });

  instance.transforms = await transforms(instance);
  instance.pattern = await pattern(instance);

  const cache = await getCache(instance);
  instance.cache = cache;

  if (options.mode !== "console") {
    const readFile = getReadFile({ cache });

    readTree(path.resolve("./patterns"), cache).then(tree =>
      Promise.all(tree.map(file => readFile(file)))
    );

find-root

find the closest package.json

MIT
Latest version published 7 years ago

Package Health Score

65 / 100
Full package analysis

Popular find-root functions