Пример #1
0
 _.forEach(lm.help.options, function (option) {
   if (option.flag === 'version' || option.flag === 'help') return;
   yargs.option(option.flag, {
     alias: option.shorthand,
     describe: option.description
   })
 });
Пример #2
0
gulp.task('doc', ['altspace_js', 'bump-readme'], function () {
    var argv = yargs.option(
        'clientjs',
        {
            describe: 'Path to the directory containing altspace-client.js',
            demand: false
        }
    ).argv

    if (!argv.clientjs) {
        argv.clientjs = "../UnityClient/js/src";
    }

    if (argv.clientjs) {
        docfiles.push(argv.clientjs + '/*.js');
    }
    console.log('deleting old docs');
    return gulp.src(docfiles)
        .pipe(jsdoc('./doc', {
            path: path.resolve('node_modules/minami'),
            default: {
                outputSourceFiles: false
            }
        }, {
            plugins: ['plugins/markdown']
        }));
});
Пример #3
0
export function run() {
    const argv = yargs
        .option('i', {
            alias: "input",
            type: "string",
            describe: "Path to dir with svg files"
        })
        .option('o', {
            alias: 'output',
            type: 'string',
            describe: 'Path to dir with results, it not defined, input will be used'
        })
        .option('w', {
            alias: 'width',
            type: 'number',
            describe: 'With of result png'
        })
        .option('h', {
            alias: 'height',
            type: 'number',
            describe: 'Height of result png'
        })
        .option('t', {
            alias: 'threads',
            type: 'number',
            describe: 'Number of threads'
        })
        .option('phantom', {
            type: 'string',
            describe: 'Path to alternative phantom'
        })
        .demand(['i'])
        .addHelpOpt("help")
        .argv;

    let { i: srcDir, o: dstDir, w: width, h: height, t: threads, phantom: phantomPath } = argv;
    dstDir = dstDir || srcDir;
    if (phantomPath) {
        // TODO this hack allows override path to default PhantomJS path from path from phantom module
        // find better way to configure this
        let phantom = require('phantomjs-prebuilt');
        phantom.path = phantomPath;
    }
    svg2png(srcDir, dstDir, {width, height}, threads)
        .then(results => {
            if (Array.isArray(results)) {
                console.log(`${results.length} files have been converted successfully`);
            } else {
                console.log(`Completed with result ${results}`);
            }
        }, errors => {
            if (!Array.isArray(errors)) {
                errors = [errors];
            }
            console.error(`Completed with ${errors.length} errors`);
            errors.forEach(error => console.error(error.stack || error));
        });
}
Пример #4
0
function parseCommandLine() {
    yargs.option("config", {
        demand: true,
        describe: "configuration file",
        type: "string"
    })
        .default({ config: "/host/etc/dockercup.conf.json" });

}
Пример #5
0
	function parseArgs() {

		var args = require('yargs');

		args.usage('Usage: $0 [options]');
		args.help('h').alias('h', 'help');

		args.option('d', {alias:'dining-room', describe:'Control dining room lights', default:false});
		args.option('l', {alias:'living-room', describe:'Control living room lights', default:false});
		args.option('o', {alias:'office',      describe:'Control office lights', default:false});
		args.option('c', {alias:'cellar',      describe:'Control cellar lights', default:false});
		args.option('t', {alias:'terrace',     describe:'Control terrace lights', default:false});
		args.option('a', {alias:'all',         describe:'Control all lights', default:true});
		args.option('L', {alias:'listen',      describe:'Start socket service', default:false});
		args.option('p', {alias:'port',        describe:'Listen to specified port', default:3010});

		args.wrap(null);

		args.check(function(argv) {
			return true;
		});

		return args.argv;
	}
Пример #6
0
const SIMPLIFIED_LANGUAGES = {
  en: 'english',
  fr: 'french',
  de: 'german',
  it: 'italian',
  sp: 'spanish'
};

const SUPPORTED_LEVELS = [
  'poetic'
];

const argv = yargs
  .option('lang', {
    alias: 'l',
    type: 'string',
    choices: SUPPORTED_LANGUAGES.concat(Object.keys(SIMPLIFIED_LANGUAGES)),
    default: null
  })
  .option('level', {
    type: 'string',
    choices: SUPPORTED_LEVELS,
    default: 'poetic'
  })
  .option('detail', {
    type: 'boolean',
    default: false
  })
  .help('h')
  .alias('h', 'help')
  .locale('en')
