Example #1
0
export async function checkMinNodeVersion(minVersion, _process = process) {
  // eslint-disable-next-line no-param-reassign
  minVersion = minVersion || '0.12.0';
  if (!semver.gte(_process.version, minVersion)) {
    throw new Error(oneLine`Node version must be ${minVersion} or
                    greater. You are using ${_process.version}.`);
  }
}
Example #2
0
Sharp.prototype.withoutAdaptiveFiltering = function(withoutAdaptiveFiltering) {
  if (semver.gte(libvipsVersion, '7.42.0')) {
    this.options.withoutAdaptiveFiltering = (typeof withoutAdaptiveFiltering === 'boolean') ? withoutAdaptiveFiltering : true;
  } else {
    console.error('withoutAdaptiveFiltering requires libvips 7.41.0+');
  }
  return this;
};
Example #3
0
Sharp.prototype.trellisQuantisation = function(trellisQuantisation) {
  if (semver.gte(libvipsVersion, '8.0.0')) {
    this.options.trellisQuantisation = (typeof trellisQuantisation === 'boolean') ? trellisQuantisation : true;
  } else {
    console.error('trellisQuantisation requires libvips 8.0.0+');
  }
  return this;
};
Example #4
0
 }).reduce(function (set, k) {
   var rangeDescriptor = semver.valid(k[1], true) &&
                         semver.gte(k[1], "0.1.0", true) &&
                         !npm.config.get("save-exact")
                       ? savePrefix : ""
   set[k[0]] = rangeDescriptor + k[1]
   return set
 }, {})
Example #5
0
Sharp.prototype.overshootDeringing = function(overshootDeringing) {
  if (semver.gte(libvipsVersion, '8.0.0')) {
    this.options.overshootDeringing = (typeof overshootDeringing === 'boolean') ? overshootDeringing : true;
  } else {
    console.error('overshootDeringing requires libvips 8.0.0+');
  }
  return this;
};
     .then(function (version) {
     if (semver.gte(version, "0.19.0")) {
         return Q.resolve(void 0);
     }
     else {
         return Q.reject(new RangeError("Project version = " + version));
     }
 });
 scrollToY(offsetY) {
     if (semver.gte(packageData.version, '0.20.0')) {
         this.scrollViewRef.scrollTo({x:0, y:offsetY});
     }
     else {
         this.scrollViewRef.scrollTo(offsetY, 0);
     }
 }
Example #8
0
Server.prototype._persistClientData = function(socket, message) {
  var client = Client.get(socket.id);

  if (client && Semver.gte(client.version, VERSION_CLIENT_STOREDATA)) {
    logging.info('#socket.message - _persistClientData', message, socket.id);
    client.storeData(message);
  }
};
Example #9
0
      fs.exists(path.join(BUILD_FOLDER, Constants.Filenames.Main), function(exists) {
        if (!isRebuildRequired && exists) {
          resultObject.success = true;
          return callback(null, 'Framework already built, nothing to do');
        }

        logger.log('info', '3.1. Ensuring framework build exists');

        var args = [];
        var outputFolder = COURSE_FOLDER.replace(FRAMEWORK_ROOT_FOLDER + path.sep,'');

        // Append the 'build' folder to later versions of the framework
        if (semver.gte(semver.clean(frameworkVersion), semver.clean('2.0.0'))) {
          outputFolder = path.join(outputFolder, Constants.Folders.Build);
        }

        args.push('--outputdir=' + outputFolder);
        args.push('--theme=' + themeName);
        args.push('--menu=' + menuName);

        logger.log('info', '3.2. Using theme: ' + themeName);
        logger.log('info', '3.3. Using menu: ' + menuName);

        var generateSourcemap = outputJson.config._generateSourcemap;
        var buildMode = generateSourcemap === true ? 'dev' : 'prod';

        logger.log('info', 'grunt server-build:' + buildMode + ' ' + args.join(' '));

        child = exec('grunt server-build:' + buildMode + ' ' + args.join(' '), {cwd: path.join(FRAMEWORK_ROOT_FOLDER)},
          function(error, stdout, stderr) {
            if (error !== null) {
              logger.log('error', 'exec error: ' + error);
              logger.log('error', 'stdout error: ' + stdout);
              error.message += getGruntFatalError(stdout) || '';
              resultObject.success = true;
              return callback(error, 'Error building framework');
            }

            if (stdout.length != 0) {
              logger.log('info', 'stdout: ' + stdout);
              resultObject.success = true;

              // Indicate that the course has built successfully
              app.emit('previewCreated', tenantId, courseId, outputFolder);

              return callback(null, 'Framework built OK');
            }

            if (stderr.length != 0) {
              logger.log('error', 'stderr: ' + stderr);
              resultObject.success = false;
              return callback(stderr, 'Error (stderr) building framework!');
            }

            resultObject.success = true;
            return callback(null, 'Framework built');
          });
      });
