fix: dev:generate-types on all test configs (#919)
This commit is contained in:
@@ -390,6 +390,7 @@ function configToJsonSchema(config: SanitizedConfig): JSONSchema4 {
|
||||
export function generateTypes(): void {
|
||||
const logger = Logger();
|
||||
const config = loadConfig();
|
||||
const outputFile = process.env.PAYLOAD_TS_OUTPUT_PATH || config.typescript.outputFile;
|
||||
|
||||
logger.info('Compiling TS types for Collections and Globals...');
|
||||
|
||||
@@ -402,8 +403,8 @@ export function generateTypes(): void {
|
||||
singleQuote: true,
|
||||
},
|
||||
}).then((compiled) => {
|
||||
fs.writeFileSync(config.typescript.outputFile, compiled);
|
||||
logger.info(`Types written to ${config.typescript.outputFile}`);
|
||||
fs.writeFileSync(outputFile, compiled);
|
||||
logger.info(`Types written to ${outputFile}`);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ export interface RestrictedVersion {
|
||||
*/
|
||||
export interface SiblingDatum {
|
||||
id: string;
|
||||
array?: {
|
||||
array: {
|
||||
allowPublicReadability?: boolean;
|
||||
text?: string;
|
||||
id?: string;
|
||||
|
||||
@@ -6,6 +6,14 @@
|
||||
*/
|
||||
|
||||
export interface Config {}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "global".
|
||||
*/
|
||||
export interface Global {
|
||||
id: string;
|
||||
title?: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "posts".
|
||||
|
||||
@@ -12,7 +12,7 @@ export interface Config {}
|
||||
*/
|
||||
export interface Array {
|
||||
id: string;
|
||||
array?: {
|
||||
array: {
|
||||
required: string;
|
||||
optional?: string;
|
||||
id?: string;
|
||||
|
||||
@@ -12,6 +12,7 @@ export interface Config {}
|
||||
*/
|
||||
export interface User {
|
||||
id: string;
|
||||
roles: ('admin' | 'editor' | 'moderator' | 'user' | 'viewer')[];
|
||||
enableAPIKey?: boolean;
|
||||
apiKey?: string;
|
||||
apiKeyIndex?: string;
|
||||
@@ -20,7 +21,6 @@ export interface User {
|
||||
resetPasswordExpiration?: string;
|
||||
loginAttempts?: number;
|
||||
lockUntil?: string;
|
||||
roles: ('admin' | 'editor' | 'moderator' | 'user' | 'viewer')[];
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,6 @@ import { Config, SanitizedConfig } from '../src/config/types';
|
||||
import { buildConfig as buildPayloadConfig } from '../src/config/build';
|
||||
|
||||
const baseConfig: Config = {
|
||||
typescript: {
|
||||
outputFile: process.env.PAYLOAD_TS_OUTPUT_PATH,
|
||||
},
|
||||
telemetry: false,
|
||||
};
|
||||
|
||||
|
||||
@@ -78,32 +78,6 @@ export interface RelationWithTitle {
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "group-nested-relation-with-title".
|
||||
*/
|
||||
export interface GroupNestedRelationWithTitle {
|
||||
id: string;
|
||||
group?: {
|
||||
relation?: string | NestedRelationWithTitle;
|
||||
};
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "nested-relation-with-title".
|
||||
*/
|
||||
export interface NestedRelationWithTitle {
|
||||
id: string;
|
||||
group?: {
|
||||
subGroup?: {
|
||||
relation?: string | RelationOne;
|
||||
};
|
||||
};
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "users".
|
||||
|
||||
41
test/globals/payload-types.ts
Normal file
41
test/globals/payload-types.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
/* tslint:disable */
|
||||
/**
|
||||
* This file was automatically generated by Payload CMS.
|
||||
* DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config,
|
||||
* and re-run `payload generate:types` to regenerate this file.
|
||||
*/
|
||||
|
||||
export interface Config {}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "global".
|
||||
*/
|
||||
export interface Global {
|
||||
id: string;
|
||||
title?: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "array".
|
||||
*/
|
||||
export interface Array {
|
||||
id: string;
|
||||
array: {
|
||||
text?: string;
|
||||
id?: string;
|
||||
}[];
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "users".
|
||||
*/
|
||||
export interface User {
|
||||
id: string;
|
||||
email?: string;
|
||||
resetPasswordToken?: string;
|
||||
resetPasswordExpiration?: string;
|
||||
loginAttempts?: number;
|
||||
lockUntil?: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
@@ -6,6 +6,21 @@
|
||||
*/
|
||||
|
||||
export interface Config {}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "users".
|
||||
*/
|
||||
export interface User {
|
||||
id: string;
|
||||
relation?: string | LocalizedPost;
|
||||
email?: string;
|
||||
resetPasswordToken?: string;
|
||||
resetPasswordExpiration?: string;
|
||||
loginAttempts?: number;
|
||||
lockUntil?: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "localized-posts".
|
||||
@@ -81,17 +96,3 @@ export interface Dummy {
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "users".
|
||||
*/
|
||||
export interface User {
|
||||
id: string;
|
||||
email?: string;
|
||||
resetPasswordToken?: string;
|
||||
resetPasswordExpiration?: string;
|
||||
loginAttempts?: number;
|
||||
lockUntil?: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ export interface Media {
|
||||
filesize?: number;
|
||||
width?: number;
|
||||
height?: number;
|
||||
sizes?: {
|
||||
maintainedAspectRatio?: {
|
||||
sizes: {
|
||||
maintainedAspectRatio: {
|
||||
url?: string;
|
||||
width?: number;
|
||||
height?: number;
|
||||
@@ -37,7 +37,7 @@ export interface Media {
|
||||
filesize?: number;
|
||||
filename?: string;
|
||||
};
|
||||
tablet?: {
|
||||
tablet: {
|
||||
url?: string;
|
||||
width?: number;
|
||||
height?: number;
|
||||
@@ -45,7 +45,7 @@ export interface Media {
|
||||
filesize?: number;
|
||||
filename?: string;
|
||||
};
|
||||
mobile?: {
|
||||
mobile: {
|
||||
url?: string;
|
||||
width?: number;
|
||||
height?: number;
|
||||
@@ -53,7 +53,7 @@ export interface Media {
|
||||
filesize?: number;
|
||||
filename?: string;
|
||||
};
|
||||
icon?: {
|
||||
icon: {
|
||||
url?: string;
|
||||
width?: number;
|
||||
height?: number;
|
||||
@@ -65,6 +65,19 @@ export interface Media {
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "unstored-media".
|
||||
*/
|
||||
export interface UnstoredMedia {
|
||||
id: string;
|
||||
url?: string;
|
||||
filename?: string;
|
||||
mimeType?: string;
|
||||
filesize?: number;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "users".
|
||||
|
||||
@@ -8,10 +8,34 @@
|
||||
export interface Config {}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "slugname".
|
||||
* via the `definition` "autosave-global".
|
||||
*/
|
||||
export interface Slugname {
|
||||
export interface AutosaveGlobal {
|
||||
id: string;
|
||||
title: string;
|
||||
_status?: 'draft' | 'published';
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "autosave-posts".
|
||||
*/
|
||||
export interface AutosavePost {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
_status?: 'draft' | 'published';
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "draft-posts".
|
||||
*/
|
||||
export interface DraftPost {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
_status?: 'draft' | 'published';
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user