@shell-shock/core 0.14.1 → 0.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/docs.cjs +25 -10
- package/dist/components/docs.cjs.map +1 -1
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts.map +1 -1
- package/dist/components/docs.mjs +25 -10
- package/dist/components/docs.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ This package is part of the ⚡<b>Shell Shock</b> monorepo. The Shell Shock pack
|
|
|
27
27
|
|
|
28
28
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
29
29
|
|
|
30
|
-
[](https://stormsoftware.com/projects/shell-shock/) [](http://commitizen.github.io/cz-cli/)  
|
|
31
31
|
|
|
32
32
|
<!-- prettier-ignore-start -->
|
|
33
33
|
<!-- markdownlint-disable -->
|
package/dist/components/docs.cjs
CHANGED
|
@@ -6,6 +6,7 @@ const require_context_helpers = require('../plugin-utils/context-helpers.cjs');
|
|
|
6
6
|
const require_reflect = require('../plugin-utils/reflect.cjs');
|
|
7
7
|
const require_components_usage = require('./usage.cjs');
|
|
8
8
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
9
|
+
let defu = require("defu");
|
|
9
10
|
let _alloy_js_core = require("@alloy-js/core");
|
|
10
11
|
let _alloy_js_markdown = require("@alloy-js/markdown");
|
|
11
12
|
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
@@ -113,7 +114,7 @@ function CommandDocs(props) {
|
|
|
113
114
|
* Generates the markdown documentation file for a command.
|
|
114
115
|
*/
|
|
115
116
|
function CommandDocsFile(props) {
|
|
116
|
-
const { levelOffset = 0, command, ...rest } = props;
|
|
117
|
+
const { levelOffset = 0, command, frontMatter, ...rest } = props;
|
|
117
118
|
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
118
119
|
const usageExamples = (0, _alloy_js_core.memo)(() => [
|
|
119
120
|
"npm",
|
|
@@ -126,15 +127,29 @@ function CommandDocsFile(props) {
|
|
|
126
127
|
get children() {
|
|
127
128
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_markdown_components_markdown_file.MarkdownFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({ get path() {
|
|
128
129
|
return (0, _stryke_path_join.joinPaths)(require_docs_helpers.getDocsOutputPath(context), `${command.path}.md`);
|
|
129
|
-
} }, rest, {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
} }, rest, {
|
|
131
|
+
get frontMatter() {
|
|
132
|
+
return (0, defu.defu)(frontMatter ?? {}, {
|
|
133
|
+
id: command.id,
|
|
134
|
+
name: command.name,
|
|
135
|
+
path: command.path,
|
|
136
|
+
reference: command.reference,
|
|
137
|
+
isVirtual: command.isVirtual,
|
|
138
|
+
title: command.title,
|
|
139
|
+
description: command.description,
|
|
140
|
+
tags: command.tags
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
get children() {
|
|
144
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(CommandDocs, {
|
|
145
|
+
levelOffset,
|
|
146
|
+
command,
|
|
147
|
+
get usageExamples() {
|
|
148
|
+
return usageExamples();
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}));
|
|
138
153
|
}
|
|
139
154
|
});
|
|
140
155
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.cjs","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\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/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, memo, Show } from \"@alloy-js/core\";\nimport { Heading } from \"@alloy-js/markdown\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { MarkdownFileProps } from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownFile } from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownTable } from \"@powerlines/plugin-alloy/markdown/components/markdown-table\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { CommandContext } from \"../contexts/command\";\nimport { getDocsOutputPath } from \"../helpers/docs-helpers\";\nimport { getAppBin } from \"../plugin-utils/context-helpers\";\nimport { sortOptions } from \"../plugin-utils/reflect\";\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport { Usage } from \"./usage\";\n\nexport interface CommandOptionsDocsProps {\n /**\n * The command to generate options documentation for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the options markdown documentation for a command.\n */\nexport function CommandOptionsDocs(props: CommandOptionsDocsProps) {\n const { command } = props;\n if (Object.keys(command.options).length === 0) {\n return code`This command does not have any options.`;\n }\n\n return (\n <MarkdownTable\n data={sortOptions(Object.values(command.options)).map(option => {\n return {\n name: option.name.trim(),\n description: option.description.trim(),\n defaultValue: option.default\n ? String(option.default)?.includes('\"')\n ? option.default\n : `\\`${option.default}\\``\n : \"\",\n required: option.optional || option.default ? \"\" : \"✔\"\n };\n })}\n />\n );\n}\n\nexport interface CommandDocsUsageExampleProps {\n /**\n * The package manager to generate the usage example for.\n *\n * @remarks\n * If not specified, examples for all supported package managers will be generated.\n *\n * @defaultValue \"npm\"\n */\n packageManager?: \"npm\" | \"yarn\" | \"pnpm\" | \"bun\";\n\n /**\n * The command to generate the usage example for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the markdown documentation for a command.\n */\nexport function CommandDocsUsageExample(props: CommandDocsUsageExampleProps) {\n const { packageManager = \"npm\", command } = props;\n\n const context = usePowerlines<Context>();\n\n return (\n <>\n <hbr />\n {code`\\`\\`\\`bash `}\n <hbr />\n <Usage\n command={command}\n bin={getAppBin(context)}\n packageManager={packageManager}\n />\n <hbr />\n {code`\\`\\`\\``}\n <hbr />\n </>\n );\n}\n\nexport interface CommandDocsProps {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n /**\n * The command to generate options documentation for.\n */\n command: CommandTree;\n\n /**\n * Optional usage examples to include in the documentation.\n *\n * @defaultValue `[\"npm\"]`\n */\n usageExamples?: Required<CommandDocsUsageExampleProps>[\"packageManager\"][];\n}\n\n/**\n * Generates the markdown documentation for a command.\n */\nexport function CommandDocs(props: CommandDocsProps) {\n const { levelOffset = 0, command, usageExamples } = props;\n\n return (\n <>\n <Heading level={1 + levelOffset}>{command.title}</Heading>\n <Spacing />\n {code`${command.description}`}\n <Spacing />\n <Heading level={2 + levelOffset}>Usage</Heading>\n <Spacing />\n {code`The ${command.name} command can be executed using the following syntax: `}\n <Spacing />\n <Show\n when={usageExamples && usageExamples.length > 0}\n fallback={\n <CommandDocsUsageExample packageManager=\"npm\" command={command} />\n }>\n <For each={usageExamples!} hardline>\n {packageManager => (\n <CommandDocsUsageExample\n packageManager={packageManager}\n command={command}\n />\n )}\n </For>\n </Show>\n <Spacing />\n <Heading level={2 + levelOffset}>Options</Heading>\n <Spacing />\n {code`The following options are available for the ${\n command.name\n } command:`}\n <Spacing />\n <CommandOptionsDocs command={command} />\n <Spacing />\n </>\n );\n}\n\nexport interface CommandDocsFileProps extends Partial<MarkdownFileProps> {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n /**\n * The command to generate documentation for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the markdown documentation file for a command.\n */\nexport function CommandDocsFile(props: CommandDocsFileProps) {\n const { levelOffset = 0, command, ...rest } = props;\n\n const context = usePowerlines<Context>();\n const usageExamples = memo(\n () => [\"npm\", \"yarn\", \"pnpm\", \"bun\"] as CommandDocsProps[\"usageExamples\"]\n );\n\n return (\n <CommandContext.Provider value={command}>\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context), `${command.path}.md`)}\n {...rest}>\n <CommandDocs\n levelOffset={levelOffset}\n command={command}\n usageExamples={usageExamples()}\n />\n </MarkdownFile>\n </CommandContext.Provider>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"docs.cjs","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\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/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, memo, Show } from \"@alloy-js/core\";\nimport { Heading } from \"@alloy-js/markdown\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { MarkdownFileProps } from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownFile } from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownTable } from \"@powerlines/plugin-alloy/markdown/components/markdown-table\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { defu } from \"defu\";\nimport { CommandContext } from \"../contexts/command\";\nimport { getDocsOutputPath } from \"../helpers/docs-helpers\";\nimport { getAppBin } from \"../plugin-utils/context-helpers\";\nimport { sortOptions } from \"../plugin-utils/reflect\";\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport { Usage } from \"./usage\";\n\nexport interface CommandOptionsDocsProps {\n /**\n * The command to generate options documentation for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the options markdown documentation for a command.\n */\nexport function CommandOptionsDocs(props: CommandOptionsDocsProps) {\n const { command } = props;\n if (Object.keys(command.options).length === 0) {\n return code`This command does not have any options.`;\n }\n\n return (\n <MarkdownTable\n data={sortOptions(Object.values(command.options)).map(option => {\n return {\n name: option.name.trim(),\n description: option.description.trim(),\n defaultValue: option.default\n ? String(option.default)?.includes('\"')\n ? option.default\n : `\\`${option.default}\\``\n : \"\",\n required: option.optional || option.default ? \"\" : \"✔\"\n };\n })}\n />\n );\n}\n\nexport interface CommandDocsUsageExampleProps {\n /**\n * The package manager to generate the usage example for.\n *\n * @remarks\n * If not specified, examples for all supported package managers will be generated.\n *\n * @defaultValue \"npm\"\n */\n packageManager?: \"npm\" | \"yarn\" | \"pnpm\" | \"bun\";\n\n /**\n * The command to generate the usage example for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the markdown documentation for a command.\n */\nexport function CommandDocsUsageExample(props: CommandDocsUsageExampleProps) {\n const { packageManager = \"npm\", command } = props;\n\n const context = usePowerlines<Context>();\n\n return (\n <>\n <hbr />\n {code`\\`\\`\\`bash `}\n <hbr />\n <Usage\n command={command}\n bin={getAppBin(context)}\n packageManager={packageManager}\n />\n <hbr />\n {code`\\`\\`\\``}\n <hbr />\n </>\n );\n}\n\nexport interface CommandDocsProps {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n /**\n * The command to generate options documentation for.\n */\n command: CommandTree;\n\n /**\n * Optional usage examples to include in the documentation.\n *\n * @defaultValue `[\"npm\"]`\n */\n usageExamples?: Required<CommandDocsUsageExampleProps>[\"packageManager\"][];\n}\n\n/**\n * Generates the markdown documentation for a command.\n */\nexport function CommandDocs(props: CommandDocsProps) {\n const { levelOffset = 0, command, usageExamples } = props;\n\n return (\n <>\n <Heading level={1 + levelOffset}>{command.title}</Heading>\n <Spacing />\n {code`${command.description}`}\n <Spacing />\n <Heading level={2 + levelOffset}>Usage</Heading>\n <Spacing />\n {code`The ${command.name} command can be executed using the following syntax: `}\n <Spacing />\n <Show\n when={usageExamples && usageExamples.length > 0}\n fallback={\n <CommandDocsUsageExample packageManager=\"npm\" command={command} />\n }>\n <For each={usageExamples!} hardline>\n {packageManager => (\n <CommandDocsUsageExample\n packageManager={packageManager}\n command={command}\n />\n )}\n </For>\n </Show>\n <Spacing />\n <Heading level={2 + levelOffset}>Options</Heading>\n <Spacing />\n {code`The following options are available for the ${\n command.name\n } command:`}\n <Spacing />\n <CommandOptionsDocs command={command} />\n <Spacing />\n </>\n );\n}\n\nexport interface CommandDocsFileProps extends Partial<MarkdownFileProps> {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n /**\n * The command to generate documentation for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the markdown documentation file for a command.\n */\nexport function CommandDocsFile(props: CommandDocsFileProps) {\n const { levelOffset = 0, command, frontMatter, ...rest } = props;\n\n const context = usePowerlines<Context>();\n const usageExamples = memo(\n () => [\"npm\", \"yarn\", \"pnpm\", \"bun\"] as CommandDocsProps[\"usageExamples\"]\n );\n\n return (\n <CommandContext.Provider value={command}>\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context), `${command.path}.md`)}\n {...rest}\n frontMatter={defu(frontMatter ?? {}, {\n id: command.id,\n name: command.name,\n path: command.path,\n reference: command.reference,\n isVirtual: command.isVirtual,\n title: command.title,\n description: command.description,\n tags: command.tags\n })}>\n <CommandDocs\n levelOffset={levelOffset}\n command={command}\n usageExamples={usageExamples()}\n />\n </MarkdownFile>\n </CommandContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,mBAAmB,OAAgC;CACjE,MAAM,EACJ,YACA;AACF,KAAA,OAAA,KAAA,QAAA,QAAA,CAAA,WAAA;AAGA,wDAAG,2EAAA,EACD,IAAE,OAAM;AACN,SAAE,4BAAO,OAAA,OAAA,QAAA,QAAA,CAAA,CAAA,KAAA,WAAA;AACP,UAAO;IACL,MAAA,OAAa,KAAA,MAAO;IACpB,aAAa,OAAO,YAAC,MAAA;IACrB,cAAW,OAAO,UAAU,OAAU,OAAE,QAAA,EAAA,SAAA,KAAA,GAAA,OAAA,UAAA,KAAA,OAAA,QAAA,MAAA;IACxC,UAAM,OAAO,YAAA,OAAA,UAAA,KAAA;IACd;IACD;IAEL,CAAC;;;;;;CAuBF,MAAA,EACC,iBAAc,OACf,YACI;CACJ,MAAM,6EAAkC;;;;;;GAElC;;AAEN,WAAO,kCAAA,QAAA;;GAEG;GACT,CAAC;kDAAoB,OAAA,EAAA,CAAA;EAAA,mBAAA;kDAAA,OAAA,EAAA,CAAA;EAAA;;;;;;CA8BtB,MAAE,EACA,cAAU,GACX,SACC,kBACA;AACF,QAAA;kDAAyB,4BAAA;GAC3B,OAAA,IAAA;;AAEE,WAAA,QAAA;;GAEA,CAAA;kDAAA,0DAAA,EAAA,CAAA;6CAAA,mBAAA,GAAA,QAAA,cAAA;kDAAA,0DAAA,EAAA,CAAA;kDAAA,4BAAA;GACF,OAAO,IAAQ;GACb,UAAQ;;;;;;GAER,IAAM,OAAC;AACJ,WAAA,iBAAA,cAAA,SAAA;;GAED,IAAG,WAAS;AACV,2DAAgB,yBAAa;KAC5B,gBAAS;KACD;KACR,CAAA;;GAEH,IAAG,WAAS;AACV,2DAAC,oBAAA;KACC,MAAM;KACN,UAAS;KACT,WAAG,mEAA2C,yBAAqB;MAClE;MACU;MACV,CAAC;KACH,CAAC;;GAEL,CAAC;kDAAmB,0DAAO,EAAA,CAAA;kDAAA,4BAAA;GAC1B,OAAO,IAAE;GACT,UAAO;GACR,CAAC;kDAAS,0DAAA,EAAA,CAAA;6CAAA,mBAAA,+CAAA,QAAA,KAAA,WAAA;kDAAA,0DAAA,EAAA,CAAA;kDAAA,oBAAA,EACD,SACT,CAAC;kDAAY,0DAAA,EAAA,CAAA;EAAA;;;;;AAsBhB,SAAgB,gBAAM,OAAA;SAElB,cAAA,GACA,SACA,aACF,GAAA,SACF;;CAEE,MAAA,+CAAA;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA;AACA,wDAAwB,wCAAc,UAAW;EACjD,OAAA;EACF,IAAO,WAAS;AACd,0DAAyB,oHAA+B;AAElD,4CAAU,uCAAwB,QAAA,EAAA,GAAA,QAAA,KAAA,KAAA;MAEnC,EAAE,MAAM;IACZ,IAAA,cAAA;;MAEM,IAAA,QAAA;MACJ,MAAA,QAAe;MACb,MAAA,QAAA;MACK,WAAW,QAAC;MACZ,WAAI,QAAA;MACR,OAAW,QAAO;MACd,aAAY,QAAA;MACd,MAAM,QAAQ;MACd,CAAA;;IAEF,IAAE,WAAW;AACX,4DAAoB,aAAA;MACP;MACP;MACL,IAAA,gBAAA;AACF,cAAA,eAAA;;MAEC,CAAA;;IAEH,CAAC,CAAC;;EAEN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.cts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"docs.d.cts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;;;UAmCiB,uBAAA;;;AAAjB;EAIE,OAAA,EAAS,WAAA;AAAA;;;AAMX;iBAAgB,kBAAA,CAAmB,KAAA,EAAO,uBAAA,GAAuB,iBAAA,CAAA,QAAA;AAAA,UAwBhD,4BAAA;EAxBgD;;;;;;AAwBjE;;EASE,cAAA;EAKoB;;;EAApB,OAAA,EAAS,WAAA;AAAA;;AAMX;;iBAAgB,uBAAA,CAAwB,KAAA,EAAO,4BAAA,GAA4B,iBAAA,CAAA,QAAA;AAAA,UAsB1D,gBAAA;EAtB8B;;;;;AAsB/C;;;EASE,WAAA;EAYyB;;;EAPzB,OAAA,EAAS,WAAA;EALT;;;;;EAYA,aAAA,GAAgB,QAAA,CAAS,4BAAA;AAAA;;AAM3B;;iBAAgB,WAAA,CAAY,KAAA,EAAO,gBAAA,GAAgB,iBAAA,CAAA,QAAA;AAAA,UAwClC,oBAAA,SAA6B,OAAA,CAAQ,iBAAA;EAxCnB;;;;;AAwCnC;;;EASE,WAAA;EAKS;;;EAAT,OAAA,EAAS,WAAA;AAAA;;;;iBAMK,eAAA,CAAgB,KAAA,EAAO,oBAAA,GAAoB,iBAAA,CAAA,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.mts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"docs.d.mts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;;;UAmCiB,uBAAA;;;AAAjB;EAIE,OAAA,EAAS,WAAA;AAAA;;;AAMX;iBAAgB,kBAAA,CAAmB,KAAA,EAAO,uBAAA,GAAuB,iBAAA,CAAA,QAAA;AAAA,UAwBhD,4BAAA;EAxBgD;;;;;;AAwBjE;;EASE,cAAA;EAKoB;;;EAApB,OAAA,EAAS,WAAA;AAAA;;AAMX;;iBAAgB,uBAAA,CAAwB,KAAA,EAAO,4BAAA,GAA4B,iBAAA,CAAA,QAAA;AAAA,UAsB1D,gBAAA;EAtB8B;;;;;AAsB/C;;;EASE,WAAA;EAYyB;;;EAPzB,OAAA,EAAS,WAAA;EALT;;;;;EAYA,aAAA,GAAgB,QAAA,CAAS,4BAAA;AAAA;;AAM3B;;iBAAgB,WAAA,CAAY,KAAA,EAAO,gBAAA,GAAgB,iBAAA,CAAA,QAAA;AAAA,UAwClC,oBAAA,SAA6B,OAAA,CAAQ,iBAAA;EAxCnB;;;;;AAwCnC;;;EASE,WAAA;EAKS;;;EAAT,OAAA,EAAS,WAAA;AAAA;;;;iBAMK,eAAA,CAAgB,KAAA,EAAO,oBAAA,GAAoB,iBAAA,CAAA,QAAA"}
|
package/dist/components/docs.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { getAppBin } from "../plugin-utils/context-helpers.mjs";
|
|
|
4
4
|
import { sortOptions } from "../plugin-utils/reflect.mjs";
|
|
5
5
|
import { Usage } from "./usage.mjs";
|
|
6
6
|
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
7
|
+
import { defu } from "defu";
|
|
7
8
|
import { For, Show, code, memo as memo$1 } from "@alloy-js/core";
|
|
8
9
|
import { Heading } from "@alloy-js/markdown";
|
|
9
10
|
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
@@ -111,7 +112,7 @@ function CommandDocs(props) {
|
|
|
111
112
|
* Generates the markdown documentation file for a command.
|
|
112
113
|
*/
|
|
113
114
|
function CommandDocsFile(props) {
|
|
114
|
-
const { levelOffset = 0, command, ...rest } = props;
|
|
115
|
+
const { levelOffset = 0, command, frontMatter, ...rest } = props;
|
|
115
116
|
const context = usePowerlines();
|
|
116
117
|
const usageExamples = memo$1(() => [
|
|
117
118
|
"npm",
|
|
@@ -124,15 +125,29 @@ function CommandDocsFile(props) {
|
|
|
124
125
|
get children() {
|
|
125
126
|
return createComponent(MarkdownFile, mergeProps({ get path() {
|
|
126
127
|
return joinPaths(getDocsOutputPath(context), `${command.path}.md`);
|
|
127
|
-
} }, rest, {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
128
|
+
} }, rest, {
|
|
129
|
+
get frontMatter() {
|
|
130
|
+
return defu(frontMatter ?? {}, {
|
|
131
|
+
id: command.id,
|
|
132
|
+
name: command.name,
|
|
133
|
+
path: command.path,
|
|
134
|
+
reference: command.reference,
|
|
135
|
+
isVirtual: command.isVirtual,
|
|
136
|
+
title: command.title,
|
|
137
|
+
description: command.description,
|
|
138
|
+
tags: command.tags
|
|
139
|
+
});
|
|
140
|
+
},
|
|
141
|
+
get children() {
|
|
142
|
+
return createComponent(CommandDocs, {
|
|
143
|
+
levelOffset,
|
|
144
|
+
command,
|
|
145
|
+
get usageExamples() {
|
|
146
|
+
return usageExamples();
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}));
|
|
136
151
|
}
|
|
137
152
|
});
|
|
138
153
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.mjs","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\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/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, memo, Show } from \"@alloy-js/core\";\nimport { Heading } from \"@alloy-js/markdown\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { MarkdownFileProps } from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownFile } from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownTable } from \"@powerlines/plugin-alloy/markdown/components/markdown-table\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { CommandContext } from \"../contexts/command\";\nimport { getDocsOutputPath } from \"../helpers/docs-helpers\";\nimport { getAppBin } from \"../plugin-utils/context-helpers\";\nimport { sortOptions } from \"../plugin-utils/reflect\";\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport { Usage } from \"./usage\";\n\nexport interface CommandOptionsDocsProps {\n /**\n * The command to generate options documentation for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the options markdown documentation for a command.\n */\nexport function CommandOptionsDocs(props: CommandOptionsDocsProps) {\n const { command } = props;\n if (Object.keys(command.options).length === 0) {\n return code`This command does not have any options.`;\n }\n\n return (\n <MarkdownTable\n data={sortOptions(Object.values(command.options)).map(option => {\n return {\n name: option.name.trim(),\n description: option.description.trim(),\n defaultValue: option.default\n ? String(option.default)?.includes('\"')\n ? option.default\n : `\\`${option.default}\\``\n : \"\",\n required: option.optional || option.default ? \"\" : \"✔\"\n };\n })}\n />\n );\n}\n\nexport interface CommandDocsUsageExampleProps {\n /**\n * The package manager to generate the usage example for.\n *\n * @remarks\n * If not specified, examples for all supported package managers will be generated.\n *\n * @defaultValue \"npm\"\n */\n packageManager?: \"npm\" | \"yarn\" | \"pnpm\" | \"bun\";\n\n /**\n * The command to generate the usage example for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the markdown documentation for a command.\n */\nexport function CommandDocsUsageExample(props: CommandDocsUsageExampleProps) {\n const { packageManager = \"npm\", command } = props;\n\n const context = usePowerlines<Context>();\n\n return (\n <>\n <hbr />\n {code`\\`\\`\\`bash `}\n <hbr />\n <Usage\n command={command}\n bin={getAppBin(context)}\n packageManager={packageManager}\n />\n <hbr />\n {code`\\`\\`\\``}\n <hbr />\n </>\n );\n}\n\nexport interface CommandDocsProps {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n /**\n * The command to generate options documentation for.\n */\n command: CommandTree;\n\n /**\n * Optional usage examples to include in the documentation.\n *\n * @defaultValue `[\"npm\"]`\n */\n usageExamples?: Required<CommandDocsUsageExampleProps>[\"packageManager\"][];\n}\n\n/**\n * Generates the markdown documentation for a command.\n */\nexport function CommandDocs(props: CommandDocsProps) {\n const { levelOffset = 0, command, usageExamples } = props;\n\n return (\n <>\n <Heading level={1 + levelOffset}>{command.title}</Heading>\n <Spacing />\n {code`${command.description}`}\n <Spacing />\n <Heading level={2 + levelOffset}>Usage</Heading>\n <Spacing />\n {code`The ${command.name} command can be executed using the following syntax: `}\n <Spacing />\n <Show\n when={usageExamples && usageExamples.length > 0}\n fallback={\n <CommandDocsUsageExample packageManager=\"npm\" command={command} />\n }>\n <For each={usageExamples!} hardline>\n {packageManager => (\n <CommandDocsUsageExample\n packageManager={packageManager}\n command={command}\n />\n )}\n </For>\n </Show>\n <Spacing />\n <Heading level={2 + levelOffset}>Options</Heading>\n <Spacing />\n {code`The following options are available for the ${\n command.name\n } command:`}\n <Spacing />\n <CommandOptionsDocs command={command} />\n <Spacing />\n </>\n );\n}\n\nexport interface CommandDocsFileProps extends Partial<MarkdownFileProps> {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n /**\n * The command to generate documentation for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the markdown documentation file for a command.\n */\nexport function CommandDocsFile(props: CommandDocsFileProps) {\n const { levelOffset = 0, command, ...rest } = props;\n\n const context = usePowerlines<Context>();\n const usageExamples = memo(\n () => [\"npm\", \"yarn\", \"pnpm\", \"bun\"] as CommandDocsProps[\"usageExamples\"]\n );\n\n return (\n <CommandContext.Provider value={command}>\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context), `${command.path}.md`)}\n {...rest}>\n <CommandDocs\n levelOffset={levelOffset}\n command={command}\n usageExamples={usageExamples()}\n />\n </MarkdownFile>\n </CommandContext.Provider>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"docs.mjs","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\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/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, memo, Show } from \"@alloy-js/core\";\nimport { Heading } from \"@alloy-js/markdown\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { MarkdownFileProps } from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownFile } from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownTable } from \"@powerlines/plugin-alloy/markdown/components/markdown-table\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { defu } from \"defu\";\nimport { CommandContext } from \"../contexts/command\";\nimport { getDocsOutputPath } from \"../helpers/docs-helpers\";\nimport { getAppBin } from \"../plugin-utils/context-helpers\";\nimport { sortOptions } from \"../plugin-utils/reflect\";\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport { Usage } from \"./usage\";\n\nexport interface CommandOptionsDocsProps {\n /**\n * The command to generate options documentation for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the options markdown documentation for a command.\n */\nexport function CommandOptionsDocs(props: CommandOptionsDocsProps) {\n const { command } = props;\n if (Object.keys(command.options).length === 0) {\n return code`This command does not have any options.`;\n }\n\n return (\n <MarkdownTable\n data={sortOptions(Object.values(command.options)).map(option => {\n return {\n name: option.name.trim(),\n description: option.description.trim(),\n defaultValue: option.default\n ? String(option.default)?.includes('\"')\n ? option.default\n : `\\`${option.default}\\``\n : \"\",\n required: option.optional || option.default ? \"\" : \"✔\"\n };\n })}\n />\n );\n}\n\nexport interface CommandDocsUsageExampleProps {\n /**\n * The package manager to generate the usage example for.\n *\n * @remarks\n * If not specified, examples for all supported package managers will be generated.\n *\n * @defaultValue \"npm\"\n */\n packageManager?: \"npm\" | \"yarn\" | \"pnpm\" | \"bun\";\n\n /**\n * The command to generate the usage example for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the markdown documentation for a command.\n */\nexport function CommandDocsUsageExample(props: CommandDocsUsageExampleProps) {\n const { packageManager = \"npm\", command } = props;\n\n const context = usePowerlines<Context>();\n\n return (\n <>\n <hbr />\n {code`\\`\\`\\`bash `}\n <hbr />\n <Usage\n command={command}\n bin={getAppBin(context)}\n packageManager={packageManager}\n />\n <hbr />\n {code`\\`\\`\\``}\n <hbr />\n </>\n );\n}\n\nexport interface CommandDocsProps {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n /**\n * The command to generate options documentation for.\n */\n command: CommandTree;\n\n /**\n * Optional usage examples to include in the documentation.\n *\n * @defaultValue `[\"npm\"]`\n */\n usageExamples?: Required<CommandDocsUsageExampleProps>[\"packageManager\"][];\n}\n\n/**\n * Generates the markdown documentation for a command.\n */\nexport function CommandDocs(props: CommandDocsProps) {\n const { levelOffset = 0, command, usageExamples } = props;\n\n return (\n <>\n <Heading level={1 + levelOffset}>{command.title}</Heading>\n <Spacing />\n {code`${command.description}`}\n <Spacing />\n <Heading level={2 + levelOffset}>Usage</Heading>\n <Spacing />\n {code`The ${command.name} command can be executed using the following syntax: `}\n <Spacing />\n <Show\n when={usageExamples && usageExamples.length > 0}\n fallback={\n <CommandDocsUsageExample packageManager=\"npm\" command={command} />\n }>\n <For each={usageExamples!} hardline>\n {packageManager => (\n <CommandDocsUsageExample\n packageManager={packageManager}\n command={command}\n />\n )}\n </For>\n </Show>\n <Spacing />\n <Heading level={2 + levelOffset}>Options</Heading>\n <Spacing />\n {code`The following options are available for the ${\n command.name\n } command:`}\n <Spacing />\n <CommandOptionsDocs command={command} />\n <Spacing />\n </>\n );\n}\n\nexport interface CommandDocsFileProps extends Partial<MarkdownFileProps> {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n /**\n * The command to generate documentation for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the markdown documentation file for a command.\n */\nexport function CommandDocsFile(props: CommandDocsFileProps) {\n const { levelOffset = 0, command, frontMatter, ...rest } = props;\n\n const context = usePowerlines<Context>();\n const usageExamples = memo(\n () => [\"npm\", \"yarn\", \"pnpm\", \"bun\"] as CommandDocsProps[\"usageExamples\"]\n );\n\n return (\n <CommandContext.Provider value={command}>\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context), `${command.path}.md`)}\n {...rest}\n frontMatter={defu(frontMatter ?? {}, {\n id: command.id,\n name: command.name,\n path: command.path,\n reference: command.reference,\n isVirtual: command.isVirtual,\n title: command.title,\n description: command.description,\n tags: command.tags\n })}>\n <CommandDocs\n levelOffset={levelOffset}\n command={command}\n usageExamples={usageExamples()}\n />\n </MarkdownFile>\n </CommandContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,mBAAmB,OAAgC;CACjE,MAAM,EACJ,YACA;AACF,KAAA,OAAA,KAAA,QAAA,QAAA,CAAA,WAAA;AAGA,QAAG,gBAAA,eAAA,EACD,IAAE,OAAM;AACN,SAAE,YAAO,OAAA,OAAA,QAAA,QAAA,CAAA,CAAA,KAAA,WAAA;AACP,UAAO;IACL,MAAA,OAAa,KAAA,MAAO;IACpB,aAAa,OAAO,YAAC,MAAA;IACrB,cAAW,OAAO,UAAU,OAAU,OAAE,QAAA,EAAA,SAAA,KAAA,GAAA,OAAA,UAAA,KAAA,OAAA,QAAA,MAAA;IACxC,UAAM,OAAO,YAAA,OAAA,UAAA,KAAA;IACd;IACD;IAEL,CAAC;;;;;;CAuBF,MAAA,EACC,iBAAc,OACf,YACI;CACJ,MAAM,UAAE,eAAgC;;;;;;GAElC;;AAEN,WAAO,UAAA,QAAA;;GAEG;GACT,CAAC;EAAE,gBAAkB,OAAA,EAAA,CAAA;EAAA,IAAA;EAAA,gBAAA,OAAA,EAAA,CAAA;EAAA;;;;;;CA8BtB,MAAE,EACA,cAAU,GACX,SACC,kBACA;AACF,QAAA;EAAA,gBAAyB,SAAA;GAC3B,OAAA,IAAA;;AAEE,WAAA,QAAA;;GAEA,CAAA;EAAA,gBAAA,SAAA,EAAA,CAAA;EAAA,WAAA,IAAA,GAAA,QAAA,cAAA;EAAA,gBAAA,SAAA,EAAA,CAAA;EAAA,gBAAA,SAAA;GACF,OAAO,IAAQ;GACb,UAAQ;;;;;;GAER,IAAM,OAAC;AACJ,WAAA,iBAAA,cAAA,SAAA;;GAED,IAAG,WAAS;AACV,WAAO,gBAAS,yBAAa;KAC5B,gBAAS;KACD;KACR,CAAA;;GAEH,IAAG,WAAS;AACV,WAAC,gBAAA,KAAA;KACC,MAAM;KACN,UAAS;KACT,WAAG,mBAAwB,gBAAmB,yBAAqB;MAClE;MACU;MACV,CAAC;KACH,CAAC;;GAEL,CAAC;EAAE,gBAAiB,SAAO,EAAA,CAAA;EAAA,gBAAA,SAAA;GAC1B,OAAO,IAAE;GACT,UAAO;GACR,CAAC;EAAE,gBAAO,SAAA,EAAA,CAAA;EAAA,WAAA,IAAA,+CAAA,QAAA,KAAA,WAAA;EAAA,gBAAA,SAAA,EAAA,CAAA;EAAA,gBAAA,oBAAA,EACD,SACT,CAAC;EAAE,gBAAU,SAAA,EAAA,CAAA;EAAA;;;;;AAsBhB,SAAgB,gBAAM,OAAA;SAElB,cAAA,GACA,SACA,aACF,GAAA,SACF;;CAEE,MAAA,gBAAA,aAAA;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA;AACA,QAAC,gBAAuB,eAAc,UAAW;EACjD,OAAA;EACF,IAAO,WAAS;AACd,UAAQ,gBAAiB,cAAS,WAAsB;AAElD,WAAS,UAAC,kBAAwB,QAAA,EAAA,GAAA,QAAA,KAAA,KAAA;MAEnC,EAAE,MAAM;IACZ,IAAA,cAAA;;MAEM,IAAA,QAAA;MACJ,MAAA,QAAe;MACb,MAAA,QAAA;MACK,WAAW,QAAC;MACZ,WAAI,QAAA;MACR,OAAW,QAAO;MACd,aAAY,QAAA;MACd,MAAM,QAAQ;MACd,CAAA;;IAEF,IAAE,WAAW;AACX,YAAO,gBAAa,aAAA;MACP;MACP;MACL,IAAA,gBAAA;AACF,cAAA,eAAA;;MAEC,CAAA;;IAEH,CAAC,CAAC;;EAEN,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/core",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing the core Shell Shock functionality used to build and manage a command-line application.",
|
|
6
6
|
"keywords": ["shell-shock", "powerlines", "storm-software"],
|
|
@@ -384,5 +384,5 @@
|
|
|
384
384
|
"peerDependencies": { "powerlines": ">=0.42.10", "zod": "^3.25.0 || ^4.0.0" },
|
|
385
385
|
"peerDependenciesMeta": { "zod": { "optional": true } },
|
|
386
386
|
"publishConfig": { "access": "public" },
|
|
387
|
-
"gitHead": "
|
|
387
|
+
"gitHead": "27a9e457bd50dd3576a1edf1882f43d82a402743"
|
|
388
388
|
}
|