• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript semver.inc函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中semver.inc函数的典型用法代码示例。如果您正苦于以下问题:TypeScript inc函数的具体用法?TypeScript inc怎么用?TypeScript inc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了inc函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: getNextVersionNumber

export function getNextVersionNumber(
  version: string,
  channel: Channel
): string {
  const semanticVersion = parse(version)

  if (semanticVersion == null) {
    throw new Error(`Unable to parse input '${version}' into version`)
  }

  switch (channel) {
    case 'production':
      if (isBetaTag(semanticVersion)) {
        throw new Error(
          `Unable to draft production release using beta version '${version}'`
        )
      }

      if (isTestTag(semanticVersion)) {
        throw new Error(
          `Unable to draft production release using test version '${version}'`
        )
      }

      const nextVersion = inc(version, 'patch')
      if (nextVersion == null) {
        throw new Error(
          `Unable to increment next production version from release version '${version}'`
        )
      }

      return nextVersion

    case 'beta':
      if (isTestTag(semanticVersion)) {
        throw new Error(
          `Unable to draft beta release using test version '${version}'`
        )
      }

      const betaNumber = tryGetBetaNumber(semanticVersion)

      if (betaNumber) {
        return semanticVersion.version.replace(
          `-beta${betaNumber}`,
          `-beta${betaNumber + 1}`
        )
      } else {
        const nextVersion = inc(semanticVersion, 'patch')
        const firstBeta = `${nextVersion}-beta1`
        return firstBeta
      }

    default:
      throw new Error(
        `Resolving the next version is not implemented for channel ${channel}`
      )
  }
}
开发者ID:ghmoore,项目名称:desktop,代码行数:59,代码来源:version.ts


示例2: getVersionUtility

export function getVersionUtility(versionRadio: string, highestVersion: string): string {
    switch(versionRadio) {
        case "patch":
            return semver.inc(highestVersion, "patch");
        case "minor":
            return semver.inc(highestVersion, "minor");
        case "major":
            return semver.inc(highestVersion, "major");
        default:
            return null;
    }
}
开发者ID:shubham90,项目名称:vsts-tasks,代码行数:12,代码来源:ArtifactToolUtilities.ts


示例3:

 .map(w => {
   const obj = pendingWorkspaces[w];
   return {
     ...obj,
     versionNext: semver.inc(obj.version, obj.type)
   };
 })
开发者ID:skatejs,项目名称:skatejs,代码行数:7,代码来源:get-changes.ts


示例4: calculateNextVersion

async function calculateNextVersion(
  name: string,
  version: string,
  changes: Array<Commit>
): Promise<string> {
  const tags = await getTagsFor(name);
  return tags.length || version !== '0.0.0'
    ? semver.inc(version, calculateReleaseType(changes))
    : version;
}
开发者ID:skatejs,项目名称:skatejs,代码行数:10,代码来源:get-changed.ts


示例5: reject

		}, ( error: Error | null, recommendedBump: RecommendedBump ) => {

			// Handle errors
			if ( error ) {
				reject( new Error( `An error occured while evaluating the next version. [${ error.message }]` ) );
				return;
			}

			const newVersion: string = semver.inc( oldVersion, recommendedBump.releaseType );
			resolve( newVersion );

		} );
开发者ID:dominique-mueller,项目名称:automatic-release,代码行数:12,代码来源:information.ts


示例6: bumpVersion

/**
 * @param {string} type
 * @returns {NodeJS.ReadableStream}
 */
function bumpVersion(type:string):void
{
	// No tsd yet.
	const bump = require('gulp-bump');

	var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
	// increment version
	var newVer = semver.inc(pkg.version, type);

	return gulp.src(['./bower.json', './package.json'])
		.pipe(bump({version: newVer}))
		.pipe(gulp.dest('./'));

}
开发者ID:wanderer06,项目名称:TypeScript.NET,代码行数:18,代码来源:bumpVersion.ts


示例7: bumpVersion

/**
 * Bumps the version of the given package descriptor and then saves the result to disk.
 *
 * @param packageDescriptor The package descriptor representing the 'package.json' file.
 * @param packagePath The path to the package.
 * @param versionBump The string representation of a version or a [[VersionBump]] value.
 *
 * @returns The modified package descriptor.
 */
function bumpVersion(packageDescriptor: PackageDescriptor, packagePath: string, versionBump: string | VersionBump): PackageDescriptor {
    let version: string;

    if (typeof versionBump === "string") {
        let versionBumpValue: string = VersionBump[VersionBump[versionBump]];

        version = versionBumpValue
                  ? semver.inc(packageDescriptor["version"], versionBump)
                  : semver.valid(versionBump);

        if (!version) {
            throw new Error(`'${versionBump}' is not a valid version.`);
        }
    }
    else {
        version = semver.inc(packageDescriptor["version"], VersionBump[versionBump]);
    }

    Logger.verbose(`Bumping workspace package '${util.colors.cyan(packageDescriptor["name"])}' to version '${version}'`);

    packageDescriptor["version"] = version;

    return packageDescriptor;
}
开发者ID:i-e-b,项目名称:gulp-npmworkspace,代码行数:33,代码来源:PublishPackages.ts


示例8: switch

		.then(manifest => {
			switch (version) {
				case 'major':
				case 'minor':
				case 'patch':
					return { manifest, version: semver.inc(manifest.version, version) };
				default:
					const updatedVersion = semver.valid(version);

					if (!updatedVersion) {
						return Promise.reject(`Invalid version ${ version }`);
					}

					return { manifest, version: updatedVersion };
			}
		}).then(({ manifest, version }) => {
开发者ID:waderyan,项目名称:vscode-vsce,代码行数:16,代码来源:publish.ts


示例9: task

task('release.copyProdVersion', () => {
  // Increment the version and update the source package file
  const sourcePackageJSON = require(`${PROJECT_ROOT}/package.json`);

  sourcePackageJSON.version = semver.inc(sourcePackageJSON.version, promptAnswers.release, true);

  const sourcePrettyPrintedJson = JSON.stringify(sourcePackageJSON, null, 2);
  writeFileSync(`${PROJECT_ROOT}/package.json`, sourcePrettyPrintedJson);

  // Copy the source package version and update it in the build package file
  const packageJsonToUpdate = require(`${DIST_BUILD_ROOT}/package.json`);

  packageJsonToUpdate.version = sourcePackageJSON.version;

  const prettyPrintedJson = JSON.stringify(packageJsonToUpdate, null, 2);
  writeFileSync(`${DIST_BUILD_ROOT}/package.json`, prettyPrintedJson);
});
开发者ID:HugoHeneault,项目名称:ionic,代码行数:17,代码来源:release.ts


示例10: prePublish

function prePublish(type: "patch" | "minor" | "major") {
  const pkg = JSON.parse(fs.readFileSync(`package.json`, "utf-8"));
  pkg.version = semver.inc(pkg.version, type);
  fs.writeFileSync(`package.json`, JSON.stringify(pkg, null, "  "));
}
开发者ID:brn,项目名称:react-mvi,代码行数:5,代码来源:semver.ts



注:本文中的semver.inc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript semver.intersects函数代码示例发布时间:2022-05-25
下一篇:
TypeScript semver.gtr函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap