mirror of
https://github.com/wavetermdev/docusaurus-og.git
synced 2026-08-05 13:46:35 -07:00
generate a minified version of team file for the specified business unit.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
"version": "0.1.1",
|
||||
"description": "Docusaurus preset for Logos documentation websites",
|
||||
"main": "lib/index.js",
|
||||
"types": "src/theme.d.ts",
|
||||
"types": "src/preset.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/acid-info/logos-docusaurus-plugins.git",
|
||||
@@ -26,12 +26,14 @@
|
||||
"@docusaurus/utils-common": "2.1.0",
|
||||
"@docusaurus/utils-validation": "2.1.0",
|
||||
"docusaurus-plugin-sass": "^0.2.2",
|
||||
"fs-extra": "^10.1.0",
|
||||
"lodash": "^4.17.21"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
"@types/lodash": "^4.14.186"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PluginOptions as SearchPluginOptions } from '@acid-info/logos-docusaurus-search-local/src'
|
||||
import { PluginOptions as SearchPluginOptions } from '@acid-info/logos-docusaurus-search-local'
|
||||
import classicPreset from '@docusaurus/preset-classic'
|
||||
import type { LoadContext, PluginConfig, Preset } from '@docusaurus/types'
|
||||
import _ from 'lodash'
|
||||
@@ -6,6 +6,7 @@ import * as path from 'path'
|
||||
import { siteConfigs } from './site-config/index'
|
||||
import { themeConfigs } from './theme-config/index'
|
||||
import { PluginOptions, ThemeNames } from './types'
|
||||
import { createCommonDataDir, createTeamFile } from './utils/data.utils'
|
||||
import { findDocInstances, validateDocPluginOptions } from './utils/docs.utils'
|
||||
|
||||
const makeSearchPluginConfig = (
|
||||
@@ -54,6 +55,9 @@ export default function logosPreset(
|
||||
|
||||
context.siteConfig.themeConfig = themeConfigs[options.businessUnit]
|
||||
|
||||
createCommonDataDir()
|
||||
createTeamFile(context, options)
|
||||
|
||||
const { plugins = [], themes = [] } = classicPreset(context, {
|
||||
docs: {
|
||||
routeBasePath: '/',
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export * from './types'
|
||||
@@ -1,4 +1,5 @@
|
||||
import { SiteConfig } from '../index'
|
||||
import { BusinessUnits } from '../types'
|
||||
import baseSiteConfig from './base'
|
||||
|
||||
export const codexSiteConfig: SiteConfig = {
|
||||
@@ -6,6 +7,9 @@ export const codexSiteConfig: SiteConfig = {
|
||||
title: 'Codex',
|
||||
tagline: 'Codex is building a Decentralized Durability Engine',
|
||||
url: 'https://codex.storage',
|
||||
customFields: {
|
||||
businessUnit: BusinessUnits.Codex,
|
||||
},
|
||||
}
|
||||
|
||||
export default codexSiteConfig
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { SiteConfig } from '../index'
|
||||
import { BusinessUnits } from '../types'
|
||||
import baseSiteConfig from './base'
|
||||
|
||||
export const wakuSiteConfig: SiteConfig = {
|
||||
@@ -7,6 +8,9 @@ export const wakuSiteConfig: SiteConfig = {
|
||||
tagline:
|
||||
'Waku is the communication layer for Web3. Decentralized communication that scales.',
|
||||
url: 'https://waku.org',
|
||||
customFields: {
|
||||
businessUnits: BusinessUnits.Waku,
|
||||
},
|
||||
}
|
||||
|
||||
export default wakuSiteConfig
|
||||
|
||||
@@ -5,4 +5,5 @@ export type PluginOptions = PresetConfig
|
||||
export type SiteConfig = Partial<Config>
|
||||
|
||||
export * from './preset'
|
||||
export * from './status'
|
||||
export * from './themes'
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
export namespace Status {
|
||||
export namespace Contacts {
|
||||
export type Contact = {
|
||||
'pref-name': string
|
||||
department: Department | null
|
||||
'photo-path': string | null
|
||||
contact: {
|
||||
email: string | null
|
||||
status: string | null
|
||||
github: string | null
|
||||
discord: string | null
|
||||
gscholar: string | null
|
||||
}
|
||||
}
|
||||
|
||||
export type Data = Record<string, Contact>
|
||||
}
|
||||
|
||||
export enum Department {
|
||||
Blockchain = 'Blockchain',
|
||||
Codex = 'Codex',
|
||||
CommsHub = 'Comms Hub',
|
||||
CommsMarketing = 'Comms/Marketing',
|
||||
DAO = 'DAO',
|
||||
Desktop = 'Desktop',
|
||||
Documentation = 'Documentation',
|
||||
EcoSystemDevelopment = 'Eco-System-Development',
|
||||
Finance = 'Finance',
|
||||
InfrastructureOps = 'Infrastructure Ops',
|
||||
Keycard = 'Keycard',
|
||||
Legal = 'Legal',
|
||||
Libp2p = 'Libp2p',
|
||||
Mobile = 'Mobile',
|
||||
Nim = 'Nim',
|
||||
PPG = 'PPG',
|
||||
PeopleOps = 'People Ops',
|
||||
ProductDesign = 'Product Design',
|
||||
ProgramLead = 'Program Lead',
|
||||
Security = 'Security',
|
||||
WakuProduct = 'Waku Product',
|
||||
WakuResearch = 'Waku Research',
|
||||
Web = 'Web',
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import type { LoadContext } from '@docusaurus/types'
|
||||
import * as fs from 'fs-extra'
|
||||
import * as path from 'path'
|
||||
import { BusinessUnits, PluginOptions, Status } from '../types'
|
||||
|
||||
const COMMON_DATA_DIR = path.join(__dirname, '../static/common/data')
|
||||
|
||||
export const createCommonDataDir = () => void fs.ensureDirSync(COMMON_DATA_DIR)
|
||||
|
||||
export const createTeamFile = (
|
||||
context: LoadContext,
|
||||
options: PluginOptions,
|
||||
) => {
|
||||
const contacts: Status.Contacts.Data = require(path.join(
|
||||
__dirname,
|
||||
'../static/common/contacts.json',
|
||||
))
|
||||
|
||||
const departments: string[] = (
|
||||
{
|
||||
[BusinessUnits.Codex]: [Status.Department.Codex],
|
||||
[BusinessUnits.Waku]: [
|
||||
Status.Department.WakuProduct,
|
||||
Status.Department.WakuResearch,
|
||||
],
|
||||
}[options.businessUnit] ?? []
|
||||
).map((dep) => dep.toLowerCase())
|
||||
|
||||
const team = Object.values(contacts).filter(
|
||||
(contact) =>
|
||||
!!contact.department &&
|
||||
departments.includes(contact.department.toLowerCase()),
|
||||
)
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(COMMON_DATA_DIR, 'team.json'),
|
||||
Buffer.from(JSON.stringify(team)),
|
||||
)
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -3074,6 +3074,13 @@
|
||||
"@types/qs" "*"
|
||||
"@types/serve-static" "*"
|
||||
|
||||
"@types/fs-extra@^9.0.13":
|
||||
version "9.0.13"
|
||||
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-9.0.13.tgz#7594fbae04fe7f1918ce8b3d213f74ff44ac1f45"
|
||||
integrity sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/hast@^2.0.0":
|
||||
version "2.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/hast/-/hast-2.3.4.tgz#8aa5ef92c117d20d974a82bdfb6a648b08c0bafc"
|
||||
|
||||
Reference in New Issue
Block a user