Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set npx working directory to force versio usage #172

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,13 @@ async function vercelDeploy(ref, commit) {
args.push('--scope', vercelScope);
}

await exec.exec('npx', ['vercel', ...args], options);
// set prefix directory for npx, this will allow it to find the vercel cli
// inside the package.json and not the global
const npxPrefixDirectory = workingDirectory
? ['--prefix', workingDirectory]
: [];

await exec.exec('npx', [...npxPrefixDirectory, 'vercel', ...args], options);

return myOutput;
}
Expand All @@ -170,12 +176,26 @@ async function vercelInspect(deploymentUrl) {
options.cwd = workingDirectory;
}

const args = ['vercel', 'inspect', deploymentUrl, '-t', vercelToken];
// set prefix directory for npx, this will allow it to find the vercel cli
// inside the package.json and not the global
const npxPrefixDirectory = workingDirectory
? ['--prefix', workingDirectory]
: [];

const args = [
...npxPrefixDirectory,
'vercel',
'inspect',
deploymentUrl,
'-t',
vercelToken,
];

if (vercelScope) {
core.info('using scope');
args.push('--scope', vercelScope);
}

await exec.exec('npx', args, options);

const match = myError.match(/^\s+name\s+(.+)$/m);
Expand Down Expand Up @@ -334,8 +354,16 @@ async function aliasDomainsToDeployment(deploymentUrl) {
core.info('using scope');
args.push('--scope', vercelScope);
}

// set prefix directory for npx, this will allow it to find the vercel cli
// inside the package.json and not the global
const npxPrefixDirectory = workingDirectory
? ['--prefix', workingDirectory]
: [];

const promises = aliasDomains.map(domain => {
return exec.exec('npx', [
...npxPrefixDirectory,
'vercel',
...args,
'alias',
Expand Down