-
-
Notifications
You must be signed in to change notification settings - Fork 513
Commit
…nown good version ISSUES CLOSED: #269
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,48 @@ | ||
import { exec } from 'child_process'; | ||
import logSymbols from 'log-symbols'; | ||
import semver from 'semver'; | ||
|
||
export default async () => | ||
new Promise((resolve) => { | ||
import { hasYarn, yarnOrNpmSpawn } from './yarn-or-npm'; | ||
|
||
async function checkGitExists() { | ||
return new Promise((resolve) => { | ||
exec('git --version', (err) => { | ||
if (err) return resolve(false); | ||
resolve(true); | ||
}); | ||
}) | ||
.then(prev => Promise.resolve(prev && semver.gt(process.versions.node, '6.0.0'))); | ||
}); | ||
} | ||
|
||
async function checkNodeVersion() { | ||
return Promise.resolve(semver.gt(process.versions.node, '6.0.0')); | ||
} | ||
|
||
const NPM_WHITELISTED_VERSIONS = '^3.0.0 || ^4.0.0 || ~5.1.0 || ~5.2.0 || >= 5.4.0'; | ||
const YARN_WHITELISTED_VERSIONS = '0.23.3 || 0.24.6'; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
malept
Author
Member
|
||
|
||
function versionWarning(packageManager, whitelistedVersions) { | ||
console.warn( | ||
logSymbols.warning, | ||
(`You are using ${packageManager}, but not a known good version. The known ` + | ||
`versions that work with Electron Forge are: ${whitelistedVersions}`).yellow | ||
); | ||
} | ||
|
||
async function checkPackageManagerVersion() { | ||
return yarnOrNpmSpawn(['--version']) | ||
.then((version) => { | ||
if (hasYarn()) { | ||
if (!semver.satisfies(version, YARN_WHITELISTED_VERSIONS)) { | ||
versionWarning('Yarn', YARN_WHITELISTED_VERSIONS); | ||
} | ||
} else if (!semver.satisfies(version, NPM_WHITELISTED_VERSIONS)) { | ||
versionWarning('NPM', NPM_WHITELISTED_VERSIONS); | ||
} | ||
|
||
return true; | ||
}); | ||
} | ||
|
||
export default async () => | ||
(await Promise.all([checkGitExists(), checkNodeVersion(), checkPackageManagerVersion()])) | ||
.every(check => check); |
This seems really sad. I'm using
brew install yarn
which is currently0.27.5_1
, seemingly way ahead of 0.24.6. How can things be so broken with such a new version?