Skip to content

Commit

Permalink
fix: need to use a version comparison that supports two part versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic Scheirlinck authored and dominics committed Jan 12, 2022
1 parent 757ddfa commit b91f1a7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"bluebird": "3.7.2",
"chalk": "4.1.2",
"command-exists": "1.2.9",
"compare-versions": "4.1.3",
"debug": "4.3.3",
"execa": "5.1.1",
"glob": "7.2.0",
Expand All @@ -73,7 +74,6 @@
"minimatch": "3.0.4",
"mkdirp": "1.0.4",
"rimraf": "3.0.2",
"semver": "7.3.5",
"split2": "4.1.0",
"tempy": "1.0.1",
"tiny-async-pool": "1.2.0",
Expand All @@ -98,7 +98,6 @@
"@types/minimatch": "3.0.5",
"@types/mkdirp": "1.0.2",
"@types/rimraf": "3.0.2",
"@types/semver": "7.3.9",
"@types/split2": "3.2.1",
"@types/tempy": "0.3.0",
"@types/tiny-async-pool": "1.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/util/tar.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import path from 'path';
import { compare } from 'compare-versions';
import debug from 'debug';
import execa from 'execa';
import _ from 'lodash';
import semver from 'semver/preload';
import { exec, hasBin } from './exec';

const log = debug('monofo:util:tar');
Expand Down Expand Up @@ -45,7 +45,7 @@ export async function tar(): Promise<{ bin: string; createArgs: string[] }> {

const matches = output.match(/^tar \(GNU tar\) ([0-9.-]+)\n/);

if (matches && semver.gte(matches[1], '1.28')) {
if (matches && compare(matches[1], '1.28', '>=')) {
createArgs = [...createArgs, '--sort=name']; // --sort was added in 1.28
}
}
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2818,11 +2818,6 @@
"@types/glob" "*"
"@types/node" "*"

"@types/[email protected]":
version "7.3.9"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.9.tgz#152c6c20a7688c30b967ec1841d31ace569863fc"
integrity sha512-L/TMpyURfBkf+o/526Zb6kd/tchUP3iBDEPjqjb+U2MAJhVRxxrmr2fwpe08E7QsV7YLcpq0tUaQ9O9x97ZIxQ==

"@types/[email protected]":
version "3.2.1"
resolved "https://registry.yarnpkg.com/@types/split2/-/split2-3.2.1.tgz#97c42b560a1b41064d46cd728cf1267d5755ee34"
Expand Down Expand Up @@ -4161,6 +4156,11 @@ compare-func@^2.0.0:
array-ify "^1.0.0"
dot-prop "^5.1.0"

[email protected]:
version "4.1.3"
resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-4.1.3.tgz#8f7b8966aef7dc4282b45dfa6be98434fc18a1a4"
integrity sha512-WQfnbDcrYnGr55UwbxKiQKASnTtNnaAWVi8jZyy8NTpVAXWACSne8lMD1iaIo9AiU6mnuLvSVshCzewVuWxHUg==

component-emitter@^1.2.1:
version "1.3.0"
resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0"
Expand Down

0 comments on commit b91f1a7

Please sign in to comment.