How to use the path.resolve function in path

To help you get started, we’ve selected a few 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 ender-js / Ender / lib / package-util.js View on Github external
, getPackageRoot = function (parents, pkg) {
      var dirs = [ 'node_modules' ]

      pkg = cleanName(pkg)

      if (!isPath(pkg)) { // not a directory reference of some kind
        parents.forEach(function (p) {
          dirs.push(p)
          dirs.push(dirs[0])
        })
        return path.resolve(path.join.apply(null, dirs), pkg)
      }

      return path.resolve(pkg)
    }
github daptin / daptin / daptinweb / build / webpack.prod.conf.js View on Github external
module.resource.indexOf(
            path.join(__dirname, '../node_modules')
          ) === 0
        )
      }
    }),
    // extract webpack runtime and module manifest to its own file in order to
    // prevent vendor hash from being updated whenever app bundle is updated
    new webpack.optimize.CommonsChunkPlugin({
      name: 'manifest',
      chunks: ['vendor']
    }),
    // copy custom static assets
    new CopyWebpackPlugin([
      {
        from: path.resolve(__dirname, '../static'),
        to: config.build.assetsSubDirectory,
        ignore: ['.*']
      },
      // Copy redirects file
      {
        from: path.resolve(__dirname, '../_redirects'),
        to: config.build.assetsRoot,
        ignore: ['.*']
      }
    ])
  ]
})

if (config.build.productionGzip) {
  var CompressionWebpackPlugin = require('compression-webpack-plugin')
github shinygang / Vue-cnodejs / config / index.js View on Github external
// see http://vuejs-templates.github.io/webpack for documentation.
var path = require('path')

module.exports = {
  build: {
    env: require('./prod.env'),
    index: path.resolve(__dirname, '../dist/index.html'),
    assetsRoot: path.resolve(__dirname, '../dist'),
    assetsSubDirectory: 'public',
    assetsPublicPath: '/',
    productionSourceMap: true,
    productionGzip: false,
    productionGzipExtensions: ['js', 'css']
  },
  dev: {
    env: require('./dev.env'),
    port: 8020,
    proxyTable: {
    }
  }
}
github 54sword / react-starter / config / webpack / client.base.js View on Github external
browsers: ['last 2 versions'] // https://browserl.ist/?q=last+2+version
      })
    ]
  }
}

module.exports = {
  name: 'client',
  target: 'web',

  entry: {
    app: ['@babel/polyfill', './src/client/index.js']
  },

  output: {
    path: path.resolve(__dirname, '../../dist/client'),
    filename: devMode ? '[name].bundle.js' : '[name].[hash].js',
    publicPath: config.public_path + '/'
  },

  resolve: {
    alias: {
      '@': path.resolve('src'),
      Config: path.resolve('config/index')
    }
  },

  resolveLoader: {
    moduleExtensions: ['-loader']
  },

  optimization: {
github timoxley / linklocal / test / nested.js View on Github external
function setup () {
  rimraf.sync(path.resolve(salad, 'node_modules'))
  rimraf.sync(path.resolve(salad, 'package-lock.json'))
  rimraf.sync(path.resolve(bowl, 'node_modules'))
  rimraf.sync(path.resolve(bowl, 'package-lock.json'))
  rimraf.sync(path.resolve(apple, 'node_modules'))
  rimraf.sync(path.resolve(apple, 'package-lock.json'))
  rimraf.sync(path.resolve(banana, 'node_modules'))
  rimraf.sync(path.resolve(banana, 'package-lock.json'))
  rimraf.sync(path.resolve(almond, 'node_modules'))
  rimraf.sync(path.resolve(almond, 'package-lock.json'))
}
github ballercat / walt / packages / walt-compiler / src / utils / test-utils.js View on Github external
function resolve(file, parent) {
  const root = parent ? path.dirname(parent) : __dirname;
  return path.resolve(root, file.slice(-5) === '.walt' ? file : file + '.walt');
}
github aMarCruz / rollup-plugin-pug / src / index.js View on Github external
options (opts) {
      if (!config.basedir) {
        config.basedir = dirname(resolve(opts.entry || './'))
      }
    },
github diegonvs / gatsby-boilerplate / gatsby / onCreateWebpackConfig.js View on Github external
module.exports = ({actions, stage}) => {
	let module = {};

	if (stage === 'build-html') {
		module = {
			rules: [
				{
					test: [
						path.resolve(__dirname, '../node_modules/wowjs'),
						path.resolve(__dirname, '../node_modules/metal-clipboard')
					],
					loader: 'null-loader',
				},
			],
		};
	}

	actions.setWebpackConfig({
		module,
		resolve: {
			modules: [path.resolve(__dirname, 'src'), 'node_modules'],
			alias: {
				$components: path.resolve(__dirname, '../src/components'),
			},
		},
	});
github appcelerator / titanium_mobile / node_modules / sqlite3 / node_modules / node-pre-gyp / lib / node-pre-gyp.js View on Github external
proto.usage = function usage () {
  var str = [
      '',
      '  Usage: node-pre-gyp  [options]',
      '',
      '  where  is one of:',
      commands.map(function (c) {
        return '    - ' + c + ' - ' + require('./' + c).usage;
      }).join('\n'),
      '',
      'node-pre-gyp@' + this.version + '  ' + path.resolve(__dirname, '..'),
      'node@' + process.versions.node
  ].join('\n');
  return str;
};
github doczjs / docz / core / docz-core / src / utils / docgen / typescript.ts View on Github external
return files.filter(filepath => {
    const normalized = path.normalize(filepath)
    const fullpath = path.resolve(root, normalized)
    const hash = digest(fs.readFileSync(fullpath, 'utf-8'))
    const found = _.get(normalized, cache)
    return found && hash !== found.hash
  })
}