diff --git a/src/build-coupled.d.ts b/src/build-coupled.d.ts index 0a46b41..c9fa67e 100644 --- a/src/build-coupled.d.ts +++ b/src/build-coupled.d.ts @@ -1,4 +1,24 @@ -import { CollectionConfig, Configuration, Parseable } from './configuration'; +import { CollectionConfig, Configuration, DataConfigEntry, Paths } from './configuration'; + +export interface BuildCoupledPaths extends Paths { + /** + * Parent folder of all collections. + */ + collections?: string; + /** + * Parent folder of all site data files. + */ + data?: string; + /** + * Parent folder of all site layout files. _Only applies to Jekyll, Hugo, and Eleventy sites_. + */ + layouts?: string; + /** + * Parent folder of all includes, partials, or shortcode files. _Only applies to Jekyll, Hugo, and + * Eleventy sites_. + */ + includes?: string; +} export type FilterBase = 'none' | 'all' | 'strict'; @@ -20,6 +40,13 @@ export interface Filter { exclude?: string[]; } +interface Parseable { + /** + * Overrides the format files are read. Detected automatically from file extension if unset. + */ + parser?: 'csv' | 'front-matter' | 'json' | 'properties' | 'toml' | 'yaml'; +} + interface Filterable { /** * Controls which files are displayed in the collection list. Does not change which files are @@ -39,12 +66,20 @@ interface WithCollectionsConfigOverride { /** * The `collections_config` entry format for build-coupled non-Jekyll/Hugo/Eleventy sites. */ -export interface ReaderCollectionConfig extends CollectionConfig, Parseable, Filterable {} +export interface ReaderCollectionConfig extends CollectionConfig, Parseable, Filterable { + /** + * Overrides the default singular input key of the collection. This is used for naming conventions + * for select and multiselect inputs. + */ + singular_key?: string; +} /** * The configuration format for build-coupled non-Jekyll/Hugo/Eleventy sites. */ export interface ReaderConfiguration extends Configuration { + paths?: BuildCoupledPaths; + data_config?: Record; collections_config?: Record; /** * Generates the integration file in another folder. Not applicable to Jekyll, Hugo, and Eleventy. @@ -53,11 +88,19 @@ export interface ReaderConfiguration extends Configuration { output?: string; } -export interface BuildCoupledCollectionConfig extends Omit, Filterable {} +export interface BuildCoupledCollectionConfig extends Omit, Filterable { + /** + * Overrides the default singular input key of the collection. This is used for naming conventions + * for select and multiselect inputs. + */ + singular_key?: string; +} interface BuildCoupledConfiguration extends Omit, - WithCollectionsConfigOverride {} + WithCollectionsConfigOverride { + paths?: BuildCoupledPaths; +} /** * The `collections_config` entry format for build-coupled Hugo sites. diff --git a/src/configuration.d.ts b/src/configuration.d.ts index d9a28ba..21c494f 100644 --- a/src/configuration.d.ts +++ b/src/configuration.d.ts @@ -9,7 +9,13 @@ import type { Syntax } from './syntax'; export type InstanceValue = 'UUID' | 'NOW'; export type EditorKey = 'visual' | 'content' | 'data'; export type SortOrder = 'ascending' | 'descending' | 'asc' | 'desc'; -export type AttributeListPosition = 'none' | 'right' | 'space right' | 'below' | 'newline below' | 'right-of-prefix'; +export type AttributeListPosition = + | 'none' + | 'right' + | 'space right' + | 'below' + | 'newline below' + | 'right-of-prefix'; export type MarkdownAttributeElementOptions = { inline?: AttributeListPosition; @@ -40,7 +46,9 @@ export interface MarkdownSettings { */ typographer?: boolean; /** - * Double + single quotes replacement pairs, when typographer enabled and smartquotes on. For example, you can use '«»„“' for Russian, '„“‚‘' for German, and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp). + * Double + single quotes replacement pairs, when typographer enabled and smartquotes on. For + * example, you can use '«»„“' for Russian, '„“‚‘' for German, and ['«\xA0', '\xA0»', '‹\xA0', + * '\xA0›'] for French (including nbsp). */ quotes?: string; /** @@ -91,11 +99,11 @@ export interface MarkdownSettings { * Save element attributes in Markdown format instead of converting to HTML. */ attributes?: boolean; - /** + /** * Define positioning behaviour of Markdown attributes for different elements. - */ + */ attribute_elements?: MarkdownAttributeElementOptions; - } + }; } // TODO: use SnippetConfig from @cloudcannon/scrap-booker when ParserConfig issue resolved. @@ -388,20 +396,20 @@ export interface BlockEditable extends ImageResizeable, TextEditable { table?: boolean; } -interface WithReducedPaths { +interface WithPaths { /** * Paths to where new asset files are uploaded to. They also set the default path when choosing * existing images, and linking to existing files. Each path is relative to global `source`. * Defaults to the global `paths`. */ - paths?: ReducedPaths; + paths?: Paths; } -export interface ImageEditable extends ImageResizeable, WithReducedPaths {} +export interface ImageEditable extends ImageResizeable, WithPaths {} -export interface LinkEditable extends WithReducedPaths {} +export interface LinkEditable extends WithPaths {} -export interface TextEditable extends WithReducedPaths { +export interface TextEditable extends WithPaths { /** * Enables a control to set selected text to bold. */ @@ -720,7 +728,7 @@ export interface RangeInput extends BaseInput { type: 'range'; } -export interface UrlInputOptions extends BaseInputOptions, WithReducedPaths {} +export interface UrlInputOptions extends BaseInputOptions, WithPaths {} export interface UrlInput extends BaseInput { type: 'range'; @@ -753,7 +761,7 @@ export interface DateInput extends BaseInput { type: 'date' | 'datetime'; } -export interface FileInputOptions extends BaseInputOptions, WithReducedPaths { +export interface FileInputOptions extends BaseInputOptions, WithPaths { /** * Restricts which file types are available to select or upload to this input. */ @@ -940,7 +948,7 @@ export type Input = | ObjectInput | ArrayInput; -export interface ReducedPaths { +export interface Paths { /** * Location of assets that are statically copied to the output site. This prefix will be removed * from the _Uploads_ path when CloudCannon outputs the URL of an asset. @@ -980,26 +988,6 @@ export interface ReducedPaths { uploads_use_relative_path?: boolean; } -export interface Paths extends ReducedPaths { - /** - * Parent folder of all collections. - */ - collections?: string; - /** - * Parent folder of all site data files. - */ - data?: string; - /** - * Parent folder of all site layout files. _Only applies to Jekyll, Hugo, and Eleventy sites_. - */ - layouts?: string; - /** - * Parent folder of all includes, partials, or shortcode files. _Only applies to Jekyll, Hugo, and - * Eleventy sites_. - */ - includes?: string; -} - export interface Documentation { /** * The "href" value of the link. @@ -1277,11 +1265,6 @@ export interface CollectionConfig extends Cascade, Previewable { * collection add menu and file context menu. */ singular_name?: string; - /** - * Overrides the default singular input key of the collection. This is used for naming conventions - * for select and multiselect inputs. - */ - singular_key?: string; /** * Changes the options presented in the add menu in the collection file list. Defaults to an * automatically generated list from _Schemas_, or uses the first file in the collection if no @@ -1431,14 +1414,7 @@ export type SelectValues = | Record | Record>; -export interface Parseable { - /** - * Overrides the format files are read. Detected automatically from file extension if unset. - */ - parser?: 'csv' | 'front-matter' | 'json' | 'properties' | 'toml' | 'yaml'; -} - -export interface DataConfigEntry extends Parseable { +export interface DataConfigEntry { /** * The path to a file or folder of files containing data. */ @@ -1523,19 +1499,14 @@ export type SsgKey = | 'nuxtjs' | 'sphinx' | 'static' - | 'other' | 'legacy' - | 'unknown'; + | 'other'; -export interface Configuration extends Cascade, WithSnippets { +export interface Configuration extends Cascade, WithSnippets, WithPaths { /** * Base path to your site source files, relative to the root folder. */ source?: string; - /** - * Global paths to common folders. - */ - paths?: Paths; /** * Definitions for your collections, which are the sets of content files for your site grouped by * folder. Entries are keyed by a chosen collection key, and contain configuration specific to