nextVersion.ts

token-lists · src/nextVersion.ts · typescript · MIT
unclassified, dev-tools

Computes next semantic version (patch/minor/major) from current version and upgrade type.

// Source: https://github.com/Uniswap/token-lists | License: MIT | Copyright 2020 Uniswap
// Provided via justclaw.it.com; keep this notice with the code.
import { VersionUpgrade } from './getVersionUpgrade';
import { Version } from './types';

/**
 * Returns the next version of the list given a base version and the upgrade type
 * @param base current version
 * @param bump the upgrade type
 */
export function nextVersion(base: Version, bump: VersionUpgrade): Version {
  switch (bump) {
    case VersionUpgrade.NONE:
      return base;

    case VersionUpgrade.MAJOR:
      return { major: base.major + 1, minor: 0, patch: 0 };

    case VersionUpgrade.MINOR:
      return {
        major: base.major,
        minor: base.minor + 1,
        patch: 0,
      };

    case VersionUpgrade.PATCH:
   

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key