umberto 9.3.0 → 10.0.0
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/CHANGELOG.md +24 -16
- package/LICENSE.md +0 -44
- package/README.md +0 -1
- package/hexo-shim.js +2 -2
- package/package.json +2 -9
- package/scripts/filter/after-post-render/{gloria.js → gloria.cjs} +3 -3
- package/scripts/filter/after-post-render/{insert-error-codes.js → insert-error-codes.cjs} +1 -1
- package/scripts/filter/after-post-render/{linker.js → linker.cjs} +1 -1
- package/scripts/filter/after-post-render/{parseicontag.js → parseicontag.cjs} +1 -1
- package/scripts/filter/after-post-render/{snippets.js → snippets.cjs} +2 -2
- package/scripts/filter/after-render/{process-svg.js → process-svg.cjs} +3 -3
- package/scripts/filter/before-post-render/{add-project-info-to-page.js → add-project-info-to-page.cjs} +2 -2
- package/scripts/filter/before-post-render/{add-repo-url.js → add-repo-url.cjs} +4 -4
- package/scripts/filter/before-post-render/{code-switcher.js → code-switcher.cjs} +1 -1
- package/scripts/filter/before-post-render/{execute-and-insert-function-results.js → execute-and-insert-function-results.cjs} +1 -1
- package/scripts/filter/before-post-render/gloria/{add-breadcrumbs-data-to-page.js → add-breadcrumbs-data-to-page.cjs} +4 -4
- package/scripts/filter/before-post-render/gloria/{prerender-admonitions.js → prerender-admonitions.cjs} +1 -1
- package/scripts/filter/before-post-render/gloria/{prerender-xml-pug-components.js → prerender-xml-pug-components.cjs} +5 -5
- package/scripts/filter/before-post-render/gloria/{render-post-render-pug-components.js → render-post-render-pug-components.cjs} +1 -1
- package/scripts/filter/before-post-render/{has-own-favicons.js → has-own-favicons.cjs} +1 -1
- package/scripts/filter/before-post-render/{infobox.js → infobox.cjs} +1 -1
- package/scripts/filter/before-post-render/{insertchangelog.js → insertchangelog.cjs} +1 -1
- package/scripts/filter/before-post-render/{replace-macros.js → replace-macros.cjs} +1 -1
- package/scripts/helper/{find-main-category-page.js → find-main-category-page.cjs} +1 -1
- package/scripts/helper/{normalize-badges.js → normalize-badges.cjs} +1 -1
- package/scripts/helper/{parse-href.js → parse-href.cjs} +1 -1
- package/scripts/helper/{u-capitalize.js → u-capitalize.cjs} +1 -1
- package/scripts/helper/{u-random-id.js → u-random-id.cjs} +1 -1
- package/scripts/helper/{u-remove-indentation.js → u-remove-indentation.cjs} +1 -1
- package/scripts/helper/{u-toc.js → u-toc.cjs} +1 -1
- package/scripts/utils/{concat-url-parts.js → concat-url-parts.cjs} +3 -3
- package/scripts/utils/{execute-and-insert-function-results.js → execute-and-insert-function-results.cjs} +7 -0
- package/scripts/utils/gloria-after-post-render/{append-copy-heading-buttons.js → append-copy-heading-buttons.cjs} +33 -16
- package/scripts/utils/{has-own-favicons.js → has-own-favicons.cjs} +6 -0
- package/scripts/utils/{inline-svg.js → inline-svg.cjs} +2 -2
- package/scripts/utils/{logcrossprojectreference.js → logcrossprojectreference.cjs} +6 -0
- package/scripts/utils/{parse-href.js → parse-href.cjs} +1 -1
- package/scripts/utils/{parseicontag.js → parseicontag.cjs} +7 -1
- package/scripts/utils/{parselinks.js → parselinks.cjs} +14 -6
- package/scripts/utils/pug-renderer/{create-prerender-pug-template.js → create-prerender-pug-template.cjs} +3 -3
- package/scripts/utils/pug-renderer/{render-pug-component.js → render-pug-component.cjs} +4 -4
- package/scripts/utils/pug-to-xml-binding/parser/{xml-components-parser.js → xml-components-parser.cjs} +2 -2
- package/scripts/utils/pug-to-xml-binding/{render-xml-pug-components-in-markdown.js → render-xml-pug-components-in-markdown.cjs} +3 -3
- package/scripts/utils/pug-to-xml-binding/{transform-xml-tree-to-pug.js → transform-xml-tree-to-pug.cjs} +1 -1
- package/scripts/utils/{spritesheet-svg.js → spritesheet-svg.cjs} +2 -2
- package/scripts/utils/{transform-markdown-admonitions.js → transform-markdown-admonitions.cjs} +1 -1
- package/src/api-builder/api-builder.js +84 -33
- package/src/api-builder/build-page-worker.js +9 -9
- package/src/api-builder/classes/description-parser.js +12 -14
- package/src/api-builder/classes/doc-data-factory.js +3 -5
- package/src/api-builder/classes/file-name-manager.js +2 -4
- package/src/api-builder/classes/html-file.js +2 -4
- package/src/api-builder/classes/navigation-tree.js +7 -9
- package/src/api-builder/classes/tree-node.js +1 -3
- package/src/api-builder/utils/findtargetdoclet.js +1 -3
- package/src/api-builder/utils/utils.js +19 -26
- package/src/data-converter/converters/jsdoc2umberto.js +2 -4
- package/src/data-converter/converters/jsduck2umberto.js +5 -7
- package/src/data-converter/converters/typedoc/abstractparser.js +3 -5
- package/src/data-converter/converters/typedoc/accessorparser.js +3 -5
- package/src/data-converter/converters/typedoc/classparser.js +3 -5
- package/src/data-converter/converters/typedoc/computedpropertyparser.js +3 -5
- package/src/data-converter/converters/typedoc/constantparser.js +3 -5
- package/src/data-converter/converters/typedoc/constructorparser.js +3 -5
- package/src/data-converter/converters/typedoc/errorparser.js +2 -4
- package/src/data-converter/converters/typedoc/eventparser.js +2 -4
- package/src/data-converter/converters/typedoc/functionparser.js +3 -5
- package/src/data-converter/converters/typedoc/interfaceparser.js +3 -5
- package/src/data-converter/converters/typedoc/methodparser.js +3 -5
- package/src/data-converter/converters/typedoc/moduleparser.js +3 -5
- package/src/data-converter/converters/typedoc/propertyparser.js +3 -5
- package/src/data-converter/converters/typedoc/referenceparser.js +3 -5
- package/src/data-converter/converters/typedoc/reflectionkind.js +24 -26
- package/src/data-converter/converters/typedoc/typedocconverter.js +3 -7
- package/src/data-converter/converters/typedoc/typeparser.js +3 -5
- package/src/data-converter/converters/typedoc2umberto.js +17 -19
- package/src/data-converter/data-collection.js +2 -5
- package/src/data-converter/data-provider.js +6 -8
- package/src/data-converter/doclet-collection.js +1 -4
- package/src/data-converter/middlewares/relation-fixer.js +3 -5
- package/src/helpers/capitalize.js +1 -3
- package/src/helpers/create-filtering-data-attribs.js +1 -3
- package/src/helpers/doc-formats.js +1 -3
- package/src/helpers/escape-longname.js +1 -3
- package/src/helpers/extract-longname.js +1 -3
- package/src/helpers/get-api-infobox-tooltip.js +3 -5
- package/src/helpers/get-docsearch-config.js +8 -6
- package/src/helpers/get-file-patterns-to-process.js +1 -3
- package/src/helpers/get-short-module-path.js +2 -4
- package/src/helpers/github-url.js +96 -103
- package/src/helpers/glob-to-regexp.js +3 -5
- package/src/helpers/html-safe.js +1 -3
- package/src/helpers/import-module.js +3 -5
- package/src/helpers/is-non-empty-array.js +1 -3
- package/src/helpers/log-with-time.js +2 -4
- package/src/helpers/resolve-path.js +5 -3
- package/src/helpers/snippets.js +50 -56
- package/src/helpers/split-longname.js +2 -4
- package/src/helpers/umberto-version.js +10 -0
- package/src/hexo/filter/extend-config.js +1 -3
- package/src/hexo/filter/project-locals.js +80 -8
- package/src/hexo/get-repo-urls.js +5 -6
- package/src/hexo/helper/get-page-group.js +1 -3
- package/src/hexo/project-globals.js +4 -6
- package/src/hexo-manager.js +12 -13
- package/src/index.js +28 -32
- package/src/sdk-builder/get-sdk-sources.js +11 -13
- package/src/sdk-builder/sdk-builder.js +11 -11
- package/src/tasks/build-api-docs.js +7 -9
- package/src/tasks/build-documentation.js +47 -36
- package/src/tasks/build-sdk.js +5 -5
- package/src/tasks/build-snippets.js +3 -5
- package/src/tasks/cache-files.js +4 -6
- package/src/tasks/compile-sass.js +8 -9
- package/src/tasks/copy-assets.js +3 -5
- package/src/tasks/copy-files.js +5 -7
- package/src/tasks/copy-project-docs.js +5 -7
- package/src/tasks/copy-project-icons.js +5 -7
- package/src/tasks/create-redirect-page.js +3 -5
- package/src/tasks/create-sitemap-index.js +3 -3
- package/src/tasks/create-sitemap-step.js +4 -4
- package/src/tasks/create-sitemap.js +6 -8
- package/src/tasks/create-sym-links.js +5 -7
- package/src/tasks/execute-hooks.js +3 -5
- package/src/tasks/get-extra-files.js +3 -5
- package/src/tasks/get-hexo-config.js +4 -4
- package/src/tasks/get-main-config.js +3 -5
- package/src/tasks/get-project-config.js +11 -8
- package/src/tasks/macro-replacer.js +1 -3
- package/src/tasks/minify-html-worker.js +5 -5
- package/src/tasks/minify-html.js +8 -10
- package/src/tasks/overwrite-api-guides.js +4 -6
- package/src/tasks/read-doc-sources.js +5 -7
- package/src/tasks/run-webpack.js +8 -6
- package/src/tasks/validate-links-collect-worker.js +6 -6
- package/src/tasks/validate-links-worker.js +6 -6
- package/src/tasks/validate-links.js +9 -11
- package/src/tasks/watcher.js +5 -7
- package/src/tasks/write-html-files.js +3 -5
- package/src/template/template-collection.js +13 -15
- package/themes/umberto/layout/gloria/_api-docs/_mixin/_api-tree-item.pug +18 -1
- package/themes/umberto/layout/gloria/_head/head.pug +5 -0
- package/themes/umberto/layout/umberto/_partial/head.pug +5 -0
- package/themes/umberto/src/gloria/css/components/_api-tree.scss +4 -0
- package/themes/umberto/src/gloria/js/app.js +32 -32
- package/themes/umberto/src/gloria/js/components/api-nav-tree.js +5 -5
- package/themes/umberto/src/gloria/js/components/api-toggle.js +2 -2
- package/themes/umberto/src/gloria/js/components/breadcrumbs.js +1 -1
- package/themes/umberto/src/gloria/js/components/code-block.js +5 -5
- package/themes/umberto/src/gloria/js/components/code-switcher.js +2 -2
- package/themes/umberto/src/gloria/js/components/dropdown.js +5 -5
- package/themes/umberto/src/gloria/js/components/expandable.js +1 -1
- package/themes/umberto/src/gloria/js/components/fake-devtools.js +4 -4
- package/themes/umberto/src/gloria/js/components/hash-link.js +2 -2
- package/themes/umberto/src/gloria/js/components/heading-link.js +2 -2
- package/themes/umberto/src/gloria/js/components/iframe.js +2 -2
- package/themes/umberto/src/gloria/js/components/mobile-overlay.js +5 -5
- package/themes/umberto/src/gloria/js/components/nav-tree.js +3 -3
- package/themes/umberto/src/gloria/js/components/tabs.js +2 -2
- package/themes/umberto/src/gloria/js/components/tooltip-popover.js +13 -13
- package/themes/umberto/src/gloria/js/helpers/animate-element.js +2 -2
- package/themes/umberto/src/gloria/js/helpers/create-anchor-positioning-watcher.js +1 -1
- package/themes/umberto/src/gloria/js/helpers/create-keyboard-focus-cycler.js +3 -3
- package/themes/umberto/src/gloria/js/helpers/focus-first-interactive.js +2 -2
- package/themes/umberto/src/gloria/js/helpers/highlight-code.js +1 -1
- package/themes/umberto/src/gloria/js/helpers/scroll-to-hash.js +1 -1
- package/themes/umberto/src/gloria/js/helpers/tween.js +2 -2
- package/themes/umberto/src/gloria/js/modules/algolia-search.js +4 -4
- package/themes/umberto/src/gloria/js/modules/api-filter.js +1 -1
- package/themes/umberto/src/gloria/js/modules/header-bar.js +4 -4
- package/themes/umberto/src/gloria/js/modules/header.js +2 -2
- package/themes/umberto/src/gloria/js/modules/links-prefetch.js +1 -1
- package/themes/umberto/src/gloria/js/modules/mobile-nav.js +7 -7
- package/themes/umberto/src/gloria/js/modules/sidebar.js +3 -3
- package/themes/umberto/src/gloria/js/modules/table-of-contents-api.js +9 -9
- package/themes/umberto/src/gloria/js/modules/table-of-contents.js +10 -10
- package/themes/umberto/src/gloria/js/public-api.js +15 -15
- package/themes/umberto/src/gloria/js/web-components/svg-icon.js +3 -3
- package/themes/umberto/src/umberto/js/_apitree.js +1 -1
- package/themes/umberto/src/umberto/js/_attachpermalinklistener.js +1 -1
- package/themes/umberto/src/umberto/js/_copymobileapinavigation.js +1 -1
- package/themes/umberto/src/umberto/js/_imageModal.js +1 -1
- package/themes/umberto/src/umberto/js/_pagenavigation.js +1 -1
- package/themes/umberto/src/umberto/js/_prism.js +1 -1
- package/themes/umberto/src/umberto/js/_samplecode.js +1 -1
- package/themes/umberto/src/umberto/js/_sidenavigation.js +1 -1
- package/themes/umberto/src/umberto/js/_toc.js +1 -1
- package/themes/umberto/src/umberto/js/_warningbanner.js +1 -1
- package/themes/umberto/src/umberto/js/app.js +19 -19
- package/src/tasks/validate-html-w3c.js +0 -35
- /package/scripts/filter/after-post-render/{basepath-replacer.js → basepath-replacer.cjs} +0 -0
- /package/scripts/filter/after-post-render/{fix-code-samples.js → fix-code-samples.cjs} +0 -0
- /package/scripts/filter/after-post-render/{gather-guides.js → gather-guides.cjs} +0 -0
- /package/scripts/filter/after-post-render/{img-linker.js → img-linker.cjs} +0 -0
- /package/scripts/filter/after-post-render/{import-guide.js → import-guide.cjs} +0 -0
- /package/scripts/filter/after-post-render/{process-variables.js → process-variables.cjs} +0 -0
- /package/scripts/filter/after-post-render/{time-end.js → time-end.cjs} +0 -0
- /package/scripts/filter/after-post-render/{time-start.js → time-start.cjs} +0 -0
- /package/scripts/filter/after-post-render/{validate-after-render.js → validate-after-render.cjs} +0 -0
- /package/scripts/filter/before-post-render/{change-output-path.js → change-output-path.cjs} +0 -0
- /package/scripts/filter/before-post-render/{set-layout.js → set-layout.cjs} +0 -0
- /package/scripts/filter/before-post-render/{validate-page-data.js → validate-page-data.cjs} +0 -0
- /package/scripts/helper/{get-pages-for-nav-tree.js → get-pages-for-nav-tree.cjs} +0 -0
- /package/scripts/helper/{mark-empty-categories.js → mark-empty-categories.cjs} +0 -0
- /package/scripts/helper/{u-extract-and-cache-title.js → u-extract-and-cache-title.cjs} +0 -0
- /package/scripts/helper/{u-split-to-title-and-content.js → u-split-to-title-and-content.cjs} +0 -0
- /package/scripts/utils/{add-indention.js → add-indention.cjs} +0 -0
- /package/scripts/utils/{capitalize.js → capitalize.cjs} +0 -0
- /package/scripts/utils/{compose.js → compose.cjs} +0 -0
- /package/scripts/utils/{decode-html-entities.js → decode-html-entities.cjs} +0 -0
- /package/scripts/utils/{drop-init-slash.js → drop-init-slash.cjs} +0 -0
- /package/scripts/utils/{drop-trailing-slash.js → drop-trailing-slash.cjs} +0 -0
- /package/scripts/utils/{drop-url-protocol.js → drop-url-protocol.cjs} +0 -0
- /package/scripts/utils/{findmaincategorypage.js → findmaincategorypage.cjs} +0 -0
- /package/scripts/utils/{getreportissuewidgeturl.js → getreportissuewidgeturl.cjs} +0 -0
- /package/scripts/utils/gloria-after-post-render/{apply-design-doc-classes.js → apply-design-doc-classes.cjs} +0 -0
- /package/scripts/utils/gloria-after-post-render/{wrap-table-into-wrappers.js → wrap-table-into-wrappers.cjs} +0 -0
- /package/scripts/utils/{insertchangelog.js → insertchangelog.cjs} +0 -0
- /package/scripts/utils/{measure-call.js → measure-call.cjs} +0 -0
- /package/scripts/utils/{normalizebadges.js → normalizebadges.cjs} +0 -0
- /package/scripts/utils/{parser-cursor.js → parser-cursor.cjs} +0 -0
- /package/scripts/utils/pug-to-xml-binding/parser/{walk-xml-tree.js → walk-xml-tree.cjs} +0 -0
- /package/scripts/utils/{random-id.js → random-id.cjs} +0 -0
- /package/scripts/utils/{remove-indentation.js → remove-indentation.cjs} +0 -0
- /package/scripts/utils/{shoulddisplaynewindicator.js → shoulddisplaynewindicator.cjs} +0 -0
- /package/scripts/utils/{toc.js → toc.cjs} +0 -0
- /package/scripts/utils/{transformcodeswitcher.js → transformcodeswitcher.cjs} +0 -0
- /package/scripts/utils/{transforminfobox.js → transforminfobox.cjs} +0 -0
- /package/scripts/utils/{uniq-by-last.js → uniq-by-last.cjs} +0 -0
|
@@ -3,35 +3,34 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
6
|
+
import upath from 'upath';
|
|
7
|
+
import { hexoManager } from '../hexo-manager.js';
|
|
8
|
+
import { getMainConfig } from './get-main-config.js';
|
|
9
|
+
import { getProjectConfig } from './get-project-config.js';
|
|
10
|
+
import { buildApiDocs as buildApi } from './build-api-docs.js';
|
|
11
|
+
import { buildSdk } from './build-sdk.js';
|
|
12
|
+
import { projectLocals as bindProjectLocals } from '../hexo/filter/project-locals.js';
|
|
13
|
+
import { projectGlobals as bindProjectGlobals } from '../hexo/project-globals.js';
|
|
14
|
+
import { copyFiles } from './copy-files.js';
|
|
15
|
+
import { copyProjectDocs } from './copy-project-docs.js';
|
|
16
|
+
import { writeHtmlFiles } from './write-html-files.js';
|
|
17
|
+
import { getExtraFiles } from './get-extra-files.js';
|
|
18
|
+
import { createRedirectPage } from './create-redirect-page.js';
|
|
19
|
+
import { cacheFiles } from './cache-files.js';
|
|
20
|
+
import { overwriteApiGuides } from './overwrite-api-guides.js';
|
|
21
|
+
import { validateLinks } from './validate-links.js';
|
|
22
|
+
import { createSitemapStep } from './create-sitemap-step.js';
|
|
23
|
+
import { buildSnippets } from './build-snippets.js';
|
|
24
|
+
import { copyProjectIcons } from './copy-project-icons.js';
|
|
25
|
+
import { executeHooks } from './execute-hooks.js';
|
|
26
|
+
import { minifyHtml } from './minify-html.js';
|
|
27
|
+
import { parseLinks } from '../../scripts/utils/parselinks.cjs';
|
|
28
|
+
import { getFilePatternsToProcess } from '../helpers/get-file-patterns-to-process.js';
|
|
29
|
+
import { logWithTime } from '../helpers/log-with-time.js';
|
|
30
|
+
import { umbertoVersion } from '../helpers/umberto-version.js';
|
|
31
|
+
|
|
32
|
+
const __dirname = import.meta.dirname;
|
|
23
33
|
const cacheDir = upath.join( __dirname, '../../temp/cache' );
|
|
24
|
-
const validateLinks = require( './validate-links' );
|
|
25
|
-
const createSitemapStep = require( './create-sitemap-step' );
|
|
26
|
-
const buildSnippets = require( './build-snippets' );
|
|
27
|
-
const copyProjectIcons = require( './copy-project-icons' );
|
|
28
|
-
const executeHooks = require( './execute-hooks' );
|
|
29
|
-
const minifyHtml = require( './minify-html' );
|
|
30
|
-
const umbertoVersion = require( '../../package.json' ).version;
|
|
31
|
-
|
|
32
|
-
const { parseLinks } = require( '../../scripts/utils/parselinks' );
|
|
33
|
-
const getFilePatternsToProcess = require( '../helpers/get-file-patterns-to-process' );
|
|
34
|
-
const logWithTime = require( '../helpers/log-with-time' );
|
|
35
34
|
|
|
36
35
|
/**
|
|
37
36
|
* Main function building the documentation.
|
|
@@ -65,7 +64,7 @@ const logWithTime = require( '../helpers/log-with-time' );
|
|
|
65
64
|
* automatically. An empty array (which is the default value) means that all guides should be processed.
|
|
66
65
|
* @returns {Promise}
|
|
67
66
|
*/
|
|
68
|
-
|
|
67
|
+
export const buildDocumentation = options => {
|
|
69
68
|
const {
|
|
70
69
|
mainConfig = getMainConfig( process.cwd() ),
|
|
71
70
|
rootPath = process.cwd(),
|
|
@@ -131,7 +130,7 @@ module.exports = options => {
|
|
|
131
130
|
} );
|
|
132
131
|
} )
|
|
133
132
|
.then( async () => {
|
|
134
|
-
const configs = await getProjectConfigs( rootPath, projectPaths, { skipLiveSnippets } );
|
|
133
|
+
const configs = await getProjectConfigs( rootPath, projectPaths, { ...mainConfig, skipLiveSnippets } );
|
|
135
134
|
|
|
136
135
|
return executeHooks( configs, 'beforeHexo' );
|
|
137
136
|
} )
|
|
@@ -143,6 +142,8 @@ module.exports = options => {
|
|
|
143
142
|
dev,
|
|
144
143
|
docSearch: mainConfig.docsearch,
|
|
145
144
|
disableSearch: mainConfig.docsearch === false,
|
|
145
|
+
shouldInjectNoIndexMeta: mainConfig.shouldInjectNoIndexMeta,
|
|
146
|
+
nonIndexableProjects: mainConfig.nonIndexableProjects || [],
|
|
146
147
|
googleoptimize: mainConfig.googleoptimize,
|
|
147
148
|
googletagmanager: mainConfig.googletagmanager,
|
|
148
149
|
googleanalytics: mainConfig.googleanalytics,
|
|
@@ -189,6 +190,7 @@ module.exports = options => {
|
|
|
189
190
|
}
|
|
190
191
|
|
|
191
192
|
const projectConfigs = await getProjectConfigs( rootPath, projectPaths, {
|
|
193
|
+
...mainConfig,
|
|
192
194
|
skipLiveSnippets
|
|
193
195
|
} );
|
|
194
196
|
const buildDir = hexoManager.getPublicDir();
|
|
@@ -232,6 +234,7 @@ module.exports = options => {
|
|
|
232
234
|
// Links validation.
|
|
233
235
|
.then( async () => {
|
|
234
236
|
const projectConfigs = await getProjectConfigs( rootPath, projectPaths, {
|
|
237
|
+
...mainConfig,
|
|
235
238
|
skipLiveSnippets
|
|
236
239
|
} );
|
|
237
240
|
|
|
@@ -263,12 +266,12 @@ module.exports = options => {
|
|
|
263
266
|
return Promise.resolve();
|
|
264
267
|
} )
|
|
265
268
|
.then( async () => {
|
|
266
|
-
const projectConfigs = await getProjectConfigs( rootPath, projectPaths, { skipLiveSnippets } );
|
|
269
|
+
const projectConfigs = await getProjectConfigs( rootPath, projectPaths, { ...mainConfig, skipLiveSnippets } );
|
|
267
270
|
|
|
268
271
|
return createSitemapStep( { projectConfigs, verbose, mainConfig } );
|
|
269
272
|
} )
|
|
270
273
|
.then( async () => {
|
|
271
|
-
const configs = await getProjectConfigs( rootPath, projectPaths, { skipLiveSnippets } );
|
|
274
|
+
const configs = await getProjectConfigs( rootPath, projectPaths, { ...mainConfig, skipLiveSnippets } );
|
|
272
275
|
|
|
273
276
|
return executeHooks( configs, 'afterHexo' );
|
|
274
277
|
} )
|
|
@@ -357,7 +360,7 @@ async function buildProjects( rootPath, projectPaths, options = {} ) {
|
|
|
357
360
|
} );
|
|
358
361
|
}
|
|
359
362
|
|
|
360
|
-
|
|
363
|
+
for ( const config of projectConfigs ) {
|
|
361
364
|
const basePath = upath.join( config.slug, config.version );
|
|
362
365
|
const extraStyles = getExtraFiles(
|
|
363
366
|
upath.join( config.projectRootPath, config.path ),
|
|
@@ -382,6 +385,7 @@ async function buildProjects( rootPath, projectPaths, options = {} ) {
|
|
|
382
385
|
bindProjectLocals( hexoManager.hexo, {
|
|
383
386
|
basePath,
|
|
384
387
|
docSearch: options.docSearch,
|
|
388
|
+
shouldInjectNoIndexMeta: config.shouldInjectNoIndexMeta,
|
|
385
389
|
config,
|
|
386
390
|
googleoptimize: options.googleoptimize,
|
|
387
391
|
googletagmanager: options.googletagmanager,
|
|
@@ -418,7 +422,7 @@ async function buildProjects( rootPath, projectPaths, options = {} ) {
|
|
|
418
422
|
title: `${ config.name } Redirection Page`,
|
|
419
423
|
url: options.dev ? `${ config.version }/` : 'latest/'
|
|
420
424
|
} ) );
|
|
421
|
-
}
|
|
425
|
+
}
|
|
422
426
|
|
|
423
427
|
return Promise.all( promises );
|
|
424
428
|
}
|
|
@@ -428,8 +432,12 @@ async function getProjectConfigs( rootPath, projectPaths, options = {} ) {
|
|
|
428
432
|
const promises = projectPaths.map( async pPath => {
|
|
429
433
|
const projectRootPath = upath.join( rootPath, pPath );
|
|
430
434
|
|
|
435
|
+
const nonIndexableProjects = options.nonIndexableProjects || [];
|
|
436
|
+
const shouldInjectNoIndexMeta = options.shouldInjectNoIndexMeta || nonIndexableProjects.includes( pPath );
|
|
437
|
+
|
|
431
438
|
return getProjectConfig( projectRootPath, {
|
|
432
|
-
skipLiveSnippets: options.skipLiveSnippets
|
|
439
|
+
skipLiveSnippets: options.skipLiveSnippets,
|
|
440
|
+
shouldInjectNoIndexMeta
|
|
433
441
|
} );
|
|
434
442
|
} );
|
|
435
443
|
|
|
@@ -491,6 +499,7 @@ async function buildApis( projectConfigs, options = {} ) {
|
|
|
491
499
|
apiType: apiConfig.type
|
|
492
500
|
},
|
|
493
501
|
disableSearch: options.disableSearch,
|
|
502
|
+
shouldInjectNoIndexMeta: config.shouldInjectNoIndexMeta,
|
|
494
503
|
googleoptimize: options.googleoptimize,
|
|
495
504
|
googletagmanager: options.googletagmanager,
|
|
496
505
|
googleanalytics: options.googleanalytics,
|
|
@@ -507,8 +516,9 @@ async function buildApis( projectConfigs, options = {} ) {
|
|
|
507
516
|
projectConfig: config,
|
|
508
517
|
canonicalUrlBeginning: getCanonicalBeginning( { config, options, hexoManager } )
|
|
509
518
|
} ).then( apiDocs => {
|
|
510
|
-
// API docs navigation tree is rendered
|
|
519
|
+
// API docs navigation tree is rendered per package and reused as HTML.
|
|
511
520
|
config.navTree = apiDocs.getNavTree();
|
|
521
|
+
config.navTreeByPackage = apiDocs.getNavTreeByPackage();
|
|
512
522
|
// API errors documentation is stored here so that it's available in guides (and hexo filters).
|
|
513
523
|
config.errorsHtml = apiDocs.getErrors();
|
|
514
524
|
hexoManager.addProjectGlobalData( config.slug, 'doclets', apiDocs.getDataCollection() );
|
|
@@ -571,6 +581,7 @@ function buildSdks( projectConfigs, options = {} ) {
|
|
|
571
581
|
extraScriptsPaths: extraScripts
|
|
572
582
|
},
|
|
573
583
|
disableSearch: options.disableSearch,
|
|
584
|
+
shouldInjectNoIndexMeta: config.shouldInjectNoIndexMeta,
|
|
574
585
|
projectsData: basicProjectsData,
|
|
575
586
|
googleoptimize: options.googleoptimize,
|
|
576
587
|
googletagmanager: options.googletagmanager,
|
package/src/tasks/build-sdk.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import upath from 'upath';
|
|
7
|
+
import { getSdkSources } from '../sdk-builder/get-sdk-sources.js';
|
|
8
|
+
import { TemplateCollection } from '../template/template-collection.js';
|
|
9
|
+
import { SdkBuilder } from '../sdk-builder/sdk-builder.js';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
export const buildSdk = config => {
|
|
12
12
|
const {
|
|
13
13
|
outputDir, // build/docs
|
|
14
14
|
themePath, // Umberto theme path
|
|
@@ -3,15 +3,13 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const { getSnippetPlaceholder, getSnippetSourcePaths } = require( '../helpers/snippets' );
|
|
6
|
+
import { getSnippetPlaceholder, getSnippetSourcePaths } from '../helpers/snippets.js';
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
9
|
* Builds snippets based on collected data from Markdown files.
|
|
12
10
|
*
|
|
13
11
|
* All data are being gathered during conversion from Markdown to HTML (by Hexo).
|
|
14
|
-
* See: `scripts/filter/after-post-render/snippets.
|
|
12
|
+
* See: `scripts/filter/after-post-render/snippets.cjs`.
|
|
15
13
|
*
|
|
16
14
|
* @param {Object} projectGlobals
|
|
17
15
|
* @param {Object} projectGlobals.common
|
|
@@ -19,7 +17,7 @@ const { getSnippetPlaceholder, getSnippetSourcePaths } = require( '../helpers/sn
|
|
|
19
17
|
* @param {Object} projectGlobals.common.snippetOptions
|
|
20
18
|
* @returns {Promise}
|
|
21
19
|
*/
|
|
22
|
-
|
|
20
|
+
export function buildSnippets( projectGlobals ) {
|
|
23
21
|
let promise = Promise.resolve();
|
|
24
22
|
let hasErrors = false;
|
|
25
23
|
|
package/src/tasks/cache-files.js
CHANGED
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const { globSync } = require( 'glob' );
|
|
10
|
-
const fs = require( 'fs-extra' );
|
|
6
|
+
import upath from 'upath';
|
|
7
|
+
import { globSync } from 'glob';
|
|
8
|
+
import fs from 'fs-extra';
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
* Caches build files so that they can be reused. Only for local (dev==true flag) build.
|
|
@@ -16,7 +14,7 @@ const fs = require( 'fs-extra' );
|
|
|
16
14
|
* @param dst
|
|
17
15
|
* @returns {boolean}
|
|
18
16
|
*/
|
|
19
|
-
|
|
17
|
+
export const cacheFiles = ( src, dst ) => {
|
|
20
18
|
const sourcePaths = globSync( upath.join( src, '**', '*' ) ).map( path => upath.normalize( path ) );
|
|
21
19
|
let result = false;
|
|
22
20
|
|
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
import * as sass from 'sass';
|
|
8
|
+
import fs from 'fs-extra';
|
|
9
|
+
import upath from 'upath';
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
const fs = require( 'fs-extra' );
|
|
10
|
-
const upath = require( 'upath' );
|
|
11
|
-
|
|
12
|
-
module.exports = ( src, dst ) => {
|
|
11
|
+
export function compileSass( src, dst ) {
|
|
13
12
|
return new Promise( ( resolve, reject ) => {
|
|
14
13
|
const options = {
|
|
15
14
|
file: src,
|
|
@@ -20,7 +19,7 @@ module.exports = ( src, dst ) => {
|
|
|
20
19
|
|
|
21
20
|
if ( themeMatch ) {
|
|
22
21
|
const [ , theme, remainingPath ] = themeMatch;
|
|
23
|
-
const filePath = upath.join(
|
|
22
|
+
const filePath = upath.join( import.meta.dirname, '../../themes/umberto/src', theme, 'css', remainingPath );
|
|
24
23
|
|
|
25
24
|
if ( fs.existsSync( filePath ) ) {
|
|
26
25
|
return done( { file: filePath } );
|
|
@@ -30,7 +29,7 @@ module.exports = ( src, dst ) => {
|
|
|
30
29
|
// In case of an import from the `node_modules` directory.
|
|
31
30
|
if ( url.startsWith( '~' ) ) {
|
|
32
31
|
// Resolve the path regarding the current working directory.
|
|
33
|
-
const absolutePath =
|
|
32
|
+
const absolutePath = fileURLToPath( import.meta.resolve( url.substr( 1 ) ) );
|
|
34
33
|
|
|
35
34
|
return fs.readFile( absolutePath, 'utf-8', ( err, data ) => {
|
|
36
35
|
if ( err ) {
|
|
@@ -72,4 +71,4 @@ module.exports = ( src, dst ) => {
|
|
|
72
71
|
} );
|
|
73
72
|
} );
|
|
74
73
|
} );
|
|
75
|
-
}
|
|
74
|
+
}
|
package/src/tasks/copy-assets.js
CHANGED
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const upath = require( 'upath' );
|
|
9
|
-
const copyFiles = require( './copy-files' );
|
|
6
|
+
import upath from 'upath';
|
|
7
|
+
import { copyFiles } from './copy-files.js';
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
* Copies umberto images to build directory.
|
|
@@ -15,7 +13,7 @@ const copyFiles = require( './copy-files' );
|
|
|
15
13
|
* @param {string} outputPath
|
|
16
14
|
* @returns {Promise}
|
|
17
15
|
*/
|
|
18
|
-
|
|
16
|
+
export const copyAssets = ( themeDir, outputPath ) => {
|
|
19
17
|
return Promise.all( [
|
|
20
18
|
copyFiles(
|
|
21
19
|
upath.join( themeDir, 'assets', '_fonts' ),
|
package/src/tasks/copy-files.js
CHANGED
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const { globSync } = require( 'glob' );
|
|
11
|
-
const globToRegexp = require( '../helpers/glob-to-regexp' );
|
|
6
|
+
import upath from 'upath';
|
|
7
|
+
import fs from 'fs-extra';
|
|
8
|
+
import { globSync } from 'glob';
|
|
9
|
+
import { globToRegexp } from '../helpers/glob-to-regexp.js';
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
12
|
* Copies src files to dst.
|
|
@@ -22,7 +20,7 @@ const globToRegexp = require( '../helpers/glob-to-regexp' );
|
|
|
22
20
|
* name of files that will be processed by Umberto.
|
|
23
21
|
* @returns {Promise}
|
|
24
22
|
*/
|
|
25
|
-
|
|
23
|
+
export const copyFiles = ( src, dst, options = {} ) => {
|
|
26
24
|
const {
|
|
27
25
|
ignored = [],
|
|
28
26
|
allOutputPaths = [],
|
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const copyDocFiles = require( './copy-files' );
|
|
11
|
-
const DOC_FORMATS = require( '../helpers/doc-formats' );
|
|
6
|
+
import upath from 'upath';
|
|
7
|
+
import { hexoManager } from '../hexo-manager.js';
|
|
8
|
+
import { copyFiles as copyDocFiles } from './copy-files.js';
|
|
9
|
+
import { docFormats as DOC_FORMATS } from '../helpers/doc-formats.js';
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
12
|
* Copies project documentation files (guides written in markdown, assets etc) to hexo source directory.
|
|
@@ -22,7 +20,7 @@ const DOC_FORMATS = require( '../helpers/doc-formats' );
|
|
|
22
20
|
* @param {Array.<String>|null} [options.additionalDocumentation]
|
|
23
21
|
* @returns {Promise}
|
|
24
22
|
*/
|
|
25
|
-
|
|
23
|
+
export const copyProjectDocs = ( rootPath, config, options ) => {
|
|
26
24
|
const {
|
|
27
25
|
globalRootPath = '',
|
|
28
26
|
additionalDocumentation = null,
|
|
@@ -3,16 +3,14 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const fs = require( 'fs-extra' );
|
|
10
|
-
const resolvePath = require( '../helpers/resolve-path' );
|
|
6
|
+
import upath from 'upath';
|
|
7
|
+
import fs from 'fs-extra';
|
|
8
|
+
import { resolvePath } from '../helpers/resolve-path.js';
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
* @returns {Promise<void>}
|
|
14
12
|
*/
|
|
15
|
-
|
|
13
|
+
export async function copyProjectIcons( projectGlobals, buildDirectory ) {
|
|
16
14
|
const availableProjects = Object.keys( projectGlobals ).filter( projectName => projectName !== 'common' );
|
|
17
15
|
|
|
18
16
|
for ( const project of availableProjects ) {
|
|
@@ -34,4 +32,4 @@ module.exports = async function copyProjectIcons( projectGlobals, buildDirectory
|
|
|
34
32
|
}
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
|
-
}
|
|
35
|
+
}
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const HtmlFile = require( '../api-builder/classes/html-file' );
|
|
9
|
-
const writeHtmlFiles = require( './write-html-files' );
|
|
6
|
+
import { HtmlFile } from '../api-builder/classes/html-file.js';
|
|
7
|
+
import { writeHtmlFiles } from './write-html-files.js';
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
* Redirection page for urls like https://docs.ckeditor.com/ckeditor5/.
|
|
@@ -17,7 +15,7 @@ const writeHtmlFiles = require( './write-html-files' );
|
|
|
17
15
|
* @param url
|
|
18
16
|
* @returns {Promise}
|
|
19
17
|
*/
|
|
20
|
-
|
|
18
|
+
export const createRedirectPage = ( {
|
|
21
19
|
destination,
|
|
22
20
|
title,
|
|
23
21
|
url
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import upath from 'upath';
|
|
7
|
+
import fs from 'node:fs/promises';
|
|
8
8
|
|
|
9
9
|
const XMLNS_STRINGS = [
|
|
10
10
|
'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"',
|
|
@@ -23,7 +23,7 @@ const XMLNS_STRINGS = [
|
|
|
23
23
|
* @param {Array.<string>} options.sitemapPaths Paths to generated sitemap files.
|
|
24
24
|
* @returns {Promise}
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
export const createSitemapIndex = ( { buildPath, hostname, sitemapPaths } ) => {
|
|
27
27
|
const sitemapPath = upath.resolve( upath.join( buildPath, 'sitemap.xml' ) );
|
|
28
28
|
const sitemapIndexContent = [
|
|
29
29
|
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import { styleText } from 'node:util';
|
|
7
|
+
import { createSitemap } from './create-sitemap.js';
|
|
8
|
+
import { createSitemapIndex } from './create-sitemap-index.js';
|
|
9
9
|
|
|
10
10
|
const BUILD_PATH = 'build/docs';
|
|
11
11
|
|
|
@@ -17,7 +17,7 @@ const BUILD_PATH = 'build/docs';
|
|
|
17
17
|
* @param {Object} options.projectConfigs
|
|
18
18
|
* @param {Object} options.verbose
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
export async function createSitemapStep( { mainConfig, projectConfigs, verbose } ) {
|
|
21
21
|
if ( mainConfig.isSingleProject ) {
|
|
22
22
|
// If available, use sitemap config from umberto-main.json.
|
|
23
23
|
// Use sitemap config from umberto.json otherwise.
|
|
@@ -3,13 +3,11 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const { URL } = require( 'node:url' );
|
|
12
|
-
const { SitemapStream, streamToPromise } = require( 'sitemap' );
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import { globSync } from 'glob';
|
|
8
|
+
import upath from 'upath';
|
|
9
|
+
import { URL } from 'node:url';
|
|
10
|
+
import { SitemapStream, streamToPromise } from 'sitemap';
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
13
|
* Creates a sitemap.xml file and saves it to build directory.
|
|
@@ -23,7 +21,7 @@ const { SitemapStream, streamToPromise } = require( 'sitemap' );
|
|
|
23
21
|
* @param {Array.<String>} options.excluded An array of urls to be excluded from the sitemap.
|
|
24
22
|
* @returns {Promise.<string>} Path to the generated sitemap.
|
|
25
23
|
*/
|
|
26
|
-
|
|
24
|
+
export const createSitemap = options => {
|
|
27
25
|
const {
|
|
28
26
|
fileName = 'sitemap.xml',
|
|
29
27
|
projectSlug,
|
|
@@ -3,14 +3,12 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import { styleText } from 'node:util';
|
|
7
|
+
import fs from 'node:fs';
|
|
8
|
+
import upath from 'upath';
|
|
9
|
+
import { getProjectConfig } from './get-project-config.js';
|
|
7
10
|
|
|
8
|
-
const
|
|
9
|
-
const fs = require( 'node:fs' );
|
|
10
|
-
const upath = require( 'upath' );
|
|
11
|
-
const getProjectConfig = require( './get-project-config' );
|
|
12
|
-
|
|
13
|
-
module.exports = async ( {
|
|
11
|
+
export const createSymLinks = async ( {
|
|
14
12
|
mainConfig,
|
|
15
13
|
rootPath,
|
|
16
14
|
isSingleProject = false
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const upath = require( 'upath' );
|
|
9
|
-
const importModule = require( '../helpers/import-module' );
|
|
6
|
+
import upath from 'upath';
|
|
7
|
+
import { importModule } from '../helpers/import-module.js';
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
* This function executes all hooks of the specified type for each config passed in the configs array.
|
|
@@ -26,7 +24,7 @@ const importModule = require( '../helpers/import-module' );
|
|
|
26
24
|
* @param {'beforeHexo'|'afterHexo'} hookName Name of a hook to execute.
|
|
27
25
|
* @returns {Promise}
|
|
28
26
|
*/
|
|
29
|
-
|
|
27
|
+
export async function executeHooks( configs, hookName ) {
|
|
30
28
|
try {
|
|
31
29
|
for ( const config of configs ) {
|
|
32
30
|
if ( !config.hooks || !config.hooks[ hookName ] ) {
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const upath = require( 'upath' );
|
|
9
|
-
const fs = require( 'fs-extra' );
|
|
6
|
+
import upath from 'upath';
|
|
7
|
+
import fs from 'fs-extra';
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
* @param rootPath
|
|
@@ -14,7 +12,7 @@ const fs = require( 'fs-extra' );
|
|
|
14
12
|
* @param {String|Array} files
|
|
15
13
|
* @returns {Array}
|
|
16
14
|
*/
|
|
17
|
-
|
|
15
|
+
export const getExtraFiles = ( rootPath, dst, files ) => {
|
|
18
16
|
const filePaths = getFilePaths( files );
|
|
19
17
|
|
|
20
18
|
return filePaths
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import upath from 'upath';
|
|
7
|
+
import fs from 'node:fs';
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
-
const fs = require( 'node:fs' );
|
|
9
|
+
const __dirname = import.meta.dirname;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Reads Umberto's hexo config file.
|
|
13
13
|
*
|
|
14
14
|
* @returns {Object}
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
export const getHexoConfig = () => {
|
|
17
17
|
const defaultConfigPath = upath.join( __dirname, '../../hexo-config.json' );
|
|
18
18
|
let defaultConfig;
|
|
19
19
|
|
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import upath from 'upath';
|
|
7
|
+
import fs from 'node:fs';
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
-
const fs = require( 'node:fs' );
|
|
10
|
-
|
|
11
|
-
module.exports = rootPath => {
|
|
9
|
+
export const getMainConfig = rootPath => {
|
|
12
10
|
const configPath = upath.join( rootPath, 'umberto-main.json' );
|
|
13
11
|
let config;
|
|
14
12
|
|
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const { globSync } = require( 'glob' );
|
|
11
|
-
const importModule = require( '../helpers/import-module' );
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import upath from 'upath';
|
|
8
|
+
import { globSync } from 'glob';
|
|
9
|
+
import { importModule } from '../helpers/import-module.js';
|
|
12
10
|
|
|
13
11
|
const cache = new Map();
|
|
14
12
|
|
|
@@ -18,9 +16,10 @@ const cache = new Map();
|
|
|
18
16
|
* @param {String} rootPath
|
|
19
17
|
* @param {Object} [options={}]
|
|
20
18
|
* @param {Boolean} [options.skipLiveSnippets=false] If set to `true`, the `snippetAdapter` module will not be added to the configuration.
|
|
19
|
+
* @param {Boolean} [options.shouldInjectNoIndexMeta] Whether the "do not index" header for bots should be included.
|
|
21
20
|
* @returns {Promise}
|
|
22
21
|
*/
|
|
23
|
-
|
|
22
|
+
export const getProjectConfig = async ( rootPath, options = {} ) => {
|
|
24
23
|
// Let's normalize the root path to fix mixed slashes and backslashes. Root path should contain only slashes.
|
|
25
24
|
rootPath = rootPath.split( /[\\/]/g ).join( '/' );
|
|
26
25
|
|
|
@@ -75,6 +74,10 @@ module.exports = async ( rootPath, options = {} ) => {
|
|
|
75
74
|
config.reportIssueWidget = {};
|
|
76
75
|
}
|
|
77
76
|
|
|
77
|
+
if ( options.shouldInjectNoIndexMeta ) {
|
|
78
|
+
config.shouldInjectNoIndexMeta = true;
|
|
79
|
+
}
|
|
80
|
+
|
|
78
81
|
// Prepare default values.
|
|
79
82
|
config.reportIssueWidget.enabled = config.reportIssueWidget.enabled || false;
|
|
80
83
|
config.reportIssueWidget.skipPages = config.reportIssueWidget.skipPages || [];
|
|
@@ -328,7 +331,7 @@ function getRepositoryUrl( rootPath ) {
|
|
|
328
331
|
*/
|
|
329
332
|
function getPackageJson( rootPath ) {
|
|
330
333
|
try {
|
|
331
|
-
return
|
|
334
|
+
return JSON.parse( fs.readFileSync( upath.join( rootPath, 'package.json' ), 'utf8' ) );
|
|
332
335
|
} catch {
|
|
333
336
|
return null;
|
|
334
337
|
}
|