How to use the yargs.argv.env function in yargs

To help you get started, we’ve selected a few yargs 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 naver / ngrinder / ngrinder-frontend / webpack.config.js View on Github external
var argv = require('yargs').argv;
var productionBuild = argv.p || false;
var devMode = process.env.NODE_ENV !== 'production';

if (productionBuild) {
    console.log('### production build is enabled. ga is included and javascript is optmized\r');
} else {
    console.log('### production build is disabled.\r');
}

if (argv.w || argv.watch) {
    console.log('### watch is enabled');
}
// If we omit the following line, the env var for module.exports will be undefined. It's weired.
console.log('### passed env is ' + JSON.stringify(argv.env));

module.exports = function (env) {
    var ngrinderVersion = '3.5.0-SNAPSHOT';
    if (env !== undefined && env.ngrinderVersion !== undefined) {
        ngrinderVersion = env.ngrinderVersion;
    }
    console.log('### frontend version is ' + ngrinderVersion + '\r');

    var webpackConfig = {
        mode: 'production',
        performance: {
            hints: false,
        },
        entry: { 'app': ['@babel/polyfill', 'entries/app.js']},
        output: {
            path: outputDir,
github juttle / juttle / gulpfile.js View on Github external
var eslint = require('gulp-eslint');
var fs = require('fs');
var gulp = require('gulp');
var gulpif = require('gulp-if');
var istanbul = require('gulp-istanbul');
var merge = require('merge-stream');
var mocha = require('gulp-mocha');
var path = require('path');
var peg = require('gulp-peg');
var rename = require('gulp-rename');
var through = require('through2');
var Promise = require('bluebird');
var marked = require('marked');
var FileResolver = require('./lib/module-resolvers/file-resolver');

var debugOn = args.env === 'debug';

// juttle spec generate tests from markdown
var juttleSpecConvert = require('./test/spec').juttleSpec.convert;
var jspec = function() {
    // I'd promisify this but its not that simple given that we're returning
    // a gulp stream
    return through.obj(function(file, encoding, callback) {
        var markdown = fs.readFileSync(file.path, { encoding: 'utf8' });
        var js = juttleSpecConvert(markdown, { baseDir: __dirname });
        fs.writeFileSync(file.path.replace(/\.[^.]*$/, '.js'), js);
        return callback();
    });
};


gulp.task('juttle-spec-clean', function() {
github KarlPurk / redux-decorators / webpack.config.js View on Github external
var webpack = require('webpack');
var yargs = require('yargs').argv;
var testing = yargs.env === 'test';

//------------------------------------------------------------------------------
// https://github.com/webpack/webpack/issues/839#issuecomment-177219660
function getExternals() {
    var fs = require('fs');
    var nodeModules = {};

    fs.readdirSync('node_modules').forEach(function (module) {
      if (module !== '.bin') {
        nodeModules[module] = true;
      }
    });

    var nodeModulesTransform = function(context, request, callback) {
      // search for a '/' indicating a nested module
      var slashIndex = request.indexOf("/");
github tapestry-cloud / tapestry / test_project / gulpfile.js View on Github external
elixir(function (mix) {
    var env = argv.e || argv.env || 'local';
    var port = argv.p || argv.port || 3000;

    mix.less('main.less')
        .imagemin()
        .copy(elixir.config.assetsPath + '/img/favicon.ico', elixir.config.publicPath + '/img/favicon.ico')
        .exec('php ../bin/tapestry.php build --quiet --env=' + env, ['./source/*', './source/**/*', '!./source/_assets/**/*'])
        .browserSync({
            port: port,
            server: {baseDir: 'build_' + env},
            proxy: null,
            files: ['build_' + env + '/**/*']
        });
});
github lore / lore / packages / lore-generate-surge / templates / gulp / tasks / surge.es5.js View on Github external
gulp.task('surge:config',  function() {
  config.domain = argv.domain || config.domain;
  config.webpack = argv.webpack || config.webpack;
  config.env = argv.env || config.env;
});
github Logophile / logophile / tasks / utils.js View on Github external
exports.getEnvName = function () {
    return argv.env || 'development';
};
github tighten / jigsaw / stubs / elixir / gulpfile.js View on Github external
elixir(function(mix) {
    var env = argv.e || argv.env || 'local';
    var port = argv.p || argv.port || 3000;

    mix.sass('main.scss')
        .exec(bin.path() + ' build ' + env, ['./source/*', './source/**/*', '!./source/_assets/**/*'])
        .browserSync({
            port: port,
            server: { baseDir: 'build_' + env },
            proxy: null,
            files: [ 'build_' + env + '/**/*' ]
        });
});
github devanandb / webpack-mix / src / Paths.js View on Github external
mix() {
        return this.root(
            argv.env && argv.env.mixfile ? argv.env.mixfile : 'webpack.mix'
        );
    }
github lore / lore / packages / lore-generate-github / templates / gulp / tasks / github.es5.js View on Github external
gulp.task('github:config',  function() {
  config.branch = argv.branch || config.branch;
  config.webpack = argv.webpack || config.webpack;
  config.env = argv.env || config.env;
});