Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
check for package.json locally
  • Loading branch information
balazsorban44 committed Jun 23, 2022
commit adc4778a77f882257340659fe6ffadb7d0cb2213
9 changes: 5 additions & 4 deletions packages/create-next-app/create-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ export async function createApp({

process.chdir(root)

const hasPackageJSON = await existsInRepo(`${example}/package.json`)

if (example) {
/**
* If an example repository is provided, clone it.
Expand Down Expand Up @@ -187,7 +185,8 @@ export async function createApp({
)
}

if (hasPackageJSON) {
const packageJsonPath = path.join(root, 'package.json')
if (fs.existsSync(packageJsonPath)) {
console.log('Installing packages. This might take a couple of minutes.')
console.log()

Expand Down Expand Up @@ -310,7 +309,9 @@ export async function createApp({
}

console.log(`${chalk.green('Success!')} Created ${appName} at ${appPath}`)
if (hasPackageJSON) {

const packageJsonPath = path.join(root, 'package.json')
if (fs.existsSync(packageJsonPath)) {
console.log('Inside that directory, you can run several commands:')
console.log()
console.log(chalk.cyan(` ${packageManager} ${useYarn ? '' : 'run '}dev`))
Expand Down