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

TypeScript semver.prerelease函数代码示例

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

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



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

示例1:

 Object.keys(packages).forEach((name: string) => {
   // If there's _ANY_ prerelease information, it's on.
   if (semver.prerelease(packages[name].version)) {
     betaOrRc = true;
     version = packages[name].version;
   }
 });
开发者ID:DevIntent,项目名称:angular-cli,代码行数:7,代码来源:publish.ts


示例2: getLatestCompatibleVersion

	public async getLatestCompatibleVersion(packageName: string, referenceVersion?: string): Promise<string> {
		referenceVersion = referenceVersion || this.$staticConfig.version;
		const isPreReleaseVersion = semver.prerelease(referenceVersion) !== null;
		// if the user has some v.v.v-prerelease-xx.xx pre-release version, include pre-release versions in the search query.
		const compatibleVersionRange = isPreReleaseVersion
			? `~${referenceVersion}`
			: `~${semver.major(referenceVersion)}.${semver.minor(referenceVersion)}.0`;
		const latestVersion = await this.getLatestVersion(packageName);
		if (semver.satisfies(latestVersion, compatibleVersionRange)) {
			return latestVersion;
		}

		const data = await this.$npm.view(packageName, { "versions": true });

		const maxSatisfying = semver.maxSatisfying(data, compatibleVersionRange);
		return maxSatisfying || latestVersion;
	}
开发者ID:NathanaelA,项目名称:nativescript-cli,代码行数:17,代码来源:npm-installation-manager.ts


示例3: validatePackageJson

/**
 * Validate the package json file, verifying that everything needed for a successful release is defined properly
 *
 * @param packageJson - Package json content
 */
