pax_global_header00006660000000000000000000000064135511046110014507gustar00rootroot0000000000000052 comment=12659d0ec02a2707c2dec435d9ef66def4065b74 semver-diff-3.1.1/000077500000000000000000000000001355110461100137205ustar00rootroot00000000000000semver-diff-3.1.1/.editorconfig000066400000000000000000000002571355110461100164010ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.yml] indent_style = space indent_size = 2 semver-diff-3.1.1/.gitattributes000066400000000000000000000000231355110461100166060ustar00rootroot00000000000000* text=auto eol=lf semver-diff-3.1.1/.github/000077500000000000000000000000001355110461100152605ustar00rootroot00000000000000semver-diff-3.1.1/.github/funding.yml000066400000000000000000000001651355110461100174370ustar00rootroot00000000000000github: sindresorhus open_collective: sindresorhus tidelift: npm/semver-diff custom: https://sindresorhus.com/donate semver-diff-3.1.1/.github/security.md000066400000000000000000000002631355110461100174520ustar00rootroot00000000000000# Security Policy To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. semver-diff-3.1.1/.gitignore000066400000000000000000000000271355110461100157070ustar00rootroot00000000000000node_modules yarn.lock semver-diff-3.1.1/.npmrc000066400000000000000000000000231355110461100150330ustar00rootroot00000000000000package-lock=false semver-diff-3.1.1/.travis.yml000066400000000000000000000000651355110461100160320ustar00rootroot00000000000000language: node_js node_js: - '12' - '10' - '8' semver-diff-3.1.1/index.d.ts000066400000000000000000000020721355110461100156220ustar00rootroot00000000000000declare namespace semverDiff { type Result = | 'major' | 'premajor' | 'minor' | 'preminor' | 'patch' | 'prepatch' | 'prerelease' | 'build'; } /** Get the diff type of two [semver](https://github.com/npm/node-semver) versions: `0.0.1 0.0.2` → `patch`. @returns The difference type between two semver versions, or `undefined` if they're identical or the second one is lower than the first. @example ``` import semverDiff = require('semver-diff'); semverDiff('1.1.1', '1.1.2'); //=> 'patch' semverDiff('1.1.1-foo', '1.1.2'); //=> 'prepatch' semverDiff('0.0.1', '1.0.0'); //=> 'major' semverDiff('0.0.1-foo', '1.0.0'); //=> 'premajor' semverDiff('0.0.1', '0.1.0'); //=> 'minor' semverDiff('0.0.1-foo', '0.1.0'); //=> 'preminor' semverDiff('0.0.1-foo', '0.0.1-foo.bar'); //=> 'prerelease' semverDiff('0.1.0', '0.1.0+foo'); //=> 'build' semverDiff('0.0.1', '0.0.1'); //=> undefined semverDiff('0.0.2', '0.0.1'); //=> undefined ``` */ declare function semverDiff( versionA: string, versionB: string ): semverDiff.Result | undefined; export = semverDiff; semver-diff-3.1.1/index.js000066400000000000000000000004371355110461100153710ustar00rootroot00000000000000'use strict'; const semver = require('semver'); module.exports = (versionA, versionB) => { versionA = semver.parse(versionA); versionB = semver.parse(versionB); if (semver.compareBuild(versionA, versionB) >= 0) { return; } return semver.diff(versionA, versionB) || 'build'; }; semver-diff-3.1.1/index.test-d.ts000066400000000000000000000002141355110461100165730ustar00rootroot00000000000000import {expectType} from 'tsd'; import semverDiff = require('.'); expectType(semverDiff('1.1.1', '1.1.2')); semver-diff-3.1.1/license000066400000000000000000000021251355110461100152650ustar00rootroot00000000000000MIT License Copyright (c) Sindre Sorhus (sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. semver-diff-3.1.1/package.json000066400000000000000000000011751355110461100162120ustar00rootroot00000000000000{ "name": "semver-diff", "version": "3.1.1", "description": "Get the diff type of two semver versions: 0.0.1 0.0.2 → patch", "license": "MIT", "repository": "sindresorhus/semver-diff", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "engines": { "node": ">=8" }, "scripts": { "test": "xo && ava && tsd" }, "files": [ "index.js", "index.d.ts" ], "keywords": [ "semver", "version", "semantic", "diff", "difference" ], "dependencies": { "semver": "^6.3.0" }, "devDependencies": { "ava": "^2.4.0", "tsd": "^0.9.0", "xo": "^0.25.3" } } semver-diff-3.1.1/readme.md000066400000000000000000000041201355110461100154740ustar00rootroot00000000000000# semver-diff [![Build Status](https://travis-ci.org/sindresorhus/semver-diff.svg?branch=master)](https://travis-ci.org/sindresorhus/semver-diff) > Get the diff type of two [semver](https://github.com/npm/node-semver) versions: `0.0.1 0.0.2` → `patch` ## Install ``` $ npm install semver-diff ``` ## Usage ```js const semverDiff = require('semver-diff'); semverDiff('1.1.1', '1.1.2'); //=> 'patch' semverDiff('1.1.1-foo', '1.1.2'); //=> 'prepatch' semverDiff('0.0.1', '1.0.0'); //=> 'major' semverDiff('0.0.1-foo', '1.0.0'); //=> 'premajor' semverDiff('0.0.1', '0.1.0'); //=> 'minor' semverDiff('0.0.1-foo', '0.1.0'); //=> 'preminor' semverDiff('0.0.1-foo', '0.0.1-foo.bar'); //=> 'prerelease' semverDiff('0.1.0', '0.1.0+foo'); //=> 'build' semverDiff('0.0.1', '0.0.1'); //=> undefined semverDiff('0.0.2', '0.0.1'); //=> undefined ``` ## API ### semverDiff(versionA, versionB) Returns the difference type between two semver versions, or `undefined` if they're identical or the second one is lower than the first. Possible values: `'major'`, `'premajor'`, `'minor'`, `'preminor'`, `'patch'`, `'prepatch'`, `'prerelease'`, `'build'`, `undefined`. ## Related - [latest-semver](https://github.com/sindresorhus/latest-semver) - Get the latest stable semver version from an array of versions - [to-semver](https://github.com/sindresorhus/to-semver) - Get an array of valid, sorted, and cleaned semver versions from an array of strings - [semver-regex](https://github.com/sindresorhus/semver-regex) - Regular expression for matching semver versions - [semver-truncate](https://github.com/sindresorhus/semver-truncate) - Truncate a semver version: `1.2.3` → `1.2.0` ---
Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.
semver-diff-3.1.1/test.js000066400000000000000000000020311355110461100152310ustar00rootroot00000000000000'use strict'; import test from 'ava'; import semverDiff from '.'; test('should get the semver diff type', t => { t.is(semverDiff('0.0.1', '1.0.0'), 'major'); t.is(semverDiff('0.0.1', '0.1.0'), 'minor'); t.is(semverDiff('0.0.1', '0.0.2'), 'patch'); t.is(semverDiff('0.0.1-foo', '1.0.0'), 'premajor'); t.is(semverDiff('0.0.1-foo', '0.1.0'), 'preminor'); t.is(semverDiff('1.1.1-foo', '1.1.2'), 'prepatch'); t.is(semverDiff('0.0.1-foo', '0.0.1-foo.bar'), 'prerelease'); t.is(semverDiff('0.0.1', '0.0.1'), undefined); t.is(semverDiff('0.0.2', '0.0.1'), undefined); t.is(semverDiff('0.0.1', '0.0.1+foo.bar'), 'build'); t.is(semverDiff('0.0.1+0', '0.0.1'), undefined); t.is(semverDiff('0.0.1+2', '0.0.1+2'), undefined); t.is(semverDiff('0.0.1+3', '0.0.1+2'), undefined); t.is(semverDiff('0.0.1+1', '0.0.1+2'), 'build'); t.is(semverDiff('0.0.1+2', '0.0.1+2.0'), 'build'); t.is(semverDiff('0.0.1+2.0', '0.0.1+2'), undefined); t.is(semverDiff('0.0.1+2.a', '0.0.1+2.0'), undefined); t.is(semverDiff('0.0.1+2.0', '0.0.1+2.a'), 'build'); });