mirror of
https://github.com/strapi/strapi.git
synced 2025-08-27 18:25:49 +00:00
update execa commands
This commit is contained in:
parent
fb9cbc1a23
commit
2c735db6e0
@ -15,7 +15,7 @@ const stopProcess = require('./stop-process');
|
||||
async function getPackageInfo(packageName, { useYarn } = {}) {
|
||||
// Use yarn if possible because it's faster
|
||||
if (useYarn) {
|
||||
const { stdout } = await execa.command(`yarn info ${packageName} --json`);
|
||||
const { stdout } = await execa('yarn', ['info', packageName, '--json']);
|
||||
const yarnInfo = JSON.parse(stdout);
|
||||
return {
|
||||
name: yarnInfo.data.name,
|
||||
@ -24,7 +24,7 @@ async function getPackageInfo(packageName, { useYarn } = {}) {
|
||||
}
|
||||
|
||||
// Fallback to npm
|
||||
const { stdout } = await execa.command(`npm view ${packageName} name version --silent`);
|
||||
const { stdout } = await execa('npm', ['view', packageName, 'name', 'version', '--silent']);
|
||||
// Use regex to parse name and version from CLI result
|
||||
const [name, version] = stdout.match(/(?<=')(.*?)(?=')/gm);
|
||||
return { name, version };
|
||||
@ -67,11 +67,11 @@ async function getStarterPackageInfo(starter, { useYarn } = {}) {
|
||||
async function downloadNpmStarter({ name, version }, parentDir, { useYarn } = {}) {
|
||||
// Download from npm, using yarn if possible
|
||||
if (useYarn) {
|
||||
await execa.command(`yarn add ${name}@${version} --no-lockfile --silent`, {
|
||||
await execa('yarn', ['add', `${name}@${version}`, '--no-lockfile', '--silent'], {
|
||||
cwd: parentDir,
|
||||
});
|
||||
} else {
|
||||
await execa.command(`npm install ${name}@${version} --no-save --silent`, {
|
||||
await execa('npm', ['install', `${name}@${version}`, '--no-save', '--silent'], {
|
||||
cwd: parentDir,
|
||||
});
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ const chalk = require('chalk');
|
||||
* @returns {Object}
|
||||
*/
|
||||
async function getPackageInfo(packageName) {
|
||||
const { stdout } = await execa.shell(`npm view ${packageName} name version --silent`);
|
||||
const { stdout } = await execa('npm', ['view', packageName, 'name', 'version', '--silent']);
|
||||
// Use regex to parse name and version from CLI result
|
||||
const [name, version] = stdout.match(/(?<=')(.*?)(?=')/gm);
|
||||
return { name, version };
|
||||
@ -46,7 +46,7 @@ async function getTemplatePackageInfo(template) {
|
||||
*/
|
||||
async function downloadNpmTemplate({ name, version }, parentDir) {
|
||||
// Download from npm
|
||||
await execa.shell(`npm install ${name}@${version} --no-save --silent`, {
|
||||
await execa('npm', ['install', `${name}@${version}`, '--no-save', '--silent'], {
|
||||
cwd: parentDir,
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user