function validatePackageJson( packageJson: PackageJson ): void {

	// Check the 'version' field
	if ( !packageJson.hasOwnProperty( 'version' ) ) {
		throw new Error( `The "package.json" file defines no version.` );
	}
	if ( semver.valid( packageJson.version ) === null ) { // 'null' means invalid
		throw new Error( `The "package.json" file defines the version "${ packageJson.version }"; regarding semantic versioning this is not a valid version number.` );
	}
	if ( semver.prerelease( packageJson.version ) !== null ) { // 'null' means no pre-release components exist
		throw new Error( `The "package.json" file defines the version "${ packageJson.version }"; pre-release versions are not supported by automatic-release.` );
	}

	// Check the 'repository' field
	if ( !packageJson.hasOwnProperty( 'repository' ) || !packageJson.repository.hasOwnProperty( 'url' ) ) {
		throw new Error( 'The "package.json" file defines no repository URL.' );
	}

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


示例4: handlePackage

/**
 * Handle an individual package on the path - update the dependency.
 */
async function handlePackage(packagePath: string): Promise<string[]> {
  const cmds: string[] = [];

  // Read in the package.json.
  packagePath = path.join(packagePath, 'package.json');
  let data: any;
  try {
    data = utils.readJSONFile(packagePath);
  } catch (e) {
    console.log('Skipping package ' + packagePath);
    return cmds;
  }

  if (data.private) {
    return cmds;
  }

  const pkg = data.name;

  let npmData = await packageJson(pkg, { allVersions: true });
  let versions = Object.keys(npmData.versions).sort(semver.rcompare);
  let tags = npmData['dist-tags'];

  // Go through the versions. The latest prerelease is 'next', the latest
  // non-prerelease should be 'stable'.
  let next = semver.prerelease(versions[0]) ? versions[0] : undefined;
  let latest = versions.find(i => !semver.prerelease(i));

  if (latest && latest !== tags.latest) {
    cmds.push(`npm dist-tag add ${pkg}@${latest} latest`);
  }

  // If next is defined, but not supposed to be, remove it. If next is supposed
  // to be defined, but is not the same as the current next, change it.
  if (!next && tags.next) {
    cmds.push(`npm dist-tag rm ${pkg} next`);
  } else if (next && next !== tags.next) {
    cmds.push(`npm dist-tag add ${pkg}@${next} next`);
  }

  return cmds;
}
开发者ID:AlbertHilb,项目名称:jupyterlab,代码行数:45,代码来源:update-dist-tag.ts


示例5: getSemanticVersion

export function getSemanticVersion() {
    const options = minimist(process.argv.slice(2), {});
    let version = options.version;
    if (!version) {
        version = "0.0.0";
        console.log("No version argument provided, fallback to default version: " + version);
    } else {
        console.log("Found version: " + version);
    }

    if (!semver.valid(version)) {
        throw new Error("Package: invalid semver version: " + version);
    }

    let patch = semver.patch(version);

    if (!options.noversiontransform) {
        patch *= 1000;
        const prerelease = semver.prerelease(version);
        if (prerelease) {
            patch += parseInt(prerelease[1], 10);
        } else {
            patch += 999;
        }
    }

    const result = {
        major: semver.major(version),
        minor: semver.minor(version),
        patch,
        getVersionString() {
            return this.major.toString() + "." + this.minor.toString() + "." + this.patch.toString();
        },
    };

    console.log("Extension Version: " + result.getVersionString());

    return result;
}
开发者ID:geeklearningio,项目名称:gl-vsts-tasks-build-scripts,代码行数:39,代码来源:extension-version.ts


示例6: isPrereleaseCli

export async function isPrereleaseCli() {
  const angularCliPkgJson = JSON.parse(await readFile('node_modules/@angular/cli/package.json'));

  return prerelease(angularCliPkgJson.version).length > 0;
}
开发者ID:angular,项目名称:angular-cli,代码行数:5,代码来源:project.ts


示例7:

 let latest = versions.find(i => !semver.prerelease(i));
开发者ID:AlbertHilb,项目名称:jupyterlab,代码行数:1,代码来源:update-dist-tag.ts


示例8:

strn = semver.clean(str);

strn = semver.valid(str, loose);
strn = semver.clean(str, loose);
strn = semver.inc(str, "major", loose);
strn = semver.inc(str, "premajor", loose);
strn = semver.inc(str, "minor", loose);
strn = semver.inc(str, "preminor", loose);
strn = semver.inc(str, "patch", loose);
strn = semver.inc(str, "prepatch", loose);
strn = semver.inc(str, "prerelease", loose);
strn = semver.inc(str, "prerelease", loose, "alpha");
num = semver.major(str, loose);
num = semver.minor(str, loose);
num = semver.patch(str, loose);
strArr = semver.prerelease(str, loose);

// Comparison
bool = semver.gt(v1, v2, loose);
bool = semver.gte(v1, v2, loose);
bool = semver.lt(v1, v2, loose);
bool = semver.lte(v1, v2, loose);
bool = semver.eq(v1, v2, loose);
bool = semver.neq(v1, v2, loose);
bool = semver.cmp(v1, op, v2, loose);
comparatorResult = semver.compare(v1, v2, loose);
comparatorResult = semver.rcompare(v1, v2, loose);
comparatorResult = semver.compareIdentifiers(str, str);
comparatorResult = semver.rcompareIdentifiers(str, str);
versionsArr = semver.sort(['', new semver.SemVer('')]);
versionsArr = semver.rsort(['', new semver.SemVer('')]);
开发者ID:PriceSpider-NeuIntel,项目名称:DefinitelyTyped,代码行数:31,代码来源:semver-tests.ts


示例9: switch

    github.authenticate({
        type: "basic",
        username: endpointAuth.parameters["Username"],
        password: endpointAuth.parameters["Password"]
    });

    var tagName = tl.getInput("tagName", true);
    var prereleaseMode = tl.getInput("prereleaseMode", true);
    var prerelease = false;
    switch (prereleaseMode)
    {
        case "1":
            prerelease = true;
            break;
        case "3":
            var prereleaseComponents = semver.prerelease(tagName);
            prerelease = (prereleaseComponents !== null);
            break;
        case "2":
        default:
            prerelease = false;
            break;
    }

    github.repos.createRelease({
        user:repositoryInfo.user,
        repo: repositoryInfo.repo,
        tag_name: tagName,
        target_commitish: buildSourceVersion,
        name: tl.getInput("releaseName", false),
        body: tl.getInput("releaseBody", false),
开发者ID:geeklearningio,项目名称:gl-vsts-tasks,代码行数:31,代码来源:creategithubrelease.ts


示例10: isStableSdk

export function isStableSdk(sdkVersion?: string): boolean {
	// We'll consider empty versions as dev; stable versions will likely always
	// be shipped with valid version files.
	return !!(sdkVersion && !semver.prerelease(sdkVersion));
}
开发者ID:DanTup,项目名称:Dart-Code,代码行数:5,代码来源:utils.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript semver.rcompare函数代码示例发布时间:2022-05-25
下一篇:
TypeScript semver.patch函数代码示例发布时间: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