Skip to content

Commit

Permalink
feat: try to use cypress new platforms (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Aug 4, 2019
1 parent 5f4476e commit 32d1c95
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/download/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const chalk = require('chalk');
const uuid = require('uuid');
const moment = require('moment');
const os = require('os');
const semver = require('semver');
const get = require('../get');
const utils = require('../utils');

Expand Down Expand Up @@ -257,11 +258,16 @@ async function download(pkg, options) {
// replace cypress download url
// https://github.com/cypress-io/cypress/blob/master/cli/lib/tasks/download.js#L30
if (pkg.name === 'cypress') {
const platforms = binaryMirror.platforms || {
const defaultPlatforms = {
darwin: 'osx64',
linux: 'linux64',
win32: 'win64',
};
let platforms = binaryMirror.platforms || defaultPlatforms;
// version >= 3.3.0 should use binaryMirror.newPlatforms by default, other use defaultPlatforms
if (binaryMirror.newPlatforms && semver.gte(pkg.version, '3.3.0')) {
platforms = binaryMirror.newPlatforms;
}
const targetPlatform = platforms[os.platform()];
if (targetPlatform) {
options.console.info('%s download from binary mirror: %j, targetPlatform: %s',
Expand Down

0 comments on commit 32d1c95

Please sign in to comment.