Skip to content

Commit

Permalink
fox: prefer using yarn when yarn.lock is found (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengzilong committed Jul 4, 2023
1 parent 6e39af1 commit 63ea467
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/mrm-task-ci/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const fs = require('fs');
const { range } = require('lodash');
const got = require('got');
const packageRepoUrl = require('package-repo-url');
Expand Down Expand Up @@ -25,6 +26,10 @@ async function getNodeVersionsRange(pkg) {
);
}

function isUsingYarn() {
return fs.existsSync('yarn.lock');
}

module.exports = async function task({ workflowFile, readmeFile }) {
const nodeVersions = await getNodeVersionsRange(packageJson());
const defaultBranch = gitDefaultBranch();
Expand Down Expand Up @@ -57,7 +62,7 @@ module.exports = async function task({ workflowFile, readmeFile }) {
},
},
{
run: 'npm ci',
run: isUsingYarn() ? 'yarn' : 'npm ci',
},
{
run: 'npm run build --if-present',
Expand Down

0 comments on commit 63ea467

Please sign in to comment.