mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 15:13:21 +00:00
[Starter CLI] fix has-yarn (#10532)
* fix missing function call * fix deprecated execa command
This commit is contained in:
parent
aebdb33a6e
commit
a860d74a35
@ -33,7 +33,7 @@ function readStarterJson(filePath, starterUrl) {
|
||||
* @param {string} projectName Name of the project
|
||||
*/
|
||||
async function initPackageJson(rootPath, projectName) {
|
||||
const packageManager = hasYarn ? 'yarn --cwd' : 'npm run --prefix';
|
||||
const packageManager = hasYarn() ? 'yarn --cwd' : 'npm run --prefix';
|
||||
|
||||
try {
|
||||
await fse.writeJson(
|
||||
|
||||
@ -9,7 +9,7 @@ const logger = require('./logger');
|
||||
* @param {string} path Path to directory (frontend, backend)
|
||||
*/
|
||||
function runInstall(path) {
|
||||
if (hasYarn) {
|
||||
if (hasYarn()) {
|
||||
return execa('yarn', ['install'], {
|
||||
cwd: path,
|
||||
stdin: 'ignore',
|
||||
@ -20,7 +20,7 @@ function runInstall(path) {
|
||||
}
|
||||
|
||||
function runApp(rootPath) {
|
||||
if (hasYarn) {
|
||||
if (hasYarn()) {
|
||||
return execa('yarn', ['develop'], {
|
||||
stdio: 'inherit',
|
||||
cwd: rootPath,
|
||||
|
||||
@ -4,8 +4,9 @@ const execa = require('execa');
|
||||
|
||||
module.exports = function hasYarn() {
|
||||
try {
|
||||
const { code } = execa.shellSync('yarnpkg --version');
|
||||
if (code === 0) return true;
|
||||
const { exitCode } = execa.sync('yarn --version', { shell: true });
|
||||
|
||||
if (exitCode === 0) return true;
|
||||
return false;
|
||||
} catch (err) {
|
||||
return false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user