import gulpLoadPlugins from 'gulp-load-plugins';
import runSequence from 'run-sequence';
import { output as pagespeed } from 'psi';
import username from 'username';
import taskListing from 'gulp-task-listing';
import yargs from 'yargs';
import process from 'process';
import { generate as fontAwesomeGenerate } from 'font-awesome-svg-png/index';
// How bad is it to be importing from local files into our gulpfile?
// It means changes from the assets/ or dancedeets-common code now will sometimes require re-running gulp.
import { cdnBaseUrl } from '../common/js/util/url';
import exportedIcons from './assets/js/exportedIcons';

const argv = yargs
  .option('d', {
    alias: 'gae_dir',
    description: 'The directory containing dev_appserver.py',
    default: './frankenserver/python',
  })
  .help('h')
  .alias('h', 'help')
  .strict().argv;

gulp.task('help', taskListing);
gulp.task('default', taskListing);

const $ = gulpLoadPlugins();

const baseAssetsDir = `/Users/${username.sync()}/Dropbox/dancedeets-development/server/build-assets`;
const generatedFilesDir = `/Users/${username.sync()}/Dropbox/dancedeets-development/server/generated`;

// download the PR* data from GC Datastore, generate sqlite databases, and then upload them to GC Storage
Пример #8
0
 * @format
 */
'use strict';

/**
 * This script bumps a new version for open source releases.
 * It updates the version in json/gradle files and makes sure they are consistent between each other
 * After changing the files it makes a commit and tags it.
 * All you have to do is push changes to remote and CI will make a new build.
 */
const fs = require('fs');
const {cat, echo, exec, exit, sed} = require('shelljs');
const yargs = require('yargs');

let argv = yargs.option('r', {
  alias: 'remote',
  default: 'origin',
}).argv;

// Check we are in release branch, e.g. 0.33-stable
let branch = exec('git symbolic-ref --short HEAD', {
  silent: true,
}).stdout.trim();

if (branch.indexOf('-stable') === -1) {
  echo('You must be in 0.XX-stable branch to bump a version');
  exit(1);
}

// e.g. 0.33
let versionMajor = branch.slice(0, branch.indexOf('-stable'));
#! /usr/bin/env node

"use strict";

const util_1 = require("./util");
const promise_1 = require("./promise");
const path = require("path");
const bluebird_1 = require("bluebird");
const yargs = require("yargs");
//noinspection JSUnusedLocalSymbols
const __awaiter = require("./awaiter");
const args = yargs.option("arch", {
    choices: ["ia32", "x64", "all"]
}).argv;
const projectDir = process.cwd();
const devPackageFile = path.join(projectDir, "package.json");
function main() {
    return __awaiter(this, void 0, void 0, function* () {
        const devMetadata = yield util_1.readPackageJson(devPackageFile);
        const results = yield bluebird_1.Promise.all([util_1.computeDefaultAppDirectory(projectDir, util_1.use(devMetadata.directories, it => it.app)), util_1.getElectronVersion(devMetadata, devPackageFile)]);
        yield util_1.installDependencies(results[0], results[1], args.arch);
    });
}
try {
    main();
} catch (e) {
    promise_1.printErrorAndExit(e);
}
//# sourceMappingURL=install-app-deps.js.map
Пример #10
0
'use strict';

const yargs = require('yargs');

yargs.option('host', {
    alias: 'h',
    describe: 'myraid host to connect to (defaults to 0.0.0.0)',
    default: '0.0.0.0'
});

yargs.option('port', {
    alias: 'p',
    describe: 'myraid port to connect to (defaults to 2666)',
    default: '2666'
});

module.exports = yargs.argv;
Пример #11
0
'use strict';

const yargs = require('yargs');
const readline = require('readline');

const Cli = require('../lib/cli/cli');
const { setupHistory, getHistorySize } = require('../lib/cli/history');

let rl = null;

const { version } = require('../package.json');
const packagePath = require('path').resolve(__dirname, '..');

