mirror of
https://github.com/strapi/strapi.git
synced 2025-12-25 06:04:29 +00:00
Add default option objects
This commit is contained in:
parent
965d27fa02
commit
983ea2ccf9
@ -33,7 +33,7 @@ function readStarterJson(filePath, starter) {
|
||||
* @param {Object} options
|
||||
* @param {boolean} options.useYarn - Use yarn instead of npm
|
||||
*/
|
||||
async function initPackageJson(rootPath, projectName, { useYarn } ) {
|
||||
async function initPackageJson(rootPath, projectName, { useYarn } = {}) {
|
||||
const packageManager = useYarn ? 'yarn --cwd' : 'npm run --prefix';
|
||||
|
||||
try {
|
||||
@ -93,7 +93,7 @@ async function installWithLogs(path, options) {
|
||||
* @param {Object} options
|
||||
* @param {boolean} options.useYarn Use yarn instead of npm
|
||||
*/
|
||||
async function getStarterInfo(starter, { useYarn }) {
|
||||
async function getStarterInfo(starter, { useYarn } = {}) {
|
||||
const isLocalStarter = ['./', '../', '/'].some(filePrefix => starter.startsWith(filePrefix));
|
||||
|
||||
let starterPath;
|
||||
|
||||
@ -9,7 +9,7 @@ const logger = require('./logger');
|
||||
* @param {Object} options
|
||||
* @param {boolean} options.useYarn Use yarn instead of npm
|
||||
*/
|
||||
function runInstall(path, { useYarn }) {
|
||||
function runInstall(path, { useYarn } = {}) {
|
||||
return execa(useYarn ? 'yarn' : 'npm', ['install'], {
|
||||
cwd: path,
|
||||
stdin: 'ignore',
|
||||
@ -21,7 +21,7 @@ function runInstall(path, { useYarn }) {
|
||||
* @param {Object} options
|
||||
* @param {boolean} options.useYarn
|
||||
*/
|
||||
function runApp(rootPath, { useYarn }) {
|
||||
function runApp(rootPath, { useYarn } = {}) {
|
||||
if (useYarn) {
|
||||
return execa('yarn', ['develop'], {
|
||||
stdio: 'inherit',
|
||||
|
||||
@ -12,7 +12,7 @@ const stopProcess = require('./stop-process');
|
||||
* @param {boolean} options.useYarn Yarn instead of npm
|
||||
* @returns {Object}
|
||||
*/
|
||||
async function getPackageInfo(packageName, { useYarn }) {
|
||||
async function getPackageInfo(packageName, { useYarn } = {}) {
|
||||
// Use yarn if possible because it's faster
|
||||
if (useYarn) {
|
||||
const { stdout } = await execa.command(`yarn info ${packageName} --json`);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user