How to use the semver.lte function in semver

To help you get started, we’ve selected a few semver 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 microsoft / vsts-cordova-tasks / Tasks / CordovaBuild / lib / cordova-task.js View on Github external
console.log('Adding ant.properties update hook')
                    cordova.on('before_compile', writeAntProperties)
                }

                if (platform === 'android') {
                    // Removes the old temp directory
                    shelljs.rm("-rf", path.join(cordovaConfig.projectPath, 'platforms', 'android', '.gradle'));

                    if (semver.valid(cordovaVersion) && semver.lt(cordovaVersion, '4.0.0')) {
                        // Special case: android on cordova versions earlier than v4.0.0 will
                        // actively fail the build if it encounters unexpected options
                        console.log('Stripping inapplicable arguments for android on cordova ' + cordovaVersion);
                        buildArgs = stripNewerAndroidArgs(buildArgs);
                    }

                    if (semver.valid(cordovaVersion) && semver.lte(cordovaVersion, '3.5.0-0.2.7')) {
                        // Special case: android on cordova versions 3.5.0-0.2.7 need
                        // "android" to be on the path, so make sure it is there
                        var currentPath = process.env['PATH'];
                        var androidHome = process.env['ANDROID_HOME'];
                        if (currentPath && androidHome && currentPath.indexOf(androidHome) === -1) {
                            console.log('Appending ANDROID_HOME to the current PATH');
                            process.env['PATH'] = currentPath + ';' + path.join(androidHome, 'tools');
                        }
                    }
                }

                if (platform !== 'ios') {
                    if (semver.valid(cordovaVersion) && semver.lt(cordovaVersion, '3.6.0')) {
                        // For cordova 3.5.0-0.2.7 or lower, we should remove the --device and --emulator
                        // flag on non-ios platforms, since they were otherwise unsupported
                        buildArgs = buildArgs.filter(function (arg) { return arg !== '--device' && arg !== '--emulator'; })
github RequestNetwork / requestNetwork / packages / request-logic / src / action.ts View on Github external
function getActionHash(action: RequestLogicTypes.IAction): string {
  // Before the version 2.0.0, the hash was computed without the signature
  if (Semver.lte(action.data.version, '2.0.0')) {
    return MultiFormat.serialize(Utils.crypto.normalizeKeccak256Hash(action.data));
  }
  return MultiFormat.serialize(Utils.crypto.normalizeKeccak256Hash(action));
}
github ctripcorp / moles-packer / lib / packCommon.js View on Github external
// sourceMap 文件临时存放地址。
		var commonSourceMapTempath     = path.join(TEMP_DIRNAME, `common.${platform}.sourcemap.json`);
		var commonSourceMapRealTempath = path.join(OPTIONS.input, commonSourceMapTempath);


		var command = [
			'react-native',
			'bundle',
			'--entry-file', pesudoEntryPath,
			'--bundle-output', commonBundleTempath,
			'--platform ', platform,
			'--sourcemap-output', commonSourceMapTempath
		];

		if (semver.lte(rnversion, '0.30.0')) {
			command.push(
				'--dev false',
				'--verbose true',
				'--minify', OPTIONS.minify
			);
		}
		else {
			command.push(
				'--dev', OPTIONS.minify
			);
		}

		// 执行命令。
		yuancon.run(command.join(' '), { cwd: OPTIONS.input, echo: OPTIONS.verbose });

		if (yuancon.run.exitCode) {
github johandb / svg-drawing-tool / node_modules / @schematics / update / update / index.js View on Github external
if (!installedPackageJson) {
        throw new schematics_1.SchematicsException(`An unexpected error happened; package ${name} has no version ${installedVersion}.`);
    }
    let targetVersion = packages.get(name);
    if (targetVersion) {
        if (npmPackageJson['dist-tags'][targetVersion]) {
            targetVersion = npmPackageJson['dist-tags'][targetVersion];
        }
        else if (targetVersion == 'next') {
            targetVersion = npmPackageJson['dist-tags']['latest'];
        }
        else {
            targetVersion = semver.maxSatisfying(Object.keys(npmPackageJson.versions), targetVersion);
        }
    }
    if (targetVersion && semver.lte(targetVersion, installedVersion)) {
        logger.debug(`Package ${name} already satisfied by package.json (${packageJsonRange}).`);
        targetVersion = undefined;
    }
    const target = targetVersion
        ? {
            version: targetVersion,
            packageJson: npmPackageJson.versions[targetVersion],
            updateMetadata: _getUpdateMetadata(npmPackageJson.versions[targetVersion], logger),
        }
        : undefined;
    // Check if there's an installed version.
    return {
        name,
        npmPackageJson,
        installed: {
            version: installedVersion,
github alanshaw / david / lib / semverext.js View on Github external
high = high || comparator
      low = low || comparator
      if (semver.gt(comparator.semver, high.semver, loose)) {
        high = comparator
      } else if (semver.lt(comparator.semver, low.semver, loose)) {
        low = comparator
      }
    })

    // If the highest version comparator has a gt/gte operator then our version isn't higher than it
    if (high.operator === ">" || high.operator === ">=") {
      return false
    }

    // If the lowest version comparator has a gt/gte operator and our version is less than it then it isn't higher than the range
    if ((!low.operator || low.operator === ">") && semver.lte(version, low.semver)) {
      return false
    } else if (low.operator === ">=" && semver.lt(version, low.semver)) {
      return false
    }
  }
  return true
}
github rolftimmermans / zeromq-ng / test / zmq_proxy.xrep-xreq.js View on Github external
var zmq = require('..')
  , should = require('should')
  , semver = require('semver');

var addr = 'tcp://127.0.0.1'
  , frontendAddr = addr+':5510'
  , backendAddr = addr+':5511'
  , captureAddr = addr+':5512';

//since its for libzmq2, we target versions < 3.0.0
var version = semver.lte(zmq.version, '3.0.0');
var testutil = require('./util');

describe('proxy.xrep-xreq', function() {
  afterEach(testutil.cleanup);
  
  it('should proxy req-rep connected to xrep-xreq', function (done) {
    if (!version) {
      console.warn('Test requires libzmq v2 (skipping)');
      return done();
    }

    var frontend = zmq.socket('xrep');
    var backend = zmq.socket('xreq');

    var req = zmq.socket('req');
    var rep = zmq.socket('rep');
github microsoft / pxt / electron / src / updater / updateservice.ts View on Github external
.then((releaseManifest) => {
                const targetVersion = this.getTargetRelease(releaseManifest);
                const versionInfo = this.getCurrentVersionInfo(releaseManifest);
                const criticalPrompt = versionInfo.banned.some((banRange) => {
                    return semver.satisfies(product.version, banRange);
                });
                const prompt = semver.lte(product.version, versionInfo.prompt);
                const notification = semver.lte(product.version, versionInfo.notification);

                if (targetVersion) {
                    if (criticalPrompt) {
                        Telemetry.tickEvent("electron.update.available", {
                            initial: "true",
                            type: "critical"
                        });
                        this.emit("critical-update", this.makeUpdateInfo(targetVersion, UpdateEventType.Critical));
                    } else if (prompt) {
                        Telemetry.tickEvent("electron.update.available", {
                            initial: "true",
                            type: "prompt"
                        });
                        this.emit("update-available", this.makeUpdateInfo(targetVersion, UpdateEventType.Prompt, /*isInitialCheck*/ true));
                    } else if (notification) {
                        Telemetry.tickEvent("electron.update.available", {
github getsmap / smap-responsive / lib / bootstrap-plugins / typeahead / Gruntfile.js View on Github external
grunt.registerTask('release', 'Ship it.', function(version) {
    var curVersion = grunt.config.get('version');

    version = semver.inc(curVersion, version) || version;

    if (!semver.valid(version) || semver.lte(version, curVersion)) {
      grunt.fatal('invalid version dummy');
    }

    grunt.config.set('version', version);

    grunt.task.run([
      'exec:git_on_master',
      'exec:git_is_clean',
      'manifests:' + version,
      'build',
      'exec:git_add',
      'exec:git_commit:' + version,
      'exec:git_tag:' + version,
      //'exec:git_push',
      'exec:publish_assets'
    ]);
github yidashi / yii2cmf / vendor / bower / typeahead.js / Gruntfile.js View on Github external
grunt.registerTask('release', '#shipit', function(version) {
    var curVersion = grunt.config.get('version');

    version = semver.inc(curVersion, version) || version;

    if (!semver.valid(version) || semver.lte(version, curVersion)) {
      grunt.fatal('hey dummy, that version is no good!');
    }

    grunt.config.set('version', version);

    grunt.task.run([
      'exec:git_on_master',
      'exec:git_is_clean',
      f('step:Update to version %s?', version),
      f('manifests:%s', version),
      'build',
      'exec:git_add',
      f('exec:git_commit:%s', version),
      f('exec:git_tag:%s', version),
      'step:Push changes?',
      'exec:git_push',