How to use the process.versions function in process

To help you get started, we’ve selected a few process 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 Azure / autorest / src / autorest-core / app.ts View on Github external
const autorestArgs = process.argv.slice(2);

    // temporary: --help displays legacy AutoRest's -Help message
    if (autorestArgs.indexOf("--help") !== -1) {
      await legacyMain(["-Help"]);
      return;
    }

    if (isLegacy(autorestArgs)) {
      await legacyMain(autorestArgs);
    } else {
      await currentMain(autorestArgs);
    }

    // for relaxed profiling (assuming that no one calls `main` from electron... use AAAL!)
    if (require("process").versions.electron) await new Promise(_ => { });

    process.exit(0);
  } catch (e) {
    if (e instanceof Exception) {
      console.error(e.message);
      process.exit(e.exitCode);
    }

    if (e instanceof Error) {
      console.error(e);
      process.exit(1);
    }

    console.error(e);
    process.exit(1);
  }
github expo / expo / tools / expotools / bin / expotools.js View on Github external
#!/usr/bin/env node
'use strict';

const ora = require('ora');
const path = require('path');
const chalk = require('chalk');
const fs = require('fs-extra');
const semver = require('semver');
const process = require('process');
const { hashElement } = require('folder-hash');
const spawnAsync = require('@expo/spawn-async');

const nodeVersion = process.versions.node.split('-')[0]; // explode and truncate tag from version

// Validate that used Node version is supported
if (semver.satisfies(nodeVersion, '>=8.9.0')) {
  maybeRebuildAndRun();
} else {
  console.log(
    chalk.red(
      `Node version ${chalk.cyan(nodeVersion)} is not supported. Please use Node.js ${chalk.cyan('8.9.0')} or higher.`
    ),
  );
  process.exit(1);
}

