How to use the semver.prerelease 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 autochthe / react-console / release.js View on Github external
function createRelease(version, body) {
	console.log(`Creating new Github release for v${version}`);
	console.log(body);

	// Connect to github
	let github = new GitHubAPI();
	github.authenticate(token);
	github.repos.createRelease({
		user: USER,
		repo: REPO,
		tag_name: `v${version}`,
		body: body,
		prerelease: semver.prerelease(version)?true:false,
	}, (err,res) => {
		if(err) {
			console.log(err);
		} else {
			let id = res.id;

			console.log('Uploading assets')
			for(let asset of ASSETS) {
				github.repos.uploadAsset({
					user: USER,
					repo: REPO,
					id: id,
					name: path.basename(asset),
					filePath: asset,
				});
			}
github greenkeeperio / greenkeeper / utils / utils.js View on Github external
return groups.map((group) => {
    // only include changes from
    const groupName = Object.keys(group)[0]
    const relevantMonorepoChangeFiles = monorepo.filter(change => {
      return group[groupName].packages.includes(change.value.filename)
    })
    const version = distTags[distTag]
    if (semver.prerelease(version) && !semver.prerelease(relevantMonorepoChangeFiles[0].value.oldVersion)) {
      log.info(`exited: ${dependency} ${version} is a prerelease on latest and user does not use prereleases`)
      return
    }
    return {
      data: Object.assign({
        name: 'create-group-version-branch',
        group,
        version,
        dependency,
        dependencyUpdatedAt,
        versions,
        repositoryId,
        oldVersionResolved,
        installation: account.installation,
        accountId: account.id || account._id,
        types,
github thelounge / thelounge / scripts / changelog.js View on Github external
function prereleaseType(v) {
	return semver.prerelease(v)[0];
}
github Shopify / polaris-react / scripts / public-repo-deploy.js View on Github external
function isMajorPrerelease(version) {
  return (
    semver.prerelease(version) &&
    semver.minor(version) === 0 &&
    semver.patch(version) === 0
  );
}
github release-it / release-it / lib / npm.js View on Github external
getTag({ tag = DEFAULT_TAG, version, isPreRelease } = {}) {
    if (!isPreRelease || !version || tag !== DEFAULT_TAG) {
      return tag;
    } else {
      const preReleaseComponents = semver.prerelease(version);
      return _.get(preReleaseComponents, 0, tag);
    }
  }
github vuejs / vue-next / scripts / release.js View on Github external
const args = require('minimist')(process.argv.slice(2))
const fs = require('fs')
const path = require('path')
const chalk = require('chalk')
const semver = require('semver')
const currentVersion = require('../package.json').version
const { prompt } = require('enquirer')
const execa = require('execa')

const preId = args.preid || semver.prerelease(currentVersion)[0] || 'alpha'
const isDryRun = args.dry
const skipTests = args.skipTests
const skipBuild = args.skipBuild
const packages = fs
  .readdirSync(path.resolve(__dirname, '../packages'))
  .filter(p => !p.endsWith('.ts') && !p.startsWith('.'))

const skippedPackages = ['server-renderer']

const versionIncrements = [
  'patch',
  'minor',
  'major',
  'prepatch',
  'preminor',
  'premajor',
github dscalzi / HeliosLauncher / app / assets / js / scripts / settings.js View on Github external
function isPrerelease(version){
    const preRelComp = semver.prerelease(version)
    return preRelComp != null && preRelComp.length > 0
}
github fossasia / susper.com / node_modules / semver-intersect / semver-intersect.js View on Github external
function parseRange(range) {
    var condition = regex.condition.exec(range)[1] || '=';
    var version = regex.version.exec(range)[1];
    var prerelease = semver.prerelease(version);
    return { condition, prerelease, version };
}
github ustbhuangyi / better-scroll / scripts / release.js View on Github external
function isPreRelease (version) {
    return !!semver.prerelease(version)
  }