-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from CloudCannon/fix/decouple-ssg
Remove ssg field and separate build-coupled configuration
- Loading branch information
Showing
10 changed files
with
1,784 additions
and
1,765 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,11 +18,11 @@ | |
"email": "[email protected]" | ||
}, | ||
"scripts": { | ||
"build:unknown": "ts-json-schema-generator --markdown-description --path src/index.d.ts --type Configuration --out build/cloudcannon-config.json", | ||
"build:default": "ts-json-schema-generator --markdown-description --path src/index.d.ts --type DefaultConfiguration --out build/cloudcannon-config-default.json", | ||
"build:eleventy": "ts-json-schema-generator --markdown-description --path src/index.d.ts --type EleventyConfiguration --out build/cloudcannon-config-eleventy.json", | ||
"build:jekyll": "ts-json-schema-generator --markdown-description --path src/index.d.ts --type JekyllConfiguration --out build/cloudcannon-config-jekyll.json", | ||
"build:hugo": "ts-json-schema-generator --markdown-description --path src/index.d.ts --type HugoConfiguration --out build/cloudcannon-config-hugo.json", | ||
"build:default": "ts-json-schema-generator --markdown-description --path src/index.d.ts --type Configuration --out build/cloudcannon-config.json", | ||
"build:reader": "ts-json-schema-generator --markdown-description --path src/build-coupled.d.ts --type ReaderConfiguration --out build/cloudcannon-config-reader.json", | ||
"build:eleventy": "ts-json-schema-generator --markdown-description --path src/build-coupled.d.ts --type EleventyConfiguration --out build/cloudcannon-config-eleventy.json", | ||
"build:jekyll": "ts-json-schema-generator --markdown-description --path src/build-coupled.d.ts --type JekyllConfiguration --out build/cloudcannon-config-jekyll.json", | ||
"build:hugo": "ts-json-schema-generator --markdown-description --path src/build-coupled.d.ts --type HugoConfiguration --out build/cloudcannon-config-hugo.json", | ||
"build": "run-p build:*", | ||
"prebuild": "mkdir -p build && rimraf --glob 'build/*.json'", | ||
"test": "exit 0" | ||
|
@@ -47,4 +47,4 @@ | |
"prettier-plugin-jsdoc": "^1.3.0", | ||
"rimraf": "^5.0.7" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
import { CollectionConfig, Configuration, Parseable } from './configuration'; | ||
|
||
export type FilterBase = 'none' | 'all' | 'strict'; | ||
|
||
export interface Filter { | ||
/** | ||
* Defines the initial set of visible files in the collection file list. Defaults to "all", or | ||
* "strict" for the auto-discovered `pages` collection in Jekyll, Hugo, and Eleventy. | ||
*/ | ||
base?: FilterBase; | ||
/** | ||
* Add to the visible files set with `base`. Paths must be relative to the containing collection | ||
* `path`. | ||
*/ | ||
include?: string[]; | ||
/** | ||
* Remove from the visible files set with `base`. Paths must be relative to the containing | ||
* collection `path`. | ||
*/ | ||
exclude?: string[]; | ||
} | ||
|
||
interface Filterable { | ||
/** | ||
* Controls which files are displayed in the collection list. Does not change which files are | ||
* assigned to this collection. | ||
*/ | ||
filter?: Filter | FilterBase; | ||
} | ||
|
||
interface WithCollectionsConfigOverride { | ||
/** | ||
* Prevents CloudCannon from automatically discovering collections for supported SSGs if true. | ||
* Defaults to false. | ||
*/ | ||
collections_config_override?: boolean; | ||
} | ||
|
||
/** | ||
* The `collections_config` entry format for build-coupled non-Jekyll/Hugo/Eleventy sites. | ||
*/ | ||
export interface ReaderCollectionConfig extends CollectionConfig, Parseable, Filterable {} | ||
|
||
/** | ||
* The configuration format for build-coupled non-Jekyll/Hugo/Eleventy sites. | ||
*/ | ||
export interface ReaderConfiguration extends Configuration { | ||
collections_config?: Record<string, ReaderCollectionConfig>; | ||
/** | ||
* Generates the integration file in another folder. Not applicable to Jekyll, Hugo, and Eleventy. | ||
* Defaults to the root folder. | ||
*/ | ||
output?: string; | ||
} | ||
|
||
export interface BuildCoupledCollectionConfig extends Omit<CollectionConfig, 'url'>, Filterable {} | ||
|
||
interface BuildCoupledConfiguration | ||
extends Omit<Configuration, 'data_config'>, | ||
WithCollectionsConfigOverride {} | ||
|
||
/** | ||
* The `collections_config` entry format for build-coupled Hugo sites. | ||
*/ | ||
export interface HugoCollectionConfig extends BuildCoupledCollectionConfig { | ||
/** | ||
* Controls whether branch index files (e.g. `_index.md`) are assigned to this collection or not. | ||
* The "pages" collection defaults this to true, and false otherwise. | ||
*/ | ||
parse_branch_index?: boolean; | ||
} | ||
|
||
/** | ||
* The configuration format for build-coupled Hugo sites. | ||
*/ | ||
export interface HugoConfiguration extends BuildCoupledConfiguration { | ||
collections_config?: Record<string, HugoCollectionConfig>; | ||
data_config?: Record<string, boolean>; | ||
} | ||
|
||
/** | ||
* The configuration format for build-coupled Jekyll sites. | ||
*/ | ||
export interface JekyllConfiguration extends BuildCoupledConfiguration { | ||
collections_config?: Record<string, BuildCoupledCollectionConfig>; | ||
data_config?: Record<string, boolean>; | ||
} | ||
|
||
/** | ||
* The configuration format for build-coupled Eleventy sites. | ||
*/ | ||
export type EleventyConfiguration = JekyllConfiguration; | ||
|
||
export type ParsedDataset = | ||
| string[] | ||
| Record<string, string> | ||
| Record<string, Record<string, any>> | ||
| Record<string, any>[]; | ||
|
||
interface ParsedCollectionItem { | ||
[index: string]: any; | ||
/** | ||
* The path to the file this was parsed from. | ||
*/ | ||
path: 'string'; | ||
/** | ||
* The collection key this is assigned to. Matches keys in `collections_config`. | ||
*/ | ||
collection: 'string'; | ||
/** | ||
* The URL this file is served at once built. | ||
*/ | ||
url?: 'string'; | ||
} | ||
|
||
interface WithIntegrationOutput { | ||
/** | ||
* The error code encountered when attempting to create the integration output file. | ||
*/ | ||
error?: 'NO_CONTENT' | string; | ||
/** | ||
* The time this file was generated. | ||
*/ | ||
time?: string; | ||
/** | ||
* The schema version of the integration output file. | ||
* | ||
* @deprecated No longer used. | ||
*/ | ||
version?: string; // This refers to an old schema, replaced by the IntegrationOutput type. | ||
/** | ||
* Details about the integration tool used to generate the integration output file. | ||
*/ | ||
cloudcannon?: { | ||
/** | ||
* Name of the integration tool used to generate the integration output file. | ||
*/ | ||
name: string; | ||
/** | ||
* Version of the integration tool used to generate the integration output file. | ||
*/ | ||
version: string; | ||
}; | ||
/** | ||
* Map of data keys to parsed datasets. Keys match keys in `data_config`. | ||
*/ | ||
data?: Record<string, ParsedDataset>; | ||
/** | ||
* Map of collection keys to parsed collection files. Keys match keys in `collections_config`. | ||
*/ | ||
collections?: Record<string, ParsedCollectionItem>; | ||
/** | ||
* Map of build file paths to MD5s. | ||
*/ | ||
files?: Record<string, string>; | ||
} | ||
|
||
/** | ||
* The output from build-coupled non-Jekyll/Hugo/Eleventy sites. | ||
*/ | ||
export interface IntegrationOutput extends Configuration, WithIntegrationOutput {} | ||
|
||
/** | ||
* The output from build-coupled Hugo sites. | ||
*/ | ||
export interface HugoIntegrationOutput extends HugoConfiguration, WithIntegrationOutput {} | ||
|
||
/** | ||
* The output from build-coupled Jekyll sites. | ||
*/ | ||
export interface JekyllIntegrationOutput extends JekyllConfiguration, WithIntegrationOutput { | ||
/** | ||
* @deprecated Do not use. | ||
*/ | ||
defaults: any; | ||
} | ||
|
||
/** | ||
* The output from build-coupled Eleventy sites. | ||
*/ | ||
export interface EleventyIntegrationOutput extends EleventyConfiguration, WithIntegrationOutput {} |
Oops, something went wrong.