Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

create-payload-app

Package Overview
Dependencies
Maintainers
3
Versions
436
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-payload-app - npm Package Compare versions

Comparing version 3.0.0-canary.f83d96a to 3.0.0-canary.fb04843

dist/lib/constants.d.ts

17

dist/lib/create-project.js
import * as p from '@clack/prompts';
import chalk from 'chalk';
import degit from 'degit';
import execa from 'execa';

@@ -11,2 +10,3 @@ import fse from 'fs-extra';

import { configurePayloadConfig } from './configure-payload-config.js';
import { downloadTemplate } from './download-template.js';
const filename = fileURLToPath(import.meta.url);

@@ -30,2 +30,4 @@ const dirname = path.dirname(filename);

installCmd = 'pnpm install';
} else if (packageManager === 'bun') {
installCmd = 'bun install';
}

@@ -54,9 +56,10 @@ try {

} else if ('url' in template) {
let templateUrl = template.url;
if (cliArgs['--template-branch']) {
templateUrl = `${template.url}#${cliArgs['--template-branch']}`;
debug(`Using template url: ${templateUrl}`);
template.url = `${template.url.split('#')?.[0]}#${cliArgs['--template-branch']}`;
}
const emitter = degit(templateUrl);
await emitter.clone(projectDir);
await downloadTemplate({
debug: cliArgs['--debug'],
projectDir,
template
});
}

@@ -77,3 +80,3 @@ const spinner = p.spinner();

// Remove yarn.lock file. This is only desired in Payload Cloud.
const lockPath = path.resolve(projectDir, 'yarn.lock');
const lockPath = path.resolve(projectDir, 'pnpm-lock.yaml');
if (fse.existsSync(lockPath)) {

@@ -80,0 +83,0 @@ await fse.remove(lockPath);

@@ -0,2 +1,6 @@

import { jest } from '@jest/globals';
import fs from 'fs';
import fse from 'fs-extra';
import globby from 'globby';
import * as os from 'node:os';
import path from 'path';

@@ -6,11 +10,10 @@ import { createProject } from './create-project.js';

import { getValidTemplates } from './templates.js';
import globby from 'globby';
import { jest } from '@jest/globals';
import tempDirectory from 'temp-dir';
describe('createProject', ()=>{
let projectDir;
beforeAll(()=>{
// eslint-disable-next-line no-console
console.log = jest.fn();
});
beforeEach(()=>{
const tempDirectory = fs.realpathSync(os.tmpdir());
projectDir = `${tempDirectory}/${Math.random().toString(36).substring(7)}`;

@@ -26,3 +29,2 @@ });

describe('#createProject', ()=>{
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
const args = {

@@ -33,3 +35,3 @@ _: [

'--db': 'mongodb',
'--local-template': 'blank-3.0',
'--local-template': 'blank',
'--no-deps': true

@@ -43,11 +45,11 @@ };

type: 'plugin',
url: 'https://github.com/payloadcms/payload-plugin-template',
description: 'Template for creating a Payload plugin'
description: 'Template for creating a Payload plugin',
url: 'https://github.com/payloadcms/payload-plugin-template'
};
await createProject({
cliArgs: args,
packageManager,
projectDir,
projectName,
projectDir,
template,
packageManager
template
});

@@ -57,3 +59,3 @@ const packageJsonPath = path.resolve(projectDir, 'package.json');

// Check package name and description
expect(packageJson.name).toEqual(projectName);
expect(packageJson.name).toStrictEqual(projectName);
});

@@ -64,7 +66,7 @@ describe('creates project from template', ()=>{

[
'blank-3.0',
'blank',
'mongodb'
],
[
'blank-3.0',
'blank',
'postgres'

@@ -82,10 +84,10 @@ ]

cliArgs,
dbDetails: {
type: db,
dbUri: `${db}://localhost:27017/create-project-test`
},
packageManager,
projectDir,
projectName,
projectDir,
template: template,
packageManager,
dbDetails: {
dbUri: `${db}://localhost:27017/create-project-test`,
type: db
}
template: template
});

@@ -103,5 +105,2 @@ const dbReplacement = dbReplacements[db];

}))?.[0];
if (!payloadConfigPath) {
throw new Error(`Could not find payload.config.ts inside ${projectDir}`);
}
const content = fse.readFileSync(payloadConfigPath, 'utf-8');

@@ -108,0 +107,0 @@ // Check payload.config.ts

@@ -6,19 +6,40 @@ import execa from 'execa';

