@cloudcannon/configuration-types 0.0.16 → 0.0.17

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Configuration types
2
2
 
3
- Contains TypeScript declarations and generates JSONSchema files for the [CloudCannon](https://cloudcannon.com/) configuration file.
3
+ Contains TypeScript declarations and generates JSON Schema files for the [CloudCannon](https://cloudcannon.com/) configuration file.
4
4
 
5
5
  [<img src="https://img.shields.io/npm/v/@cloudcannon%2Fconfiguration-types?logo=npm" alt="version badge">](https://www.npmjs.com/package/@cloudcannon%2Fconfiguration-types)
6
6
 
@@ -8,8 +8,6 @@ Contains TypeScript declarations and generates JSONSchema files for the [CloudCa
8
8
 
9
9
  - [Installation](#installation)
10
10
  - [Usage](#usage)
11
- - [YAML and JSON](#yaml-and-json)
12
- - [JavaScript](#javascript)
13
11
  - [Development](#development)
14
12
  - [License](#license)
15
13
 
@@ -23,19 +21,16 @@ npm i -D @cloudcannon/configuration-types
23
21
 
24
22
  ## Usage
25
23
 
26
- The primary use of this package is to validate your configuration file. You can also use it to autocomplete and read inline documention while editing. Here are some suggested workflows below.
27
-
28
- ### YAML and JSON
29
-
30
24
  We plan to add the configuration schema to [JSON Schema Store](https://www.schemastore.org/json/), which would automatically enable in-editor validation, autocomplete and tooltips with the YAML or JSON LSP enabled.
31
25
 
32
26
  Alternatively, you can add a comment to the top of your file to use a specific schema for YAML files:
33
27
 
34
28
  ```yaml
35
- # yaml-language-server: $schema=https://raw.githubusercontent.com/CloudCannon/configuration-types/main/build/cloudcannon-config.json
29
+ # yaml-language-server: $schema=https://raw.githubusercontent.com/CloudCannon/configuration-types/main/dist/cloudcannon-config.schema.json
36
30
 
37
31
  collections_config:
38
32
  posts:
33
+ path: content/posts
39
34
  name: Blog
40
35
  icon: event
41
36
  ```
@@ -44,10 +39,11 @@ Or the top-level `$schema` entry for JSON files:
44
39
 
45
40
  ```json
46
41
  {
47
- "$schema": "https://raw.githubusercontent.com/CloudCannon/configuration-types/main/build/cloudcannon-config.json",
42
+ "$schema": "https://raw.githubusercontent.com/CloudCannon/configuration-types/main/dist/cloudcannon-config.schema.json",
48
43
 
49
44
  "collections_config": {
50
45
  "posts": {
46
+ "path": "content/posts",
51
47
  "name": "Blog",
52
48
  "icon": "event"
53
49
  }
@@ -59,33 +55,7 @@ You could also/alternatively validate the file on the command line with somethin
59
55
 
60
56
  ```sh
61
57
  npm i @cloudcannon/configuration-types ajv-cli
62
- npm run ajv validate -s node_modules/@cloudcannon/configuration-types/cloudcannon-config.json -d cloudcannon.config.yml
63
- ```
64
-
65
- ### JavaScript
66
-
67
- For a CommonJS formatted configuration file (e.g. `/cloudcannon.config.cjs`), you can use a JSDoc comment to indicate the type of the module export:
68
-
69
- ```javascript
70
- /** @type {import("@cloudcannon/configuration-types").Configuration} */
71
- const config = {
72
- collections_config: {
73
- posts: {
74
- name: 'Blog',
75
- icon: 'event',
76
- },
77
- },
78
- };
79
-
80
- module.exports = config;
81
- ```
82
-
83
- Then use the TypeScript LSP in your supported editor, ensuring it is set up to check JavaScript files. This would provide in-editor validation, autocomplete and tooltips as you modify the file.
84
-
85
- You could also/alternatively run `tsc` over your file to validate there are no issues outside of your editor:
86
-
87
- ```sh
88
- npx tsc test/cloudcannon.config.js --allowJs --checkJs --noEmit
58
+ npm run ajv validate -s node_modules/@cloudcannon/configuration-types/schema/cloudcannon-config.schema.json -d cloudcannon.config.yml
89
59
  ```
90
60
 
91
61
  ***
@@ -98,7 +68,7 @@ Install dependencies:
98
68
  npm i
99
69
  ```
100
70
 
101
- Build JSONSchema files:
71
+ Build:
102
72
 
103
73
  ```sh
104
74
  npm run build