本文整理汇总了TypeScript中semver.SemVer.toString方法的典型用法代码示例。如果您正苦于以下问题:TypeScript SemVer.toString方法的具体用法?TypeScript SemVer.toString怎么用?TypeScript SemVer.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类semver.SemVer
的用法示例。
在下文中一共展示了SemVer.toString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: patch
export default function patch(args: string[], opts: any, logger: logging.Logger): void {
const newVersion = args[0];
const incFn = opts.patch ? (v: SemVer) => v.inc('patch') : (v: SemVer) => v;
if (!newVersion) {
logger.fatal('Need to pass in a new version.');
return;
}
const { packages } = require('../../../lib/packages');
const rootPackageJson = path.join(__dirname, '../../../package.json');
for (const packageName of Object.keys(packages)) {
if (packageName == 'angular-cli') {
// Skip the main package.
continue;
}
const pkgJson = require(packages[packageName].packageJson);
const version = new SemVer(pkgJson['version']);
const oldVersion = version.toString();
pkgJson['version'] = incFn(version).toString();
fs.writeFileSync(packages[packageName].packageJson, JSON.stringify(pkgJson, null, 2) + '\n');
logger.info(`${packageName}: ${oldVersion} => ${pkgJson['version']}`);
}
// Do the main package.
const angularCliPackageJson = require(rootPackageJson);
angularCliPackageJson['version'] = newVersion;
fs.writeFileSync(rootPackageJson, JSON.stringify(angularCliPackageJson, null, 2) + '\n');
}
示例2:
// Ranges
str = semver.validRange(str, loose);
bool = semver.satisfies(version, str, loose);
str = semver.maxSatisfying(versions, str, loose);
str = semver.minSatisfying(versions, str, loose);
bool = semver.gtr(version, str, loose);
bool = semver.ltr(version, str, loose);
bool = semver.outside(version, str, '<', loose);
bool = semver.intersects(str, str, loose);
let ver = new semver.SemVer(str, bool);
str = ver.raw;
bool = ver.loose;
str = ver.format();
str = ver.inspect();
str = ver.toString();
num = ver.major;
num = ver.minor;
num = ver.patch;
str = ver.version;
strArr = ver.build;
strArr = ver.prerelease;
comparatorResult = ver.compare(ver);
comparatorResult = ver.compareMain(ver);
comparatorResult = ver.comparePre(ver);
ver = ver.inc("major");
ver = ver.inc("premajor");
ver = ver.inc("minor");
ver = ver.inc("preminor");