Example #10
0
  createTableQuery: function(tableName, attributes, options) {
    var self = this;

    options = Utils._.extend({
    }, options || {});

    var databaseVersion = Utils._.get(self, 'sequelize.options.databaseVersion', 0);
    //Postgres 9.0 does not support CREATE TABLE IF NOT EXISTS, 9.1 and above do
    var query = 'CREATE TABLE ' +
                ( (databaseVersion === 0 || semver.gte(databaseVersion, '9.1.0')) ? 'IF NOT EXISTS ' : '') +
                '<%= table %> (<%= attributes%>)<%= comments %>'
      , comments = ''
      , attrStr = []
      , i;

    if (options.comment && Utils._.isString(options.comment)) {
      comments += '; COMMENT ON TABLE <%= table %> IS ' + this.escape(options.comment);
    }

    for (var attr in attributes) {
      if ((i = attributes[attr].indexOf('COMMENT')) !== -1) {
        // Move comment to a separate query
        comments += '; ' + attributes[attr].substring(i);
        attributes[attr] = attributes[attr].substring(0, i);
      }

      var dataType = this.dataTypeMapping(tableName, attr, attributes[attr]);
      attrStr.push(this.quoteIdentifier(attr) + ' ' + dataType);
    }

    var values = {
      table: this.quoteTable(tableName),
      attributes: attrStr.join(', '),
      comments: Utils._.template(comments)({ table: this.quoteTable(tableName)})
    };

    if (!!options.uniqueKeys) {
      Utils._.each(options.uniqueKeys, function(columns) {
        if (!columns.singleField) { // If it's a single field its handled in column def, not as an index
          values.attributes += ', UNIQUE (' + columns.fields.map(function(f) { return self.quoteIdentifiers(f); }).join(', ') + ')';
        }
      });
    }

    var pks = _.reduce(attributes, function (acc, attribute, key) {
      if (_.includes(attribute, 'PRIMARY KEY')) {
        acc.push(this.quoteIdentifier(key));
      }
      return acc;
    }.bind(this), []).join(',');

    if (pks.length > 0) {
      values.attributes += ', PRIMARY KEY (' + pks + ')';
    }

    return Utils._.template(query)(values).trim() + ';';
  },
Example #11
0
  createSchema(schema) {
    const databaseVersion = _.get(this, 'sequelize.options.databaseVersion', 0);

    if (databaseVersion && semver.gte(databaseVersion, '9.2.0')) {
      return `CREATE SCHEMA IF NOT EXISTS ${schema};`;
    }

    return `CREATE SCHEMA ${schema};`;
  }
Example #12
0
 bootstraps.each(function () {
     var version = versionInLinkedElement($, this);
     if (version === null) {
         return;
     }
     if (semver.gte(version, BOOTSTRAP_VERSION_4, true)) {
         reporter(FUTURE_VERSION_ERROR, $(this));
     }
 });
	self._read_create_package(name, function(err, data) {
		if (err) return callback(err)

		var change = false
		for (var ver in newdata.versions) {
			if (data.versions[ver] == null) {
				var verdata = newdata.versions[ver]

				// why does anyone need to keep that in database?
				delete verdata.readme

				change = true
				data.versions[ver] = verdata

				if (verdata.dist && verdata.dist.tarball) {
					var url = utils.parse_tarball_url(
						verdata.dist.__sinopia_orig_tarball || verdata.dist.tarball
					)

					// we do NOT overwrite any existing records
					if (url != null && data._distfiles[url.filename] == null) {
						data._distfiles[url.filename] = {
							url: verdata.dist.__sinopia_orig_tarball || verdata.dist.tarball,
							sha: verdata.dist.shasum,
						}
					}
				}
			}
		}
		for (var tag in newdata['dist-tags']) {
			// if tag is updated to reference latter version, that's fine
			var need_change = 
				(data['dist-tags'][tag] == null) ||
				(!semver.gte(newdata['dist-tags'][tag], data['dist-tags'][tag]))

			if (need_change) {
				change = true
				data['dist-tags'][tag] = newdata['dist-tags'][tag]
			}
		}
		for (var up in newdata._uplinks) {
			var need_change = 
				!utils.is_object(data._uplinks[up]) || (newdata._uplinks[up].etag !== data._uplinks[up].etag)

			if (need_change) {
				change = true
				data._uplinks[up] = newdata._uplinks[up]
			}
		}

		if (change) {
			self.logger.debug('updating package info')
			self._write_package(name, data, callback)
		} else {
			callback()
		}
	})
  _refreshDynamicOIDs(connection) {
    const databaseVersion = this.sequelize.options.databaseVersion;
    const supportedVersion = '8.3.0';

    // Check for supported version
    if ( (databaseVersion && semver.gte(databaseVersion, supportedVersion)) === false) {
      return Promise.resolve();
    }

    // Refresh dynamic OIDs for some types
    // These include, Geometry / HStore / Enum
    return (connection || this.sequelize).query(
      "SELECT typname, typtype, oid, typarray FROM pg_type WHERE (typtype = 'b' AND typname IN ('hstore', 'geometry', 'geography')) OR (typtype = 'e')"
    ).then(results => {
      let result = Array.isArray(results) ? results.pop() : results;

      // When searchPath is prepended then two statements are executed and the result is
      // an array of those two statements. First one is the SET search_path and second is
      // the SELECT query result.
      if (Array.isArray(result)) {
        if (result[0].command === 'SET') {
          result = result.pop();
        }
      }

      // Reset OID mapping for dynamic type
      [
        dataTypes.postgres.GEOMETRY,
        dataTypes.postgres.HSTORE,
        dataTypes.postgres.GEOGRAPHY,
        dataTypes.postgres.ENUM
      ].forEach(type => {
        type.types.postgres.oids = [];
        type.types.postgres.array_oids = [];
      });

      for (const row of result.rows) {
        let type;

        if (row.typname === 'geometry') {
          type = dataTypes.postgres.GEOMETRY;
        } else if (row.typname === 'hstore') {
          type = dataTypes.postgres.HSTORE;
        } else if (row.typname === 'geography') {
          type = dataTypes.postgres.GEOGRAPHY;
        } else if (row.typtype === 'e') {
          type = dataTypes.postgres.ENUM;
        }

        type.types.postgres.oids.push(row.oid);
        type.types.postgres.array_oids.push(row.typarray);
      }

      this.refreshTypeParser(dataTypes.postgres);
    });
  }
