Skip to content

Commit

Permalink
fix(create-app): revert version
Browse files Browse the repository at this point in the history
  • Loading branch information
xud_wang committed Jul 12, 2021
1 parent ead5f90 commit 8602c45
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions packages/create-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,17 +254,14 @@ async function init() {

write('package.json', JSON.stringify(pkg, null, 2))

const pkgManager =
pmFromUserAgent(process.env.npm_config_user_agent)?.name || 'npm'
const pkgManager = /yarn/.test(process.env.npm_execpath) ? 'yarn' : 'npm'

console.log(`\nDone. Now run:\n`)
if (root !== cwd) {
console.log(` cd ${path.relative(cwd, root)}`)
}
console.log(` ${pkgManager === 'yarn' ? `yarn` : `${pkgManager} install`}`)
console.log(
` ${pkgManager === 'yarn' ? `yarn dev` : `${pkgManager} run dev`}`
)
console.log(` ${pkgManager === 'yarn' ? `yarn` : `npm install`}`)
console.log(` ${pkgManager === 'yarn' ? `yarn dev` : `npm run dev`}`)
console.log()
}

Expand Down Expand Up @@ -321,20 +318,6 @@ function emptyDir(dir) {
}
}

/**
* @param {string | undefined} userAgent process.env.npm_config_user_agent
* @returns object | undefined
*/
function pmFromUserAgent(userAgent) {
if (!userAgent) return undefined
const pmSpec = userAgent.split(' ')[0]
const pmSpecArr = pmSpec.split('/')
return {
name: pmSpecArr[0],
version: pmSpecArr[1]
}
}

init().catch((e) => {
console.error(e)
})
})

0 comments on commit 8602c45

Please sign in to comment.