How to use the app-root-path.resolve 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 coountdown / coountdown / main / index.js View on Github external
app.on('ready', async () => {
  // Checking internet connection
  onlineStatusWindow = new BrowserWindow({
    width: 0,
    height: 0,
    show: false,
  })

  onlineStatusWindow.loadURL(`file://${resolveRootPath('./main/static/pages/online-status.html')}`)

  // Update internet connection
  ipcMain.on('online-status-changed', (event, status) => {
    console.log(`connection: ${status.toUpperCase()}`)
    process.env.CONNECTION = status
  })

  electronUtil.enforceMacOSAppLocation()
  updater(app)
  mixpanel.track(app, 'Launch App')

  try {
    tray = new Tray(resolveRootPath('./main/static/tray/iconTemplate.png'))
    tray.setToolTip(config.APP_NAME)
  } catch (err) {
    Sentry.captureException(err)
github MozillaSecurity / virgo / configs / parcel / bundler.js View on Github external
/** @format */

// https://github.com/parcel-bundler/parcel/issues/1005#issuecomment-419688410

const Bundler = require('parcel-bundler')
const Server = require('express')()
const appRoot = require('app-root-path')

const options = {
  outDir: appRoot.resolve('build/app/renderer/development'), // The out directory to put the build files in, defaults to dist
  outFile: 'index.html', // The name of the outputFile
  //  publicUrl: './', // The url to server on, defaults to dist
  watch: true, // whether to watch the files and rebuild them on change, defaults to process.env.NODE_ENV !== 'production'
  cache: true, // Enabled or disables caching, defaults to true
  cacheDir: appRoot.resolve('.cache'), // The directory cache gets put in, defaults to .cache
  contentHash: false, // Disable content hash from being included on the filename
  minify: false, // Minify files, enabled if process.env.NODE_ENV === 'production'
  scopeHoist: false, // turn on experimental scope hoisting/tree shaking flag, for smaller production bundles
  target: 'electron', // browser/node/electron, defaults to browser
  https: false, // Serve files over https or http, defaults to false
  logLevel: 3, // 3 = log everything, 2 = log warnings & errors, 1 = log errors
  hmrPort: 0, // The port the HMR socket runs on, defaults to a random free port (0 in node.js resolves to a random free port)
  sourceMaps: true, // Enable or disable sourcemaps, defaults to enabled (not supported in minified builds yet)
  hmrHostname: '', // A hostname for hot module reload, default to ''
  detailedReport: false // Prints a detailed report of the bundles, assets, filesizes and times, defaults to false, reports are only printed if watch is disabled
}

const runBundle = async (entrypoint, port) => {
  // Initializes a bundler using the entrypoint location and options provided.
  const bundler = new Bundler(entrypoint, options)
github Tencent / bk-PaaS / paas-ce / lesscode / lib / server / controller / vue-code.js View on Github external
async deleteTmpFile (ctx) {
        try {
            const post = ctx.request.body || {}
            const filePath = STATIC_URL + post.fileName
            await deleteFile(appRoot.resolve(filePath))
            ctx.send({
                code: 0,
                message: 'success',
                data: 'delete suc'
            })
        } catch (err) {
            console.log(err, 'delete err')
            ctx.throwError({
                message: err.message
            })
        }
    }
}
github alibaba / ice / tools / iceworks / app / main / createTouchBar.js View on Github external
function createIcon(path) {
  return nativeImage.createFromPath(
    resolve(`./static/touchbar/${path}.png`)
  );
}
github xing / hops / lib / config.js View on Github external
function getSourceDir() {
  try { return path.dirname(require.resolve(appRoot)); }
  catch (e) { return appRoot.resolve('src'); }
}
github xing / hops / etc / webpack.dll.js View on Github external
merge(defaults, {
    output: {
      path: appRoot.resolve('.tmp/webpack/watch')
    },
    devtool: '#eval-source-map',
    plugins: [
      new webpack.DllPlugin({
        context: appRoot.toString(),
        path: appRoot.resolve('.tmp/webpack/watch/[name].json'),
        name: '__[name]__'
      })
    ]
  }),
  merge(defaults, {
    output: {
      path: appRoot.resolve('.tmp/webpack/build')
    },
    plugins: [
      new webpack.DllPlugin({
        context: appRoot.toString(),
        path: appRoot.resolve('.tmp/webpack/build/[name].json'),
        name: '__[name]__'
      }),
      new webpack.DefinePlugin({
        'process.env.NODE_ENV': '"production"'
      }),
      new webpack.optimize.DedupePlugin(),
      new webpack.optimize.UglifyJsPlugin({
        compress: { warnings: false, unused: true, 'dead_code': true },
        output: { comments: false }
      })
    ]
github openpitrix / dashboard / lib / utils.js View on Github external
const root = dir => appRoot.resolve(dir || '');
github simonepri / geo-maps / gulp / folders.js View on Github external
'use strict';

const root = require('app-root-path');

module.exports = {
  tmpDir: root.resolve('tmp'),
  mapsDir: root.resolve('maps'),
  distDir: root.resolve('dist'),
  buildDir: root.resolve('build'),
  pkgsDir: root.resolve('pkgs'),

  tplDir: root.resolve('tpls'),
  prevDir: root.resolve('previews')
};
github xing / hops / etc / helpers.js View on Github external
['config', 'template'].forEach(function (key) {
      if (config[key] && !fileExists[config[key]]) {
        config[key] = appRoot.resolve(config[key]);
      }
    });
    return config;

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