Example #15
0
 blocks.sort(function(a, b) {
     var nameA = a.group + a.name;
     var nameB = b.group + b.name;
     
     if (nameA === nameB) {
         if (a.version === b.version) return 0;
         return (semver.gte(a.version, b.version)) ? -1 : 1;
     }
     return (nameA < nameB) ? -1 : 1;
 });
Example #16
0
var isValidNpmEclassVersionByStr = function(npmVersion) {

   var ans = false;

   if (semver.valid(npmVersion)) {
      ans = semver.gte(npmVersion, npmEclassMinVer);
   }

   return ans;
};
Example #17
0
    }, function(err, json) {
      if (err) {
        return callback(err);
      }

      var versions = json && json.versions && Object.keys(json.versions) || [];
      versions.sort(semver.rcompare);

      // '1.2.3' -> '~1.2.0'
      var range = semver_helper.get_base_range(parsed);
      var max_patch = semver.maxSatisfying(versions, range);
      var max = versions[0];

      if (
        // if the current minor(feature) doesn't exist
        !max_patch ||

        // greater or equal to
        semver.gte(version, max_patch)
      ) {
        // >>>> range
        tasks[range] = node_path.join(built_root, name, range);

        // if the package is not the latest patch,
        // it's impossible to be the latest of all versions
        if (
          // if there's no versions on the regsitry
          !max ||

          // if current version is the greatest
          semver.gte(version, max)
        ) {
          // >>>> latest
          tasks.latest = node_path.join(built_root, name, 'latest');
        }
      }

      // {
      //     '1.2.3': '/xxx/~1.2.0',
      //     'latest': '/xxx/latest'
      // }
      callback(null, tasks);
    });
 task("version", function() {
    console.log("Checking Node version: .");
    var packageJson = require("./package.json");
    var expectedVersion = packageJson.engines.node;
    var actualVersion = process.version;
    
    if (!semver.gte(actualVersion, expectedVersion)) {
        fail("Wrong version, expected " + expectedVersion + " got " + actualVersion);
    }
 });
Example #19
0
 jqueries.each(function () {
     var script = $(this);
     var matches = script.attr('src').match(/\d+\.\d+\.\d+/g);
     if (!matches) {
         return;
     }
     var version = matches[matches.length - 1];
     if (!semver.gte(version, MIN_JQUERY_VERSION, true)) {
         reporter(OLD_JQUERY, script);
     }
 });
Example #20
0
 errors: result.results[0].messages.map(function (msg) {
   return {
     pos: {
       line: msg.line - 1,
       ch: msg.column + (semverGte(result.version, '5.0.0') ? -1 : 0)
     },
     message: msg.message,
     type: msg.severity === 1 ? CodeInspection.Type.WARNING
                              : CodeInspection.Type.ERROR
   }
 })})
 }, function (err, code, stdout, stderr) {
   t.ifErr(err, 'npm i ' + dep + ' finished without error')
   t.equal(code, 0, 'npm i ' + dep + ' exited ok')
   // https://github.com/npm/npm/pull/13077
   if (semver.gte(process.version, '6.0.0')) {
     t.is(stderr.trim().split(/\n/).length, 3)
   } else {
     t.notOk(stderr, 'no output stderr')
   }
   t.end()
 })
