All files defaults.ts

100% Statements 106/106
100% Branches 2/2
100% Functions 2/2
100% Lines 106/106

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 1071x 1x 1x 1x 1x 1x 1x 1x 1x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 1x 1x 1x 1x 1x 4x 4x 4x  
import { readFileSync } from 'fs';
import { trueCasePathSync } from 'true-case-path';
import { join, toUnix } from 'upath';
import * as yaml from 'yaml';
 
/**
 * get default configuration
 * @returns
 */
export function getDefaultConfig() {
  const hexoDefaultConfig = {
    // Site
    title: 'Hexo',
    subtitle: '',
    description: '',
    author: 'John Doe',
    language: 'en',
    timezone: '',
    // URL
    url: 'http://example.com',
    root: '/',
    permalink: ':year/:month/:day/:name/',
    permalink_defaults: {},
    pretty_urls: {
      trailing_index: true,
      trailing_html: true
    },
    // Directory
    source_dir: 'source',
    public_dir: 'public',
    tag_dir: 'tags',
    archive_dir: 'archives',
    category_dir: 'categories',
    code_dir: 'downloads/code',
    i18n_dir: ':lang',
    skip_render: [],
    // Writing
    new_post_name: ':title.md',
    default_layout: 'post',
    titlecase: false,
    external_link: {
      enable: true,
      field: 'site',
      exclude: ''
    },
    filename_case: 0,
    render_drafts: false,
    post_asset_folder: false,
    relative_link: false,
    future: true,
    syntax_highlighter: 'highlight.js',
    highlight: {
      auto_detect: false,
      line_number: true,
      tab_replace: '',
      wrap: true,
      exclude_languages: [],
      language_attr: false,
      hljs: false
    },
    prismjs: {
      preprocess: true,
      line_number: true,
      tab_replace: ''
    },
    // Category & Tag
    default_category: 'uncategorized',
    category_map: {},
    tag_map: {},
    // Date / Time format
    date_format: 'YYYY-MM-DD',
    time_format: 'HH:mm:ss',
    updated_option: 'mtime',
    // * mtime: file modification date (default)
    // * empty: no more update
    // Pagination
    per_page: 10,
    pagination_dir: 'page',
    // Extensions
    theme: 'landscape',
    server: {
      cache: false
    },
    // Deployment
    deploy: {},
 
    // ignore files from processing
    ignore: [],
 
    // Category & Tag
    meta_generator: true
  };
  const sbgDefaultConfig = {
    cwd: toUnix(trueCasePathSync(process.cwd()))
  };
  const configYML = yaml.parse(getDefaultConfigYaml());
  return Object.assign(hexoDefaultConfig, sbgDefaultConfig, configYML) as typeof import('./_config.json');
}
 
/**
 * get default _config.yml
 * @returns
 */
export function getDefaultConfigYaml() {
  return readFileSync(join(__dirname, '_config.yml'), 'utf-8');
}