From aa372b37d2187ec6cd184fe79d6a7c6a9d92d781 Mon Sep 17 00:00:00 2001 From: Giuseppe De Franceschi Date: Tue, 19 Aug 2025 13:21:08 +0200 Subject: [PATCH] tecnopack docs4 --- docusaurus.config.js | 156 ------------------------------ docusaurus.config.ts | 190 +++++++++++++++++++++++++++++++++++++ sidebars.js => sidebars.ts | 10 +- 3 files changed, 194 insertions(+), 162 deletions(-) delete mode 100644 docusaurus.config.js create mode 100644 docusaurus.config.ts rename sidebars.js => sidebars.ts (78%) diff --git a/docusaurus.config.js b/docusaurus.config.js deleted file mode 100644 index 0dc47ea..0000000 --- a/docusaurus.config.js +++ /dev/null @@ -1,156 +0,0 @@ -// @ts-check -// `@type` JSDoc annotations allow editor autocompletion and type checking -// (when paired with `@ts-check`). -// There are various equivalent ways to declare your Docusaurus config. -// See: https://docusaurus.io/docs/api/docusaurus-config - -import { themes as prismThemes } from 'prism-react-renderer'; - -// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...) - -/** @type {import('@docusaurus/types').Config} */ -const config = { - title: 'My Site', - tagline: 'Dinosaurs are cool', - favicon: 'img/favicon.ico', - - // Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future - future: { - v4: true, // Improve compatibility with the upcoming Docusaurus v4 - }, - - // Set the production url of your site here - url: 'https://docs.pages.dffm.it', - // Set the // pathname under which ysour site is served - // For GitHub pages deployment, it is often '//' - baseUrl: '/', - - // GitHub pages deployment config. - // If you aren't using GitHub pages, you don't need these. - organizationName: 'facebook', // Usually your GitHub org/user name. - projectName: 'docusaurus', // Usually your repo name. - - onBrokenLinks: 'throw', - onBrokenMarkdownLinks: 'warn', - - // Even if you don't use internationalization, you can use this field to set - // useful metadata like html lang. For example, if your site is Chinese, you - // may want to replace "en" with "zh-Hans". - i18n: { - defaultLocale: 'en', - locales: ['en'], - }, - - presets: [ - [ - 'classic', - /** @type {import('@docusaurus/preset-classic').Options} */ - ({ - docs: { - sidebarPath: './sidebars.js', - // Please change this to your repo. - // Remove this to remove the "edit this page" links. - editUrl: - 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/', - }, - blog: { - showReadingTime: true, - feedOptions: { - type: ['rss', 'atom'], - xslt: true, - }, - // Please change this to your repo. - // Remove this to remove the "edit this page" links. - editUrl: - 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/', - // Useful options to enforce blogging best practices - onInlineTags: 'warn', - onInlineAuthors: 'warn', - onUntruncatedBlogPosts: 'warn', - }, - theme: { - customCss: './src/css/custom.css', - }, - }), - ], - ], - - themeConfig: - /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ - ({ - // Replace with your project's social card - image: 'img/docusaurus-social-card.jpg', - navbar: { - title: 'My Site', - logo: { - alt: 'My Site Logo', - src: 'img/logo.svg', - }, - items: [ - { - type: 'docSidebar', - sidebarId: 'tutorialSidebar', - position: 'left', - label: 'Tutorial', - }, - { to: '/blog', label: 'Blog', position: 'left' }, - { - href: 'https://github.com/facebook/docusaurus', - label: 'GitHub', - position: 'right', - }, - ], - }, - footer: { - style: 'dark', - links: [ - { - title: 'Docs', - items: [ - { - label: 'Tutorial', - to: '/docs', - }, - ], - }, - { - title: 'Community', - items: [ - { - label: 'Stack Overflow', - href: 'https://stackoverflow.com/questions/tagged/docusaurus', - }, - { - label: 'Discord', - href: 'https://discordapp.com/invite/docusaurus', - }, - { - label: 'X', - href: 'https://x.com/docusaurus', - }, - ], - }, - { - title: 'More', - items: [ - { - label: 'Blog', - to: '/blog', - }, - { - label: 'GitHub', - href: 'https://github.com/facebook/docusaurus', - }, - ], - }, - ], - copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`, - }, - prism: { - theme: prismThemes.github, - darkTheme: prismThemes.dracula, - }, - }), -}; - -export default config; diff --git a/docusaurus.config.ts b/docusaurus.config.ts new file mode 100644 index 0000000..98bf8c9 --- /dev/null +++ b/docusaurus.config.ts @@ -0,0 +1,190 @@ +import { themes as prismThemes } from "prism-react-renderer"; +import type { Config } from "@docusaurus/types"; +import type * as Preset from "@docusaurus/preset-classic"; + +// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...) + +const config: Config = { + title: "TP-Docs", + tagline: "Your Source of Truth for Engineering Docs", + favicon: "img/favicon.png", + + // Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future + future: { + v4: true, // Improve compatibility with the upcoming Docusaurus v4 + }, + + // Set the production url of your site here + url: "https://docs.gitlab.tecnopackspa.it/", + // Set the // pathname under which your site is served + // For GitHub pages deployment, it is often '//' + baseUrl: "/", + + // GitHub pages deployment config. + // If you aren't using GitHub pages, you don't need these. + organizationName: "marco.costalunga", // Usually your GitHub org/user name. + projectName: "tp-docs", // Usually your repo name. + + onBrokenLinks: "throw", + onBrokenMarkdownLinks: "warn", + + // Even if you don't use internationalization, you can use this field to set + // useful metadata like html lang. For example, if your site is Chinese, you + // may want to replace "en" with "zh-Hans". + i18n: { + defaultLocale: "it", + locales: ["it"], + }, + + presets: [ + [ + "classic", + { + docs: { + sidebarPath: "./sidebars.ts", + // Please change this to your repo. + // Remove this to remove the "edit this page" links. + editUrl: + "https://gitlab.tecnopackspa.it/tp-docs/tp-docs/-/edit/master/", + }, + blog: { + showReadingTime: true, + feedOptions: { + type: ['rss', 'atom'], + xslt: true, + }, + // Please change this to your repo. + // Remove this to remove the "edit this page" links. + editUrl: + 'https://gitlab.tecnopackspa.it/tp-docs/tp-docs/-/edit/master/', + // Useful options to enforce blogging best practices + onInlineTags: 'warn', + onInlineAuthors: 'warn', + onUntruncatedBlogPosts: 'warn', + }, + theme: { + customCss: "./src/css/custom.css", + }, + } satisfies Preset.Options, + ], + ], + + themes: [ + [ + require.resolve("@easyops-cn/docusaurus-search-local"), + { + hashed: true, + language: ["it"], + }, + ], + ], + + plugins: [ + [ + "@docusaurus/plugin-pwa", + { + debug: true, + offlineModeActivationStrategies: [ + "appInstalled", + "standalone", + "queryString", + ], + pwaHead: [ + { + tagName: "link", + rel: "icon", + href: "/img/favicon.png", + }, + { + tagName: "link", + rel: "manifest", + href: "/manifest.json", // your PWA manifest + }, + { + tagName: "meta", + name: "theme-color", + content: "rgb(37, 194, 160)", + }, + ], + }, + ], + ], + + themeConfig: { + // Replace with your project's social card + image: "img/docusaurus-social-card.jpg", + navbar: { + title: "TP-Docs", + logo: { + alt: "My Site Logo", + src: "img/favicon.png", + }, + items: [ + { + type: "docSidebar", + sidebarId: "docSidebar", + position: "left", + label: "Documentazione", + }, //, + {to: '/blog', label: 'Blog', position: 'left'}, + /*{ + href: 'https://github.com/facebook/docusaurus', + label: 'GitHub', + position: 'right', + },*/ + ], + }, + footer: { + style: "dark", + links: [ + /*{ + title: 'Docs', + items: [ + { + label: 'Tutorial', + to: '/docs/intro', + }, + ], + }, + { + title: 'Community', + items: [ + { + label: 'Stack Overflow', + href: 'https://stackoverflow.com/questions/tagged/docusaurus', + }, + { + label: 'Discord', + href: 'https://discordapp.com/invite/docusaurus', + }, + { + label: 'X', + href: 'https://x.com/docusaurus', + }, + ], + }, + { + title: 'More', + items: [ + { + label: 'Blog', + to: '/blog', + }, + { + label: 'GitHub', + href: 'https://github.com/facebook/docusaurus', + }, + ], + },*/ + ], + copyright: `Copyright © ${new Date().getFullYear()} Tecno Pack SPA. Built with Docusaurus.`, + }, + prism: { + theme: prismThemes.github, + darkTheme: prismThemes.vsDark, + additionalLanguages: ['yaml', 'csharp', 'iecst', 'bash'] + }, + } satisfies Preset.ThemeConfig, +}; + +export default config; diff --git a/sidebars.js b/sidebars.ts similarity index 78% rename from sidebars.js rename to sidebars.ts index f77355c..8f697be 100644 --- a/sidebars.js +++ b/sidebars.ts @@ -1,4 +1,4 @@ -// @ts-check +import type { SidebarsConfig } from '@docusaurus/plugin-content-docs'; // This runs in Node.js - Don't use client-side code here (browser APIs, JSX...) @@ -11,12 +11,10 @@ The sidebars can be generated from the filesystem, or explicitly defined here. Create as many sidebars as you want. - - @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ -const sidebars = { +const sidebars: SidebarsConfig = { // By default, Docusaurus generates a sidebar from the docs folder structure - tutorialSidebar: [{type: 'autogenerated', dirName: '.'}], + docSidebar: [{ type: 'autogenerated', dirName: '.' }], // But you can create a sidebar manually /* @@ -32,4 +30,4 @@ const sidebars = { */ }; -export default sidebars; +export default sidebars; \ No newline at end of file