Example #22
0
Sharp.prototype.optimiseScans = function(optimiseScans) {
  if (semver.gte(libvipsVersion, '8.0.0')) {
    this.options.optimiseScans = (typeof optimiseScans === 'boolean') ? optimiseScans : true;
    if (this.options.optimiseScans) {
      this.progressive();
    }
  } else {
    console.error('optimiseScans requires libvips 8.0.0+');
  }
  return this;
};
Example #23
0
module.exports.use_global_vips = function() {
  var useGlobalVips = false;
  var globalVipsVersion = process.env.GLOBAL_VIPS_VERSION;
  if (globalVipsVersion) {
    useGlobalVips = semver.gte(
      globalVipsVersion,
      minimumLibvipsVersion
    );
  }
  process.stdout.write(useGlobalVips ? 'true' : 'false');
};
Example #24
0
function checkVersion(json, report) {
  if ('version' in json) {
    var v = semver.parse(json.version);
    if (!v) {
      report(fmt('Version "%s" is invalid', json.version));
    } else if (!semver.gte(json.version, '1.0.0-0')) {
      // the only versions below 1.0.0 allowed are pre-releases of 1.0.0
      report(fmt('Version "%s" is lower than 1.0.0', json.version));
    }
  }
}
function getFlag(moduleName, version) {
  const list = flags[moduleName || 'react-native'] || {};
  const versions = Object.keys(list);
  let flag = flags.default;
  for (let i = 0; i < versions.length; i++) {
    if (semver.gte(version, versions[i])) {
      flag = list[versions[i]];
    }
  }
  return flag;
}
Example #26
0
 it('should support setting max io threads', function(done) {
   // 3.2 and above.
   if (!semver.gte(zmq.version, '3.2.0')) {
     done();
     return console.warn('Test requires libzmq >= 3.2.0');
   }
   zmq.Context.setMaxThreads(3);
   zmq.Context.getMaxThreads().should.equal(3);
   zmq.Context.setMaxThreads(1);
   done();
 });
        function validateVersionResults(results) {
            expect(results).to.be.an.instanceOf(Object);

            expect(results).to.have.property("name");
            expect(results).to.have.property("version");

            expect(results.version).to.have.property("api");
            expect(semver.gte(results.version.api, testValues.version.api)).to.be.true;

            expect(results.version).to.have.property("software");
            expect(parseInt(results.version.software)).to.at.least(parseInt(testValues.version.software));
        }
Example #28
0
 it('should support setting max number of sockets', function(done) {
   // 3.2 and above.
   if (!semver.gte(zmq.version, '3.2.0')) {
     done();
     return console.warn('Test requires libzmq >= 3.2.0');
   }
   var currMaxSockets = zmq.Context.getMaxSockets();
   zmq.Context.setMaxSockets(256);
   zmq.Context.getMaxSockets().should.equal(256);
   zmq.Context.setMaxSockets(currMaxSockets);
   done();
 });
 getPhotos(parmas, success, failed) {
     if (semver.gte(packageData.version, '0.20.0')) {
         CameraRoll.getPhotos(parmas).then(r=>{
             success(r);
         },e=>{
             failed(e);
         })
     }
     else {
         CameraRoll.getPhotos(params, success, failed);
     }
 }
/**
 * Packer( builder, theme, options )
 * - builder [ instanceof Builder ]: jQuery UI builder object.
 * - theme [ instanceof ThemeRoller ]: theme object.
 * - options: details below.
 *
 * options:
 * - bundleSuffix [ String ]: Change bundle filename suffix. Default is ".custom".
 *
 * Other options may be available, see Packer 1.10 or 1.11-x.
 */
function Packer( builder, theme, options ) {
	this.options = options = options || {};
	if ( typeof options.bundleSuffix === "undefined" ) {
	 options.bundleSuffix = ".custom";
	}

	this.basedir = "jquery-ui-" + builder.jqueryUi.pkg.version + options.bundleSuffix;
	this.builder = builder;
	this.theme = theme;
	this.themeImagesCache = themeImagesCache;

	if ( semver.gte( this.builder.jqueryUi.pkg.version, "1.12.0-a" ) ) {
		require( "./packer-1-12-0" ).call( this, builder, theme, options );
	} else if ( semver.gte( this.builder.jqueryUi.pkg.version, "1.11.1-a" ) ) {
		require( "./packer-1-11-1" ).call( this, builder, theme, options );
	} else if ( semver.gte( this.builder.jqueryUi.pkg.version, "1.11.0-a" ) ) {
		require( "./packer-1-11-0" ).call( this, builder, theme, options );
	} else {
		require( "./packer-1-10" ).call( this, builder, theme, options );
	}
}