How to use the yargs.argv.prod 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 NorthMcCormick / Polyonic / tasks / run.js View on Github external
gulp.task('run', function(error) {
  if(argv.prod !== undefined) {
    console.log('Starting app from "build" without live-reload...')
    childProcess.spawn(electron, ['./build'], {
      stdio: 'inherit'
    })
    .on('close', function () {
        // User closed the app. Kill the host process.
      process.exit()
    })
  }else{
    console.log('Starting app from "src" with live-reload...')
    var runner = childProcess.exec('cd src && gulp dev', function (error, stdout, stderr) {
      console.log(stdout);
      console.log(stderr);

      done(error);
    });
github BraveUX / braventures / gulp / tasks / scss.js View on Github external
'use strict';

const gulp = require('gulp');
const plugins = require('gulp-load-plugins');
const $ = plugins();
const config = require('../config');
const when = require('gulp-if');
// Check if gulp scripts --prod or --production has been added to the task
const argv = require('yargs').argv;
const production = argv.prod || argv.production;

const destination = `${config.distFolder}/assets/stylesheets`;

gulp.task('scss', () => {
  return (
    gulp
      .src('./src/styles/main.scss')
      .pipe(
        $.sass({
          includePaths: config.scssIncludes
        })
      )
      .on('error', $.notify.onError('Error: <%= error.message %>'))
      .pipe(when(!production, $.sourcemaps.init()))
      .pipe($.autoprefixer())
      .pipe(when(!production, $.sourcemaps.write('./')))
github codeBelt / StructureJS / examples / troubleshooting / Gulpfile.js View on Github external
});

/**
 * Setup global variables to use across tasks
 */
global.pkg = require('./package.json');
global.env = require('./build-env.js');

global.reloadBrowser = browserSync.reload;

/**
 * Determines the build mode. Default will be read from the env file but can be overridden with a flag.
 * Flags are: --dev , --prod
 */
if (argv.prod === true || argv.dev === true) {
    global.isProd = !!argv.prod;
    global.isDev = !!argv.dev;
} else {
    global.isProd = (env.BUILD_MODE === 'prod');
    global.isDev = (env.BUILD_MODE === 'dev');
}

// -- Tasks ----------------------------------------------------------------
/**
 * Run default tasks for the target environment.
 *
 * @task default
 */
gulp.task('default', (done) => {
    runSequence(
        (isDev === true) ? ['lint', 'build'] :
        (isProd === true) ? ['build'] : [],
github Redocly / redoc / build / tasks / build.js View on Github external
gulp.task('bundle', ['injectVersionFile'], function bundle(done) {
  mkdir('-p', 'dist');
  cp('lib/index.js', path.join(paths.tmp, paths.sourceEntryPoint));
  var builder = new Builder('./', 'system.config.js');

  builder
    .buildStatic(path.join(paths.tmp, paths.sourceEntryPoint),
      outputFileName,
      { format:'umd', sourceMaps: !argv.prod, lowResSourceMaps: true, minify: argv.prod, globalName: 'Redoc' }
    )
    .then(() => {
      // wait some time to allow flush
      setTimeout(() => done(), 500);
    })
    .catch(err => done(err));
});
github ducky / play-midnight / gulpfile.js View on Github external
gulp.task('styles', function() {
		var style = gulp.src('src/scss/*.scss');

		return style
			.pipe($.sass({ outputStyle: 'compressed', errLogToConsole: true }))
			.pipe($.autoprefixer({ browsers: ['last 2 version'] }))
			.pipe($.if(argv.prod, $.minifycss()))
			.pipe(gulp.dest('dist/css'))
			.pipe($.notify({ onLast: true, message: 'Styles Task Completed' }));
	});
github thecreation / breakpoints-js / config.js View on Github external
'use strict';

import fs from 'graceful-fs';
import {argv} from 'yargs';

const production = argv.production || argv.prod || false;

export default {
  getConfig: function(pkg, src, dest) {
    return {
      version: pkg.version,
      name: pkg.name,
      title: pkg.title,
      filename: 'breakpoints',
      description: pkg.description,
      author: pkg.author,
      banner: `/**
* ${pkg.title} v${pkg.version}
* ${pkg.homepage}
*
* Copyright (c) ${pkg.author.name}
* Released under the ${pkg.license} license
github LogMeIn-BoldChat / Html-Chat-Sdk / gulpfile.js View on Github external
function getJsBoldchatSrc() {
	return getBoldchatJsSource()
		.pipe(req.if(argv.prod || argv.min, req.concat(nameJsBoldchat + '.js')))
		.pipe(req.if(argv.min, req.rename({suffix: '.min'})));
}
github vladotesanovic / angular2-express-starter / tools / builder.js View on Github external
.then(function(){
        var outputFile = argv.prod ? './public/assets/js/bundle.min.js' : './public/assets/js/bundle.js';
        return builder.buildStatic('app', outputFile, {
            minify: argv.prod,
            mangle: argv.prod,
            rollup: argv.prod
        });
    })
    .then(function() {
github communitybridge / easycla / archive / tools / builder.js View on Github external
.then(function(){
        var outputFile = argv.prod ? './public/assets/js/bundle.min.js' : './public/assets/js/bundle.js';
        return builder.buildStatic('app', outputFile, {
            minify: argv.prod,
            mangle: argv.prod,
            rollup: argv.prod
        });
    })
    .then(function() {
github parhansson / KMotionX / KMotionX / KMotionXCNC / ng2 / bundle.js View on Github external
.then(function(){
	  var outputFile = argv.prod ? 'dist/kmxcnc.min.js' : 'dist/kmxcnc.js';
	  return builder.bundle //builder.buildStatic 
    ('app', outputFile, {
      encodeNames:false,
      //sourceMaps: true,
		  minify: argv.prod,
		  mangle: argv.prod,
		  rollup: argv.prod
	  });
  })
  .then(function(){