How to use the app-root-path.setPath function in app-root-path

To help you get started, we’ve selected a few app-root-path 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 sidneys / ffmpeg-progressbar-cli / lib / progress-bar.js View on Github external
/**
 * Modules
 * Node
 * @constant
 */
const path = require('path')

/**
 * Modules
 * External
 * @constant
 */
const appRootPath = require('app-root-path')
appRootPath.setPath(path.join(__dirname, '..'))
const CliProgress = require('@sidneys/cli-progress')
const moment = require('moment')
/* eslint-disable no-unused-vars */
const momentDurationFormat = require('moment-duration-format')
/* eslint-enable */

/**
 * Modules
 * Internal
 * @constant
 */
const formatter = require('./formatter')
const theme = require('./theme')

/**
 * Timecode format
github openpitrix / dashboard / lib / utils.js View on Github external
const entry_file = require.main && require.main.filename;
  let rootDir;
  if (process.env.CWD) {
    rootDir = process.env.CWD;
  } else if (entry_file) {
    rootDir = entry_file.substring(
      0,
      entry_file.lastIndexOf('server/server.js')
    );
  } else {
    rootDir = process.cwd(); // not always consistent
  }
  return rootDir;
}());

appRoot.setPath(appRootDir);

const root = dir => appRoot.resolve(dir || '');

let serverConfig = {};

/**
 *
 * @param filePath
 * @returns {*} json formatted content
 */
const loadYaml = filePath => {
  try {
    return yaml.safeLoad(fs.readFileSync(filePath), 'utf8');
  } catch (e) {
    return false;
  }
github DefinitelyTyped / DefinitelyTyped / types / app-root-path / app-root-path-tests.ts View on Github external
import * as root from 'app-root-path';

let resolvedPath: string;
resolvedPath = root.resolve('../dir');
resolvedPath = root.path;
resolvedPath = root.toString();
let resolvedModule: any = root.require('app-root-path');
root.setPath('C:\\app-root');
github wix / redux-testkit / wallaby.js View on Github external
setup: function(w) {
      require('babel-polyfill');
      require('app-root-path').setPath(w.projectCacheDir);
    }
  };
github sidneys / ffmpeg-progressbar-cli / lib / formatter.js View on Github external
/**
 * Modules
 * Node
 * @constant
 */
const path = require('path')

/**
 * Modules
 * External
 * @constant
 */
const appRootPath = require('app-root-path')
appRootPath.setPath(path.join(__dirname, '..'))
const ellipsize = require('ellipsize')
const stringWidth = require('string-width')


/**
 * Ellipse character
 * @type {string}
 * @constant
 * @default
 */
const ellipseCharacter = '…'

/**
 * Convert file paths to prettified file name
 * @param {String} filePath - File path
 * @param {Number=} targetLength - File name length before adding ellipsis
github sidneys / pb-for-desktop / bin / cli.js View on Github external
/**
 * Modules
 * External
 * @constant
 */
const _ = require('lodash')
const appRootPath = require('app-root-path')
const readPkg = require('read-pkg')
const simpleReload = require('simple-reload')
const detectInstalled = require('detect-installed')
/**
 * Modules
 * Configuration
 */
appRootPath.setPath(path.join(__dirname, '..'))

/**
 * Modules
 * Internal
 * @constant
 */
const packageJson = require(path.join(appRootPath.path, 'package.json'))
const logger = require('@sidneys/logger')({ write: false })

/**
 * Filesystem
 * @constant
 * @default
 */
const applicationPath = path.join(appRootPath.path, packageJson.main)
github sidneys / pb-for-desktop / gulpfile.babel.js View on Github external
* Modules
 * External
 * @constant
 */
const appRootPath = require('app-root-path')
const electronConnect = require('electron-connect')
const gulp = require('gulp')
const logger = require('@sidneys/logger')({ write: true })
const minimist = require('minimist')


/**
 * Modules
 * Configuration
 */
appRootPath.setPath(path.join(__dirname))

/**
 * Modules
 * Internal
 * @constant
 */
const packageJson = require(path.join(appRootPath.path, 'package.json'))


/**
 * Filesystem
 * @constant
 * @default
 */
const applicationPath = path.join(appRootPath['path'], packageJson.main)
github sidneys / ffmpeg-progressbar-cli / lib / main.js View on Github external
* Modules
 * Node
 * @constant
 */
const childProcess = require('child_process')
const os = require('os')
const readline = require('readline')
const path = require('path')

/**
 * Modules
 * External
 * @constant
 */
const appRootPath = require('app-root-path')
appRootPath.setPath(path.join(__dirname, '..'))
const ellipsize = require('ellipsize')
const ini = require('ini')
const which = require('which')

/**
 * Modules
 * Internal
 * @constant
 */
const progressBar = require('./progress-bar')
const parseFFmpegLog = require('./parse-ffmpeg-log')
const predictProgressbarWidth = require('./predict-progressbar-width')
const formatter = require('./formatter')
const theme = require('./theme')

app-root-path

Determine an app's root path from anywhere inside the app

MIT
Latest version published 2 years ago

Package Health Score

67 / 100
Full package analysis