diff --git a/assets/favicon.ico b/assets/favicon.ico new file mode 100644 index 0000000..8276955 Binary files /dev/null and b/assets/favicon.ico differ diff --git a/scripts/html/doc-kit.config.mjs b/scripts/html/doc-kit.config.mjs index 1a366f9..f73862c 100644 --- a/scripts/html/doc-kit.config.mjs +++ b/scripts/html/doc-kit.config.mjs @@ -11,6 +11,9 @@ const MAJOR_VERSION = VERSION ? `v${major(VERSION)}.x` : undefined; const inputDir = VERSION ? `./pages/api/${MAJOR_VERSION}` : './pages'; +const Webpack_Description = + 'Webpack is the build tool for modern web applications run on NodeJS. Webpack is a module bundler and its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset. '; + /** * Configuration for @node-core/doc-kit when generating webpack API docs. * @@ -39,6 +42,16 @@ export default { project: 'webpack', useAbsoluteURLs: true, remoteConfigUrl: null, + title: VERSION ? `Webpack ${MAJOR_VERSION} Documentation` : 'Webpack', + head: { + meta: [{ name: 'description', content: Webpack_Description }], + links: [ + { + rel: 'icon', + href: '/assets/favicon.ico', + }, + ], + }, imports: { '#theme/local/site': join(ROOT, inputDir, 'site.json'), diff --git a/scripts/html/index.mjs b/scripts/html/index.mjs index 8b882e5..e094fa6 100644 --- a/scripts/html/index.mjs +++ b/scripts/html/index.mjs @@ -1,7 +1,14 @@ import { execFile } from 'node:child_process'; -import { readFile } from 'node:fs/promises'; +import { readFile, cp, writeFile } from 'node:fs/promises'; +import { dirname, join } from 'node:path'; +import { fileURLToPath } from 'node:url'; import { promisify } from 'node:util'; +const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..'); + +const ASSETS_SOURCE = join(ROOT, 'assets'); +const ASSETS_DESTINATION = join(ROOT, 'out/assets'); + const execFileAsync = promisify(execFile); const runDocKit = version => @@ -35,3 +42,22 @@ for (const version of versions) { await runDocKit(version); } await runDocKit(); + +// copy assets folder to the out directory + +await cp(ASSETS_SOURCE, ASSETS_DESTINATION, { recursive: true }); + +// title clean up for non api pages: (|Webpack --> Webpack) + +const indexPath = join(ROOT, 'out/index.html'); + +let htmlContent = await readFile(indexPath, 'utf-8'); + +htmlContent = htmlContent.replace( + '