async function maybeRebuildAndRun() {
  const rootDir = path.dirname(__dirname);
  const checksumFilePath = path.join(rootDir, 'build', '.checksum');
github mihe / tsu / Source / TsuBootstrap / dist / require.js View on Github external
function unwrapExports (x) {
	return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x.default : x;
}

function createCommonjsModule(fn, module) {
	return module = { exports: {} }, fn(module, module.exports), module.exports;
}

function getCjsExportFromNamespace (n) {
	return n && n.default || n;
}

var data = getCjsExportFromNamespace(core$1);

var current = (process$1.versions && process$1.versions.node && process$1.versions.node.split('.')) || [];

function specifierIncluded(specifier) {
    var parts = specifier.split(' ');
    var op = parts.length > 1 ? parts[0] : '=';
    var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.');

    for (var i = 0; i < 3; ++i) {
        var cur = Number(current[i] || 0);
        var ver = Number(versionParts[i] || 0);
        if (cur === ver) {
            continue; // eslint-disable-line no-restricted-syntax, no-continue
        }
        if (op === '<') {
            return cur < ver;
        } else if (op === '>=') {
            return cur >= ver;
github leanix / leanix-reporting-cli / src / initializer.ts View on Github external
.then(answers => {
      answers = this.handleDefaultAnswers(answers);
      answers['node_version'] = process.versions.node;
      this.extractor.extractTemplateFiles(answers as UserInitInput);
      console.log(chalk.green('\u2713 Your project is ready!'));
      console.log(chalk.green('Please run `npm install` to install dependencies and then run `npm start` to start developing!'));
      // return this.installViaNpm();
    });
github parcel-bundler / parcel / packages / core / register / src / hook.js View on Github external
// Replace old hook, as this one likely contains options.
  if (hooks) {
    for (let extension in hooks) {
      hooks[extension]();
    }
  }

  let parcel = new Parcel({
    entries: [path.join(process.cwd(), 'index.js')],
    cliOpts: opts
  });

  let environment = new Environment({
    context: 'node',
    engines: {
      node: process.versions.node
    }
  });

  syncPromise(parcel.init());

  let isProcessing = false;

  // As Parcel is pretty much fully asynchronous, create an async function and wrap it in a syncPromise later...
  async function fileProcessor(code, filename) {
    if (isProcessing) {
      return code;
    }

    try {
      isProcessing = true;
      let result = await parcel.runTransform({
github koush / electron-chrome / chrome / api / chrome-update.js View on Github external
return new Promise((resolve, reject) => {
    var updateParams = {
      id: id,
      installsource: 'ondemand',
      uc: '',
    }
    // guess we're downloading it...
    var params = {
      prodversion: require('process').versions.chrome,
      x: querystring.stringify(updateParams)
    }
    var encodedParams = querystring.stringify(params);
    var crxInfoUrl = `https://clients2.google.com/service/update2/crx?${encodedParams}`
    console.log(crxInfoUrl);

    var crxs = getCrxDir(id);
    mkdirp.sync(crxs);

    return fetch(crxInfoUrl)
    .then(res => {
      return res.text();
    })
    .then(text => {
      console.log('server version');
      console.log(text);
github b3nsn0w / koa-easy-ws / index.js View on Github external
function createWebsocketMiddleware (propertyName = 'ws', options) {
  if (!options) options = {}
  if (options instanceof http.Server) options = { server: options }

  if (parseInt(process.versions.node) < 10 && !options.noServerWorkaround) { // node 9 or earlier needs a workaround for upgrade requests
    if (!options.server) {
      throw new TypeError(`
        If you target Node 9 or earlier you must provide the HTTP server either as an option or as the second parameter.
        See the readme for more instructions: https://github.com/b3nsn0w/koa-easy-ws#special-usage-for-node-9-or-earlier
      `.trim().split('\n').map(s => s.trim()).join('\n'))
    } else {
      if (!serversPatched.has(options.server)) {
        serversPatched.add(options.server)
        options.server.on('upgrade', req => options.server.emit('request', req, new http.ServerResponse(req)))
        debug('added workaround to a server')
      }
    }
  }

  debug(`websocket middleware created with property name '${propertyName}'`)
  const wss = new WebSocket.Server({ noServer: true })
github avajs / babel-preset-stage-4 / plugins / best-match.js View on Github external
function getClosestVersion() {
	if (!process.versions.v8) {
		// Assume compatibility with Node.js 8.9.4
		return 'v8-6.1';
	}

	const v8 = parseFloat(process.versions.v8);
	if (v8 >= 6.6) {
		return 'v8-6.6';
	}

	if (v8 >= 6.2) {
		return 'v8-6.2';
	}

	return 'v8-6.1';
}
github burtonator / polar-bookshelf / main.ts View on Github external
async function launch() {

    console.log("Running with CWD: " + process.cwd());
    console.log("Running with Node version: " + process.version);
    console.log("Running with Electron version: " + process.versions.electron);
    console.log("Running with Polar version: " + Version.get());
    console.log("Running with app version: " + app.getVersion());

    const log = Logger.create();

    const datastore = new LazyWriteDatastore(Datastores.create());

    await datastore.init();

    await Logging.init();

    const mainApp = new MainApp(datastore);
    const {mainAppController} = await mainApp.start();

    const fileArg = Cmdline.getDocArg(process.argv);
github agorf / lucien / src / main.js View on Github external
const showAboutDialog = () => {
  const clickedButton = dialog.showMessageBoxSync(editorWindow, {
    type: 'info',
    buttons: ['Visit website', 'Report issue', 'Close'],
    defaultId: 2,
    cancelId: 2,
    title: `About ${appName}`,
    message: appName,
    detail: [
      `Copyright © ${new Date().getFullYear()} ${manifest.author}`,
      '',
      `Licensed under the ${manifest.license} license`,
      '',
      `Version: ${appVersion}`,
      `Electron: ${process.versions.electron}`,
      `Node: ${process.versions.node}`,
      `V8: ${process.versions.v8}`,
      `Platform: ${process.platform}`,
      `Arch: ${process.arch}`
    ].join('\n')
  });

  switch (clickedButton) {
    case 0:
      shell.openExternal(manifest.homepage);
      break;

    case 1:
      shell.openExternal(manifest.bugs.url);
      break;
  }