Skip to content
This repository has been archived by the owner on Sep 9, 2021. It is now read-only.

Fix file existence checks in init.js #73

Merged
merged 5 commits into from
Jan 25, 2021
Merged
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
7 changes: 3 additions & 4 deletions src/init.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

const { promises: fs } = require('fs');
const { promises: fs, existsSync } = require('fs');
const pathUtils = require('path');
const packageInit = require('init-package-json');

Expand Down Expand Up @@ -68,7 +67,7 @@ module.exports = async function initHandler(argv) {
async function asyncPackageInit() {

// use existing package.json if found
const hasPackage = await fs.access('package.json');
const hasPackage = existsSync('package.json');

if (hasPackage) {

Expand All @@ -90,7 +89,7 @@ async function asyncPackageInit() {
}

// exit if yarn.lock is found, or we'll be in trouble
const usesYarn = await fs.access('yarn.lock');
const usesYarn = existsSync('yarn.lock');

if (usesYarn) {
logError(
Expand Down