const args = yargs
  .option('verbose', {
    alias: 'v',
    type: 'count',
    describe: 'Verbosely print incoming and outgoing messages',
  })
  .option('no-reconnect', {
    alias: 'R',
    type: 'boolean',
    describe: 'Disable reconnection',
  })
  .option('heartbeat-interval', {
    alias: 'i',
    requiresArg: true,
    type: 'number',
    describe: 'Heartbeat interval in milliseconds',
  })
  .option('pretty-print', {
    alias: 'p',
Пример #12
0
'use strict';

const yargs = require('yargs');
const args = yargs
  .option('utc', {    // <1>
    alias: 'u',
    type: 'boolean',
  })
  .locale('fr')       // <2>
  .argv;              // <3>

console.log(args);
Пример #13
0
var historyFallback = require('connect-history-api-fallback');
var log = require('connect-logger');
var yargs = require('yargs');
var sync = require('browser-sync').create();
var defaultOpenPath = '';

yargs.option('files', {
  describe: 'array of file paths to watch',
  type: 'array'
});

var argv = yargs.argv;
var openPath = getOpenPath();
var options =
  {
    openPath: openPath,
    files: argv.files ? argv.files : [
      openPath + '/**/*.html',
      openPath + '/**/*.css',
      openPath + '/**/*.js'
    ],
    baseDir: argv.baseDir || './',
    fallback: '/' + openPath + '/index.html'
  };

if (argv.verbose) {
  console.log('options', options);
}

function getOpenPath() {
  var src = argv.open || defaultOpenPath;
Пример #14
0
// help
argv.help('help')
argv.alias('h', 'help')

// register abbreviated aliases
var abbrevs = abbrev(['help', 'size', 'format'])
var aliases = Object.keys(abbrevs)
aliases.forEach(function (alias) {
  if (alias !== abbrevs[alias]) {
    argv.alias(alias, abbrevs[alias])
  }
})

// document options
argv.option('size', {
  description: 'number of pixels (width) or string identifiying the icon image'
})
argv.option('format', {
  description: 'format of the output to stdout (csv or json)'
})

// will show up in help
argv.usage('Usage: android-icons [options]')

argv.example('$ android-icons --size 48', 'mdpi.png,48')
argv.example('$ android-icons --size 48 --format json', '{"name":"mdpi.png","width":48}')
argv.example('$ android-icons --size xhdpi', 'xhdpi.png,96')

argv = argv.argv

function formatLog (icons, argv) {
Пример #15
0
'use strict';

const yargs = require('yargs');
const fs = require('fs');
const path = require('path');

const jstp = require('../..');
const parseAddress = require('./parse-address');
const statistics = require('../statistics');

const args = yargs
  .option('address', {
    alias: 'a',
    describe: 'Address for master server to listen on',
    type: 'string',
    default: 'tcp://localhost:3000',
  })
  .options('report', {
    alias: 'r',
    describe: 'Report interval in ms',
    type: 'number',
    default: 10000,
  })
  .options('key', {
    alias: 'k',
    describe: 'Path to file that contains SSL certificate key',
    type: 'string',
    coerce: arg =>
      arg ? fs.readFileSync(path.resolve(__dirname, arg)) : undefined,
  })
  .options('cert', {
Пример #16
0
require('babel-polyfill');
const chalk = require('chalk');
const inquirer = require('inquirer');
const jsforce = require('jsforce');
const logger = require('../logger');
const Store = require('jfs');
const yargs = require('yargs');

const argv = yargs
  .option('c', {
    alias: 'connection',
    describe: 'Name of a pre-configured connection',
    type: 'string',
  })
  .argv;

const db = new Store('./.jsforce.config.json', { single: false, pretty: true });

const CREATE_NEW = 'Create New';

class Configure {

  get connections() {
    let res = db.getSync('connections');
    if (res instanceof Error) {
      db.saveSync('connections', res = []);
    }
    return res;
  }

  set connections(value) {
Пример #17
0
function build() {
  const async = require("async");
  let buildPaths = require("./getBuildPaths")(rootPath).map((buildPath) => path.sep + path.relative(rootPath, buildPath));

  // Arguments
  const yargs = require("yargs");

  const argv = yargs.option("verbose", { alias: "v", describe: "Verbose mode" }).argv;

  if (argv._.length > 0) {
    const filter = argv._[0].replace(/[\\/]/g, path.sep);
    const oldPathCount = buildPaths.length;
    if (filter[0] === "!") {
      buildPaths = buildPaths.filter((buildPath) => path.relative(rootPath, buildPath).toLowerCase().indexOf(filter.slice(1).toLowerCase()) === -1);
    } else {
      buildPaths = buildPaths.filter((buildPath) => path.relative(rootPath, buildPath).toLowerCase().indexOf(filter.toLowerCase()) !== -1);
    }
    log(`Rebuilding "${filter}", leaving out ${oldPathCount - buildPaths.length} paths`);
  }

  // Build
  log(`Build paths: ${buildPaths.join(", ")}`);

  const errors = [];
  let progress = 0;

  const chalk = require("chalk");
  const styleBuildPath = chalk.bgWhite.black;

  async.eachSeries(buildPaths, (relBuildPath, callback) => {
    log(styleBuildPath(`Building ${relBuildPath} (${++progress}/${buildPaths.length})`));
    const absBuildPath = path.resolve(path.join(rootPath, relBuildPath));
    const spawnOptions = { cwd: absBuildPath, env: process.env, stdio: "inherit" };

    async.waterfall([

      (cb) => {
        if (!fs.existsSync(`${absBuildPath}/package.json`)) { cb(null, null); return; }
        const packageJSON = require(`${absBuildPath}/package.json`);
        cb(null, packageJSON);
      },

      (packageJSON, cb) => {
        // Skip if the package doesn't need to be installed
        if (packageJSON == null || packageJSON.dependencies == null && packageJSON.devDependencies == null) {
          if (packageJSON == null || packageJSON.scripts == null ||
          (packageJSON.scripts.preinstall == null &&
          packageJSON.scripts.install == null &&
          packageJSON.scripts.postinstall == null)) {
            cb(null, packageJSON);
            return;
          }
        }

        const npm = child_process.spawn(`npm${execSuffix ? ".cmd" : ""}`, [ "install" ], spawnOptions);

        npm.on("close", (status) => {
          if (status !== 0) errors.push(`${relBuildPath}: "npm install" exited with status code ${status}`);
          cb(null, packageJSON);
        });
      },

      (packageJSON, cb) => {
        // Check if the package has a build script
        if (absBuildPath !== rootPath && packageJSON != null && packageJSON.scripts != null && packageJSON.scripts.build != null) {
          const args = [ "run", "build" ];
          if (!argv.verbose) args.push("-s", "--", "--silent");
          const npm = child_process.spawn(`npm${execSuffix ? ".cmd" : ""}`, args, spawnOptions);
    
          npm.on("close", (status) => {
            if (status !== 0) errors.push(`${relBuildPath}: "npm run build" exited with status code ${status}`);
            cb();
          });
          return;
        }

        // Check if the package has a gulpfile instead
        if (fs.existsSync(`${absBuildPath}/gulpfile.js`)) {
          const args = [];
          if (!argv.verbose) args.push("--silent");
          const gulp = child_process.spawn(`gulp${execSuffix ? ".cmd" : ""}`, args, spawnOptions);

          gulp.on("close", (status) => {
            if (status !== 0) errors.push(`${relBuildPath}: "gulp" exited with status code ${status}`);
            cb();
          });
          return;
        }

        cb();
      }

    ], callback);
  }, () => {
    console.log("");

    if (errors.length > 0) {
      log("There were build errors:");
      for (const error of errors) console.log(error);
      process.exit(1);
    } else {
      const duration = Math.floor((Date.now() - startTime) / 1000);
      const minutes = Math.floor(duration / 60);
      const seconds = duration % 60;
      log(`Build completed in ${minutes}mn ${seconds}s.`);
    }
  });
}
Пример #18
0
#!/usr/bin/env node
'use strict';

var yargs = require('yargs'),
  Promise = require('bluebird'),
  isString = require('lodash.isstring'),
  mapValues = require('lodash.mapvalues'),
  isNumber = require('lodash.isnumber'),
  markdownIndex = require('../index');

var argv = yargs
    .option('inject', {
      alias: 'i',
      describe: 'Do not output to STDOUT; instead, inject TOC into file at ' +
      'range marked by "<!-- INDEX -->...<!-- /INDEX -->".  Mutually exclusive ' +
      'with "--output"'
    })
    .option('exclude', {
      alias: 'x',
      describe: 'Exclude a glob.  Injected file (if any) and node_modules/ ' +
      'are excluded by default'
    })
    .option('output', {
      alias: 'o',
      describe: 'Do not write to SDTOUT; instead, write to file.  Mutually ' +
      'exclusive with "--inject"'
    })
    .option('template', {
      type: 'string',
      describe: 'The Lo-Dash template used to generate the Table of Contents.'
    })
Пример #19
0
/* eslint no-console: 0 */ // allow console.log() in this file

const request = require('request-promise-native');
const cheerio = require('cheerio');
const assert = require('assert');
const yargs = require('yargs');

const config = require('../lib/config');
const csrf = require('../lib/csrf');


const argv = yargs
      .option('config', {
          alias: 'f',
          describe: 'JSON configuration file',
          default: 'config.json',
          type: 'string',
      })
      .option('server', {
          alias: 's',
          describe: 'Remote server URL',
          default: 'http://localhost:3000',
          type: 'string',
      })
      .option('iterations', {
          alias: 'n',
          describe: 'Number of test iterations per client',
          default: 1,
          type: 'number',
      })
      .option('clients', {
// https://babeljs.io/docs/learn-es2015/

import fs from 'fs';
import glob from 'glob';
import gulp from 'gulp';
import gulpLoadPlugins from 'gulp-load-plugins';
import runSequence from 'run-sequence';
import yaml from 'js-yaml';
import taskListing from 'gulp-task-listing';
import { execSync } from 'child_process';
import flatten from 'lodash/flatten';
import yargs from 'yargs';

const argv = yargs
  .option('a', {
    alias: 'a',
    description: 'The params to pass to scrapers',
    default: '',
  })
  .help('h')
  .alias('h', 'help')
  .strict().argv;

gulp.task('help', taskListing);
gulp.task('default', taskListing);

const $ = gulpLoadPlugins();

function getScrapyNames(pattern) {
  return glob
    .sync(pattern)
    .map(filename => {
Пример #21
0
import path from 'path';
import pathIsAbsolute from 'path-is-absolute'; // used for compatibility
import fs from 'fs';
import _ from 'lodash';
import yargs from 'yargs';
import chalk from 'chalk';
import build from '..';
import options from '../options'
import server from '../server';
import workers from '../workers';
import defaults from '../options/defaults';
import packageJson from '../../package';

const argv = yargs
  .option('c', {
    alias: 'config',
    description: 'A path to a config file',
    default: 'webpack.config.js'
  })
  .option('d', {
    alias: 'development',
    description: 'Activate development mode',
    default: false
  })
  .option('p', {
    alias: 'port',
    description: 'Specify the server\'s port',
    default: 9009
  })
  .option('a', {
    alias: 'address',
    description: 'Specify the server\'s address',
Пример #22
0
/**
 * Parses the command-line arguments
 *
 * @returns {object} - The parsed arguments
 */
function parseArgs () {
  // Configure the argument parser
  yargs
    .option("schema", {
      type: "boolean",
      default: true,
    })
    .option("spec", {
      type: "boolean",
      default: true,
    })
    .option("o", {
      alias: "outfile",
      type: "string",
      normalize: true,
    })
    .option("r", {
      alias: "dereference",
      type: "boolean",
    })
    .option("t", {
      alias: "type",
      type: "string",
      normalize: true,
      default: "json",
    })
    .option("f", {
      alias: "format",
      type: "number",
      default: 2,
    })
    .option("w", {
      alias: "wrap",
      type: "number",
      default: Infinity,
    })
    .option("d", {
      alias: "debug",
      type: "boolean",
    })
    .option("h", {
      alias: "help",
      type: "boolean",
    });

  // Show the version number on "--version" or "-v"
  yargs
    .version()
    .alias("v", "version");

  // Disable the default "--help" behavior
  yargs.help(false);

  // Parse the command-line arguments
  let args = yargs.argv;

  // Normalize the parsed arguments
  let parsed = {
    command: args._[0],
    file: args._[1],
    options: {
      schema: args.schema,
      spec: args.spec,
      outfile: args.outfile,
      dereference: args.dereference,
      format: args.format || 2,
      type: args.type || "json",
      wrap: args.wrap || Infinity,
      debug: args.debug,
      help: args.help,
    }
  };

  if (parsed.options.debug) {
    console.log(JSON.stringify(parsed, null, 2));
  }

  return parsed;
}
Пример #23
0
gulp.task('e2e-build', function() {
  var argv;

  yargs = yargs
    .usage('gulp e2e-build --target <target> <options>')
    .option('target', {
      alias: 't',
      choices: ['browser', 'android', 'ios'],
      describe: 'The target for the test suite'
    })
    .option('output', {
      alias: 'o',
      default: 'protractor.conf.js',
      describe: 'The output file'
    })
    .option('site-url', {
      alias: 'U',
      default: 'http://school.demo.moodle.net',
      describe: 'The URL of the site targetted by the tests'
    })
    .option('site-version', {
      alias: 'V',
      default: 2.9,
      describe: 'The version of the site targetted by the tests (2.8, 2.9, ...)'
    })
    .option('site-uses-local-mobile', {
      alias: 'L',
      describe: 'When set the site is using local_mobile',
      type: 'boolean'
    })
    .option('tablet', {
      describe: 'Indicate that the tests are run on a tablet',
      type: 'boolean'
    })
    .option('filter', {
      alias: 'f',
      describe: 'To filter the tests to be executed (i.e www/messages/e2e/*)'
    })
    .option('help', {   // Fake the help option.
      alias: 'h',
      describe: 'Show help',
      type: 'boolean'
    });

  // Show help when the target was not set.
  argv = yargs.argv;
  if (!argv.target) {
    yargs.showHelp();
    return;
  }

  // Restore the normal use of the help.
  yargs = yargs.help('help');

  // Define the arguments for the browser target.
  if (argv.target == 'browser') {
    yargs = yargs
      .option('webdriver', {
        alias: 'w',
        default: 'http://127.0.0.1:4444/wd/hub',
        describe: 'The URL to the Web Driver'
      })
      .option('browser', {
        alias: 'b',
        default: 'chrome',
        describe: 'The browse to run the test on'
      })
      .option('url', {
        alias: 'u',
        default: 'http://localhost:8100/',
        describe: 'The URL to open the browser at'
      });

  // Arguments for Android.
  } else if (argv.target == 'android') {
    yargs = yargs
      .option('apk', {
        alias: 'a',
        default: 'platforms/android/ant-build/MainActivity-debug.apk',
        describe: 'The relative path to the APK'
      })
      .option('device', {
        alias: 'd',
        demand: true,
        describe: 'The device ID of the targetted device',
      })
      .option('version', {
        alias: 'v',
        demand: true,
        describe: 'The Android version of the targetted device (4.4, 5.0, ...)'
      })
      .option('webdriver', {
        alias: 'w',
        default: 'http://127.0.0.1:4723/wd/hub',
        describe: 'The URL to the Web Driver'
      });

  // Arguments for iOS.
  } else if (argv.target == 'ios') {
    yargs = yargs
      .option('ipa', {
        alias: 'i',
        describe: 'The path to the .ipa'
      })
      .option('device', {
        alias: 'd',
        demand: true,
        describe: 'The device UDID of the targetted device',
      })
      .option('version', {
        alias: 'v',
        demand: true,
        describe: 'The iOS version of the targetted device (7.1.2, 8.0, ...)'
      })
      .option('webdriver', {
        alias: 'w',
        default: 'http://127.0.0.1:4723/wd/hub',
        describe: 'The URL to the Web Driver'
      });
  }

  argv = yargs.argv;
  var config = {
        framework: 'jasmine2',
        specs: [],
        capabilities: {},
        restartBrowserBetweenTests: true,
        onPrepare: 'FN_ONPREPARE_PLACEHOLDER',
        getPageTimeout: 15000,  // Increase page fetching time out because of travis.
        plugins: [{
          path: npmPath.join(paths.e2e.pluginsToRoot, paths.e2e.plugins, 'wait_for_transitions.js')
        }]
      },
      i,
      configStr,
      onPrepare,
      users = {
        STUDENT: {
          LOGIN: '******',
          PASSWORD: '******'
        },
        TEACHER: {
          LOGIN: '******',
          PASSWORD: '******'
        },
        ADMIN: {
          LOGIN: '******',
          PASSWORD: '******'
        }
      };

  // Preparing specs. Checking first if we are filtering per specs.
  for (i in paths.e2e.libs) {
    config.specs.push(npmPath.join(paths.e2e.buildToRoot, paths.e2e.libs[i]));
  }

  if (argv.filter) {
    config.specs.push(npmPath.join(paths.e2e.buildToRoot, argv.filter));
  } else {
    for (i in paths.e2e.specs) {
      config.specs.push(npmPath.join(paths.e2e.buildToRoot, paths.e2e.specs[i]));
    }
  }

  // Browser.
  if (argv.target == 'browser') {
    config.seleniumAddress = argv.webdriver;
    config.capabilities.browserName = argv.browser;
    config.capabilities.chromeOptions = {
      args: ['--allow-file-access', '--allow-file-access-from-files', '--enable-local-file-accesses', '--unlimited-storage']
    };

  // Android.
  } else if (argv.target == 'android') {
    config.seleniumAddress = argv.webdriver;
    config.capabilities.app = npmPath.join(__dirname, argv.apk);
    config.capabilities.browserName = '';
    config.capabilities.platformName = 'Android';
    config.capabilities.platformVersion = String(argv.version);
    config.capabilities.deviceName = 'Android Device';
    config.capabilities.udid = argv.device;
    config.capabilities.autoWebview = true;
    config.capabilities.autoWebviewTimeout = 10000;

  // iOS.
  } else if (argv.target == 'ios') {
    config.seleniumAddress = argv.webdriver;
    if (argv.ipa.charAt(0) === '/' || argv.ipa.charAt(0) === '\\') {
      config.capabilities.app = argv.ipa;
    } else {
      config.capabilities.app = npmPath.join(__dirname, argv.ipa);
    }
    config.capabilities.browserName = 'iOS';
    config.capabilities.platformName = 'iOS';
    config.capabilities.platformVersion = String(argv.version);
    config.capabilities.deviceName = 'iOS Device';
    config.capabilities.udid = argv.device;
    config.capabilities.autoWebview = true;
    config.capabilities.autoWebviewTimeout = 10000;
  }

  // Prepend the onPrepare function.
  onPrepare = "\n" +
    "        var wd = require('wd'),\n" +
    "        protractor = require('protractor'),\n" +
    "        wdBridge = require('wd-bridge')(protractor, wd);\n" +
    "        wdBridge.initFromProtractor(exports.config);\n" +
    "\n" +
    "        // Define global variables for our tests.\n" +
    "        global.ISANDROID      = " + (argv.target == 'android' ? 'true' : 'false') + ";\n" +
    "        global.ISBROWSER      = " + (argv.target == 'browser' ? 'true' : 'false') + ";\n" +
    "        global.ISIOS          = " + (argv.target == 'ios' ? 'true' : 'false') + ";\n" +
    "        global.ISTABLET       = " + (argv.tablet ? 'true' : 'false') + ";\n" +
    "        global.DEVICEURL      = " + (argv.url ? "'" + argv.url + "'" : undefined) + ";\n" +
    "        global.DEVICEVERSION  = " + (argv.version ? "'" + argv.version + "'" : 'undefined') + ";\n" +
    "        global.SITEURL        = '" + (argv['site-url']) + "';\n" +
    "        global.SITEVERSION    = " + (argv['site-version']) + ";\n" +
    "        global.SITEHASLM      = " + (argv['site-has-local-mobile'] ? 'true' : 'false') + ";\n" +
    "        global.USERS          = \n" + JSON.stringify(users, null, 4) + ";    \n" +
    "    ";

  configStr = JSON.stringify(config, null, 4);
  configStr = configStr.replace('"FN_ONPREPARE_PLACEHOLDER"', "function(){" + onPrepare + "}");
  configStr = 'exports.config = ' + configStr + ';';

  gfile(argv.output, configStr, {src: true}).pipe(gulp.dest(paths.e2e.build));
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var fs = require("mz/fs");
var path = require("path");
var yargs = require("yargs");
var index_1 = require("./index");
var theme_1 = require("./theme");
yargs
    .option('theme', {
    alias: 't',
    nargs: 1,
    description: 'Use a theme defined in a JSON file',
})
    .usage(['', 'Usage: highlight [options] [file]', '', 'Outputs a file or STDIN input with syntax highlighting'].join('\n'))
    .option('language', {
    alias: 'l',
    nargs: 1,
    description: 'Set the langugage explicitely\nIf omitted will try to auto-detect',
})
    .version()
    .help('help')
    .alias('help', 'h')
    .alias('version', 'v');
var argv = yargs.argv;
var file = argv._[0];
var codePromise;
if (!file && !process.stdin.isTTY) {
    // Input from STDIN
    process.stdin.setEncoding('utf8');
    var code_1 = '';
    process.stdin.on('readable', function () {
Пример #25
0
/* eslint no-process-exit: 0 */

import 'colors';
import build from './build';
import docs from '../docs/build';
import { setExecOptions } from './exec';

import yargs from 'yargs';

const argv = yargs
  .option('docs-only', {
    demand: false,
    default: false
  })
  .option('verbose', {
    demand: false,
    default: false,
    describe: 'Increased debug output'
  })
  .argv;

setExecOptions(argv);

let buildProcess = argv.docsOnly ? docs() : build();

buildProcess
  .catch(err => {
    console.error(err.toString().red);
    if (err.stack) {
      console.error(err.stack.red);
    }
Пример #26
0
var uglify = require('gulp-uglify');
var util = require('gulp-util');
var zip = require('gulp-zip');
var exec = require('child-process-promise').exec;
var karma = require('karma');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var merge = require('merge-stream');
var collapse = require('bundle-collapser/plugin');
var yargs = require('yargs');
var path = require('path');
var fs = require('fs');
var htmllint = require('gulp-htmllint');
var pkg = require('./package.json');

var argv = yargs
  .option('force-output', {default: false})
  .option('silent-errors', {default: false})
  .option('verbose', {default: false})
  .argv

var srcDir = './src/';
var outDir = './dist/';

var header = "/*!\n" +
  " * Chart.js\n" +
  " * http://chartjs.org/\n" +
  " * Version: {{ version }}\n" +
  " *\n" +
  " * Copyright " + (new Date().getFullYear()) + " Chart.js Contributors\n" +
  " * Released under the MIT license\n" +
  " * https://github.com/chartjs/Chart.js/blob/master/LICENSE.md\n" +
Пример #27
0
import yargs from 'yargs';

const args = yargs

  .option('production',{
    boolean:true,
    default:false,
    describe:'min all scripts'
  })

  .option('watch',{
    boolean:true,
    default:false,
    describe:'watch all files'
  })

  .option('verbose',{
    boolean:true,
    default:false,
    describe:'log'
  })

  .option('sourcemaps',{
    describe:'force the creation of sroucemaps'
  })

  .option('port',{
    string:true,
    default:8080,
    describe:'server port'
  })
// help
argv.help('help')
argv.alias('h', 'help')

// register abbreviated aliases
var abbrevs = abbrev(['input', 'output', 'help'])
var aliases = Object.keys(abbrevs)
aliases.forEach(function (alias) {
  if (alias !== abbrevs[alias]) {
    argv.alias(alias, abbrevs[alias])
  }
})

// document options
argv.option('input', {
  description: 'input path for the original icon file'
})
argv.option('output', {
  description: 'output directory'
})

argv.usage('Usage: $ android-icon-resize [options]')

argv.example('$ android-icon-resize -i path/to/icon.png -o path/to/output/')

argv = argv.argv

function cli (argv) {
  if (argv.version) {
    return console.log(pkg.version)
  }
Пример #29
0
  const done = await serve(options);
  try {
    await render(entries, options);
  } finally {
    if (!options.interactive) {
      done();
    }
  }
}

if (require.main === module) {

  const options = yargs.
    option('fix', {
      describe: 'Accept all screenshots as accepted',
      default: false
    }).
    option('host', {
      describe: 'The host for serving rendering cases',
      default: '127.0.0.1'
    }).
    option('port', {
      describe: 'The port for serving rendering cases',
      type: 'number',
      default: 3000
    }).
    option('match', {
      describe: 'Only run tests matching the provided string RegExp pattern',
      type: 'string'
    }).
Пример #30
0
'use strict'

const yargs = require('yargs')
const utils = require('./utils')
const print = utils.print

const parser = yargs
  .option('silent', {
    desc: 'Write no output',
    type: 'boolean',
    default: false,
    coerce: silent => {
      if (silent) utils.disablePrinting()
      return silent
    }
  })
  .option('pass', {
    desc: 'Pass phrase for the keys',
    type: 'string',
    default: ''
  })
  .epilog(utils.ipfsPathHelp)
  .demandCommand(1)
  .fail((msg, err, yargs) => {
    if (err) {
      throw err // preserve stack
    }
    print(msg)
    yargs.showHelp()
  })
  .commandDir('commands')