create-payload-app
Advanced tools
Comparing version 3.0.0-beta.37 to 3.0.0-beta.38
@@ -1,17 +0,29 @@ | ||
import commandExists from 'command-exists'; | ||
import execa from 'execa'; | ||
import fse from 'fs-extra'; | ||
export async function getPackageManager(args) { | ||
const { cliArgs, projectDir } = args; | ||
// Check for yarn.lock, package-lock.json, or pnpm-lock.yaml | ||
let detected = 'npm'; | ||
if (cliArgs?.['--use-pnpm'] || fse.existsSync(`${projectDir}/pnpm-lock.yaml`) || await commandExists('pnpm')) { | ||
detected = 'pnpm'; | ||
} else if (cliArgs?.['--use-yarn'] && fse.existsSync(`${projectDir}/yarn.lock`) || await commandExists('yarn')) { | ||
detected = 'yarn'; | ||
} else if (cliArgs?.['--use-npm'] && fse.existsSync(`${projectDir}/package-lock.json`)) { | ||
detected = 'npm'; | ||
try { | ||
// Check for yarn.lock, package-lock.json, or pnpm-lock.yaml | ||
let detected = 'npm'; | ||
if (cliArgs?.['--use-pnpm'] || fse.existsSync(`${projectDir}/pnpm-lock.yaml`) || await commandExists('pnpm')) { | ||
detected = 'pnpm'; | ||
} else if (cliArgs?.['--use-yarn'] || fse.existsSync(`${projectDir}/yarn.lock`) || await commandExists('yarn')) { | ||
detected = 'yarn'; | ||
} else if (cliArgs?.['--use-npm'] || fse.existsSync(`${projectDir}/package-lock.json`)) { | ||
detected = 'npm'; | ||
} | ||
return detected; | ||
} catch (error) { | ||
return 'npm'; | ||
} | ||
return detected || 'npm'; | ||
} | ||
async function commandExists(command) { | ||
try { | ||
await execa.command(`command -v ${command}`); | ||
return true; | ||
} catch { | ||
return false; | ||
} | ||
} | ||
//# sourceMappingURL=get-package-manager.js.map |
@@ -14,31 +14,6 @@ import { error, info } from '../utils/log.js'; | ||
{ | ||
name: 'blank-3.0', | ||
name: 'blank', | ||
type: 'starter', | ||
description: 'Blank 3.0 Template', | ||
url: 'https://github.com/payloadcms/payload/templates/blank-3.0#beta' | ||
}, | ||
// Remove these until they have been updated for 3.0 | ||
// { | ||
// name: 'blank', | ||
// type: 'starter', | ||
// description: 'Blank Template', | ||
// url: 'https://github.com/payloadcms/payload/templates/blank', | ||
// }, | ||
// { | ||
// name: 'website', | ||
// type: 'starter', | ||
// description: 'Website Template', | ||
// url: 'https://github.com/payloadcms/payload/templates/website', | ||
// }, | ||
// { | ||
// name: 'ecommerce', | ||
// type: 'starter', | ||
// description: 'E-commerce Template', | ||
// url: 'https://github.com/payloadcms/payload/templates/ecommerce', | ||
// }, | ||
{ | ||
name: 'plugin', | ||
type: 'plugin', | ||
description: 'Template for creating a Payload plugin', | ||
url: 'https://github.com/payloadcms/payload-plugin-template#beta' | ||
} | ||
@@ -45,0 +20,0 @@ ]; |
{ | ||
"name": "create-payload-app", | ||
"version": "3.0.0-beta.37", | ||
"version": "3.0.0-beta.38", | ||
"homepage": "https://payloadcms.com", | ||
@@ -32,3 +32,2 @@ "repository": { | ||
"chalk": "^4.1.0", | ||
"command-exists": "^1.2.9", | ||
"comment-json": "^4.2.3", | ||
@@ -44,3 +43,2 @@ "degit": "^2.8.4", | ||
"devDependencies": { | ||
"@types/command-exists": "^1.2.0", | ||
"@types/degit": "^2.8.3", | ||
@@ -47,0 +45,0 @@ "@types/esprima": "^4.0.6", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
12
6
194818
1822
- Removedcommand-exists@^1.2.9
- Removedcommand-exists@1.2.9(transitive)