try {
// Check for yarn.lock, package-lock.json, or pnpm-lock.yaml
// Check for flag or lockfile
let detected = 'npm';
if (cliArgs?.['--use-pnpm'] || fse.existsSync(`${projectDir}/pnpm-lock.yaml`) || await commandExists('pnpm')) {
if (cliArgs?.['--use-pnpm'] || fse.existsSync(`${projectDir}/pnpm-lock.yaml`)) {
detected = 'pnpm';
} else if (cliArgs?.['--use-yarn'] || fse.existsSync(`${projectDir}/yarn.lock`) || await commandExists('yarn')) {
} else if (cliArgs?.['--use-yarn'] || fse.existsSync(`${projectDir}/yarn.lock`)) {
detected = 'yarn';
} else if (cliArgs?.['--use-npm'] || fse.existsSync(`${projectDir}/package-lock.json`)) {
detected = 'npm';
} else if (cliArgs?.['--use-bun'] || fse.existsSync(`${projectDir}/bun.lockb`)) {
detected = 'bun';
} else if (await commandExists('pnpm')) {
// Prefer pnpm if it's installed
detected = 'pnpm';
} else {
// Otherwise check the execution environment
detected = getEnvironmentPackageManager();
}
return detected;
} catch (error) {
} catch (ignore) {
return 'npm';
}
}
function getEnvironmentPackageManager() {
const userAgent = process.env.npm_config_user_agent || '';
if (userAgent.startsWith('yarn')) {
return 'yarn';
}
if (userAgent.startsWith('pnpm')) {
return 'pnpm';
}
if (userAgent.startsWith('bun')) {
return 'bun';
}
return 'npm';
}
async function commandExists(command) {
try {
await execa.command(`command -v ${command}`);
await execa.command(process.platform === 'win32' ? `where ${command}` : `command -v ${command}`);
return true;

@@ -25,0 +46,0 @@ } catch {

import type { CliArgs, DbType, NextAppDetails, PackageManager } from '../types.js';
type InitNextArgs = Pick<CliArgs, '--debug'> & {
type InitNextArgs = {
dbType: DbType;

@@ -8,13 +8,13 @@ nextAppDetails?: NextAppDetails;

useDistFiles?: boolean;
};
} & Pick<CliArgs, '--debug'>;
type InitNextResult = {
isSrcDir: boolean;
nextAppDir?: string;
reason: string;
success: false;
} | {
isSrcDir: boolean;
nextAppDir: string;
payloadConfigPath: string;
success: true;
} | {
isSrcDir: boolean;
nextAppDir?: string;
reason: string;
success: false;
};

@@ -21,0 +21,0 @@ export declare function initNext(args: InitNextArgs): Promise<InitNextResult>;

@@ -29,3 +29,3 @@ import * as p from '@clack/prompts';

}
const { hasTopLevelLayout, isPayloadInstalled, isSrcDir, nextAppDir, nextConfigType } = nextAppDetails;
const { hasTopLevelLayout, isSrcDir, nextAppDir, nextConfigType } = nextAppDetails;
if (!nextConfigType) {

@@ -54,3 +54,3 @@ return {

installSpinner.start('Installing Payload and dependencies...');
const configurationResult = installAndConfigurePayload({
const configurationResult = await installAndConfigurePayload({
...args,

@@ -117,3 +117,3 @@ nextAppDetails,

}
function installAndConfigurePayload(args) {
async function installAndConfigurePayload(args) {
const { '--debug': debug, nextAppDetails: { isSrcDir, nextAppDir, nextConfigPath } = {}, nextConfigType, projectDir, useDistFiles } = args;

@@ -127,3 +127,5 @@ if (!nextAppDir || !nextConfigPath) {

const logDebug = (message)=>{
if (debug) origDebug(message);
if (debug) {
origDebug(message);
}
};

@@ -136,3 +138,3 @@ if (!fs.existsSync(projectDir)) {

}
const templateFilesPath = dirname.endsWith('dist') || useDistFiles ? path.resolve(dirname, '../..', 'dist/template') : path.resolve(dirname, '../../../../templates/blank-3.0');
const templateFilesPath = dirname.endsWith('dist') || useDistFiles ? path.resolve(dirname, '../..', 'dist/template') : path.resolve(dirname, '../../../../templates/blank');
logDebug(`Using template files from: ${templateFilesPath}`);

@@ -156,5 +158,5 @@ if (!fs.existsSync(templateFilesPath)) {

// This is a little clunky and needs to account for isSrcDir
copyRecursiveSync(templateSrcDir, path.dirname(nextConfigPath), debug);
copyRecursiveSync(templateSrcDir, path.dirname(nextConfigPath));
// Wrap next.config.js with withPayload
wrapNextConfig({
await wrapNextConfig({
nextConfigPath,

@@ -173,3 +175,3 @@ nextConfigType

'@payloadcms/richtext-lexical',
'@payloadcms/plugin-cloud'
'@payloadcms/payload-cloud'
].map((pkg)=>`${pkg}@beta`);

@@ -187,3 +189,4 @@ packagesToInstall.push(`@payloadcms/db-${dbType}@beta`);

const isSrcDir = fs.existsSync(path.resolve(projectDir, 'src'));
const nextConfigPath = (await globby('next.config.*js', {
// Match next.config.js, next.config.ts, next.config.mjs, next.config.cjs
const nextConfigPath = (await globby('next.config.(\\w)?(t|j)s', {
absolute: true,

@@ -196,6 +199,38 @@ cwd: projectDir

isSrcDir,
nextConfigPath: undefined
isSupportedNextVersion: false,
nextConfigPath: undefined,
nextVersion: null
};
}
const packageObj = await fse.readJson(path.resolve(projectDir, 'package.json'));
// Check if Next.js version is new enough
let nextVersion = null;
if (packageObj.dependencies?.next) {
nextVersion = packageObj.dependencies.next;
// Match versions using regex matching groups
const versionMatch = /(?<major>\d+)/.exec(nextVersion);
if (!versionMatch) {
p.log.warn(`Could not determine Next.js version from ${nextVersion}`);
return {
hasTopLevelLayout: false,
isSrcDir,
isSupportedNextVersion: false,
nextConfigPath,
nextVersion
};
}
const { major } = versionMatch.groups;
const majorVersion = parseInt(major);
if (majorVersion < 15) {
return {
hasTopLevelLayout: false,
isSrcDir,
isSupportedNextVersion: false,
nextConfigPath,
nextVersion
};
}
}
const isSupportedNextVersion = true;
// Check if Payload already installed
if (packageObj.dependencies?.payload) {

@@ -206,3 +241,5 @@ return {

isSrcDir,
nextConfigPath
isSupportedNextVersion,
nextConfigPath,
nextVersion
};

@@ -231,5 +268,7 @@ }

isSrcDir,
isSupportedNextVersion,
nextAppDir,
nextConfigPath,
nextConfigType: configType
nextConfigType: configType,
nextVersion
};

@@ -239,2 +278,5 @@ }

const { nextConfigPath, packageObj } = args;
if (nextConfigPath.endsWith('.ts')) {
return 'ts';
}
if (nextConfigPath.endsWith('.mjs')) {

@@ -241,0 +283,0 @@ return 'esm';

@@ -8,7 +8,11 @@ import execa from 'execa';

switch(packageManager){
case 'npm':
case 'bun':
case 'pnpm':
case 'yarn':
{
({ exitCode, stderr } = await execa('npm', [
'install',
'--save',
if (packageManager === 'bun') {
warning('Bun support is untested.');
}
({ exitCode, stderr } = await execa(packageManager, [
'add',
...packagesToInstall

@@ -20,11 +24,7 @@ ], {

}
case 'yarn':
case 'pnpm':
case 'bun':
case 'npm':
{
if (packageManager === 'bun') {
warning('Bun support is untested.');
}
({ exitCode, stderr } = await execa(packageManager, [
'add',
({ exitCode, stderr } = await execa('npm', [
'install',
'--save',
...packagesToInstall

@@ -31,0 +31,0 @@ ], {

import * as p from '@clack/prompts';
import slugify from '@sindresorhus/slugify';
export async function parseProjectName(args) {
if (args['--name']) return slugify(args['--name']);
if (args._[0]) return slugify(args._[0]);
if (args['--name']) {
return slugify(args['--name']);
}
if (args._[0]) {
return slugify(args._[0]);
}
const projectName = await p.text({
message: 'Project name?',
validate: (value)=>{
if (!value) return 'Please enter a project name.';
if (!value) {
return 'Please enter a project name.';
}
}

@@ -11,0 +17,0 @@ });

@@ -6,3 +6,5 @@ import * as p from '@clack/prompts';

const template = validTemplates.find((t)=>t.name === templateName);
if (!template) throw new Error('Invalid template given');
if (!template) {
throw new Error('Invalid template given');
}
return template;

@@ -9,0 +11,0 @@ }

@@ -22,5 +22,29 @@ const mongodbReplacement = {

};
const vercelPostgresReplacement = {
configReplacement: (envName = 'POSTGRES_URL')=>[
' db: vercelPostgresAdapter({',
' pool: {',
` connectionString: process.env.${envName} || '',`,
' },',
' }),'
],
importReplacement: "import { vercelPostgresAdapter } from '@payloadcms/db-vercel-postgres'",
packageName: '@payloadcms/db-vercel-postgres'
};
const sqliteReplacement = {
configReplacement: (envName = 'DATABASE_URI')=>[
' db: sqliteAdapter({',
' client: {',
` url: process.env.${envName} || '',`,
' },',
' }),'
],
importReplacement: "import { sqliteAdapter } from '@payloadcms/db-sqlite'",
packageName: '@payloadcms/db-sqlite'
};
export const dbReplacements = {
mongodb: mongodbReplacement,
postgres: postgresReplacement
postgres: postgresReplacement,
sqlite: sqliteReplacement,
'vercel-postgres': vercelPostgresReplacement
};

@@ -44,4 +68,4 @@ const vercelBlobStorageReplacement = {

],
importReplacement: "import { payloadCloudPlugin } from '@payloadcms/plugin-cloud'",
packageName: '@payloadcms/plugin-cloud'
importReplacement: "import { payloadCloudPlugin } from '@payloadcms/payload-cloud'",
packageName: '@payloadcms/payload-cloud'
};

@@ -48,0 +72,0 @@ // Removes placeholders

@@ -11,4 +11,15 @@ import * as p from '@clack/prompts';

dbConnectionPrefix: 'postgres://postgres:<password>@127.0.0.1:5432/',
title: 'PostgreSQL (beta)',
title: 'PostgreSQL',
value: 'postgres'
},
sqlite: {
dbConnectionPrefix: 'file:./',
dbConnectionSuffix: '.db',
title: 'SQLite (beta)',
value: 'sqlite'
},
'vercel-postgres': {
dbConnectionPrefix: 'postgres://postgres:<password>@127.0.0.1:5432/',
title: 'Vercel Postgres (beta)',
value: 'vercel-postgres'
}

@@ -27,18 +38,14 @@ };

message: `Select a database`,
options: [
{
label: 'MongoDB',
value: 'mongodb'
},
{
label: 'Postgres',
value: 'postgres'
}
]
options: Object.values(dbChoiceRecord).map((dbChoice)=>({
label: dbChoice.title,
value: dbChoice.value
}))
});
if (p.isCancel(dbType)) process.exit(0);
if (p.isCancel(dbType)) {
process.exit(0);
}
}
const dbChoice = dbChoiceRecord[dbType];
let dbUri = undefined;
const initialDbUri = `${dbChoice.dbConnectionPrefix}${projectName === '.' ? `payload-${getRandomDigitSuffix()}` : slugify(projectName)}`;
const initialDbUri = `${dbChoice.dbConnectionPrefix}${projectName === '.' ? `payload-${getRandomDigitSuffix()}` : slugify(projectName)}${dbChoice.dbConnectionSuffix || ''}`;
if (args['--db-accept-recommended']) {

@@ -53,3 +60,5 @@ dbUri = initialDbUri;

});
if (p.isCancel(dbUri)) process.exit(0);
if (p.isCancel(dbUri)) {
process.exit(0);
}
}

@@ -56,0 +65,0 @@ return {

import { error, info } from '../utils/log.js';
import { PACKAGE_VERSION } from './constants.js';
export function validateTemplate(templateName) {

@@ -12,2 +13,3 @@ const validTemplates = getValidTemplates();

export function getValidTemplates() {
// Starters _must_ be a valid template name from the templates/ directory
return [

@@ -18,3 +20,9 @@ {

description: 'Blank 3.0 Template',
url: 'https://github.com/payloadcms/payload/templates/blank-3.0#beta'
url: `https://github.com/payloadcms/payload/templates/blank#v${PACKAGE_VERSION}`
},
{
name: 'website',
type: 'starter',
description: 'Website Template',
url: `https://github.com/payloadcms/payload/templates/website#v${PACKAGE_VERSION}`
}

@@ -21,0 +29,0 @@ ];

@@ -12,6 +12,8 @@ import execa from 'execa';

export async function updatePayloadInProject(appDetails) {
if (!appDetails.nextConfigPath) return {
message: 'No Next.js config found',
success: false
};
if (!appDetails.nextConfigPath) {
return {
message: 'No Next.js config found',
success: false
};
}
const projectDir = path.dirname(appDetails.nextConfigPath);

@@ -63,3 +65,3 @@ const packageObj = await fse.readJson(path.resolve(projectDir, 'package.json'));

info(`Updating Payload Next.js files...`);
const templateFilesPath = dirname.endsWith('dist') ? path.resolve(dirname, '../..', 'dist/template') : path.resolve(dirname, '../../../../templates/blank-3.0');
const templateFilesPath = process.env.JEST_WORKER_ID !== undefined ? path.resolve(dirname, '../../../../templates/blank') : path.resolve(dirname, '../..', 'dist/template');
const templateSrcDir = path.resolve(templateFilesPath, 'src/app/(payload)');

@@ -66,0 +68,0 @@ copyRecursiveSync(templateSrcDir, path.resolve(projectDir, appDetails.isSrcDir ? 'src/app' : 'app', '(payload)'));

@@ -0,18 +1,18 @@

import type { NextConfigType } from '../types.js';
export declare const withPayloadStatement: {
cjs: string;
esm: string;
ts: string;
};
type NextConfigType = 'cjs' | 'esm';
export declare const wrapNextConfig: (args: {
nextConfigPath: string;
nextConfigType: NextConfigType;
}) => void;
}) => Promise<void>;
/**
* Parses config content with AST and wraps it with withPayload function
*/
export declare function parseAndModifyConfigContent(content: string, configType: NextConfigType): {
export declare function parseAndModifyConfigContent(content: string, configType: NextConfigType): Promise<{
modifiedConfigContent: string;
success: boolean;
};
export {};
}>;
//# sourceMappingURL=wrap-next-config.d.ts.map

@@ -0,13 +1,15 @@

import { parse } from '@swc/core';
import chalk from 'chalk';
import { Syntax, parseModule } from 'esprima-next';
import { parseModule, Syntax } from 'esprima-next';
import fs from 'fs';
import { log, warning } from '../utils/log.js';
export const withPayloadStatement = {
cjs: `const { withPayload } = require('@payloadcms/next/withPayload')\n`,
esm: `import { withPayload } from '@payloadcms/next/withPayload'\n`
cjs: `const { withPayload } = require("@payloadcms/next/withPayload");`,
esm: `import { withPayload } from "@payloadcms/next/withPayload";`,
ts: `import { withPayload } from "@payloadcms/next/withPayload";`
};
export const wrapNextConfig = (args)=>{
export const wrapNextConfig = async (args)=>{
const { nextConfigPath, nextConfigType: configType } = args;
const configContent = fs.readFileSync(nextConfigPath, 'utf8');
const { modifiedConfigContent: newConfig, success } = parseAndModifyConfigContent(configContent, configType);
const { modifiedConfigContent: newConfig, success } = await parseAndModifyConfigContent(configContent, configType);
if (!success) {

@@ -20,54 +22,77 @@ return;

* Parses config content with AST and wraps it with withPayload function
*/ export function parseAndModifyConfigContent(content, configType) {
content = withPayloadStatement[configType] + content;
let ast;
try {
ast = parseModule(content, {
loc: true
});
} catch (error) {
if (error instanceof Error) {
warning(`Unable to parse Next config. Error: ${error.message} `);
warnUserWrapNotSuccessful(configType);
}
return {
modifiedConfigContent: content,
success: false
};
}
if (configType === 'esm') {
const exportDefaultDeclaration = ast.body.find((p)=>p.type === Syntax.ExportDefaultDeclaration);
const exportNamedDeclaration = ast.body.find((p)=>p.type === Syntax.ExportNamedDeclaration);
if (!exportDefaultDeclaration && !exportNamedDeclaration) {
throw new Error('Could not find ExportDefaultDeclaration in next.config.js');
}
if (exportDefaultDeclaration && exportDefaultDeclaration.declaration?.loc) {
const modifiedConfigContent = insertBeforeAndAfter(content, exportDefaultDeclaration.declaration.loc);
*/ export async function parseAndModifyConfigContent(content, configType) {
content = withPayloadStatement[configType] + '\n' + content;
if (configType === 'cjs' || configType === 'esm') {
try {
const ast = parseModule(content, {
loc: true
});
if (configType === 'cjs') {
// Find `module.exports = X`
const moduleExports = ast.body.find((p)=>p.type === Syntax.ExpressionStatement && p.expression?.type === Syntax.AssignmentExpression && p.expression.left?.type === Syntax.MemberExpression && p.expression.left.object?.type === Syntax.Identifier && p.expression.left.object.name === 'module' && p.expression.left.property?.type === Syntax.Identifier && p.expression.left.property.name === 'exports');
if (moduleExports && moduleExports.expression.right?.loc) {
const modifiedConfigContent = insertBeforeAndAfter(content, moduleExports.expression.right.loc);
return {
modifiedConfigContent,
success: true
};
}
return Promise.resolve({
modifiedConfigContent: content,
success: false
});
} else if (configType === 'esm') {
const exportDefaultDeclaration = ast.body.find((p)=>p.type === Syntax.ExportDefaultDeclaration);
const exportNamedDeclaration = ast.body.find((p)=>p.type === Syntax.ExportNamedDeclaration);
if (!exportDefaultDeclaration && !exportNamedDeclaration) {
throw new Error('Could not find ExportDefaultDeclaration in next.config.js');
}
if (exportDefaultDeclaration && exportDefaultDeclaration.declaration?.loc) {
const modifiedConfigContent = insertBeforeAndAfter(content, exportDefaultDeclaration.declaration.loc);
return {
modifiedConfigContent,
success: true
};
} else if (exportNamedDeclaration) {
const exportSpecifier = exportNamedDeclaration.specifiers.find((s)=>s.type === 'ExportSpecifier' && s.exported?.name === 'default' && s.local?.type === 'Identifier' && s.local?.name);
if (exportSpecifier) {
warning('Could not automatically wrap next.config.js with withPayload.');
warning('Automatic wrapping of named exports as default not supported yet.');
warnUserWrapNotSuccessful(configType);
return {
modifiedConfigContent: content,
success: false
};
}
}
warning('Could not automatically wrap Next config with withPayload.');
warnUserWrapNotSuccessful(configType);
return Promise.resolve({
modifiedConfigContent: content,
success: false
});
}
} catch (error) {
if (error instanceof Error) {
warning(`Unable to parse Next config. Error: ${error.message} `);
warnUserWrapNotSuccessful(configType);
}
return {
modifiedConfigContent,
success: true
modifiedConfigContent: content,
success: false
};
} else if (exportNamedDeclaration) {
const exportSpecifier = exportNamedDeclaration.specifiers.find((s)=>s.type === 'ExportSpecifier' && s.exported?.name === 'default' && s.local?.type === 'Identifier' && s.local?.name);
if (exportSpecifier) {
warning('Could not automatically wrap next.config.js with withPayload.');
warning('Automatic wrapping of named exports as default not supported yet.');
}
} else if (configType === 'ts') {
const { moduleItems, parseOffset } = await compileTypeScriptFileToAST(content);
const exportDefaultDeclaration = moduleItems.find((m)=>m.type === 'ExportDefaultExpression' && (m.expression.type === 'Identifier' || m.expression.type === 'CallExpression'));
if (exportDefaultDeclaration) {
if (!('span' in exportDefaultDeclaration.expression)) {
warning('Could not automatically wrap Next config with withPayload.');
warnUserWrapNotSuccessful(configType);
return {
return Promise.resolve({
modifiedConfigContent: content,
success: false
};
});
}
}
warning('Could not automatically wrap Next config with withPayload.');
warnUserWrapNotSuccessful(configType);
return {
modifiedConfigContent: content,
success: false
};
} else if (configType === 'cjs') {
// Find `module.exports = X`
const moduleExports = ast.body.find((p)=>p.type === Syntax.ExpressionStatement && p.expression?.type === Syntax.AssignmentExpression && p.expression.left?.type === Syntax.MemberExpression && p.expression.left.object?.type === Syntax.Identifier && p.expression.left.object.name === 'module' && p.expression.left.property?.type === Syntax.Identifier && p.expression.left.property.name === 'exports');
if (moduleExports && moduleExports.expression.right?.loc) {
const modifiedConfigContent = insertBeforeAndAfter(content, moduleExports.expression.right.loc);
const modifiedConfigContent = insertBeforeAndAfterSWC(content, exportDefaultDeclaration.expression.span, parseOffset);
return {

@@ -78,13 +103,9 @@ modifiedConfigContent,

}
return {
modifiedConfigContent: content,
success: false
};
}
warning('Could not automatically wrap Next config with withPayload.');
warnUserWrapNotSuccessful(configType);
return {
return Promise.resolve({
modifiedConfigContent: content,
success: false
};
});
}

@@ -95,3 +116,3 @@ function warnUserWrapNotSuccessful(configType) {

${chalk.bold(`Please manually wrap your existing next.config.js with the withPayload function. Here is an example:`)}
${chalk.bold(`Please manually wrap your existing Next config with the withPayload function. Here is an example:`)}

@@ -104,3 +125,3 @@ ${withPayloadStatement[configType]}

${configType === 'esm' ? 'export default withPayload(nextConfig)' : 'module.exports = withPayload(nextConfig)'}
${configType === 'cjs' ? 'module.exports = withPayload(nextConfig)' : 'export default withPayload(nextConfig)'}

@@ -126,3 +147,42 @@ `;

}
function insertBeforeAndAfterSWC(content, span, /**
* WARNING: This is ONLY for unit tests. Defaults to 0 otherwise.
*
* @see compileTypeScriptFileToAST
*/ parseOffset) {
const { end: preOffsetEnd, start: preOffsetStart } = span;
const start = preOffsetStart - parseOffset;
const end = preOffsetEnd - parseOffset;
const insert = (pos, text)=>{
return content.slice(0, pos) + text + content.slice(pos);
};
// insert ) after end
content = insert(end - 1, ')');
// insert withPayload before start
content = insert(start - 1, 'withPayload(');
return content;
}
/**
* Compile typescript to AST using the swc compiler
*/ async function compileTypeScriptFileToAST(fileContent) {
let parseOffset = 0;
/**
* WARNING: This is ONLY for unit tests.
*
* Multiple instances of swc DO NOT reset the .span.end value.
* During unit tests, the .spawn.end value is read and accounted for.
*
* https://github.com/swc-project/swc/issues/1366
*/ if (process.env.NODE_ENV === 'test') {
parseOffset = (await parse('')).span.end;
}
const module = await parse(fileContent, {
syntax: 'typescript'
});
return {
moduleItems: module.body,
parseOffset
};
}
//# sourceMappingURL=wrap-next-config.js.map

@@ -1,4 +0,31 @@

import { parseAndModifyConfigContent, withPayloadStatement } from './wrap-next-config.js';
import * as p from '@clack/prompts';
import { jest } from '@jest/globals';
import { parseAndModifyConfigContent, withPayloadStatement } from './wrap-next-config.js';
const tsConfigs = {
defaultNextConfig: `import type { NextConfig } from "next";
const nextConfig: NextConfig = {};
export default nextConfig;`,
nextConfigExportNamedDefault: `import type { NextConfig } from "next";
const nextConfig: NextConfig = {};
const wrapped = someFunc(asdf);
export { wrapped as default };
`,
nextConfigWithFunc: `import type { NextConfig } from "next";
const nextConfig: NextConfig = {};
export default someFunc(nextConfig);
`,
nextConfigWithFuncMultiline: `import type { NextConfig } from "next";
const nextConfig: NextConfig = {};
export default someFunc(
nextConfig
);
`,
nextConfigWithSpread: `import type { NextConfig } from "next";
const nextConfig: NextConfig = {
...someConfig,
};
export default nextConfig;
`
};
const esmConfigs = {

@@ -9,2 +36,6 @@ defaultNextConfig: `/** @type {import('next').NextConfig} */

`,
nextConfigExportNamedDefault: `const nextConfig = {};
const wrapped = someFunc(asdf);
export { wrapped as default };
`,
nextConfigWithFunc: `const nextConfig = {};

@@ -18,6 +49,2 @@ export default someFunc(nextConfig);

`,
nextConfigExportNamedDefault: `const nextConfig = {};
const wrapped = someFunc(asdf);
export { wrapped as default };
`,
nextConfigWithSpread: `const nextConfig = {

@@ -30,2 +57,3 @@ ...someConfig,

const cjsConfigs = {
anonConfig: `module.exports = {};`,
defaultNextConfig: `

@@ -36,3 +64,6 @@ /** @type {import('next').NextConfig} */

`,
anonConfig: `module.exports = {};`,
nextConfigExportNamedDefault: `const nextConfig = {};
const wrapped = someFunc(asdf);
module.exports = wrapped;
`,
nextConfigWithFunc: `const nextConfig = {};

@@ -46,6 +77,2 @@ module.exports = someFunc(nextConfig);

`,
nextConfigExportNamedDefault: `const nextConfig = {};
const wrapped = someFunc(asdf);
module.exports = wrapped;
`,
nextConfigWithSpread: `const nextConfig = { ...someConfig };

@@ -56,21 +83,44 @@ module.exports = nextConfig;

describe('parseAndInsertWithPayload', ()=>{
describe('ts', ()=>{
const configType = 'ts';
const importStatement = withPayloadStatement[configType];
it('should parse the default next config', async ()=>{
const { modifiedConfigContent } = await parseAndModifyConfigContent(tsConfigs.defaultNextConfig, configType);
expect(modifiedConfigContent).toContain(importStatement);
expect(modifiedConfigContent).toContain('withPayload(nextConfig)');
});
it('should parse the config with a function', async ()=>{
const { modifiedConfigContent: modifiedConfigContent2 } = await parseAndModifyConfigContent(tsConfigs.nextConfigWithFunc, configType);
expect(modifiedConfigContent2).toContain('withPayload(someFunc(nextConfig))');
});
it('should parse the config with a multi-lined function', async ()=>{
const { modifiedConfigContent } = await parseAndModifyConfigContent(tsConfigs.nextConfigWithFuncMultiline, configType);
expect(modifiedConfigContent).toContain(importStatement);
expect(modifiedConfigContent).toMatch(/withPayload\(someFunc\(\n {2}nextConfig\n\)\)/);
});
it('should parse the config with a spread', async ()=>{
const { modifiedConfigContent } = await parseAndModifyConfigContent(tsConfigs.nextConfigWithSpread, configType);
expect(modifiedConfigContent).toContain(importStatement);
expect(modifiedConfigContent).toContain('withPayload(nextConfig)');
});
});
describe('esm', ()=>{
const configType = 'esm';
const importStatement = withPayloadStatement[configType];
it('should parse the default next config', ()=>{
const { modifiedConfigContent } = parseAndModifyConfigContent(esmConfigs.defaultNextConfig, configType);
it('should parse the default next config', async ()=>{
const { modifiedConfigContent } = await parseAndModifyConfigContent(esmConfigs.defaultNextConfig, configType);
expect(modifiedConfigContent).toContain(importStatement);
expect(modifiedConfigContent).toContain('withPayload(nextConfig)');
});
it('should parse the config with a function', ()=>{
const { modifiedConfigContent } = parseAndModifyConfigContent(esmConfigs.nextConfigWithFunc, configType);
it('should parse the config with a function', async ()=>{
const { modifiedConfigContent } = await parseAndModifyConfigContent(esmConfigs.nextConfigWithFunc, configType);
expect(modifiedConfigContent).toContain('withPayload(someFunc(nextConfig))');
});
it('should parse the config with a function on a new line', ()=>{
const { modifiedConfigContent } = parseAndModifyConfigContent(esmConfigs.nextConfigWithFuncMultiline, configType);
it('should parse the config with a multi-lined function', async ()=>{
const { modifiedConfigContent } = await parseAndModifyConfigContent(esmConfigs.nextConfigWithFuncMultiline, configType);
expect(modifiedConfigContent).toContain(importStatement);
expect(modifiedConfigContent).toMatch(/withPayload\(someFunc\(\n nextConfig\n\)\)/);
expect(modifiedConfigContent).toMatch(/withPayload\(someFunc\(\n {2}nextConfig\n\)\)/);
});
it('should parse the config with a spread', ()=>{
const { modifiedConfigContent } = parseAndModifyConfigContent(esmConfigs.nextConfigWithSpread, configType);
it('should parse the config with a spread', async ()=>{
const { modifiedConfigContent } = await parseAndModifyConfigContent(esmConfigs.nextConfigWithSpread, configType);
expect(modifiedConfigContent).toContain(importStatement);

@@ -80,5 +130,5 @@ expect(modifiedConfigContent).toContain('withPayload(nextConfig)');

// Unsupported: export { wrapped as default }
it('should give warning with a named export as default', ()=>{
it('should give warning with a named export as default', async ()=>{
const warnLogSpy = jest.spyOn(p.log, 'warn').mockImplementation(()=>{});
const { modifiedConfigContent, success } = parseAndModifyConfigContent(esmConfigs.nextConfigExportNamedDefault, configType);
const { modifiedConfigContent, success } = await parseAndModifyConfigContent(esmConfigs.nextConfigExportNamedDefault, configType);
expect(modifiedConfigContent).toContain(importStatement);

@@ -92,28 +142,28 @@ expect(success).toBe(false);

const requireStatement = withPayloadStatement[configType];
it('should parse the default next config', ()=>{
const { modifiedConfigContent } = parseAndModifyConfigContent(cjsConfigs.defaultNextConfig, configType);
it('should parse the default next config', async ()=>{
const { modifiedConfigContent } = await parseAndModifyConfigContent(cjsConfigs.defaultNextConfig, configType);
expect(modifiedConfigContent).toContain(requireStatement);
expect(modifiedConfigContent).toContain('withPayload(nextConfig)');
});
it('should parse anonymous default config', ()=>{
const { modifiedConfigContent } = parseAndModifyConfigContent(cjsConfigs.anonConfig, configType);
it('should parse anonymous default config', async ()=>{
const { modifiedConfigContent } = await parseAndModifyConfigContent(cjsConfigs.anonConfig, configType);
expect(modifiedConfigContent).toContain(requireStatement);
expect(modifiedConfigContent).toContain('withPayload({})');
});
it('should parse the config with a function', ()=>{
const { modifiedConfigContent } = parseAndModifyConfigContent(cjsConfigs.nextConfigWithFunc, configType);
it('should parse the config with a function', async ()=>{
const { modifiedConfigContent } = await parseAndModifyConfigContent(cjsConfigs.nextConfigWithFunc, configType);
expect(modifiedConfigContent).toContain('withPayload(someFunc(nextConfig))');
});
it('should parse the config with a function on a new line', ()=>{
const { modifiedConfigContent } = parseAndModifyConfigContent(cjsConfigs.nextConfigWithFuncMultiline, configType);
it('should parse the config with a multi-lined function', async ()=>{
const { modifiedConfigContent } = await parseAndModifyConfigContent(cjsConfigs.nextConfigWithFuncMultiline, configType);
expect(modifiedConfigContent).toContain(requireStatement);
expect(modifiedConfigContent).toMatch(/withPayload\(someFunc\(\n nextConfig\n\)\)/);
expect(modifiedConfigContent).toMatch(/withPayload\(someFunc\(\n {2}nextConfig\n\)\)/);
});
it('should parse the config with a named export as default', ()=>{
const { modifiedConfigContent } = parseAndModifyConfigContent(cjsConfigs.nextConfigExportNamedDefault, configType);
it('should parse the config with a named export as default', async ()=>{
const { modifiedConfigContent } = await parseAndModifyConfigContent(cjsConfigs.nextConfigExportNamedDefault, configType);
expect(modifiedConfigContent).toContain(requireStatement);
expect(modifiedConfigContent).toContain('withPayload(wrapped)');
});
it('should parse the config with a spread', ()=>{
const { modifiedConfigContent } = parseAndModifyConfigContent(cjsConfigs.nextConfigWithSpread, configType);
it('should parse the config with a spread', async ()=>{
const { modifiedConfigContent } = await parseAndModifyConfigContent(cjsConfigs.nextConfigWithSpread, configType);
expect(modifiedConfigContent).toContain(requireStatement);

@@ -120,0 +170,0 @@ expect(modifiedConfigContent).toContain('withPayload(nextConfig)');

@@ -1,5 +0,6 @@

import type { CliArgs, ProjectTemplate } from '../types.js';
import type { CliArgs, DbType, ProjectTemplate } from '../types.js';
/** Parse and swap .env.example values and write .env */
export declare function writeEnvFile(args: {
cliArgs: CliArgs;
databaseType?: DbType;
databaseUri: string;

@@ -6,0 +7,0 @@ payloadSecret: string;

@@ -5,3 +5,3 @@ import fs from 'fs-extra';

/** Parse and swap .env.example values and write .env */ export async function writeEnvFile(args) {
const { cliArgs, databaseUri, payloadSecret, projectDir, template } = args;
const { cliArgs, databaseType, databaseUri, payloadSecret, projectDir, template } = args;
if (cliArgs['--dry-run']) {

@@ -13,30 +13,35 @@ debug(`DRY RUN: .env file created`);

try {
if (fs.existsSync(envOutputPath)) {
if (template?.type === 'starter') {
// Parse .env file into key/value pairs
const envFile = await fs.readFile(path.join(projectDir, '.env.example'), 'utf8');
const envWithValues = envFile.split('\n').filter((e)=>e).map((line)=>{
if (line.startsWith('#') || !line.includes('=')) return line;
const split = line.split('=');
const key = split[0];
let value = split[1];
if (key === 'MONGODB_URI' || key === 'MONGO_URL' || key === 'DATABASE_URI') {
value = databaseUri;
let fileContents;
if (template?.type === 'starter') {
// Parse .env file into key/value pairs
const envExample = path.join(projectDir, '.env.example');
const envFile = await fs.readFile(envExample, 'utf8');
fileContents = `# Added by Payload\n` + envFile.split('\n').filter((e)=>e).map((line)=>{
if (line.startsWith('#') || !line.includes('=')) {
return line;
}
const split = line.split('=');
let key = split[0];
let value = split[1];
if (key === 'MONGODB_URI' || key === 'MONGO_URL' || key === 'DATABASE_URI' || key === 'POSTGRES_URL') {
if (databaseType === 'vercel-postgres') {
key = 'POSTGRES_URL';
}
if (key === 'PAYLOAD_SECRET' || key === 'PAYLOAD_SECRET_KEY') {
value = payloadSecret;
}
return `${key}=${value}`;
});
// Write new .env file
await fs.writeFile(envOutputPath, envWithValues.join('\n'));
} else {
const existingEnv = await fs.readFile(envOutputPath, 'utf8');
const newEnv = existingEnv + `\nDATABASE_URI=${databaseUri}\nPAYLOAD_SECRET=${payloadSecret}\n`;
await fs.writeFile(envOutputPath, newEnv);
}
value = databaseUri;
}
if (key === 'PAYLOAD_SECRET' || key === 'PAYLOAD_SECRET_KEY') {
value = payloadSecret;
}
return `${key}=${value}`;
}).join('\n');
} else {
const content = `DATABASE_URI=${databaseUri}\nPAYLOAD_SECRET=${payloadSecret}`;
await fs.outputFile(`${projectDir}/.env`, content);
fileContents = `# Added by Payload\nDATABASE_URI=${databaseUri}\nPAYLOAD_SECRET=${payloadSecret}\n`;
}
if (fs.existsSync(envOutputPath)) {
const existingEnv = await fs.readFile(envOutputPath, 'utf8');
const newEnv = existingEnv + '\n# Added by Payload' + fileContents;
await fs.writeFile(envOutputPath, newEnv);
} else {
await fs.writeFile(envOutputPath, fileContents);
}
} catch (err) {

@@ -43,0 +48,0 @@ error('Unable to write .env file');

@@ -8,2 +8,3 @@ 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';

@@ -19,4 +20,4 @@ import { generateSecret } from './lib/generate-secret.js';

import { writeEnvFile } from './lib/write-env-file.js';
import { error, info } from './utils/log.js';
import { feedbackOutro, helpMessage, moveMessage, successMessage, successfulNextInit } from './utils/messages.js';
import { debug, error, info } from './utils/log.js';
import { feedbackOutro, helpMessage, moveMessage, successfulNextInit, successMessage } from './utils/messages.js';
export class Main {

@@ -40,2 +41,3 @@ args;

'--no-deps': Boolean,
'--use-bun': Boolean,
'--use-npm': Boolean,

@@ -65,2 +67,3 @@ '--use-pnpm': Boolean,

}
const debugFlag = this.args['--debug'];
// eslint-disable-next-line no-console

@@ -72,3 +75,8 @@ console.log('\n');

const nextAppDetails = await getNextAppDetails(process.cwd());
const { hasTopLevelLayout, isPayloadInstalled, nextAppDir, nextConfigPath } = nextAppDetails;
const { hasTopLevelLayout, isPayloadInstalled, isSupportedNextVersion, nextAppDir, nextConfigPath, nextVersion } = nextAppDetails;
if (nextConfigPath && !isSupportedNextVersion) {
p.log.warn(`Next.js v${nextVersion} is unsupported. Next.js >= 15 is required to use Payload.`);
p.outro(feedbackOutro());
process.exit(0);
}
// Upgrade Payload in existing project

@@ -140,2 +148,3 @@ if (isPayloadInstalled && nextConfigPath) {

cliArgs: this.args,
databaseType: dbDetails.type,
databaseUri: dbDetails.dbUri,

@@ -158,2 +167,5 @@ payloadSecret: generateSecret(),

}
if (debugFlag) {
debug(`Using templates from git tag: v${PACKAGE_VERSION}`);
}
const validTemplates = getValidTemplates();

@@ -167,2 +179,13 @@ const template = await parseTemplate(this.args, validTemplates);

switch(template.type){
case 'plugin':
{
await createProject({
cliArgs: this.args,
packageManager,
projectDir,
projectName,
template
});
break;
}
case 'starter':

@@ -182,2 +205,3 @@ {

cliArgs: this.args,
databaseType: dbDetails.type,
databaseUri: dbDetails.dbUri,

@@ -190,13 +214,2 @@ payloadSecret,

}
case 'plugin':
{
await createProject({
cliArgs: this.args,
packageManager,
projectDir,
projectName,
template
});
break;
}
}

@@ -203,0 +216,0 @@ info('Payload project successfully created!');

@@ -10,3 +10,3 @@ import fs from 'fs';

/**
* Copy the necessary template files from `templates/blank-3.0` to `dist/template`
* Copy the necessary template files from `templates/blank` to `dist/template`
*

@@ -17,3 +17,3 @@ * Eventually, this should be replaced with using tar.x to stream from the git repo

const outputPath = path.resolve(dirname, '../../dist/template');
const sourceTemplatePath = path.resolve(root, 'templates/blank-3.0');
const sourceTemplatePath = path.resolve(root, 'templates/blank');
if (!fs.existsSync(sourceTemplatePath)) {

@@ -27,3 +27,3 @@ throw new Error(`Source path does not exist: ${sourceTemplatePath}`);

}
// Copy the src directory from `templates/blank-3.0` to `dist`
// Copy the src directory from `templates/blank` to `dist`
const srcPath = path.resolve(sourceTemplatePath, 'src');

@@ -30,0 +30,0 @@ const distSrcPath = path.resolve(outputPath, 'src');

/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY it because it could be re-written at any time. */
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import config from '@payload-config'
import { REST_DELETE, REST_GET, REST_OPTIONS, REST_PATCH, REST_POST } from '@payloadcms/next/routes'
import '@payloadcms/next/css'
import {
REST_DELETE,
REST_GET,
REST_OPTIONS,
REST_PATCH,
REST_POST,
REST_PUT,
} from '@payloadcms/next/routes'

@@ -10,2 +18,3 @@ export const GET = REST_GET(config)

export const PATCH = REST_PATCH(config)
export const PUT = REST_PUT(config)
export const OPTIONS = REST_OPTIONS(config)
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY it because it could be re-written at any time. */
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import config from '@payload-config'
import '@payloadcms/next/css'
import { GRAPHQL_PLAYGROUND_GET } from '@payloadcms/next/routes'
export const GET = GRAPHQL_PLAYGROUND_GET(config)
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY it because it could be re-written at any time. */
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import config from '@payload-config'
import { GRAPHQL_POST } from '@payloadcms/next/routes'
import { GRAPHQL_POST, REST_OPTIONS } from '@payloadcms/next/routes'
export const POST = GRAPHQL_POST(config)
export const OPTIONS = REST_OPTIONS(config)

@@ -18,2 +18,5 @@ // storage-adapter-import-placeholder

user: Users.slug,
importMap: {
baseDir: path.resolve(dirname),
},
},

@@ -20,0 +23,0 @@ collections: [Users, Media],

@@ -18,2 +18,3 @@ import type arg from 'arg';

'--template-branch': StringConstructor;
'--use-bun': BooleanConstructor;
'--use-npm': BooleanConstructor;

@@ -50,3 +51,3 @@ '--use-pnpm': BooleanConstructor;

export type PackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn';
export type DbType = 'mongodb' | 'postgres';
export type DbType = 'mongodb' | 'postgres' | 'sqlite' | 'vercel-postgres';
export type DbDetails = {

@@ -61,9 +62,11 @@ dbUri: string;

isSrcDir: boolean;
isSupportedNextVersion: boolean;
nextAppDir?: string;
nextConfigPath?: string;
nextConfigType?: NextConfigType;
nextVersion: null | string;
};
export type NextConfigType = 'cjs' | 'esm';
export type NextConfigType = 'cjs' | 'esm' | 'ts';
export type StorageAdapterType = 'localDisk' | 'payloadCloud' | 'vercelBlobStorage';
export {};
//# sourceMappingURL=types.d.ts.map

@@ -6,3 +6,3 @@ /**

*/
export declare function copyRecursiveSync(src: string, dest: string, debug?: boolean): void;
export declare function copyRecursiveSync(src: string, dest: string, ignoreRegex?: string[]): void;
//# sourceMappingURL=copy-recursive-sync.d.ts.map

@@ -7,3 +7,3 @@ import fs from 'fs';

* @internal
*/ export function copyRecursiveSync(src, dest, debug) {
*/ export function copyRecursiveSync(src, dest, ignoreRegex) {
const exists = fs.existsSync(src);

@@ -17,2 +17,5 @@ const stats = exists && fs.statSync(src);

fs.readdirSync(src).forEach((childItemName)=>{
if (ignoreRegex && ignoreRegex.some((regex)=>new RegExp(regex).test(childItemName))) {
return;
}
copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName));

@@ -19,0 +22,0 @@ });

@@ -1,2 +0,2 @@

/* eslint-disable no-console */ import * as p from '@clack/prompts';
import * as p from '@clack/prompts';
import chalk from 'chalk';

@@ -3,0 +3,0 @@ export const warning = (message)=>{

@@ -35,2 +35,3 @@ /* eslint-disable no-console */ import chalk from 'chalk';

--use-pnpm Use pnpm to install dependencies
--use-bun Use bun to install dependencies (experimental)
--no-deps Do not install any dependencies

@@ -37,0 +38,0 @@ -h Show help

{
"name": "create-payload-app",
"version": "3.0.0-canary.f83d96a",
"version": "3.0.0-canary.fb04843",
"homepage": "https://payloadcms.com",

@@ -11,2 +11,10 @@ "repository": {

"license": "MIT",
"author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
"maintainers": [
{
"name": "Payload",
"email": "info@payloadcms.com",
"url": "https://payloadcms.com"
}
],
"type": "module",

@@ -45,6 +53,6 @@ "exports": {

"@sindresorhus/slugify": "^1.1.0",
"@swc/core": "1.7.10",
"arg": "^5.0.0",
"chalk": "^4.1.0",
"comment-json": "^4.2.3",
"degit": "^2.8.4",
"esprima-next": "^6.0.3",

@@ -55,12 +63,14 @@ "execa": "^5.0.0",

"globby": "11.1.0",
"tar": "^7.4.3",
"terminal-link": "^2.1.1"
},
"devDependencies": {
"@types/degit": "^2.8.3",
"@types/esprima": "^4.0.6",
"@types/fs-extra": "^9.0.12",
"@types/jest": "29.5.12",
"@types/node": "20.12.5",
"temp-dir": "2.0.0"
"@types/node": "22.5.4"
},
"engines": {
"node": "^18.20.2 || >=20.9.0"
},
"scripts": {

@@ -70,3 +80,5 @@ "build": "pnpm pack-template-files && pnpm typecheck && pnpm build:swc",

"clean": "rimraf {dist,*.tsbuildinfo}",
"pack-template-files": "tsx src/scripts/pack-template-files.ts",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"pack-template-files": "node --no-deprecation --import @swc-node/register/esm-register src/scripts/pack-template-files.ts",
"test": "jest",

@@ -73,0 +85,0 @@ "typecheck": "tsc"

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

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

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

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

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

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc