@cloudcannon/configuration-types 0.0.22 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,49 +1,60 @@
1
1
  {
2
- "name": "@cloudcannon/configuration-types",
3
- "version": "0.0.22",
4
- "description": "Contains TypeScript declarations and generates JSONSchema files for the CloudCannon configuration file.",
5
- "author": "CloudCannon <support@cloudcannon.com>",
6
- "license": "MIT",
7
- "keywords": [
8
- "static site generator",
9
- "cloudcannon"
10
- ],
11
- "homepage": "https://github.com/CloudCannon/configuration-types#readme",
12
- "repository": {
13
- "type": "git",
14
- "url": "https://github.com/CloudCannon/configuration-types.git"
15
- },
16
- "bugs": {
17
- "url": "https://github.com/CloudCannon/configuration-types/issues",
18
- "email": "support@cloudcannon.com"
19
- },
20
- "scripts": {
21
- "prebuild": "rimraf dist && mkdir -p dist",
22
- "build": "ts-json-schema-generator --no-top-ref --markdown-description --path src/index.d.ts --type Configuration --out dist/cloudcannon-config.schema.json --id 'https://github.com/cloudcannon/configuration-types/releases/latest/download/cloudcannon-config.schema.json'",
23
- "lint": "npm run lint:tsc && npm run lint:format",
24
- "lint:tsc": "tsc --noEmit",
25
- "lint:format": "prettier -c src",
26
- "format": "prettier -w src",
27
- "test": "exit 0"
28
- },
29
- "main": "./src/index.d.ts",
30
- "types": "./src/index.d.ts",
31
- "publishConfig": {
32
- "access": "public"
33
- },
34
- "files": [
35
- "src/**/*",
36
- "dist/**/*"
37
- ],
38
- "dependencies": {
39
- "@cloudcannon/snippet-types": "^1.1.12",
40
- "ts-json-schema-generator": "^2.2.0"
41
- },
42
- "devDependencies": {
43
- "@types/node": "^22.9.1",
44
- "prettier": "^3.3.3",
45
- "prettier-plugin-jsdoc": "^1.3.0",
46
- "rimraf": "^6.0.1",
47
- "typescript": "^5.6.3"
48
- }
2
+ "name": "@cloudcannon/configuration-types",
3
+ "version": "0.0.24",
4
+ "type": "module",
5
+ "description": "Contains TypeScript declarations and generates JSONSchema files for the CloudCannon configuration file.",
6
+ "author": "CloudCannon <support@cloudcannon.com>",
7
+ "license": "MIT",
8
+ "keywords": [
9
+ "static site generator",
10
+ "cloudcannon"
11
+ ],
12
+ "homepage": "https://github.com/CloudCannon/configuration-types#readme",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/CloudCannon/configuration-types.git"
16
+ },
17
+ "bugs": {
18
+ "url": "https://github.com/CloudCannon/configuration-types/issues",
19
+ "email": "support@cloudcannon.com"
20
+ },
21
+ "scripts": {
22
+ "prebuild": "rimraf dist && mkdir -p dist",
23
+ "build": "run-p build:*",
24
+ "build:combined": "cp src/cloudcannon-config.schema.json dist/cloudcannon-config.schema.json",
25
+ "build:latest": "ts-json-schema-generator --markdown-description --no-top-ref --path src/index.d.ts --type Configuration --out dist/cloudcannon-config.latest.schema.json --id 'https://github.com/cloudcannon/configuration-types/releases/latest/download/cloudcannon-config.latest.schema.json'",
26
+ "build:legacy-jekyll": "ts-json-schema-generator --markdown-description --no-top-ref --path src/build-coupled.d.ts --type JekyllConfiguration --out dist/cloudcannon-config.legacy-jekyll.schema.json --id 'https://github.com/cloudcannon/configuration-types/releases/latest/download/cloudcannon-config.legacy-jekyll.schema.json'",
27
+ "build:legacy-hugo": "ts-json-schema-generator --markdown-description --no-top-ref --path src/build-coupled.d.ts --type HugoConfiguration --out dist/cloudcannon-config.legacy-hugo.schema.json --id 'https://github.com/cloudcannon/configuration-types/releases/latest/download/cloudcannon-config.legacy-hugo.schema.json'",
28
+ "build:legacy-eleventy": "ts-json-schema-generator --markdown-description --no-top-ref --path src/build-coupled.d.ts --type EleventyConfiguration --out dist/cloudcannon-config.legacy-eleventy.schema.json --id 'https://github.com/cloudcannon/configuration-types/releases/latest/download/cloudcannon-config.legacy-eleventy.schema.json'",
29
+ "build:legacy-reader": "ts-json-schema-generator --markdown-description --no-top-ref --path src/build-coupled.d.ts --type ReaderConfiguration --out dist/cloudcannon-config.legacy-reader.schema.json --id 'https://github.com/cloudcannon/configuration-types/releases/latest/download/cloudcannon-config.legacy-reader.schema.json'",
30
+ "lint": "npm run lint:tsc && npm run lint:format",
31
+ "lint:tsc": "tsc --noEmit",
32
+ "lint:format": "prettier -c src",
33
+ "format": "prettier -w src",
34
+ "site:dev": "http-server site -p 12345 -c-1",
35
+ "site:build": "cp dist/*.schema.json site/.",
36
+ "test": "exit 0"
37
+ },
38
+ "main": "./src/index.d.ts",
39
+ "types": "./src/index.d.ts",
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "files": [
44
+ "src/**/*",
45
+ "dist/**/*"
46
+ ],
47
+ "dependencies": {
48
+ "@cloudcannon/snippet-types": "^1.1.13",
49
+ "npm-run-all": "^4.1.5",
50
+ "ts-json-schema-generator": "^2.2.0"
51
+ },
52
+ "devDependencies": {
53
+ "@types/node": "^22.10.7",
54
+ "http-server": "^14.1.1",
55
+ "prettier": "^3.4.2",
56
+ "prettier-plugin-jsdoc": "^1.3.2",
57
+ "rimraf": "^6.0.1",
58
+ "typescript": "^5.7.3"
59
+ }
49
60
  }
@@ -1,4 +1,5 @@
1
- import type { CollectionConfig, Configuration, DataConfigEntry, Paths } from './configuration';
1
+ import type { CollectionConfig, Configuration, DataConfigEntry } from './configuration';
2
+ import type { Paths } from './paths';
2
3
 
3
4
  export interface BuildCoupledPaths extends Paths {
4
5
  /**
@@ -72,14 +73,38 @@ export interface ReaderCollectionConfig extends CollectionConfig, Parseable, Fil
72
73
  * for select and multiselect inputs.
73
74
  */
74
75
  singular_key?: string;
76
+ /**
77
+ * Specifies whether this collection's source files build to output files. Defaults to false.
78
+ */
79
+ output?: boolean;
75
80
  }
76
81
 
77
82
  /**
78
83
  * The configuration format for build-coupled non-Jekyll/Hugo/Eleventy sites.
79
84
  */
80
- export interface ReaderConfiguration extends Configuration {
85
+ export interface ReaderConfiguration extends Omit<Configuration, 'version'> {
86
+ /**
87
+ * Controls which schema this file is validated against. Defaults to the latest schema.
88
+ */
89
+ version: 'legacy-reader';
90
+ /**
91
+ * Paths to where new asset files are uploaded to. They also set the default path when choosing
92
+ * existing images, and linking to existing files. Each path is relative to global `source`.
93
+ */
81
94
  paths?: BuildCoupledPaths;
95
+ /**
96
+ * Controls what data sets are available to populate select and multiselect inputs.
97
+ *
98
+ * https://cloudcannon.com/documentation/articles/configuration-file-reference/#data_config
99
+ */
82
100
  data_config?: Record<string, DataConfigEntry & Parseable>;
101
+ /**
102
+ * Definitions for your collections, which are the sets of content files for your site grouped by
103
+ * folder. Entries are keyed by a chosen collection key, and contain configuration specific to
104
+ * that collection.
105
+ *
106
+ * https://cloudcannon.com/documentation/articles/configuration-file-reference/#collections_config
107
+ */
83
108
  collections_config?: Record<string, ReaderCollectionConfig>;
84
109
  /**
85
110
  * Generates the integration file in another folder. Not applicable to Jekyll, Hugo, and Eleventy.
@@ -89,7 +114,7 @@ export interface ReaderConfiguration extends Configuration {
89
114
  }
90
115
 
91
116
  export interface BuildCoupledCollectionConfig
92
- extends Omit<CollectionConfig, 'url' | 'path'>,
117
+ extends Omit<CollectionConfig, 'url' | 'path' | 'disable_url'>,
93
118
  Filterable {
94
119
  /**
95
120
  * Overrides the default singular input key of the collection. This is used for naming conventions
@@ -100,13 +125,34 @@ export interface BuildCoupledCollectionConfig
100
125
  * The top-most folder where the files in this collection are stored. It is relative to `source`.
101
126
  */
102
127
  path?: string;
128
+ /**
129
+ * Specifies whether this collection's source files build to output files. Defaults to false.
130
+ */
131
+ output?: boolean;
103
132
  }
104
133
 
105
134
  interface BuildCoupledConfiguration
106
- extends Omit<Configuration, 'data_config' | 'collections_config'>,
135
+ extends Omit<Configuration, 'data_config' | 'collections_config' | 'version'>,
107
136
  WithCollectionsConfigOverride {
137
+ /**
138
+ * Paths to where new asset files are uploaded to. They also set the default path when choosing
139
+ * existing images, and linking to existing files. Each path is relative to global `source`.
140
+ */
108
141
  paths?: BuildCoupledPaths;
142
+ /**
143
+ * Definitions for your collections, which are the sets of content files for your site grouped by
144
+ * folder. Entries are keyed by a chosen collection key, and contain configuration specific to
145
+ * that collection.
146
+ *
147
+ * https://cloudcannon.com/documentation/articles/configuration-file-reference/#collections_config
148
+ */
109
149
  collections_config?: BuildCoupledCollectionConfig;
150
+ /**
151
+ * Controls what data sets are available to populate select and multiselect inputs.
152
+ *
153
+ * https://cloudcannon.com/documentation/articles/configuration-file-reference/#data_config
154
+ */
155
+ data_config?: Record<string, boolean>;
110
156
  }
111
157
 
112
158
  /**
@@ -124,22 +170,66 @@ export interface HugoCollectionConfig extends BuildCoupledCollectionConfig {
124
170
  * The configuration format for build-coupled Hugo sites.
125
171
  */
126
172
  export interface HugoConfiguration extends BuildCoupledConfiguration {
173
+ /**
174
+ * Controls which schema this file is validated against. Defaults to the latest schema.
175
+ */
176
+ version: 'legacy-hugo';
177
+ /**
178
+ * Definitions for your collections, which are the sets of content files for your site grouped by
179
+ * folder. Entries are keyed by a chosen collection key, and contain configuration specific to
180
+ * that collection.
181
+ *
182
+ * https://cloudcannon.com/documentation/articles/configuration-file-reference/#collections_config
183
+ */
127
184
  collections_config?: Record<string, HugoCollectionConfig>;
128
- data_config?: Record<string, boolean>;
129
185
  }
130
186
 
131
187
  /**
132
188
  * The configuration format for build-coupled Jekyll sites.
133
189
  */
134
190
  export interface JekyllConfiguration extends BuildCoupledConfiguration {
191
+ /**
192
+ * Controls which schema this file is validated against. Defaults to the latest schema.
193
+ */
194
+ version: 'legacy-jekyll';
195
+ /**
196
+ * Definitions for your collections, which are the sets of content files for your site grouped by
197
+ * folder. Entries are keyed by a chosen collection key, and contain configuration specific to
198
+ * that collection.
199
+ *
200
+ * https://cloudcannon.com/documentation/articles/configuration-file-reference/#collections_config
201
+ */
135
202
  collections_config?: Record<string, BuildCoupledCollectionConfig>;
136
- data_config?: Record<string, boolean>;
137
203
  }
138
204
 
139
205
  /**
140
206
  * The configuration format for build-coupled Eleventy sites.
141
207
  */
142
- export type EleventyConfiguration = JekyllConfiguration;
208
+ export interface EleventyConfiguration extends BuildCoupledConfiguration {
209
+ /**
210
+ * Controls which schema this file is validated against. Defaults to the latest schema.
211
+ */
212
+ version: 'legacy-eleventy';
213
+ /**
214
+ * Definitions for your collections, which are the sets of content files for your site grouped by
215
+ * folder. Entries are keyed by a chosen collection key, and contain configuration specific to
216
+ * that collection.
217
+ *
218
+ * https://cloudcannon.com/documentation/articles/configuration-file-reference/#collections_config
219
+ */
220
+ collections_config?: Record<string, BuildCoupledCollectionConfig>;
221
+ }
222
+
223
+ /**
224
+ * @discriminator version
225
+ */
226
+ export type AnyLegacyConfiguration =
227
+ | HugoConfiguration
228
+ | JekyllConfiguration
229
+ | EleventyConfiguration
230
+ | ReaderConfiguration;
231
+
232
+ export type AnyConfiguration = Configuration | AnyLegacyConfiguration;
143
233
 
144
234
  export type ParsedDataset =
145
235
  | string[]
@@ -172,12 +262,6 @@ interface WithIntegrationOutput {
172
262
  * The time this file was generated.
173
263
  */
174
264
  time?: string;
175
- /**
176
- * The schema version of the integration output file.
177
- *
178
- * @deprecated No longer used.
179
- */
180
- version?: string; // This refers to an old schema, replaced by the IntegrationOutput type.
181
265
  /**
182
266
  * Details about the integration tool used to generate the integration output file.
183
267
  */
@@ -0,0 +1,37 @@
1
+ import type { Editables } from './editables';
2
+ import type { Input } from './inputs';
3
+ import type { SelectValues } from './select-values';
4
+ import type { Structure } from './structures';
5
+
6
+ export type EditorKey = 'visual' | 'content' | 'data';
7
+
8
+ export interface ReducedCascade {
9
+ /**
10
+ * Controls the behavior and appearance of your inputs in all data editing interfaces.
11
+ */
12
+ _inputs?: Record<string, Input>;
13
+ /**
14
+ * Fixed datasets that can be referenced by the _Values_ configuration for _Select_ and
15
+ * _Multiselect_ inputs.
16
+ */
17
+ _select_data?: Record<string, SelectValues>;
18
+ /**
19
+ * Structured values for editors adding new items to arrays and objects. Entries here can be
20
+ * referenced in the configuration for `array` or `object` inputs.
21
+ */
22
+ _structures?: Record<string, Structure>;
23
+ }
24
+
25
+ export interface Cascade extends ReducedCascade {
26
+ /**
27
+ * Set a preferred editor and/or disable the others. The first value sets which editor opens by
28
+ * default, and the following values specify which editors are accessible.
29
+ *
30
+ * @uniqueItems
31
+ */
32
+ _enabled_editors?: EditorKey[];
33
+ /**
34
+ * Contains input options for Editable Regions and the Content Editor.
35
+ */
36
+ _editables?: Editables;
37
+ }
@@ -0,0 +1,79 @@
1
+ {
2
+ "$id": "https://github.com/cloudcannon/configuration-types/releases/latest/download/cloudcannon-config.schema.json",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "description": "Delegates to other schemas based on version.",
5
+ "type": "object",
6
+ "properties": {
7
+ "version": {
8
+ "enum": ["legacy-hugo", "legacy-jekyll", "legacy-eleventy", "legacy-reader", "latest"]
9
+ }
10
+ },
11
+ "allOf": [
12
+ {
13
+ "if": {
14
+ "properties": {
15
+ "version": {
16
+ "not": {
17
+ "enum": ["legacy-hugo", "legacy-jekyll", "legacy-eleventy", "legacy-reader"]
18
+ }
19
+ }
20
+ }
21
+ },
22
+ "then": {
23
+ "$ref": "cloudcannon-config.latest.schema.json"
24
+ }
25
+ },
26
+ {
27
+ "if": {
28
+ "properties": {
29
+ "version": {
30
+ "const": "legacy-hugo"
31
+ }
32
+ },
33
+ "required": ["version"]
34
+ },
35
+ "then": {
36
+ "$ref": "cloudcannon-config.legacy-hugo.schema.json"
37
+ }
38
+ },
39
+ {
40
+ "if": {
41
+ "properties": {
42
+ "version": {
43
+ "const": "legacy-jekyll"
44
+ }
45
+ },
46
+ "required": ["version"]
47
+ },
48
+ "then": {
49
+ "$ref": "cloudcannon-config.legacy-jekyll.schema.json"
50
+ }
51
+ },
52
+ {
53
+ "if": {
54
+ "properties": {
55
+ "version": {
56
+ "const": "legacy-eleventy"
57
+ }
58
+ },
59
+ "required": ["version"]
60
+ },
61
+ "then": {
62
+ "$ref": "cloudcannon-config.legacy-eleventy.schema.json"
63
+ }
64
+ },
65
+ {
66
+ "if": {
67
+ "properties": {
68
+ "version": {
69
+ "const": "legacy-reader"
70
+ }
71
+ },
72
+ "required": ["version"]
73
+ },
74
+ "then": {
75
+ "$ref": "cloudcannon-config.legacy-reader.schema.json"
76
+ }
77
+ }
78
+ ]
79
+ }