build: switch from npm to yarn
This commit is contained in:

committed by
Alex Rickabaugh

parent
544a7ad0a5
commit
2d5ef15e08
@ -30,7 +30,7 @@ if (+process.version[1] < 5) {
|
||||
try {
|
||||
semver = require('semver');
|
||||
} catch (e) {
|
||||
issues.push('Looks like you are missing some npm dependencies. Run: npm install');
|
||||
issues.push('Looks like you are missing some npm dependencies. Run: `yarn install`');
|
||||
}
|
||||
|
||||
if (issues.length) {
|
||||
@ -46,7 +46,7 @@ if (issues.length) {
|
||||
try {
|
||||
checkNodeModules = require('./npm/check-node-modules.js');
|
||||
} catch (e) {
|
||||
issues.push('Looks like you are missing some npm dependencies. Run: npm install');
|
||||
issues.push('Looks like you are missing some npm dependencies. Run: `yarn install`');
|
||||
throw e;
|
||||
} finally {
|
||||
// print warnings and move on, the next steps will likely fail, but hey, we warned them.
|
||||
@ -65,46 +65,36 @@ if (require.main === module) {
|
||||
}
|
||||
|
||||
function checkEnvironment(reqs) {
|
||||
exec('npm --version', function(npmErr, npmStdout) {
|
||||
exec('yarn --version', function(yarnErr, yarnStdout) {
|
||||
var foundNodeVersion = process.version;
|
||||
var foundNpmVersion = semver.clean(npmStdout);
|
||||
var foundYarnVersion = !yarnErr && semver.clean(yarnStdout);
|
||||
var issues = [];
|
||||
exec('yarn --version', function(yarnErr, yarnStdout) {
|
||||
var foundNodeVersion = process.version;
|
||||
var foundYarnVersion = !yarnErr && semver.clean(yarnStdout);
|
||||
var issues = [];
|
||||
|
||||
if (!semver.satisfies(foundNodeVersion, reqs.requiredNodeVersion)) {
|
||||
issues.push(
|
||||
'You are running unsupported node version. Found: ' + foundNodeVersion + ' Expected: ' +
|
||||
reqs.requiredNodeVersion + '. Use nvm to update your node version.');
|
||||
}
|
||||
|
||||
if (!semver.satisfies(foundNodeVersion, reqs.requiredNodeVersion)) {
|
||||
issues.push(
|
||||
'You are running unsupported node version. Found: ' + foundNodeVersion + ' Expected: ' +
|
||||
reqs.requiredNodeVersion + '. Use nvm to update your node version.');
|
||||
}
|
||||
if (yarnErr) {
|
||||
issues.push(
|
||||
'You don\'t have yarn globally installed. This is required because we use yarn to ' +
|
||||
'ensure that we all use the exact same npm dependencies. Installation instructions: ' +
|
||||
'https://yarnpkg.com/lang/en/docs/install/');
|
||||
} else if (!semver.satisfies(foundYarnVersion, reqs.requiredYarnVersion)) {
|
||||
issues.push(
|
||||
'You are running an unsupported yarn version. Found: ' + foundYarnVersion +
|
||||
' Expected: ' + reqs.requiredYarnVersion + '. This is required because we use yarn to ' +
|
||||
'ensure that we all use the exact same npm dependencies. Installation instructions: ' +
|
||||
'https://yarnpkg.com/lang/en/docs/install/');
|
||||
}
|
||||
|
||||
if (!semver.satisfies(foundNpmVersion, reqs.requiredNpmVersion)) {
|
||||
issues.push(
|
||||
'You are running unsupported npm version. Found: ' + foundNpmVersion + ' Expected: ' +
|
||||
reqs.requiredNpmVersion + '. Run: npm update -g npm');
|
||||
}
|
||||
if (!checkNodeModules()) {
|
||||
issues.push(
|
||||
'Your node_modules directory is stale or out of sync with yarn.lock. Run: yarn install');
|
||||
}
|
||||
|
||||
if (yarnErr) {
|
||||
issues.push(
|
||||
'You don\'t have yarn globally installed. This is required if you want to work on ' +
|
||||
'certain areas, such as `aio/` and `integration/`. Installation instructions: ' +
|
||||
'https://yarnpkg.com/lang/en/docs/install/');
|
||||
} else if (!semver.satisfies(foundYarnVersion, reqs.requiredYarnVersion)) {
|
||||
issues.push(
|
||||
'You are running unsupported yarn version. Found: ' + foundYarnVersion + ' Expected: ' +
|
||||
reqs.requiredYarnVersion + '. This is required if you want to work on ' +
|
||||
'certain areas, such as `aio/` and `integration/`. See: ' +
|
||||
'https://yarnpkg.com/lang/en/docs/install/');
|
||||
}
|
||||
|
||||
if (!checkNodeModules()) {
|
||||
issues.push(
|
||||
'Your node_modules directory is stale or out of sync with npm-shrinkwrap.json. Run: npm install');
|
||||
}
|
||||
|
||||
printWarning(issues);
|
||||
})
|
||||
printWarning(issues);
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user