@storm-stack/core
Version:
A build toolkit and runtime used by Storm Software in TypeScript applications
1 lines • 8.59 kB
Source Map (JSON)
{"version":3,"sources":["../../src/commands/docs/api-reference/index.ts","../../src/commands/docs/index.ts"],"names":["docsApiReference","context","hooks","log","LogLevelLabel","TRACE","outputPath","joinPaths","options","projectRoot","existsSync","removeDirectory","createDirectory","app","typedoc","Application","bootstrapWithPlugins","plugin","theme","hideGenerator","readme","excludePrivate","gitRevision","branch","entryPoints","entry","map","file","tsconfig","exclude","raw","out","TypeDocReader","PackageJsonReader","TSConfigReader","project","convert","generateDocs","callHook","catch","error","ERROR","message","stack","Error","cause","docs"],"mappings":";;;;;;;;;;;;;AAgCA,eAAsBA,gBAAAA,CAAiBC,SAAkBC,KAAAA,EAAkB;AACzED,EAAAA,OAAAA,CAAQE,GAAAA,CACNC,mBAAAA,CAAcC,KAAAA,EACd,4EAAA,CAAA;AAIF,EAAA,MAAMC,aAAaC,mBAAAA,CACjBN,OAAAA,CAAQO,QAAQC,WAAAA,EAChB,MAAA,EACA,aACA,eAAA,CAAA;AAGF,EAAA,IAAIC,iBAAAA,CAAWJ,UAAAA,CAAAA,EAAa;AAC1B,IAAA,MAAMK,wBAAgBL,UAAAA,CAAAA;AACxB,EAAA;AAEA,EAAA,MAAMM,wBAAgBN,UAAAA,CAAAA;AAEtB,EAAA,MAAMO,GAAAA,GAAM,MAAMC,wBAAAA,CAAQC,WAAAA,CAAYC,oBAAAA,CACpC;IACEC,MAAAA,EAAQ;AACN,MAAA,yBAAA;AACA,MAAA,4BAAA;AACA,MAAA;;IAEFC,KAAAA,EAAO,aAAA;IACPC,aAAAA,EAAe,IAAA;IACfC,MAAAA,EAAQ,MAAA;IACRC,cAAAA,EAAgB,IAAA;IAChBC,WAAAA,EAAarB,OAAAA,CAAQO,QAAQe,MAAAA,IAAU,MAAA;IACvCC,WAAAA,EAAavB,OAAAA,CAAQwB,KAAAA,CAAMC,GAAAA,CAAID,CAAAA,KAAAA,KAC7BlB,mBAAAA,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NC,mBAAAA,CAAcqC,KAAAA,EACd,CAAA,uFAAA,EAA0FD,MAAME,OAAO,CAAA;EAAMF,KAAAA,CAAMG,KAAAA,IAAS,EAAA,CAAA,CAAI,CAAA;AAGlI,IAAA,MAAM,IAAIC,MACR,uFAAA,EACA;MAAEC,KAAAA,EAAOL;KAAM,CAAA;EAEnB,CAAA,CAAA;AAEA,EAAA,MAAMxC,gBAAAA,CAAiBC,SAASC,KAAAA,CAAAA;AAEhC,EAAA,MAAMA,MAAMoC,QAAAA,CAAS,eAAA,EAAiBrC,OAAAA,CAAAA,CAASsC,KAAAA,CAAM,CAACC,KAAAA,KAAAA;AACpDvC,IAAAA,OAAAA,CAAQE,GAAAA,CACNC,mBAAAA,CAAcqC,KAAAA,EACd,CAAA,0FAAA,EAA6FD,MAAME,OAAO,CAAA;EAAMF,KAAAA,CAAMG,KAAAA,IAAS,EAAA,CAAA,CAAI,CAAA;AAGrI,IAAA,MAAM,IAAIC,MACR,0FAAA,EACA;MAAEC,KAAAA,EAAOL;KAAM,CAAA;EAEnB,CAAA,CAAA;AACF;AA1BsBM,wBAAAA,CAAAA,IAAAA,EAAAA,MAAAA,CAAAA","file":"chunk-U7VT5A6F.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/storm-stack.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-stack\n Documentation: https://docs.stormsoftware.com/projects/storm-stack\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { createDirectory, removeDirectory } from \"@stryke/fs/helpers\";\nimport { existsSync } from \"@stryke/path/exists\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport typedoc from \"typedoc\";\nimport type { EngineHooks } from \"../../../types/build\";\nimport { Context } from \"../../../types/context\";\n\n/**\n * Generates API-Reference documentation for the Storm Stack project artifacts.\n *\n * @param context - The build context.\n * @param hooks - The engine hooks.\n */\nexport async function docsApiReference(context: Context, hooks: EngineHooks) {\n context.log(\n LogLevelLabel.TRACE,\n \"Writing API-Reference documentation for the Storm Stack project artifacts.\"\n );\n\n // Clean and recreate the output directories\n const outputPath = joinPaths(\n context.options.projectRoot,\n \"docs\",\n \"generated\",\n \"api-reference\"\n );\n\n if (existsSync(outputPath)) {\n await removeDirectory(outputPath);\n }\n\n await createDirectory(outputPath);\n\n const app = await typedoc.Application.bootstrapWithPlugins(\n {\n plugin: [\n \"typedoc-plugin-markdown\",\n \"typedoc-plugin-frontmatter\",\n \"@storm-stack/core/lib/typedoc\"\n ],\n theme: \"storm-stack\",\n hideGenerator: true,\n readme: \"none\",\n excludePrivate: true,\n gitRevision: context.options.branch || \"main\",\n entryPoints: context.entry.map(entry =>\n joinPaths(context.options.projectRoot, entry.file)\n ),\n tsconfig: context.options.tsconfig,\n exclude: context.tsconfig?.raw?.exclude,\n out: outputPath\n },\n [\n new typedoc.TypeDocReader(),\n new typedoc.PackageJsonReader(),\n new typedoc.TSConfigReader()\n ]\n );\n\n const project = await app.convert();\n if (project) {\n await app.generateDocs(project, outputPath);\n }\n\n await hooks.callHook(\"docs:api-reference\", context).catch((error: Error) => {\n context.log(\n LogLevelLabel.ERROR,\n `An error occured while writing the API-Reference documentation for the Storm Stack project artifacts: ${error.message} \\n${error.stack ?? \"\"}`\n );\n\n throw new Error(\n \"An error occured while writing the API-Reference documentation for the Storm Stack project artifacts\",\n {\n cause: error\n }\n );\n });\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Storm Stack\n\n This code was released as part of the Storm Stack project. Storm Stack\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/storm-stack.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/storm-stack\n Documentation: https://docs.stormsoftware.com/projects/storm-stack\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport type { EngineHooks } from \"../../types/build\";\nimport { Context } from \"../../types/context\";\nimport { docsApiReference } from \"./api-reference\";\n\n/**\n * Generates documentation for the Storm Stack project based on the provided context and hooks.\n *\n * @param context - The build context.\n * @param hooks - The engine hooks.\n */\nexport async function docs(context: Context, hooks: EngineHooks) {\n await hooks.callHook(\"docs:begin\", context).catch((error: Error) => {\n context.log(\n LogLevelLabel.ERROR,\n `An error occured while starting to generate documentation for the Storm Stack project: ${error.message} \\n${error.stack ?? \"\"}`\n );\n\n throw new Error(\n \"An error occured while starting to generate documentation for the Storm Stack project\",\n { cause: error }\n );\n });\n\n await docsApiReference(context, hooks);\n\n await hooks.callHook(\"docs:complete\", context).catch((error: Error) => {\n context.log(\n LogLevelLabel.ERROR,\n `An error occured while finishing generation of documentation for the Storm Stack project: ${error.message} \\n${error.stack ?? \"\"}`\n );\n\n throw new Error(\n \"An error occured while finishing generation of documentation for the Storm Stack project\",\n { cause: error }\n );\n });\n}\n"]}