mirror of
https://github.com/azure/login.git
synced 2026-03-15 09:20:56 -04:00
* Bump lodash from 4.17.15 to 4.17.19 (#52) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Amruta Kawade <65217380+AmrutaKawade@users.noreply.github.com> * Bump @actions/core from 1.1.3 to 1.2.6 (#60) Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.1.3 to 1.2.6. - [Release notes](https://github.com/actions/toolkit/releases) - [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md) - [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Amruta Kawade <65217380+AmrutaKawade@users.noreply.github.com> * updating node_nodules * updated package-lock Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
92 lines
1.9 KiB
JavaScript
92 lines
1.9 KiB
JavaScript
'use strict';
|
|
const supportsColor = require('supports-color');
|
|
const hasFlag = require('has-flag');
|
|
|
|
function parseVersion(versionString) {
|
|
if (/^\d{3,4}$/.test(versionString)) {
|
|
// Env var doesn't always use dots. example: 4601 => 46.1.0
|
|
const m = /(\d{1,2})(\d{2})/.exec(versionString);
|
|
return {
|
|
major: 0,
|
|
minor: parseInt(m[1], 10),
|
|
patch: parseInt(m[2], 10)
|
|
};
|
|
}
|
|
|
|
const versions = (versionString || '').split('.').map(n => parseInt(n, 10));
|
|
return {
|
|
major: versions[0],
|
|
minor: versions[1],
|
|
patch: versions[2]
|
|
};
|
|
}
|
|
|
|
function supportsHyperlink(stream) {
|
|
const {env} = process;
|
|
|
|
if ('FORCE_HYPERLINK' in env) {
|
|
return !(env.FORCE_HYPERLINK.length > 0 && parseInt(env.FORCE_HYPERLINK, 10) === 0);
|
|
}
|
|
|
|
if (hasFlag('no-hyperlink') || hasFlag('no-hyperlinks') || hasFlag('hyperlink=false') || hasFlag('hyperlink=never')) {
|
|
return false;
|
|
}
|
|
|
|
if (hasFlag('hyperlink=true') || hasFlag('hyperlink=always')) {
|
|
return true;
|
|
}
|
|
|
|
// If they specify no colors, they probably don't want hyperlinks.
|
|
if (!supportsColor.supportsColor(stream)) {
|
|
return false;
|
|
}
|
|
|
|
if (stream && !stream.isTTY) {
|
|
return false;
|
|
}
|
|
|
|
if (process.platform === 'win32') {
|
|
return false;
|
|
}
|
|
|
|
if ('CI' in env) {
|
|
return false;
|
|
}
|
|
|
|
if ('TEAMCITY_VERSION' in env) {
|
|
return false;
|
|
}
|
|
|
|
if ('TERM_PROGRAM' in env) {
|
|
const version = parseVersion(env.TERM_PROGRAM_VERSION);
|
|
|
|
switch (env.TERM_PROGRAM) {
|
|
case 'iTerm.app':
|
|
if (version.major === 3) {
|
|
return version.minor >= 1;
|
|
}
|
|
|
|
return version.major > 3;
|
|
// No default
|
|
}
|
|
}
|
|
|
|
if ('VTE_VERSION' in env) {
|
|
// 0.50.0 was supposed to support hyperlinks, but throws a segfault
|
|
if (env.VTE_VERSION === '0.50.0') {
|
|
return false;
|
|
}
|
|
|
|
const version = parseVersion(env.VTE_VERSION);
|
|
return version.major > 0 || version.minor >= 50;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
module.exports = {
|
|
supportsHyperlink,
|
|
stdout: supportsHyperlink(process.stdout),
|
|
stderr: supportsHyperlink(process.stderr)
|
|
};
|