summaryrefslogtreecommitdiff
path: root/src/config.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.ts')
-rw-r--r--src/config.ts13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/config.ts b/src/config.ts
index 70463fee7..937499923 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -12,11 +12,18 @@ function validateConfig(config: any): void {
if (typeof config !== 'object') throw new Error(`[astro config] Expected object, received ${typeof config}`);
// strings
- for (const key of ['projectRoot', 'astroRoot', 'dist', 'public']) {
- if (config[key] && typeof config[key] !== 'string') {
+ for (const key of ['projectRoot', 'astroRoot', 'dist', 'public', 'site']) {
+ if (config[key] !== undefined && config[key] !== null && typeof config[key] !== 'string') {
throw new Error(`[astro config] ${key}: ${JSON.stringify(config[key])}\n Expected string, received ${type(config[key])}.`);
}
}
+
+ // booleans
+ for (const key of ['sitemap']) {
+ if (config[key] !== undefined && config[key] !== null && typeof config[key] !== 'boolean') {
+ throw new Error(`[astro config] ${key}: ${JSON.stringify(config[key])}\n Expected boolean, received ${type(config[key])}.`);
+ }
+ }
}
/** Set default config values */
@@ -28,6 +35,8 @@ function configDefaults(userConfig?: any): any {
if (!config.dist) config.dist = './_site';
if (!config.public) config.public = './public';
+ if (typeof config.sitemap === 'undefined') config.sitemap = true;
+
return config;
}