documentation-website
Advanced tools
Comparing version 1.0.332 to 1.0.333
{ | ||
"name": "documentation-website", | ||
"version": "1.0.332", | ||
"version": "1.0.333", | ||
"description": "Declarative multilanguage documentation website generator", | ||
@@ -54,29 +54,29 @@ "keywords": [ | ||
"devDependencies": { | ||
"@aws-sdk/client-s3": "^3.637.0", | ||
"@aws-sdk/client-s3": "^3.658.1", | ||
"@babel/eslint-parser": "^7.25.1", | ||
"@babel/runtime": "^7.25.4", | ||
"@stylistic/eslint-plugin": "^2.6.4", | ||
"@babel/runtime": "^7.25.6", | ||
"@stylistic/eslint-plugin-ts": "^2.8.0", | ||
"@types/archiver": "^6.0.2", | ||
"@types/ejs": "^3.1.5", | ||
"@types/html-minifier": "^4.0.5", | ||
"@types/jquery": "^3.5.30", | ||
"@types/jquery": "^3.5.31", | ||
"@types/jsdom": "^21.1.7", | ||
"@types/marked": "^6.0.0", | ||
"@types/node": "^22.5.0", | ||
"@types/node": "^22.7.4", | ||
"@types/unzipper": "^0.10.10", | ||
"@typescript-eslint/eslint-plugin": "^8.3.0", | ||
"@typescript-eslint/parser": "^8.3.0", | ||
"@typescript-eslint/eslint-plugin": "^8.7.0", | ||
"@typescript-eslint/parser": "^8.7.0", | ||
"archiver": "^7.0.1", | ||
"clientnode": "^3.0.1178", | ||
"clientnode": "^3.0.1193", | ||
"css-loader": "^7.1.2", | ||
"cssnano": "^7.0.5", | ||
"cssnano": "^7.0.6", | ||
"default-gateway": "^7.2.2", | ||
"errorreporter": "^1.0.307", | ||
"eslint": "^9.9.1", | ||
"errorreporter": "^1.0.308", | ||
"eslint": "^9.11.1", | ||
"eslint-config-google": "^0.14.0", | ||
"eslint-plugin-jsdoc": "^50.2.2", | ||
"eslint-plugin-jsdoc": "^50.3.0", | ||
"favicons": "^7.2.0", | ||
"favicons-webpack-plugin": "^6.0.1", | ||
"highlight.js": "^11.10.0", | ||
"internationalisation": "^1.0.319", | ||
"internationalisation": "^1.0.320", | ||
"jest": "^29.7.0", | ||
@@ -86,11 +86,11 @@ "jquery": "^3.7.1", | ||
"legal-notes": "^1.0.21", | ||
"marked": "^14.1.0", | ||
"marked": "^14.1.2", | ||
"mini-css-extract-plugin": "^2.9.1", | ||
"postcss": "^8.4.41", | ||
"postcss": "^8.4.47", | ||
"postcss-fontpath": "^1.0.0", | ||
"postcss-import": "^16.1.0", | ||
"postcss-loader": "^8.1.1", | ||
"postcss-mixins": "^10.0.1", | ||
"postcss-mixins": "^11.0.2", | ||
"postcss-nested": "^6.2.0", | ||
"postcss-preset-env": "^10.0.2", | ||
"postcss-preset-env": "^10.0.5", | ||
"postcss-sprites": "^4.2.1", | ||
@@ -100,10 +100,10 @@ "postcss-url": "^10.1.3", | ||
"style-loader": "^4.0.0", | ||
"stylelint": "^16.8.2", | ||
"stylelint": "^16.9.0", | ||
"stylelint-config-standard": "^36.0.1", | ||
"typescript-eslint": "^8.3.0", | ||
"ua-parser-js": "^1.0.38", | ||
"typescript-eslint": "^8.7.0", | ||
"ua-parser-js": "^1.0.39", | ||
"unzipper": "^0.12.3", | ||
"weboptimizer": "^2.0.1498", | ||
"webpack-dev-server": "^5.0.4", | ||
"website-utilities": "^1.0.350" | ||
"weboptimizer": "^2.0.1516", | ||
"webpack-dev-server": "^5.1.0", | ||
"website-utilities": "^1.0.351" | ||
}, | ||
@@ -110,0 +110,0 @@ "engines": { |
@@ -45,12 +45,12 @@ // #!/usr/bin/env babel-node | ||
interface SCOPE_TYPE extends Mapping<unknown> { | ||
description?:string | ||
documentationWebsite?:PlainObject | ||
files?:Array<string> | ||
main?:string | ||
name:string | ||
scripts?:Mapping | ||
version:string | ||
description?: string | ||
documentationWebsite?: PlainObject | ||
files?: Array<string> | ||
main?: string | ||
name: string | ||
scripts?: Mapping | ||
version: string | ||
} | ||
const run = (command:string, options = {}):string => | ||
const run = (command: string, options = {}): string => | ||
execSync(command, {encoding: 'utf-8', shell: '/bin/bash', ...options}) | ||
@@ -90,3 +90,3 @@ | ||
const PROJECT_PAGE_COMMIT_MESSAGE = 'Update project homepage content.' | ||
let SCOPE:SCOPE_TYPE = {name: '__dummy__', version: '1.0.0'} | ||
let SCOPE: SCOPE_TYPE = {name: '__dummy__', version: '1.0.0'} | ||
// endregion | ||
@@ -99,10 +99,10 @@ // region functions | ||
*/ | ||
const stream2buffer = async (stream:Stream):Promise<Buffer> => { | ||
const stream2buffer = async (stream: Stream): Promise<Buffer> => { | ||
return new Promise<Buffer>((resolve, reject) => { | ||
const chunks:Array<Uint8Array> = [] | ||
stream.on('data', (chunk:Uint8Array) => chunks.push(chunk)) | ||
const chunks: Array<Uint8Array> = [] | ||
stream.on('data', (chunk: Uint8Array) => chunks.push(chunk)) | ||
stream.on('end', () => { | ||
resolve(Buffer.concat(chunks)) | ||
}) | ||
stream.on('error', (error:Error) => { | ||
stream.on('error', (error: Error) => { | ||
reject(error) | ||
@@ -124,6 +124,6 @@ }) | ||
const generateAndPushNewDocumentationPage = async ( | ||
temporaryDocumentationFolderPath:string, | ||
distributionBundleFilePath:null|string, | ||
hasAPIDocumentationCommand:boolean | ||
):Promise<void> => { | ||
temporaryDocumentationFolderPath: string, | ||
distributionBundleFilePath: null|string, | ||
hasAPIDocumentationCommand: boolean | ||
): Promise<void> => { | ||
console.info('Generate document website artefacts.') | ||
@@ -155,4 +155,4 @@ | ||
await new Promise<void>(( | ||
resolve:() => void, reject:(reason:Error) => void | ||
):void => { | ||
resolve: () => void, reject: (reason: Error) => void | ||
) => { | ||
createReadStream(newDistributionBundleFilePath) | ||
@@ -163,3 +163,3 @@ .pipe(Extract({path: newDistributionBundleDirectoryPath})) | ||
}) | ||
.on('error', (error:Error) => { | ||
.on('error', (error: Error) => { | ||
reject(error) | ||
@@ -180,3 +180,3 @@ }) | ||
let parameters:Mapping<unknown> = {} | ||
let parameters: Mapping<unknown> = {} | ||
for (const [key, value] of Object.entries( | ||
@@ -193,3 +193,3 @@ SCOPE.documentationWebsite || {} | ||
let apiDocumentationPath:null|string = null | ||
let apiDocumentationPath: null|string = null | ||
if (hasAPIDocumentationCommand) { | ||
@@ -216,7 +216,7 @@ apiDocumentationPath = | ||
const serializedParameters:string = | ||
const serializedParameters: string = | ||
JSON.stringify(evaluateDynamicData( | ||
BUILD_DOCUMENTATION_PAGE_CONFIGURATION, {parameters, ...SCOPE} | ||
)) | ||
const parametersFilePath:string = run('mktemp --suffix .json').trim() | ||
const parametersFilePath: string = run('mktemp --suffix .json').trim() | ||
await writeFile(parametersFilePath, serializedParameters) | ||
@@ -256,3 +256,3 @@ | ||
documentationBuildFolderPath, | ||
(file:File):Promise<false|undefined> => | ||
(file: File): Promise<false|undefined> => | ||
copyRepositoryFile(documentationBuildFolderPath, './', file) | ||
@@ -272,3 +272,3 @@ ) | ||
*/ | ||
const createDistributionBundle = async ():Promise<null|string> => { | ||
const createDistributionBundle = async (): Promise<null|string> => { | ||
if ( | ||
@@ -296,3 +296,3 @@ SCOPE.scripts && | ||
console.info('Pack to a zip archive.') | ||
const distributionBundleFilePath:string = | ||
const distributionBundleFilePath: string = | ||
run('mktemp --suffix .zip').trim() | ||
@@ -308,5 +308,5 @@ | ||
const determineFilePaths = async ( | ||
filePaths:Array<string> | ||
):Promise<Array<string>> => { | ||
let result:Array<string> = [] | ||
filePaths: Array<string> | ||
): Promise<Array<string>> => { | ||
let result: Array<string> = [] | ||
@@ -319,3 +319,3 @@ for (let filePath of filePaths) { | ||
result = result.concat(await determineFilePaths( | ||
(await readdir(filePath)).map((path:string):string => | ||
(await readdir(filePath)).map((path: string): string => | ||
resolve(filePath, path) | ||
@@ -338,13 +338,13 @@ ) | ||
const promise = new Promise<void>(( | ||
resolve:() => void, reject:(reason:Error) => void | ||
):void => { | ||
archive.on('error', (error:Error):void => { | ||
resolve: () => void, reject: (reason: Error) => void | ||
): void => { | ||
archive.on('error', (error: Error): void => { | ||
reject(error) | ||
}) | ||
archive.on('warning', (error:Error):void => { | ||
archive.on('warning', (error: Error): void => { | ||
console.warn(error) | ||
}) | ||
archive.on('progress', ({entries: {total, processed}}):void => { | ||
archive.on('progress', ({entries: {total, processed}}): void => { | ||
if (total === processed) | ||
@@ -373,3 +373,3 @@ resolve() | ||
*/ | ||
const isFileIgnored = async (filePath:string):Promise<boolean> => ( | ||
const isFileIgnored = async (filePath: string): Promise<boolean> => ( | ||
basename(filePath, extname(filePath)).startsWith('.') || | ||
@@ -391,4 +391,4 @@ basename(filePath, extname(filePath)) === 'dummyDocumentation' || | ||
const copyRepositoryFile = async ( | ||
sourcePath:string, targetPath:string, file:File | ||
):Promise<false|undefined> => { | ||
sourcePath: string, targetPath: string, file: File | ||
): Promise<false|undefined> => { | ||
if (await isFileIgnored(file.path) || basename(file.name) === 'readme.md') | ||
@@ -414,3 +414,3 @@ return false | ||
*/ | ||
const addReadme = async (file:File):Promise<false|null> => { | ||
const addReadme = async (file: File): Promise<false|null> => { | ||
if (await isFileIgnored(file.path)) | ||
@@ -438,3 +438,3 @@ return false | ||
const evaluationResult:EvaluationResult = evaluate( | ||
const evaluationResult: EvaluationResult = evaluate( | ||
`\`${API_DOCUMENTATION_PATH_SUFFIX}\``, SCOPE | ||
@@ -453,3 +453,3 @@ ) | ||
let distributionBundleFilePath:null|string = null | ||
let distributionBundleFilePath: null|string = null | ||
try { | ||
@@ -475,3 +475,3 @@ distributionBundleFilePath = await createDistributionBundle() | ||
let hasAPIDocumentationCommand:boolean = | ||
let hasAPIDocumentationCommand: boolean = | ||
Boolean(SCOPE.scripts) && | ||
@@ -489,3 +489,3 @@ Object.prototype.hasOwnProperty.call(SCOPE.scripts, 'document') | ||
const apiDocumentationDirectoryPath:string = | ||
const apiDocumentationDirectoryPath: string = | ||
resolve(API_DOCUMENTATION_PATHS[1]) | ||
@@ -501,3 +501,3 @@ if (await isDirectory(apiDocumentationDirectoryPath)) | ||
const localDocumentationWebsitePath:string = | ||
const localDocumentationWebsitePath: string = | ||
resolve(`../${basename(temporaryDocumentationFolderPath)}`) | ||
@@ -509,3 +509,3 @@ if (await isDirectory(localDocumentationWebsitePath)) { | ||
localDocumentationWebsitePath, | ||
(file:File):Promise<false|undefined> => | ||
(file: File): Promise<false|undefined> => | ||
copyRepositoryFile( | ||
@@ -519,7 +519,7 @@ localDocumentationWebsitePath, | ||
/* TODO | ||
const nodeModulesDirectoryPath:string = | ||
const nodeModulesDirectoryPath: string = | ||
resolve(localDocumentationWebsitePath, 'node_modules') | ||
if (await isDirectory(nodeModulesDirectoryPath)) { | ||
// NOTE: Not working caused by nested symlinks. | ||
const temporaryDocumentationNodeModulesDirectoryPath:string = | ||
const temporaryDocumentationNodeModulesDirectoryPath: string = | ||
resolve(temporaryDocumentationFolderPath, 'node_modules') | ||
@@ -526,0 +526,0 @@ /* |
@@ -27,3 +27,3 @@ // #!/usr/bin/env babel-node | ||
// region declaration | ||
declare const LANGUAGES:Array<string> | ||
declare const LANGUAGES: Array<string> | ||
// endregion | ||
@@ -69,3 +69,3 @@ // region plugins/classes | ||
export class Documentation extends WebsiteUtilities { | ||
static _commonOptions:DefaultOptions = { | ||
static _commonOptions: DefaultOptions = { | ||
domNodes: { | ||
@@ -116,3 +116,3 @@ aboutThisWebsiteLink: 'a[href="#about-this-website"]', | ||
options:Options = null as unknown as Options | ||
options = null as unknown as Options | ||
@@ -128,4 +128,4 @@ _activateLanguageSupport = false | ||
initialize<R = Promise<Documentation>>( | ||
options:RecursivePartial<Options> = {} | ||
):R { | ||
options: RecursivePartial<Options> = {} | ||
): R { | ||
this._activateLanguageSupport = options.activateLanguageSupport ?? true | ||
@@ -140,3 +140,3 @@ /* | ||
true, {} as Options, Documentation._commonOptions, options | ||
)).then(():Documentation => { | ||
)).then((): Documentation => { | ||
if (!( | ||
@@ -162,4 +162,4 @@ Object.prototype.hasOwnProperty.call($.global, 'location') && | ||
'click', | ||
(event:Event):void => { | ||
const hashReference:string|undefined = | ||
(event: Event) => { | ||
const hashReference: string|undefined = | ||
$(event.target as HTMLLinkElement).attr('href') | ||
@@ -182,3 +182,3 @@ if (hashReference && hashReference !== '#') | ||
this.options.section.aboutThisWebsite.fadeOutOptions.always = | ||
():void => { | ||
() => { | ||
this.$domNodes.mainSection.fadeIn( | ||
@@ -188,3 +188,3 @@ this.options.section.main.fadeInOptions | ||
} | ||
this.options.section.main.fadeOutOptions.always = ():void => { | ||
this.options.section.main.fadeOutOptions.always = () => { | ||
this.$domNodes.aboutThisWebsiteSection.fadeIn( | ||
@@ -222,3 +222,3 @@ this.options.section.aboutThisWebsite.fadeInOptions | ||
*/ | ||
async _onExamplesLoaded():Promise<void> { | ||
async _onExamplesLoaded(): Promise<void> { | ||
/* | ||
@@ -246,3 +246,3 @@ NOTE: After injecting new dom nodes we have to grab them for | ||
*/ | ||
_onSwitchSection(sectionName:string, event?:Event):void { | ||
_onSwitchSection(sectionName: string, event?: Event): void { | ||
const hashReference = `#${sectionName}` | ||
@@ -285,3 +285,3 @@ const $target = $(hashReference) | ||
*/ | ||
async _onStartUpAnimationComplete():Promise<void> { | ||
async _onStartUpAnimationComplete(): Promise<void> { | ||
/* | ||
@@ -321,3 +321,3 @@ NOTE: We reference "Internationalisation" here to make sure that | ||
*/ | ||
_generateTableOfContentsLinks():void { | ||
_generateTableOfContentsLinks(): void { | ||
if (!Object.prototype.hasOwnProperty.call( | ||
@@ -332,8 +332,8 @@ this.$domNodes, 'tableOfContent' | ||
this.$domNodes.headlines.each(( | ||
index:number, element:HTMLElement | ||
):void => { | ||
index: number, element: HTMLElement | ||
): void => { | ||
if ($(element).closest('.show-example-wrapper').length) | ||
return | ||
const newLevel:number = | ||
const newLevel: number = | ||
parseInt(element.nodeName.replace(/\D/g, '')) | ||
@@ -378,10 +378,12 @@ | ||
*/ | ||
_makeCodeEllipsis():void { | ||
_makeCodeEllipsis(): void { | ||
const lengthLimit = 89 // 79 | ||
this.$domNodes.code.each((index:number, domNode:HTMLElement):void => { | ||
const $domNode:$T = $(domNode) | ||
this.$domNodes.code.each(( | ||
index: number, domNode: HTMLElement | ||
): void => { | ||
const $domNode: $T = $(domNode) | ||
let newContent = '' | ||
const codeLines:Array<string> = $domNode.html().split('\n') | ||
const codeLines: Array<string> = $domNode.html().split('\n') | ||
@@ -394,3 +396,3 @@ let subIndex = 0 | ||
*/ | ||
const excess:number = $(`<div>${value}</div>`).text( | ||
const excess: number = $(`<div>${value}</div>`).text( | ||
).length - lengthLimit | ||
@@ -416,13 +418,13 @@ if (excess > 0) | ||
*/ | ||
_replaceExcessWithDots(content:string, excess:number):string { | ||
_replaceExcessWithDots(content: string, excess: number): string { | ||
// Add space for ending dots. | ||
excess += 3 | ||
let newContent = '' | ||
const $content:$T = $(`<wrapper>${content}</wrapper>`) | ||
const $content: $T = $(`<wrapper>${content}</wrapper>`) | ||
for (const domNode of $content.contents().get().reverse()) { | ||
const $wrapper:$T = $(domNode).wrap('<wrapper>').parent() as $T | ||
const $wrapper: $T = $(domNode).wrap('<wrapper>').parent() as $T | ||
const textContent:string = domNode.textContent || '' | ||
const textContent: string = domNode.textContent || '' | ||
let contentSnippet:string = $wrapper.html() | ||
let contentSnippet: string = $wrapper.html() | ||
if (!contentSnippet) | ||
@@ -460,10 +462,10 @@ contentSnippet = textContent | ||
*/ | ||
_showExamples():void { | ||
_showExamples(): void { | ||
this.$domNodes.parent?.find(':not(iframe)') | ||
.contents() | ||
.each((index:number, domNode:Node):void => { | ||
.each((index: number, domNode: Node): void => { | ||
if ( | ||
domNode.nodeName === this.options.showExample.domNodeName | ||
) { | ||
const match:null|RegExpMatchArray = | ||
const match: null|RegExpMatchArray = | ||
(domNode.textContent || '').match( | ||
@@ -473,5 +475,5 @@ new RegExp(this.options.showExample.pattern) | ||
if (match) { | ||
const $codeDomNode:$T<Node> = $(domNode).next() | ||
const $codeDomNode: $T<Node> = $(domNode).next() | ||
let code:string = $codeDomNode | ||
let code: string = $codeDomNode | ||
.find(this.$domNodes.codeWrapper) | ||
@@ -536,3 +538,3 @@ .text() | ||
// region handle $ extending | ||
$.Documentation = ((...parameter:Array<unknown>):unknown => | ||
$.Documentation = ((...parameter: Array<unknown>): unknown => | ||
Tools.controller(Documentation, parameter) | ||
@@ -543,7 +545,7 @@ ) as DocumentationFunction | ||
// script loading simpler. | ||
;($.global as unknown as {$documentationWebsite:JQueryStatic}) | ||
;($.global as unknown as {$documentationWebsite: JQueryStatic}) | ||
.$documentationWebsite = $ | ||
// endregion | ||
// region bootstrap | ||
$.noConflict(true)(($:JQueryStatic):void => { | ||
$.noConflict(true)(($: JQueryStatic) => { | ||
$.Documentation({ | ||
@@ -550,0 +552,0 @@ language: { |
@@ -23,3 +23,3 @@ // #!/usr/bin/env babel-node | ||
describe('Documentation', () => { | ||
let documentation:Documentation | ||
let documentation: Documentation | ||
/* | ||
@@ -35,3 +35,3 @@ NOTE: Import plugins with side effects (augmenting "$" scope / | ||
beforeAll(async ():Promise<void> => { | ||
beforeAll(async (): Promise<void> => { | ||
documentation = (await $.Documentation()) as Documentation | ||
@@ -38,0 +38,0 @@ }) |
@@ -28,7 +28,7 @@ // -*- coding: utf-8 -*- | ||
export type DocumentationFunction = | ||
((..._parameters:Array<unknown>) => unknown) & | ||
{class:typeof Documentation} | ||
((..._parameters: Array<unknown>) => unknown) & | ||
{class: typeof Documentation} | ||
declare global { | ||
interface JQueryStatic { | ||
Documentation:DocumentationFunction | ||
Documentation: DocumentationFunction | ||
} | ||
@@ -40,35 +40,35 @@ } | ||
{ | ||
aboutThisWebsiteLink:Type | ||
aboutThisWebsiteSection:Type | ||
aboutThisWebsiteLink: Type | ||
aboutThisWebsiteSection: Type | ||
codeWrapper:Type | ||
code:Type | ||
codeWrapper: Type | ||
code: Type | ||
homeLink:Type | ||
mainSection:Type | ||
homeLink: Type | ||
mainSection: Type | ||
headlines:Type | ||
tableOfContent:Type | ||
tableOfContentLinks:Type | ||
headlines: Type | ||
tableOfContent: Type | ||
tableOfContentLinks: Type | ||
} | ||
export interface DefaultOptions { | ||
domNodes:DomNodes | ||
domNodeSelectorInfix:null|string | ||
name:string | ||
onExamplesLoaded:ProcedureFunction | ||
section:{ | ||
aboutThisWebsite:{ | ||
fadeInOptions:JQuery.EffectsOptions<HTMLElement> | ||
fadeOutOptions:JQuery.EffectsOptions<HTMLElement> | ||
domNodes: DomNodes | ||
domNodeSelectorInfix: null|string | ||
name: string | ||
onExamplesLoaded: ProcedureFunction | ||
section: { | ||
aboutThisWebsite: { | ||
fadeInOptions: JQuery.EffectsOptions<HTMLElement> | ||
fadeOutOptions: JQuery.EffectsOptions<HTMLElement> | ||
} | ||
main:{ | ||
fadeInOptions:JQuery.EffectsOptions<HTMLElement> | ||
fadeOutOptions:JQuery.EffectsOptions<HTMLElement> | ||
main: { | ||
fadeInOptions: JQuery.EffectsOptions<HTMLElement> | ||
fadeOutOptions: JQuery.EffectsOptions<HTMLElement> | ||
} | ||
} | ||
showExample:{ | ||
domNodeName:string | ||
htmlWrapper:string | ||
pattern:string | ||
showExample: { | ||
domNodeName: string | ||
htmlWrapper: string | ||
pattern: string | ||
} | ||
@@ -75,0 +75,0 @@ } |
Sorry, the diff of this file is too big to display
1453469
6455