Add default option objects

This commit is contained in:
Rémi de Juvigny 2021-11-24 09:52:26 +01:00
parent 965d27fa02
commit 983ea2ccf9
3 changed files with 5 additions and 5 deletions

View File

@ -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;

View File

@ -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',

View File

@ -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`);