How to use app-root-dir - 10 common examples

To help you get started, we’ve selected a few app-root-dir 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 ctrlplusb / code-split-component / tools / scripts / flow.js View on Github external
/* @flow */

// Runs flow type checking.

import { existsSync } from 'fs';
import { resolve as resolvePath } from 'path';
import appRootDir from 'app-root-dir';
import { exec } from '../utils';

if (!existsSync(resolvePath(appRootDir.get(), './flow-typed'))) {
  console.warn('You haven\'t installed the flow-typed definitions. Please run the `npm run flow:defs` command if you would like to install them.');
}

try {
  exec('flow');
} catch (err) {
  // Flow will print any errors.
  process.exit(1);
}
github hanayik / CAM / core.js View on Github external
const { remote, shell } = require('electron')
const {Menu, MenuItem} = remote
const path = require('path')
const csvsync = require('csvsync')
const fs = require('fs')
const $ = require('jQuery')
const {app} = require('electron').remote;
app.setName('CAM')
const appRootDir = require('app-root-dir').get() //get the path of the application bundle
const ffmpeg = appRootDir+'/ffmpeg/ffmpeg'
const exec = require( 'child_process' ).exec
const si = require('systeminformation');
const mkdirp = require('mkdirp');
var ipcRenderer = require('electron').ipcRenderer;
var moment = require('moment')
var content = document.getElementById("contentDiv")
var localMediaStream
var sys = {
  modelID: 'unknown',
  isMacBook: false // need to detect if macbook for ffmpeg recording framerate value
}
var exp = new experiment('CAM')
var rec = new ff()
exp.getRootPath()
exp.getMediaPath()
github strues / boldr / src / server / middleware / clientBundle.js View on Github external
/* @flow */

import { resolve as pathResolve } from 'path';
import express from 'express';
import appRootDir from 'app-root-dir';
// import config from '../../../config';

// Middleware to server our client bundle.
export default express.static(
  // client bundle output path
  pathResolve(appRootDir.get(), 'boldrCMS/client'),
  { maxAge: '365d' },
);
github quran / quran.com-frontend / internal / development / createVendorDLL.js View on Github external
function webpackConfigFactory() {
    return {
      // We only use this for development, so lets always include source maps.
      devtool: 'inline-source-map',
      entry: {
        [dllConfig.name]: devDLLDependencies
      },
      output: {
        path: pathResolve(appRootDir.get(), bundleConfig.outputPath),
        filename: `${dllConfig.name}.js`,
        library: dllConfig.name
      },
      plugins: [
        new webpack.DllPlugin({
          path: pathResolve(
            appRootDir.get(),
            bundleConfig.outputPath,
            `./${dllConfig.name}.json`
          ),
          name: dllConfig.name
        })
      ]
    };
  }
github olymp / olymp / universally / tools / webpack / configFactory.js View on Github external
_app_: resolve(config.bundlesSharedSrcPath),
        _shared_: path.resolve(base, 'src', 'shared'),
        _server_: path.resolve(appRootDir.get(), 'server'),
      }),
      modules: [
        path.resolve(appRootDir.get(), 'node_modules'),
        path.resolve(base, '..', 'node_modules'),
        'node_modules',
      ],
      // These extensions are tried when resolving a file.
      extensions: config.bundleSrcTypes.map(ext => `.${ext}`),
    },

    resolveLoader: {
      modules: [
        path.resolve(appRootDir.get(), 'node_modules'),
        path.resolve(base, '..', 'node_modules'),
        'node_modules',
      ],
    },

    plugins: removeEmpty([
      // Required support for code-split-component, which provides us with our
      // code splitting functionality.
      //
      // The code-split-component doesn't work nicely with React Hot Loader,
      // which we use in our development builds, so we will disable it (which
      // causes synchronous loading behaviour for the CodeSplit instances).
      ifProd(() => new CodeSplitPlugin()),

      // We use this so that our generated [chunkhash]'s are only different if
      // the content for our respective chunks have changed.  This optimises
github olymp / olymp / scripts.js View on Github external
const exists = (p, throwError) => {
  const doesExist = fs.existsSync(path.resolve(appRootDir.get(), `${p}.js`)) || fs.existsSync(path.resolve(appRootDir.get(), p, 'index.js'));
  if (!doesExist && throwError) throw new Error(`${p} not found in your root dir!`);
  else if (!doesExist) console.log(`${p} not found in your root dir!`);
  return doesExist;
};
github livepeer / LivepeerDesktop / app / main.js View on Github external
request("http://localhost:"+httpPort+"/localStreams", function(err, res, body) {
    if (err == null) {
      if (global.sharedObj.livepeerProc == null) {
        global.sharedObj.livepeerProc = "local"
        sender.send("showMsg", "Local livepeer node already running. Using that instead of launching new node.")
      }
    } else {
      if (global.sharedObj.livepeerProc == null) {

        var appRootDir = require('app-root-dir').get();
        var livepeerPath = appRootDir+'/node_modules/livepeer/livepeer --ffmpegPath ' + appRootDir + '/node_modules/ffmpeg' + ' < ' + appRootDir + '/node_modules/livepeer/enters.txt';
        var livepeerProc = spawn(appRootDir+"/node_modules/livepeer/livepeer", ["--ffmpegPath", appRootDir+"/node_modules/ffmpeg", "--datadir", homeDir+"/Livepeer/livepeernet"])
        livepeerProc.stdin.write("\n\n\n\n\n")
        global.sharedObj.livepeerProc = livepeerProc;
        livepeerProc.stdout.on('data', (data) => {
          log.info(`stdout: ${data}`);
        });

        livepeerProc.stderr.on('data', (data) => {
          log.info(`stderr: ${data}`);
        });

        livepeerProc.on('close', (code) => {
          log.info(`child process exited with code ${code}`);
        });
github neo-one-suite / neo-one / scripts / ts / createGuards.ts View on Github external
const run = () => {
  const tsConfigFilePath = path.resolve(appRootDir.get(), 'tsconfig.json');
  const res = ts.readConfigFile(tsConfigFilePath, (value) => fs.readFileSync(value, 'utf8'));
  const parseConfigHost = {
    fileExists: fs.existsSync,
    readDirectory: ts.sys.readDirectory,
    readFile: ts.sys.readFile,
    useCaseSensitiveFileNames: true,
  };
  const parsed = ts.parseJsonConfigFileContent(res.config, parseConfigHost, path.dirname(tsConfigFilePath));

  const typescriptFile = path.resolve(appRootDir.get(), 'node_modules', 'typescript', 'lib', 'typescript.d.ts');
  const program = ts.createProgram({
    options: parsed.options,
    rootNames: [typescriptFile],
  });
  ts.getPreEmitDiagnostics(program);
github strues / boldr / packages / boldr-cms / tools / webpack / configFactory.js View on Github external
ifClient(() =>
        new AssetsPlugin({
          filename: config.bundleAssetsFileName,
          path: path.resolve(appRootDir.get(), bundleConfig.outputPath),
        }),
      ),
github ff14wed / aetherometer / ui / src / main / core.ts View on Github external
private get resourcesPath() {
    return isDevelopment ?
      path.join(appRootDir.get(), '..', 'resources') :
      path.join(appRootDir.get());
  }

app-root-dir

Simple module to infer the root directory of the currently running node application

MIT
Latest version published 9 years ago

Package Health Score

65 / 100
Full package analysis

Popular app-root-dir functions