create-payload-app
Advanced tools
Comparing version
import type { ProjectTemplate } from '../types.js'; | ||
export declare function validateTemplate(templateName: string): boolean; | ||
export declare function validateTemplate({ templateName }: { | ||
templateName: string; | ||
}): boolean; | ||
export declare function getValidTemplates(): ProjectTemplate[]; | ||
//# sourceMappingURL=templates.d.ts.map |
import { error, info } from '../utils/log.js'; | ||
import { PACKAGE_VERSION } from './constants.js'; | ||
export function validateTemplate(templateName) { | ||
export function validateTemplate({ templateName }) { | ||
const validTemplates = getValidTemplates(); | ||
@@ -19,3 +18,3 @@ if (!validTemplates.map((t)=>t.name).includes(templateName)) { | ||
description: 'Blank 3.0 Template', | ||
url: `https://github.com/payloadcms/payload/templates/blank#v${PACKAGE_VERSION}` | ||
url: `https://github.com/payloadcms/payload/templates/blank#main` | ||
}, | ||
@@ -26,3 +25,3 @@ { | ||
description: 'Website Template', | ||
url: `https://github.com/payloadcms/payload/templates/website#v${PACKAGE_VERSION}` | ||
url: `https://github.com/payloadcms/payload/templates/website#main` | ||
}, | ||
@@ -29,0 +28,0 @@ { |
@@ -1,2 +0,1 @@ | ||
import execa from 'execa'; | ||
import fse from 'fs-extra'; | ||
@@ -8,2 +7,3 @@ import { fileURLToPath } from 'node:url'; | ||
import { copyRecursiveSync } from '../utils/copy-recursive-sync.js'; | ||
import { getLatestPackageVersion } from '../utils/getLatestPackageVersion.js'; | ||
import { info } from '../utils/log.js'; | ||
@@ -31,11 +31,6 @@ import { getPackageManager } from './get-package-manager.js'; | ||
}); | ||
// Fetch latest Payload version from npm | ||
const { exitCode: getLatestVersionExitCode, stdout: latestPayloadVersion } = await execa('npm', [ | ||
'show', | ||
'payload', | ||
'version' | ||
]); | ||
if (getLatestVersionExitCode !== 0) { | ||
throw new Error('Failed to fetch latest Payload version'); | ||
} | ||
// Fetch latest Payload version | ||
const latestPayloadVersion = await getLatestPackageVersion({ | ||
packageName: 'payload' | ||
}); | ||
if (payloadVersion === latestPayloadVersion) { | ||
@@ -42,0 +37,0 @@ return { |
@@ -8,3 +8,2 @@ import * as p from '@clack/prompts'; | ||
import { configurePayloadConfig } from './lib/configure-payload-config.js'; | ||
import { PACKAGE_VERSION } from './lib/constants.js'; | ||
import { createProject } from './lib/create-project.js'; | ||
@@ -21,2 +20,3 @@ import { parseExample } from './lib/examples.js'; | ||
import { updatePayloadInProject } from './lib/update-payload-in-project.js'; | ||
import { getLatestPackageVersion } from './utils/getLatestPackageVersion.js'; | ||
import { debug, error, info } from './utils/log.js'; | ||
@@ -65,2 +65,7 @@ import { feedbackOutro, helpMessage, moveMessage, successfulNextInit, successMessage } from './utils/messages.js'; | ||
try { | ||
const debugFlag = this.args['--debug']; | ||
const LATEST_VERSION = await getLatestPackageVersion({ | ||
debug: debugFlag, | ||
packageName: 'payload' | ||
}); | ||
if (this.args['--help']) { | ||
@@ -70,3 +75,2 @@ helpMessage(); | ||
} | ||
const debugFlag = this.args['--debug']; | ||
// eslint-disable-next-line no-console | ||
@@ -162,3 +166,5 @@ console.log('\n'); | ||
if (templateArg) { | ||
const valid = validateTemplate(templateArg); | ||
const valid = validateTemplate({ | ||
templateName: templateArg | ||
}); | ||
if (!valid) { | ||
@@ -188,3 +194,3 @@ helpMessage(); | ||
if (debugFlag) { | ||
debug(`Using ${exampleArg ? 'examples' : 'templates'} from git tag: v${PACKAGE_VERSION}`); | ||
debug(`Using ${exampleArg ? 'examples' : 'templates'} from git tag: v${LATEST_VERSION}`); | ||
} | ||
@@ -191,0 +197,0 @@ if (!exampleArg) { |
{ | ||
"name": "create-payload-app", | ||
"version": "3.39.0-canary.6", | ||
"version": "3.39.0-canary.7", | ||
"homepage": "https://payloadcms.com", | ||
@@ -5,0 +5,0 @@ "repository": { |
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
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
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
282948
0.67%2948
0.96%18
-5.26%