@shell-shock/preset-cli 0.0.7 → 0.1.0
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/banner.cjs +53 -35
- package/dist/components/banner.d.cts +4 -35
- package/dist/components/banner.d.cts.map +1 -1
- package/dist/components/banner.d.mts +4 -35
- package/dist/components/banner.d.mts.map +1 -1
- package/dist/components/banner.mjs +54 -36
- package/dist/components/banner.mjs.map +1 -1
- package/dist/helpers/get-default-options.cjs +2 -37
- package/dist/helpers/get-default-options.mjs +4 -39
- package/dist/helpers/get-default-options.mjs.map +1 -1
- package/dist/index.cjs +136 -46
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +136 -46
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
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 -->
|
|
@@ -2,59 +2,77 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
|
2
2
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
3
|
let __alloy_js_core = require("@alloy-js/core");
|
|
4
4
|
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
5
|
+
let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
|
|
5
6
|
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
6
|
-
let
|
|
7
|
+
let __shell_shock_core_contexts_command = require("@shell-shock/core/contexts/command");
|
|
7
8
|
let __shell_shock_preset_script_contexts_theme = require("@shell-shock/preset-script/contexts/theme");
|
|
8
|
-
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
9
9
|
let cfonts = require("cfonts");
|
|
10
10
|
|
|
11
11
|
//#region src/components/banner.tsx
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
14
14
|
*/
|
|
15
15
|
function BannerFunctionDeclaration(props) {
|
|
16
|
-
const {
|
|
17
|
-
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
16
|
+
const { consoleFnName = "log", variant = "primary", title: titleProp } = props;
|
|
18
17
|
const theme = (0, __shell_shock_preset_script_contexts_theme.useTheme)();
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
19
|
+
const command = (0, __shell_shock_core_contexts_command.useCommand)();
|
|
20
|
+
const header = (0, __alloy_js_core.computed)(() => `${theme.labels.banner.header[variant] || (0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context)} v${context.packageJson.version || "1.0.0"}`);
|
|
21
|
+
const description = (0, __alloy_js_core.computed)(() => command?.description || (0, __shell_shock_core_plugin_utils_context_helpers.getAppDescription)(context));
|
|
22
|
+
const footer = (0, __alloy_js_core.computed)(() => theme.labels.banner.footer[variant]);
|
|
23
|
+
const title = (0, __alloy_js_core.computed)(() => titleProp || /(?:cli|command-line|command line)\s+(?:application|app)?$/.test(header.value.toLowerCase()) ? header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim() : `${header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim()} Command-Line Application`);
|
|
24
|
+
const titleLines = (0, __alloy_js_core.computed)(() => {
|
|
25
|
+
const result = (0, cfonts.render)((0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context), {
|
|
26
|
+
font: "tiny",
|
|
27
|
+
align: "left",
|
|
28
|
+
colors: ["system"],
|
|
29
|
+
background: "transparent",
|
|
30
|
+
letterSpacing: 1,
|
|
31
|
+
lineHeight: 1,
|
|
32
|
+
gradient: false,
|
|
33
|
+
transitionGradient: false,
|
|
34
|
+
env: "node"
|
|
35
|
+
});
|
|
36
|
+
if (!result) return [(0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context)];
|
|
37
|
+
return result.array;
|
|
31
38
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
|
|
39
|
+
const bannerPadding = (0, __alloy_js_core.computed)(() => Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.banner.outline[variant].left.length + theme.borderStyles.banner.outline[variant].right.length);
|
|
40
|
+
const totalPadding = (0, __alloy_js_core.computed)(() => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value);
|
|
41
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
|
|
42
|
+
"export": true,
|
|
38
43
|
name: "banner",
|
|
44
|
+
doc: "Write the application banner to the console.",
|
|
39
45
|
get children() {
|
|
40
46
|
return __alloy_js_core.code`
|
|
41
|
-
|
|
47
|
+
if (hasFlag("no-banner") || hasFlag("hide-banner") || isCI || isMinimal) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const titleLines = [${titleLines.value.map((line) => JSON.stringify(line)).join(", ")}];
|
|
52
|
+
const title = Math.max(...titleLines.map(line => stripAnsi(line).trim().length)) > Math.max(process.stdout.columns - ${totalPadding.value}, 0)
|
|
53
|
+
? ["${title.value}"]
|
|
54
|
+
: titleLines;
|
|
55
|
+
|
|
56
|
+
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].topLeft}") + ${theme.icons.banner.header[variant] ? `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(4)) + " " + ${theme.icons.banner.header[variant] ? `colors.text.banner.header.${variant}("${theme.icons.banner.header[variant]}") + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}") + " " +` : ""} colors.bold(colors.text.banner.header.${variant}("${header.value}")) + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${4 + (theme.icons.banner.header[variant] ? theme.icons.banner.header[variant].length + 3 : 0) + (header.value ? header.value.length + 2 : 0) + bannerPadding.value}, 0)))` : `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${bannerPadding.value}, 0)))`} + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].topRight}"), { consoleFn: console.${consoleFnName} });
|
|
42
57
|
|
|
43
|
-
${
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(process.stdout.columns - ${bannerPadding.value})) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
|
|
59
|
+
|
|
60
|
+
title.map(line => line.trim()).forEach((line) => {
|
|
61
|
+
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.text.banner.title.${variant}(line) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(process.stdout.columns - ${bannerPadding.value})) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
|
|
65
|
+
|
|
66
|
+
${command?.title ? `writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.bold(colors.text.banner.command.${variant}("${command.title}")) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} }); ` : ""}
|
|
48
67
|
|
|
49
68
|
splitText(
|
|
50
|
-
${
|
|
51
|
-
Math.max(process.stdout.columns - ${
|
|
69
|
+
${command?.title ? "colors.text.banner.description" : "colors.text.banner.command"}.${variant}("${description.value.replace(/"/g, "\\\"")}"),
|
|
70
|
+
Math.max(process.stdout.columns - ${totalPadding.value}, 0)
|
|
52
71
|
).forEach((line) => {
|
|
53
|
-
writeLine(colors.border.banner.outline
|
|
72
|
+
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.text.banner.description.${variant}(line) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
|
|
54
73
|
});
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}".repeat(Math.max(process.stdout.columns - ${(Math.max(theme.padding.app, 0) + Math.max(theme.padding.banner, 0)) * 2 + theme.borderStyles.banner.outline.primary.bottomLeft.length + theme.borderStyles.banner.outline.primary.bottomRight.length}, 0) / ${theme.borderStyles.banner.outline.primary.bottom.length ?? 1})) + colors.border.banner.outline.primary("${theme.borderStyles.banner.outline.primary.bottomRight}"), { consoleFn: console.info });
|
|
74
|
+
|
|
75
|
+
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottomLeft}") + ${footer.value ? `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${6 + (footer.value ? footer.value.length : 0) + bannerPadding.value}, 0))) + " " + ${footer.value ? `colors.bold(colors.text.banner.footer.${variant}("${footer.value}"))` : ""} + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottom}".repeat(4))` : `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${bannerPadding.value}, 0)))`} + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottomRight}"), { consoleFn: console.${consoleFnName} });
|
|
58
76
|
`;
|
|
59
77
|
}
|
|
60
78
|
})];
|
|
@@ -1,45 +1,14 @@
|
|
|
1
1
|
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import { ThemeColorVariant } from "@shell-shock/plugin-theme/types/theme";
|
|
2
3
|
|
|
3
4
|
//#region src/components/banner.d.ts
|
|
4
5
|
interface BannerFunctionDeclarationProps {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
* @remarks
|
|
9
|
-
* If not provided, the application title from the configuration will be used.
|
|
10
|
-
*/
|
|
6
|
+
variant?: ThemeColorVariant;
|
|
7
|
+
consoleFnName?: "log" | "info" | "warn" | "error" | "debug";
|
|
11
8
|
title?: string;
|
|
12
|
-
/**
|
|
13
|
-
* The sub-title text to display in the banner.
|
|
14
|
-
*
|
|
15
|
-
* @remarks
|
|
16
|
-
* This will be displayed in small text below the title.
|
|
17
|
-
*/
|
|
18
|
-
subTitle?: string;
|
|
19
|
-
/**
|
|
20
|
-
* The description of the command/application to display in the banner.
|
|
21
|
-
*
|
|
22
|
-
* @remarks
|
|
23
|
-
* This text will be displayed in small text below the title.
|
|
24
|
-
*/
|
|
25
|
-
description?: string;
|
|
26
|
-
/**
|
|
27
|
-
* An optional header to display above the banner. If not provided, the application's name and version will be displayed. If set to `false`, no header will be displayed.
|
|
28
|
-
*
|
|
29
|
-
* @remarks
|
|
30
|
-
* This can be used to provide additional context or information before the banner. It will be displayed in the border surrounding the banner.
|
|
31
|
-
*/
|
|
32
|
-
header?: string | false;
|
|
33
|
-
/**
|
|
34
|
-
* An optional footer to display below the banner. If not provided, the organization name or workspace name will be used. If set to `false`, no footer will be displayed.
|
|
35
|
-
*
|
|
36
|
-
* @remarks
|
|
37
|
-
* This can be used to provide additional context or information after the banner. It will be displayed in the border surrounding the banner.
|
|
38
|
-
*/
|
|
39
|
-
footer?: string | false;
|
|
40
9
|
}
|
|
41
10
|
/**
|
|
42
|
-
*
|
|
11
|
+
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
43
12
|
*/
|
|
44
13
|
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core0.Children;
|
|
45
14
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner.d.cts","names":[],"sources":["../../src/components/banner.tsx"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"banner.d.cts","names":[],"sources":["../../src/components/banner.tsx"],"sourcesContent":[],"mappings":";;;;UA+BiB,8BAAA;YACL;;EADK,KAAA,CAAA,EAAA,MAAA;AASjB;;;;iBAAgB,yBAAA,QACP,iCAA8B,eAAA,CAAA"}
|
|
@@ -1,45 +1,14 @@
|
|
|
1
1
|
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import { ThemeColorVariant } from "@shell-shock/plugin-theme/types/theme";
|
|
2
3
|
|
|
3
4
|
//#region src/components/banner.d.ts
|
|
4
5
|
interface BannerFunctionDeclarationProps {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
* @remarks
|
|
9
|
-
* If not provided, the application title from the configuration will be used.
|
|
10
|
-
*/
|
|
6
|
+
variant?: ThemeColorVariant;
|
|
7
|
+
consoleFnName?: "log" | "info" | "warn" | "error" | "debug";
|
|
11
8
|
title?: string;
|
|
12
|
-
/**
|
|
13
|
-
* The sub-title text to display in the banner.
|
|
14
|
-
*
|
|
15
|
-
* @remarks
|
|
16
|
-
* This will be displayed in small text below the title.
|
|
17
|
-
*/
|
|
18
|
-
subTitle?: string;
|
|
19
|
-
/**
|
|
20
|
-
* The description of the command/application to display in the banner.
|
|
21
|
-
*
|
|
22
|
-
* @remarks
|
|
23
|
-
* This text will be displayed in small text below the title.
|
|
24
|
-
*/
|
|
25
|
-
description?: string;
|
|
26
|
-
/**
|
|
27
|
-
* An optional header to display above the banner. If not provided, the application's name and version will be displayed. If set to `false`, no header will be displayed.
|
|
28
|
-
*
|
|
29
|
-
* @remarks
|
|
30
|
-
* This can be used to provide additional context or information before the banner. It will be displayed in the border surrounding the banner.
|
|
31
|
-
*/
|
|
32
|
-
header?: string | false;
|
|
33
|
-
/**
|
|
34
|
-
* An optional footer to display below the banner. If not provided, the organization name or workspace name will be used. If set to `false`, no footer will be displayed.
|
|
35
|
-
*
|
|
36
|
-
* @remarks
|
|
37
|
-
* This can be used to provide additional context or information after the banner. It will be displayed in the border surrounding the banner.
|
|
38
|
-
*/
|
|
39
|
-
footer?: string | false;
|
|
40
9
|
}
|
|
41
10
|
/**
|
|
42
|
-
*
|
|
11
|
+
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
43
12
|
*/
|
|
44
13
|
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core0.Children;
|
|
45
14
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner.d.mts","names":[],"sources":["../../src/components/banner.tsx"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"banner.d.mts","names":[],"sources":["../../src/components/banner.tsx"],"sourcesContent":[],"mappings":";;;;UA+BiB,8BAAA;YACL;;EADK,KAAA,CAAA,EAAA,MAAA;AASjB;;;;iBAAgB,yBAAA,QACP,iCAA8B,eAAA,CAAA"}
|
|
@@ -1,59 +1,77 @@
|
|
|
1
1
|
import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { code } from "@alloy-js/core";
|
|
2
|
+
import { code, computed } from "@alloy-js/core";
|
|
3
3
|
import { FunctionDeclaration } from "@alloy-js/typescript";
|
|
4
|
+
import { getAppDescription, getAppTitle } from "@shell-shock/core/plugin-utils/context-helpers";
|
|
4
5
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
5
|
-
import {
|
|
6
|
+
import { useCommand } from "@shell-shock/core/contexts/command";
|
|
6
7
|
import { useTheme } from "@shell-shock/preset-script/contexts/theme";
|
|
7
|
-
import { titleCase } from "@stryke/string-format/title-case";
|
|
8
8
|
import { render } from "cfonts";
|
|
9
9
|
|
|
10
10
|
//#region src/components/banner.tsx
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* A component to generate the `banner` function in the `shell-shock:console` builtin module.
|
|
13
13
|
*/
|
|
14
14
|
function BannerFunctionDeclaration(props) {
|
|
15
|
-
const {
|
|
16
|
-
const context = usePowerlines();
|
|
15
|
+
const { consoleFnName = "log", variant = "primary", title: titleProp } = props;
|
|
17
16
|
const theme = useTheme();
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
const context = usePowerlines();
|
|
18
|
+
const command = useCommand();
|
|
19
|
+
const header = computed(() => `${theme.labels.banner.header[variant] || getAppTitle(context)} v${context.packageJson.version || "1.0.0"}`);
|
|
20
|
+
const description = computed(() => command?.description || getAppDescription(context));
|
|
21
|
+
const footer = computed(() => theme.labels.banner.footer[variant]);
|
|
22
|
+
const title = computed(() => titleProp || /(?:cli|command-line|command line)\s+(?:application|app)?$/.test(header.value.toLowerCase()) ? header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim() : `${header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim()} Command-Line Application`);
|
|
23
|
+
const titleLines = computed(() => {
|
|
24
|
+
const result = render(getAppTitle(context), {
|
|
25
|
+
font: "tiny",
|
|
26
|
+
align: "left",
|
|
27
|
+
colors: ["system"],
|
|
28
|
+
background: "transparent",
|
|
29
|
+
letterSpacing: 1,
|
|
30
|
+
lineHeight: 1,
|
|
31
|
+
gradient: false,
|
|
32
|
+
transitionGradient: false,
|
|
33
|
+
env: "node"
|
|
34
|
+
});
|
|
35
|
+
if (!result) return [getAppTitle(context)];
|
|
36
|
+
return result.array;
|
|
30
37
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
}), createComponent(FunctionDeclaration, {
|
|
38
|
+
const bannerPadding = computed(() => Math.max(theme.padding.app, 0) * 2 + theme.borderStyles.banner.outline[variant].left.length + theme.borderStyles.banner.outline[variant].right.length);
|
|
39
|
+
const totalPadding = computed(() => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value);
|
|
40
|
+
return [createComponent(FunctionDeclaration, {
|
|
41
|
+
"export": true,
|
|
37
42
|
name: "banner",
|
|
43
|
+
doc: "Write the application banner to the console.",
|
|
38
44
|
get children() {
|
|
39
45
|
return code`
|
|
40
|
-
|
|
46
|
+
if (hasFlag("no-banner") || hasFlag("hide-banner") || isCI || isMinimal) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const titleLines = [${titleLines.value.map((line) => JSON.stringify(line)).join(", ")}];
|
|
51
|
+
const title = Math.max(...titleLines.map(line => stripAnsi(line).trim().length)) > Math.max(process.stdout.columns - ${totalPadding.value}, 0)
|
|
52
|
+
? ["${title.value}"]
|
|
53
|
+
: titleLines;
|
|
54
|
+
|
|
55
|
+
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].topLeft}") + ${theme.icons.banner.header[variant] ? `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(4)) + " " + ${theme.icons.banner.header[variant] ? `colors.text.banner.header.${variant}("${theme.icons.banner.header[variant]}") + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}") + " " +` : ""} colors.bold(colors.text.banner.header.${variant}("${header.value}")) + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${4 + (theme.icons.banner.header[variant] ? theme.icons.banner.header[variant].length + 3 : 0) + (header.value ? header.value.length + 2 : 0) + bannerPadding.value}, 0)))` : `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${bannerPadding.value}, 0)))`} + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].topRight}"), { consoleFn: console.${consoleFnName} });
|
|
41
56
|
|
|
42
|
-
${
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
57
|
+
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(process.stdout.columns - ${bannerPadding.value})) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
|
|
58
|
+
|
|
59
|
+
title.map(line => line.trim()).forEach((line) => {
|
|
60
|
+
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.text.banner.title.${variant}(line) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(process.stdout.columns - ${bannerPadding.value})) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
|
|
64
|
+
|
|
65
|
+
${command?.title ? `writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.bold(colors.text.banner.command.${variant}("${command.title}")) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} }); ` : ""}
|
|
47
66
|
|
|
48
67
|
splitText(
|
|
49
|
-
${
|
|
50
|
-
Math.max(process.stdout.columns - ${
|
|
68
|
+
${command?.title ? "colors.text.banner.description" : "colors.text.banner.command"}.${variant}("${description.value.replace(/"/g, "\\\"")}"),
|
|
69
|
+
Math.max(process.stdout.columns - ${totalPadding.value}, 0)
|
|
51
70
|
).forEach((line) => {
|
|
52
|
-
writeLine(colors.border.banner.outline
|
|
71
|
+
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.text.banner.description.${variant}(line) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
|
|
53
72
|
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}".repeat(Math.max(process.stdout.columns - ${(Math.max(theme.padding.app, 0) + Math.max(theme.padding.banner, 0)) * 2 + theme.borderStyles.banner.outline.primary.bottomLeft.length + theme.borderStyles.banner.outline.primary.bottomRight.length}, 0) / ${theme.borderStyles.banner.outline.primary.bottom.length ?? 1})) + colors.border.banner.outline.primary("${theme.borderStyles.banner.outline.primary.bottomRight}"), { consoleFn: console.info });
|
|
73
|
+
|
|
74
|
+
writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottomLeft}") + ${footer.value ? `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${6 + (footer.value ? footer.value.length : 0) + bannerPadding.value}, 0))) + " " + ${footer.value ? `colors.bold(colors.text.banner.footer.${variant}("${footer.value}"))` : ""} + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottom}".repeat(4))` : `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${bannerPadding.value}, 0)))`} + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottomRight}"), { consoleFn: console.${consoleFnName} });
|
|
57
75
|
`;
|
|
58
76
|
}
|
|
59
77
|
})];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner.mjs","names":["code","FunctionDeclaration","usePowerlines","TSDoc","TSDocRemarks","useTheme","titleCase","render","BannerFunctionDeclaration","props","title","propTitle","description","propDescription","context","theme","config","renderedTitle","font","align","colors","background","letterSpacing","lineHeight","gradient","transitionGradient","env","_$createComponent","heading","children","name","borderStyles","banner","outline","primary","topLeft","top","Math","max","padding","app","length","topRight","array","map","line","left","right","join","replace","repeat","bottomLeft","bottomRight","bottom"],"sources":["../../src/components/banner.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 } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n TSDoc,\n TSDocRemarks\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { useTheme } from \"@shell-shock/preset-script/contexts/theme\";\nimport type { ScriptPresetContext } from \"@shell-shock/preset-script/types/plugin\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { render } from \"cfonts\";\n// import {\n// getOrganizationName,\n// getWorkspaceName\n// } from \"powerlines/plugin-utils/context-helpers\";\n\nexport interface BannerFunctionDeclarationProps {\n /**\n * The title to display in the banner.\n *\n * @remarks\n * If not provided, the application title from the configuration will be used.\n */\n title?: string;\n\n /**\n * The sub-title text to display in the banner.\n *\n * @remarks\n * This will be displayed in small text below the title.\n */\n subTitle?: string;\n\n /**\n * The description of the command/application to display in the banner.\n *\n * @remarks\n * This text will be displayed in small text below the title.\n */\n description?: string;\n\n /**\n * An optional header to display above the banner. If not provided, the application's name and version will be displayed. If set to `false`, no header will be displayed.\n *\n * @remarks\n * This can be used to provide additional context or information before the banner. It will be displayed in the border surrounding the banner.\n */\n header?: string | false;\n\n /**\n * An optional footer to display below the banner. If not provided, the organization name or workspace name will be used. If set to `false`, no footer will be displayed.\n *\n * @remarks\n * This can be used to provide additional context or information after the banner. It will be displayed in the border surrounding the banner.\n */\n footer?: string | false;\n}\n\n/**\n * The `banner` handler function declaration code for the Shell Shock project.\n */\nexport function BannerFunctionDeclaration(\n props: BannerFunctionDeclarationProps\n) {\n const { title: propTitle, description: propDescription } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const theme = useTheme();\n\n const title = propTitle || titleCase(context.config.title);\n const description = propDescription || context.config.description;\n // const header =\n // propHeader !== false\n // ? propHeader ||\n // `${title} ${context.packageJson?.version ? `v${context.packageJson.version}` : \"\"}`.trim()\n // : undefined;\n // const footer =\n // propFooter !== false\n // ? propFooter ||\n // titleCase(getOrganizationName(context) || getWorkspaceName(context))\n // : undefined;\n\n const renderedTitle = render(title, {\n font: \"tiny\",\n align: \"left\",\n colors: [\"system\"],\n background: \"transparent\",\n letterSpacing: 1,\n lineHeight: 1,\n gradient: false,\n transitionGradient: false,\n env: \"node\"\n });\n\n return (\n <>\n <TSDoc heading={`Write the application banner display to the console.`}>\n <TSDocRemarks>\n {`This function should be run at the start of an application and should identify the current application/command to the user.`}\n </TSDocRemarks>\n </TSDoc>\n <FunctionDeclaration name=\"banner\">\n {code`\n writeLine(colors.border.banner.outline.primary(\"${\n theme.borderStyles.banner.outline.primary.topLeft\n }\") + colors.border.banner.outline.primary(\"${\n theme.borderStyles.banner.outline.primary.top\n }\".repeat(Math.max(process.stdout.columns - ${\n (Math.max(theme.padding.app, 0) + Math.max(theme.padding.banner, 0)) *\n 2 +\n theme.borderStyles.banner.outline.primary.topLeft.length +\n theme.borderStyles.banner.outline.primary.topRight.length\n }, 0) / ${\n theme.borderStyles.banner.outline.primary.top.length ?? 1\n })) + colors.border.banner.outline.primary(\"${\n theme.borderStyles.banner.outline.primary.topRight\n }\"), { consoleFn: console.info });\n\n ${\n renderedTitle\n ? renderedTitle.array\n .map(\n line =>\n `writeLine(colors.border.banner.outline.primary(\"${\n theme.borderStyles.banner.outline.primary.left\n }\") +\n \" \".repeat(Math.max(theme.padding.banner, 0)) +\n colors.text.banner.title(\"${line}\") +\n \" \".repeat(Math.max(theme.padding.banner, 0)) +\n colors.border.banner.outline.primary(\"${\n theme.borderStyles.banner.outline.primary.right\n }\"), { consoleFn: console.info });`\n )\n .join(`\\n`)\n : \"\"\n }\n\n splitText(\n ${description ? code`\"${description.replace(/\"/g, '\\\\\"')}\"` : \"''\"},\n Math.max(process.stdout.columns - ${\n (Math.max(theme.padding.app, 0) +\n Math.max(theme.padding.banner, 0)) *\n 2 +\n theme.borderStyles.banner.outline.primary.left.length +\n theme.borderStyles.banner.outline.primary.right.length\n }, 0)\n ).forEach((line) => {\n writeLine(colors.border.banner.outline.primary(\"${\n theme.borderStyles.banner.outline.primary.left +\n \" \".repeat(Math.max(theme.padding.banner, 0))\n }\") + colors.text.banner.description(line) + colors.border.banner.outline.primary(\"${\n \" \".repeat(Math.max(theme.padding.banner, 0)) +\n theme.borderStyles.banner.outline.primary.right\n }\"), { consoleFn: console.info });\n });\n writeLine(colors.border.banner.outline.primary(\"${\n theme.borderStyles.banner.outline.primary.bottomLeft\n }\") + colors.border.banner.outline.primary(\"$\"{\n theme.borderStyles.banner.outline.primary.bottom\n }\".repeat(Math.max(process.stdout.columns - ${\n (Math.max(theme.padding.app, 0) + Math.max(theme.padding.banner, 0)) *\n 2 +\n theme.borderStyles.banner.outline.primary.bottomLeft.length +\n theme.borderStyles.banner.outline.primary.bottomRight.length\n }, 0) / ${\n theme.borderStyles.banner.outline.primary.bottom.length ?? 1\n })) + colors.border.banner.outline.primary(\"${\n theme.borderStyles.banner.outline.primary.bottomRight\n }\"), { consoleFn: console.info });\n`}\n </FunctionDeclaration>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA+EA,SAAgBQ,0BACdC,OACA;CACA,MAAM,EAAEC,OAAOC,WAAWC,aAAaC,oBAAoBJ;CAE3D,MAAMK,UAAUZ,eAAoC;CACpD,MAAMa,QAAQV,UAAU;CAExB,MAAMK,QAAQC,aAAaL,UAAUQ,QAAQE,OAAON,MAAM;CAC1D,MAAME,c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AIvB,MAAMwB,QAAQP,QAAQ,EAAE,IACjC,IACFjB,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQY,KAAKL,SAC/C1B,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQa,MAAMN,OAAM;;4DAItD1B,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQY,OAC1C,IAAII,OAAOb,KAAKC,IAAIvB,MAAMwB,QAAQP,QAAQ,EAAE,CAAC,CAAA,oFAE7C,IAAIkB,OAAOb,KAAKC,IAAIvB,MAAMwB,QAAQP,QAAQ,EAAE,CAAC,GAC7CjB,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQa,MAAK;;0DAIjDhC,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQiB,WAAU;;uDAInDd,KAAKC,IAAIvB,MAAMwB,QAAQC,KAAK,EAAE,GAAGH,KAAKC,IAAIvB,MAAMwB,QAAQP,QAAQ,EAAE,IACjE,IACFjB,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQiB,WAAWV,SACrD1B,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQkB,YAAYX,OAAM,SAE5D1B,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQmB,OAAOZ,UAAU,EAAC,6CAE5D1B,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQkB,YAAW;;;EAE9D,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"banner.mjs","names":["code","computed","FunctionDeclaration","usePowerlines","useCommand","getAppDescription","getAppTitle","useTheme","render","BannerFunctionDeclaration","props","consoleFnName","variant","title","titleProp","theme","context","command","header","labels","banner","packageJson","version","description","footer","test","value","toLowerCase","replace","trim","titleLines","result","font","align","colors","background","letterSpacing","lineHeight","gradient","transitionGradient","env","array","bannerPadding","Math","max","padding","app","borderStyles","outline","left","length","right","totalPadding","_$createComponent","name","doc","children","map","line","JSON","stringify","join","topLeft","icons","top","topRight","bottomLeft","bottom","bottomRight"],"sources":["../../src/components/banner.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, computed } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { useCommand } from \"@shell-shock/core/contexts/command\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { ThemeColorVariant } from \"@shell-shock/plugin-theme/types/theme\";\nimport { useTheme } from \"@shell-shock/preset-script/contexts/theme\";\nimport type { ScriptPresetContext } from \"@shell-shock/preset-script/types/plugin\";\nimport { render } from \"cfonts\";\n\nexport interface BannerFunctionDeclarationProps {\n variant?: ThemeColorVariant;\n consoleFnName?: \"log\" | \"info\" | \"warn\" | \"error\" | \"debug\";\n title?: string;\n}\n\n/**\n * A component to generate the `banner` function in the `shell-shock:console` builtin module.\n */\nexport function BannerFunctionDeclaration(\n props: BannerFunctionDeclarationProps\n) {\n const {\n consoleFnName = \"log\",\n variant = \"primary\",\n title: titleProp\n } = props;\n\n const theme = useTheme();\n\n const context = usePowerlines<ScriptPresetContext>();\n const command = useCommand();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context)} v${context.packageJson.version || \"1.0.0\"}`\n );\n const description = computed(\n () => command?.description || getAppDescription(context)\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n\n const title = computed(() =>\n titleProp ||\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n header.value.toLowerCase()\n )\n ? header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()\n : `${header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()} Command-Line Application`\n );\n\n const titleLines = computed(() => {\n const result = render(getAppTitle(context), {\n font: \"tiny\",\n align: \"left\",\n colors: [\"system\"],\n background: \"transparent\",\n letterSpacing: 1,\n lineHeight: 1,\n gradient: false,\n transitionGradient: false,\n env: \"node\"\n });\n if (!result) {\n return [getAppTitle(context)];\n }\n\n return result.array;\n });\n\n const bannerPadding = computed(\n () =>\n Math.max(theme.padding.app, 0) * 2 +\n theme.borderStyles.banner.outline[variant].left.length +\n theme.borderStyles.banner.outline[variant].right.length\n );\n const totalPadding = computed(\n () => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value\n );\n\n return (\n <>\n <FunctionDeclaration\n export\n name=\"banner\"\n doc=\"Write the application banner to the console.\">\n {code`\n if (hasFlag(\"no-banner\") || hasFlag(\"hide-banner\") || isCI || isMinimal) {\n return;\n }\n\n const titleLines = [${titleLines.value\n .map(line => JSON.stringify(line))\n .join(\", \")}];\n const title = Math.max(...titleLines.map(line => stripAnsi(line).trim().length)) > Math.max(process.stdout.columns - ${\n totalPadding.value\n }, 0)\n ? [\"${title.value}\"]\n : titleLines;\n\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].topLeft\n }\") + ${\n theme.icons.banner.header[variant]\n ? `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\".repeat(4)) + \" \" + ${\n theme.icons.banner.header[variant]\n ? `colors.text.banner.header.${variant}(\"${\n theme.icons.banner.header[variant]\n }\") + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\") + \" \" +`\n : \"\"\n } colors.bold(colors.text.banner.header.${variant}(\"${\n header.value\n }\")) + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\".repeat(Math.max(process.stdout.columns - ${\n 4 +\n (theme.icons.banner.header[variant]\n ? theme.icons.banner.header[variant].length + 3\n : 0) +\n (header.value ? header.value.length + 2 : 0) +\n bannerPadding.value\n }, 0)))`\n : `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\".repeat(Math.max(process.stdout.columns - ${\n bannerPadding.value\n }, 0)))`\n } + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].topRight\n }\"), { consoleFn: console.${consoleFnName} });\n\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(process.stdout.columns - ${\n bannerPadding.value\n })) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} });\n\n title.map(line => line.trim()).forEach((line) => {\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.text.banner.title.${\n variant\n }(line) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} });\n });\n\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(process.stdout.columns - ${\n bannerPadding.value\n })) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} });\n\n ${\n command?.title\n ? `writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.bold(colors.text.banner.command.${\n variant\n }(\"${command.title}\")) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} }); `\n : \"\"\n }\n\n splitText(\n ${\n command?.title\n ? \"colors.text.banner.description\"\n : \"colors.text.banner.command\"\n }.${variant}(\"${description.value.replace(/\"/g, '\\\\\"')}\"),\n Math.max(process.stdout.columns - ${totalPadding.value}, 0)\n ).forEach((line) => {\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.text.banner.description.${variant}(line) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} });\n });\n\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottomLeft\n }\") + ${\n footer.value\n ? `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(Math.max(process.stdout.columns - ${\n 6 +\n (footer.value ? footer.value.length : 0) +\n bannerPadding.value\n }, 0))) + \" \" + ${\n footer.value\n ? `colors.bold(colors.text.banner.footer.${variant}(\"${footer.value}\"))`\n : \"\"\n } + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(4))`\n : `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(Math.max(process.stdout.columns - ${\n bannerPadding.value\n }, 0)))`\n } + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottomRight\n }\"), { consoleFn: console.${consoleFnName} });\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ASsD,WAAU,OAErD1C,OAAOE,QACH,gCAAgCd,QAAO,IACrCG,MAAMgC,aAAa3B,OAAO4B,QAAQpC,SAASuD,OAAM,6CAEjD,KACC3C,OAAOE,QAAQF,OAAOE,MAAMwB,SAAS,KACtCR,cAAchB,MAAK,iBAEnBF,OAAOE,QACH,yCAAyCd,QAAO,IAAKY,OAAOE,MAAK,OACjE,GAAE,wCACiCd,QAAO,IAC9CG,MAAMgC,aAAa3B,OAAO4B,QAAQpC,SAASuD,OAAM,gBAEnD,gCAAgCvD,QAAO,IACrCG,MAAMgC,aAAa3B,OAAO4B,QAAQpC,SAASuD,OAAM,6CAEjDzB,cAAchB,MAAK,QACb,kCACqBd,QAAO,IACxCG,MAAMgC,aAAa3B,OAAO4B,QAAQpC,SAASwD,YAAW,2BAC5BzD,cAAa;;;EAChD,CAAA,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
3
|
+
let __shell_shock_preset_script_helpers_get_default_options = require("@shell-shock/preset-script/helpers/get-default-options");
|
|
3
4
|
|
|
4
5
|
//#region src/helpers/get-default-options.ts
|
|
5
6
|
/**
|
|
@@ -11,26 +12,7 @@ let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type"
|
|
|
11
12
|
*/
|
|
12
13
|
function getDefaultOptions(context, _) {
|
|
13
14
|
return [
|
|
14
|
-
|
|
15
|
-
name: "help",
|
|
16
|
-
title: "Help",
|
|
17
|
-
description: "Show help information.",
|
|
18
|
-
alias: ["h", "?"],
|
|
19
|
-
kind: __powerlines_deepkit_vendor_type.ReflectionKind.boolean,
|
|
20
|
-
optional: true,
|
|
21
|
-
default: false,
|
|
22
|
-
skipAddingNegative: true
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
name: "version",
|
|
26
|
-
title: "Version",
|
|
27
|
-
description: "Show the version of the application.",
|
|
28
|
-
alias: ["v"],
|
|
29
|
-
kind: __powerlines_deepkit_vendor_type.ReflectionKind.boolean,
|
|
30
|
-
optional: true,
|
|
31
|
-
default: false,
|
|
32
|
-
skipAddingNegative: true
|
|
33
|
-
},
|
|
15
|
+
...(0, __shell_shock_preset_script_helpers_get_default_options.getDefaultOptions)(),
|
|
34
16
|
context.config.interactive !== "never" && context.config.interactive !== true && {
|
|
35
17
|
name: "interactive",
|
|
36
18
|
title: "Interactive",
|
|
@@ -49,23 +31,6 @@ function getDefaultOptions(context, _) {
|
|
|
49
31
|
optional: true,
|
|
50
32
|
default: false,
|
|
51
33
|
isNegativeOf: "interactive"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
name: "no-banner",
|
|
55
|
-
title: "Hide Banner",
|
|
56
|
-
description: "Hide the banner displayed while running the CLI application (will be set to true if running in a CI pipeline).",
|
|
57
|
-
kind: __powerlines_deepkit_vendor_type.ReflectionKind.boolean,
|
|
58
|
-
optional: true,
|
|
59
|
-
default: false
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: "verbose",
|
|
63
|
-
title: "Verbose",
|
|
64
|
-
description: "Enable verbose output.",
|
|
65
|
-
kind: __powerlines_deepkit_vendor_type.ReflectionKind.boolean,
|
|
66
|
-
optional: true,
|
|
67
|
-
default: false,
|
|
68
|
-
skipAddingNegative: true
|
|
69
34
|
}
|
|
70
35
|
].filter(Boolean);
|
|
71
36
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
2
|
+
import { getDefaultOptions } from "@shell-shock/preset-script/helpers/get-default-options";
|
|
2
3
|
|
|
3
4
|
//#region src/helpers/get-default-options.ts
|
|
4
5
|
/**
|
|
@@ -8,28 +9,9 @@ import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
|
8
9
|
* @param _ - The command input.
|
|
9
10
|
* @returns The default command options.
|
|
10
11
|
*/
|
|
11
|
-
function getDefaultOptions(context, _) {
|
|
12
|
+
function getDefaultOptions$1(context, _) {
|
|
12
13
|
return [
|
|
13
|
-
|
|
14
|
-
name: "help",
|
|
15
|
-
title: "Help",
|
|
16
|
-
description: "Show help information.",
|
|
17
|
-
alias: ["h", "?"],
|
|
18
|
-
kind: ReflectionKind.boolean,
|
|
19
|
-
optional: true,
|
|
20
|
-
default: false,
|
|
21
|
-
skipAddingNegative: true
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: "version",
|
|
25
|
-
title: "Version",
|
|
26
|
-
description: "Show the version of the application.",
|
|
27
|
-
alias: ["v"],
|
|
28
|
-
kind: ReflectionKind.boolean,
|
|
29
|
-
optional: true,
|
|
30
|
-
default: false,
|
|
31
|
-
skipAddingNegative: true
|
|
32
|
-
},
|
|
14
|
+
...getDefaultOptions(),
|
|
33
15
|
context.config.interactive !== "never" && context.config.interactive !== true && {
|
|
34
16
|
name: "interactive",
|
|
35
17
|
title: "Interactive",
|
|
@@ -48,27 +30,10 @@ function getDefaultOptions(context, _) {
|
|
|
48
30
|
optional: true,
|
|
49
31
|
default: false,
|
|
50
32
|
isNegativeOf: "interactive"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
name: "no-banner",
|
|
54
|
-
title: "Hide Banner",
|
|
55
|
-
description: "Hide the banner displayed while running the CLI application (will be set to true if running in a CI pipeline).",
|
|
56
|
-
kind: ReflectionKind.boolean,
|
|
57
|
-
optional: true,
|
|
58
|
-
default: false
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: "verbose",
|
|
62
|
-
title: "Verbose",
|
|
63
|
-
description: "Enable verbose output.",
|
|
64
|
-
kind: ReflectionKind.boolean,
|
|
65
|
-
optional: true,
|
|
66
|
-
default: false,
|
|
67
|
-
skipAddingNegative: true
|
|
68
33
|
}
|
|
69
34
|
].filter(Boolean);
|
|
70
35
|
}
|
|
71
36
|
|
|
72
37
|
//#endregion
|
|
73
|
-
export { getDefaultOptions };
|
|
38
|
+
export { getDefaultOptions$1 as getDefaultOptions };
|
|
74
39
|
//# sourceMappingURL=get-default-options.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-default-options.mjs","names":["ReflectionKind","getDefaultOptions","context","_","name","title","description","alias","kind","boolean","optional","default","
|
|
1
|
+
{"version":3,"file":"get-default-options.mjs","names":["ReflectionKind","getDefaultOptions","getDefaultOptionsBase","context","_","config","interactive","name","title","description","alias","kind","boolean","optional","default","isNegativeOf","filter","Boolean"],"sources":["../../src/helpers/get-default-options.ts"],"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 { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport type { CommandBase, CommandOption } from \"@shell-shock/core\";\nimport { getDefaultOptions as getDefaultOptionsBase } from \"@shell-shock/preset-script/helpers/get-default-options\";\nimport type { CLIPresetContext } from \"../types\";\n\n/**\n * Get the default command options.\n *\n * @param context - The build context.\n * @param _ - The command input.\n * @returns The default command options.\n */\nexport function getDefaultOptions(\n context: CLIPresetContext,\n _: CommandBase\n): CommandOption[] {\n return [\n ...getDefaultOptionsBase(),\n context.config.interactive !== \"never\" &&\n context.config.interactive !== true && {\n name: \"interactive\",\n title: \"Interactive\",\n description:\n \"Enable interactive mode (will be set to false if running in a CI pipeline).\",\n alias: [\"i\", \"interact\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: context.config.interactive !== false\n },\n context.config.interactive !== \"never\" &&\n context.config.interactive !== false && {\n name: \"no-interactive\",\n title: \"Non-Interactive\",\n description:\n \"Disable interactive mode (will be set to true if running in a CI pipeline).\",\n alias: [\"no-interact\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n isNegativeOf: \"interactive\"\n }\n ].filter(Boolean) as CommandOption[];\n}\n"],"mappings":";;;;;;;;;;;AA8BA,SAAgBC,oBACdE,SACAC,GACiB;AACjB,QAAO;EACL,GAAGF,mBAAuB;EAC1BC,QAAQE,OAAOC,gBAAgB,WAC7BH,QAAQE,OAAOC,gBAAgB,QAAQ;GACrCC,MAAM;GACNC,OAAO;GACPC,aACE;GACFC,OAAO,CAAC,KAAK,WAAW;GACxBC,MAAMX,eAAeY;GACrBC,UAAU;GACVC,SAASX,QAAQE,OAAOC,gBAAgB;GACzC;EACHH,QAAQE,OAAOC,gBAAgB,WAC7BH,QAAQE,OAAOC,gBAAgB,SAAS;GACtCC,MAAM;GACNC,OAAO;GACPC,aACE;GACFC,OAAO,CAAC,cAAc;GACtBC,MAAMX,eAAeY;GACrBC,UAAU;GACVC,SAAS;GACTC,cAAc;GACf;EACJ,CAACC,OAAOC,QAAQ"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
|
+
const require_components_banner = require('./components/banner.cjs');
|
|
4
|
+
require('./components/index.cjs');
|
|
3
5
|
const require_get_default_options = require('./helpers/get-default-options.cjs');
|
|
4
6
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
7
|
let __alloy_js_core = require("@alloy-js/core");
|
|
6
8
|
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
7
9
|
let __powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
|
|
8
|
-
let
|
|
10
|
+
let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
|
|
9
11
|
let __shell_shock_plugin_theme = require("@shell-shock/plugin-theme");
|
|
10
12
|
__shell_shock_plugin_theme = require_rolldown_runtime.__toESM(__shell_shock_plugin_theme);
|
|
11
13
|
let __shell_shock_preset_script_components_bin_entry = require("@shell-shock/preset-script/components/bin-entry");
|
|
12
14
|
let __shell_shock_preset_script_components_command_entry = require("@shell-shock/preset-script/components/command-entry");
|
|
13
15
|
let __shell_shock_preset_script_components_command_router = require("@shell-shock/preset-script/components/command-router");
|
|
14
16
|
let __shell_shock_preset_script_components_console_builtin = require("@shell-shock/preset-script/components/console-builtin");
|
|
17
|
+
let __shell_shock_preset_script_components_help = require("@shell-shock/preset-script/components/help");
|
|
15
18
|
let __shell_shock_preset_script_components_utils_builtin = require("@shell-shock/preset-script/components/utils-builtin");
|
|
16
19
|
let __shell_shock_preset_script_components_virtual_command_entry = require("@shell-shock/preset-script/components/virtual-command-entry");
|
|
17
20
|
|
|
@@ -20,66 +23,153 @@ let __shell_shock_preset_script_components_virtual_command_entry = require("@she
|
|
|
20
23
|
* The Shell Shock base plugin.
|
|
21
24
|
*/
|
|
22
25
|
const plugin = (options = {}) => {
|
|
23
|
-
return [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
return [
|
|
27
|
+
(0, __shell_shock_plugin_theme.default)({ theme: options.theme }),
|
|
28
|
+
{
|
|
29
|
+
name: "shell-shock:cli-preset",
|
|
30
|
+
config() {
|
|
31
|
+
this.debug("Providing default configuration for the Shell Shock `cli` preset.");
|
|
32
|
+
return {
|
|
33
|
+
defaultOptions: require_get_default_options.getDefaultOptions,
|
|
34
|
+
isCaseSensitive: false,
|
|
35
|
+
...options
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
configResolved() {
|
|
39
|
+
this.dependencies.didyoumean2 = "^7.0.4";
|
|
40
|
+
},
|
|
41
|
+
async prepare() {
|
|
42
|
+
this.debug("Rendering built-in modules for the Shell Shock `cli` preset.");
|
|
43
|
+
return (0, __powerlines_plugin_alloy_render.render)(this, [(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_utils_builtin.UtilsBuiltin, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_console_builtin.ConsoleBuiltin, { get banner() {
|
|
44
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_banner.BannerFunctionDeclaration, {});
|
|
45
|
+
} })]);
|
|
46
|
+
}
|
|
32
47
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
{
|
|
49
|
+
name: "shell-shock:cli-preset:generate-entrypoint",
|
|
50
|
+
prepare: {
|
|
51
|
+
order: "post",
|
|
52
|
+
async handler() {
|
|
53
|
+
const _self$ = this;
|
|
54
|
+
this.debug("Rendering entrypoint modules for the Shell Shock `cli` preset.");
|
|
55
|
+
return (0, __powerlines_plugin_alloy_render.render)(this, [(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_bin_entry.BinEntry, {
|
|
56
|
+
builtinImports: {
|
|
57
|
+
console: [
|
|
58
|
+
"divider",
|
|
59
|
+
"writeLine",
|
|
60
|
+
"colors",
|
|
61
|
+
"banner",
|
|
62
|
+
"help"
|
|
63
|
+
],
|
|
64
|
+
utils: ["getArgs"]
|
|
42
65
|
},
|
|
43
66
|
get children() {
|
|
44
67
|
return [
|
|
45
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
68
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
69
|
+
get when() {
|
|
70
|
+
return Object.keys(_self$.commands).length > 0;
|
|
71
|
+
},
|
|
72
|
+
get children() {
|
|
73
|
+
return [
|
|
74
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
75
|
+
"const": true,
|
|
76
|
+
name: "args",
|
|
77
|
+
type: "string[]",
|
|
78
|
+
initializer: __alloy_js_core.code`getArgs();`
|
|
79
|
+
}),
|
|
80
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
81
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_router.CommandRouter, {
|
|
82
|
+
path: [],
|
|
83
|
+
get commands() {
|
|
84
|
+
return _self$.commands ?? {};
|
|
85
|
+
}
|
|
86
|
+
}),
|
|
87
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
88
|
+
];
|
|
89
|
+
}
|
|
50
90
|
}),
|
|
51
91
|
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
92
|
+
__alloy_js_core.code`
|
|
93
|
+
writeLine("");
|
|
94
|
+
banner();
|
|
95
|
+
writeLine(""); `,
|
|
96
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
97
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
98
|
+
__alloy_js_core.code`writeLine(colors.text.heading.secondary("Global Options:"));`,
|
|
99
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
100
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_help.HelpOptions, { get options() {
|
|
101
|
+
return _self$.options;
|
|
102
|
+
} }),
|
|
103
|
+
__alloy_js_core.code`writeLine(""); `,
|
|
104
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
105
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
106
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
107
|
+
get when() {
|
|
108
|
+
return Object.keys(_self$.commands).length > 0;
|
|
109
|
+
},
|
|
110
|
+
get children() {
|
|
111
|
+
return [
|
|
112
|
+
__alloy_js_core.code`writeLine(colors.text.body.secondary("The following commands are available:"));
|
|
113
|
+
writeLine(""); `,
|
|
114
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
115
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
116
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
117
|
+
get each() {
|
|
118
|
+
return Object.values(_self$.commands);
|
|
119
|
+
},
|
|
120
|
+
doubleHardline: true,
|
|
121
|
+
joiner: __alloy_js_core.code`writeLine(""); `,
|
|
122
|
+
ender: __alloy_js_core.code`writeLine(""); `,
|
|
123
|
+
children: (child) => [
|
|
124
|
+
(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`
|
|
125
|
+
writeLine(colors.text.heading.primary("${child.title} ${child.isVirtual ? "" : "Command"}"));
|
|
126
|
+
writeLine("");
|
|
127
|
+
writeLine(colors.text.body.secondary("${child.description}"));
|
|
128
|
+
writeLine("");
|
|
129
|
+
`),
|
|
130
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
131
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_help.Help, {
|
|
132
|
+
command: child,
|
|
133
|
+
indent: 2
|
|
134
|
+
}),
|
|
135
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
136
|
+
]
|
|
137
|
+
}),
|
|
138
|
+
(0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`help("Running a specific command with the help flag (via: '${(0, __shell_shock_core_plugin_utils_context_helpers.getAppBin)(_self$)} <specific command> --help') will provide additional information that is specific to that command.");
|
|
139
|
+
writeLine("");`)
|
|
140
|
+
];
|
|
56
141
|
}
|
|
57
142
|
})
|
|
58
143
|
];
|
|
59
144
|
}
|
|
60
|
-
})
|
|
61
|
-
} }),
|
|
62
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
63
|
-
get each() {
|
|
64
|
-
return Object.values(commands);
|
|
65
|
-
},
|
|
66
|
-
children: (child) => (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
145
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
67
146
|
get when() {
|
|
68
|
-
return
|
|
69
|
-
},
|
|
70
|
-
get fallback() {
|
|
71
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_entry.CommandEntry, { command: child });
|
|
147
|
+
return Object.values(_self$.commands).length > 0;
|
|
72
148
|
},
|
|
73
149
|
get children() {
|
|
74
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(
|
|
150
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
151
|
+
get each() {
|
|
152
|
+
return Object.values(_self$.commands);
|
|
153
|
+
},
|
|
154
|
+
doubleHardline: true,
|
|
155
|
+
children: (child) => (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
156
|
+
get when() {
|
|
157
|
+
return child.isVirtual;
|
|
158
|
+
},
|
|
159
|
+
get fallback() {
|
|
160
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_entry.CommandEntry, { command: child });
|
|
161
|
+
},
|
|
162
|
+
get children() {
|
|
163
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_virtual_command_entry.VirtualCommandEntry, { command: child });
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
});
|
|
75
167
|
}
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_console_builtin.ConsoleBuiltin, {})
|
|
80
|
-
]);
|
|
168
|
+
})]);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
81
171
|
}
|
|
82
|
-
|
|
172
|
+
];
|
|
83
173
|
};
|
|
84
174
|
var src_default = plugin;
|
|
85
175
|
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAsCA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,gBAAA,GAAmB,gBAAnB,CAAA,CAAA,OAAA,CAAA,EAC7B,gBAD6B,EAAA,GA4HjC,MA5HiC,CA4H1B,QA5H0B,CAAA,EAAA"}
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAsCA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,gBAAA,GAAmB,gBAAnB,CAAA,CAAA,OAAA,CAAA,EAC7B,gBAD6B,EAAA,GA4HjC,MA5HiC,CA4H1B,QA5H0B,CAAA,EAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
import { BannerFunctionDeclaration } from "./components/banner.mjs";
|
|
2
|
+
import "./components/index.mjs";
|
|
1
3
|
import { getDefaultOptions } from "./helpers/get-default-options.mjs";
|
|
2
4
|
import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
|
|
3
5
|
import { For, Show, code } from "@alloy-js/core";
|
|
4
6
|
import { VarDeclaration } from "@alloy-js/typescript";
|
|
5
7
|
import { render } from "@powerlines/plugin-alloy/render";
|
|
6
|
-
import {
|
|
8
|
+
import { getAppBin } from "@shell-shock/core/plugin-utils/context-helpers";
|
|
7
9
|
import theme from "@shell-shock/plugin-theme";
|
|
8
10
|
import { BinEntry } from "@shell-shock/preset-script/components/bin-entry";
|
|
9
11
|
import { CommandEntry } from "@shell-shock/preset-script/components/command-entry";
|
|
10
12
|
import { CommandRouter } from "@shell-shock/preset-script/components/command-router";
|
|
11
13
|
import { ConsoleBuiltin } from "@shell-shock/preset-script/components/console-builtin";
|
|
14
|
+
import { Help, HelpOptions } from "@shell-shock/preset-script/components/help";
|
|
12
15
|
import { UtilsBuiltin } from "@shell-shock/preset-script/components/utils-builtin";
|
|
13
16
|
import { VirtualCommandEntry } from "@shell-shock/preset-script/components/virtual-command-entry";
|
|
14
17
|
|
|
@@ -17,66 +20,153 @@ import { VirtualCommandEntry } from "@shell-shock/preset-script/components/virtu
|
|
|
17
20
|
* The Shell Shock base plugin.
|
|
18
21
|
*/
|
|
19
22
|
const plugin = (options = {}) => {
|
|
20
|
-
return [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
return [
|
|
24
|
+
theme({ theme: options.theme }),
|
|
25
|
+
{
|
|
26
|
+
name: "shell-shock:cli-preset",
|
|
27
|
+
config() {
|
|
28
|
+
this.debug("Providing default configuration for the Shell Shock `cli` preset.");
|
|
29
|
+
return {
|
|
30
|
+
defaultOptions: getDefaultOptions,
|
|
31
|
+
isCaseSensitive: false,
|
|
32
|
+
...options
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
configResolved() {
|
|
36
|
+
this.dependencies.didyoumean2 = "^7.0.4";
|
|
37
|
+
},
|
|
38
|
+
async prepare() {
|
|
39
|
+
this.debug("Rendering built-in modules for the Shell Shock `cli` preset.");
|
|
40
|
+
return render(this, [createComponent(UtilsBuiltin, {}), createComponent(ConsoleBuiltin, { get banner() {
|
|
41
|
+
return createComponent(BannerFunctionDeclaration, {});
|
|
42
|
+
} })]);
|
|
43
|
+
}
|
|
29
44
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
45
|
+
{
|
|
46
|
+
name: "shell-shock:cli-preset:generate-entrypoint",
|
|
47
|
+
prepare: {
|
|
48
|
+
order: "post",
|
|
49
|
+
async handler() {
|
|
50
|
+
const _self$ = this;
|
|
51
|
+
this.debug("Rendering entrypoint modules for the Shell Shock `cli` preset.");
|
|
52
|
+
return render(this, [createComponent(BinEntry, {
|
|
53
|
+
builtinImports: {
|
|
54
|
+
console: [
|
|
55
|
+
"divider",
|
|
56
|
+
"writeLine",
|
|
57
|
+
"colors",
|
|
58
|
+
"banner",
|
|
59
|
+
"help"
|
|
60
|
+
],
|
|
61
|
+
utils: ["getArgs"]
|
|
39
62
|
},
|
|
40
63
|
get children() {
|
|
41
64
|
return [
|
|
42
|
-
createComponent(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
65
|
+
createComponent(Show, {
|
|
66
|
+
get when() {
|
|
67
|
+
return Object.keys(_self$.commands).length > 0;
|
|
68
|
+
},
|
|
69
|
+
get children() {
|
|
70
|
+
return [
|
|
71
|
+
createComponent(VarDeclaration, {
|
|
72
|
+
"const": true,
|
|
73
|
+
name: "args",
|
|
74
|
+
type: "string[]",
|
|
75
|
+
initializer: code`getArgs();`
|
|
76
|
+
}),
|
|
77
|
+
createIntrinsic("hbr", {}),
|
|
78
|
+
createComponent(CommandRouter, {
|
|
79
|
+
path: [],
|
|
80
|
+
get commands() {
|
|
81
|
+
return _self$.commands ?? {};
|
|
82
|
+
}
|
|
83
|
+
}),
|
|
84
|
+
createIntrinsic("hbr", {})
|
|
85
|
+
];
|
|
86
|
+
}
|
|
47
87
|
}),
|
|
48
88
|
createIntrinsic("hbr", {}),
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
89
|
+
code`
|
|
90
|
+
writeLine("");
|
|
91
|
+
banner();
|
|
92
|
+
writeLine(""); `,
|
|
93
|
+
createIntrinsic("hbr", {}),
|
|
94
|
+
createIntrinsic("hbr", {}),
|
|
95
|
+
code`writeLine(colors.text.heading.secondary("Global Options:"));`,
|
|
96
|
+
createIntrinsic("hbr", {}),
|
|
97
|
+
createComponent(HelpOptions, { get options() {
|
|
98
|
+
return _self$.options;
|
|
99
|
+
} }),
|
|
100
|
+
code`writeLine(""); `,
|
|
101
|
+
createIntrinsic("hbr", {}),
|
|
102
|
+
createIntrinsic("hbr", {}),
|
|
103
|
+
createComponent(Show, {
|
|
104
|
+
get when() {
|
|
105
|
+
return Object.keys(_self$.commands).length > 0;
|
|
106
|
+
},
|
|
107
|
+
get children() {
|
|
108
|
+
return [
|
|
109
|
+
code`writeLine(colors.text.body.secondary("The following commands are available:"));
|
|
110
|
+
writeLine(""); `,
|
|
111
|
+
createIntrinsic("hbr", {}),
|
|
112
|
+
createIntrinsic("hbr", {}),
|
|
113
|
+
createComponent(For, {
|
|
114
|
+
get each() {
|
|
115
|
+
return Object.values(_self$.commands);
|
|
116
|
+
},
|
|
117
|
+
doubleHardline: true,
|
|
118
|
+
joiner: code`writeLine(""); `,
|
|
119
|
+
ender: code`writeLine(""); `,
|
|
120
|
+
children: (child) => [
|
|
121
|
+
memo(() => code`
|
|
122
|
+
writeLine(colors.text.heading.primary("${child.title} ${child.isVirtual ? "" : "Command"}"));
|
|
123
|
+
writeLine("");
|
|
124
|
+
writeLine(colors.text.body.secondary("${child.description}"));
|
|
125
|
+
writeLine("");
|
|
126
|
+
`),
|
|
127
|
+
createIntrinsic("hbr", {}),
|
|
128
|
+
createComponent(Help, {
|
|
129
|
+
command: child,
|
|
130
|
+
indent: 2
|
|
131
|
+
}),
|
|
132
|
+
createIntrinsic("hbr", {})
|
|
133
|
+
]
|
|
134
|
+
}),
|
|
135
|
+
memo(() => code`help("Running a specific command with the help flag (via: '${getAppBin(_self$)} <specific command> --help') will provide additional information that is specific to that command.");
|
|
136
|
+
writeLine("");`)
|
|
137
|
+
];
|
|
53
138
|
}
|
|
54
139
|
})
|
|
55
140
|
];
|
|
56
141
|
}
|
|
57
|
-
})
|
|
58
|
-
} }),
|
|
59
|
-
createComponent(For, {
|
|
60
|
-
get each() {
|
|
61
|
-
return Object.values(commands);
|
|
62
|
-
},
|
|
63
|
-
children: (child) => createComponent(Show, {
|
|
142
|
+
}), createComponent(Show, {
|
|
64
143
|
get when() {
|
|
65
|
-
return
|
|
66
|
-
},
|
|
67
|
-
get fallback() {
|
|
68
|
-
return createComponent(CommandEntry, { command: child });
|
|
144
|
+
return Object.values(_self$.commands).length > 0;
|
|
69
145
|
},
|
|
70
146
|
get children() {
|
|
71
|
-
return createComponent(
|
|
147
|
+
return createComponent(For, {
|
|
148
|
+
get each() {
|
|
149
|
+
return Object.values(_self$.commands);
|
|
150
|
+
},
|
|
151
|
+
doubleHardline: true,
|
|
152
|
+
children: (child) => createComponent(Show, {
|
|
153
|
+
get when() {
|
|
154
|
+
return child.isVirtual;
|
|
155
|
+
},
|
|
156
|
+
get fallback() {
|
|
157
|
+
return createComponent(CommandEntry, { command: child });
|
|
158
|
+
},
|
|
159
|
+
get children() {
|
|
160
|
+
return createComponent(VirtualCommandEntry, { command: child });
|
|
161
|
+
}
|
|
162
|
+
})
|
|
163
|
+
});
|
|
72
164
|
}
|
|
73
|
-
})
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
createComponent(ConsoleBuiltin, {})
|
|
77
|
-
]);
|
|
165
|
+
})]);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
78
168
|
}
|
|
79
|
-
|
|
169
|
+
];
|
|
80
170
|
};
|
|
81
171
|
var src_default = plugin;
|
|
82
172
|
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","getAppBin","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","Help","HelpOptions","UtilsBuiltin","VirtualCommandEntry","BannerFunctionDeclaration","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","banner","order","handler","_self$","builtinImports","console","utils","children","when","Object","keys","commands","length","type","initializer","_$createIntrinsic","path","each","values","doubleHardline","joiner","ender","child","_$memo","title","isVirtual","description","command","indent","fallback"],"sources":["../src/index.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, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport { getAppBin } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport { BinEntry } from \"@shell-shock/preset-script/components/bin-entry\";\nimport { CommandEntry } from \"@shell-shock/preset-script/components/command-entry\";\nimport { CommandRouter } from \"@shell-shock/preset-script/components/command-router\";\nimport { ConsoleBuiltin } from \"@shell-shock/preset-script/components/console-builtin\";\nimport { Help, HelpOptions } from \"@shell-shock/preset-script/components/help\";\nimport { UtilsBuiltin } from \"@shell-shock/preset-script/components/utils-builtin\";\nimport { VirtualCommandEntry } from \"@shell-shock/preset-script/components/virtual-command-entry\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BannerFunctionDeclaration } from \"./components\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { CLIPresetContext, CLIPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <TContext extends CLIPresetContext = CLIPresetContext>(\n options: CLIPresetOptions = {}\n) => {\n return [\n theme({\n theme: options.theme\n }),\n {\n name: \"shell-shock:cli-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `cli` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n },\n configResolved() {\n this.dependencies.didyoumean2 = \"^7.0.4\";\n },\n async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `cli` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin banner={<BannerFunctionDeclaration />} />\n </>\n );\n }\n },\n {\n name: \"shell-shock:cli-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `cli` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\"divider\", \"writeLine\", \"colors\", \"banner\", \"help\"],\n utils: [\"getArgs\"]\n }}>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`getArgs();`}\n />\n <hbr />\n <CommandRouter path={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <hbr />\n {code`\n writeLine(\"\");\n banner();\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n {code`writeLine(colors.text.heading.secondary(\"Global Options:\"));`}\n <hbr />\n <HelpOptions options={this.options} />\n {code`writeLine(\"\"); `}\n <hbr />\n <hbr />\n <Show when={Object.keys(this.commands).length > 0}>\n {code`writeLine(colors.text.body.secondary(\"The following commands are available:\"));\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n <For\n each={Object.values(this.commands)}\n doubleHardline\n joiner={code`writeLine(\"\"); `}\n ender={code`writeLine(\"\"); `}>\n {child => (\n <>\n {code`\n writeLine(colors.text.heading.primary(\"${child.title} ${child.isVirtual ? \"\" : \"Command\"}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n `}\n <hbr />\n <Help command={child} indent={2} />\n <hbr />\n </>\n )}\n </For>\n {code`help(\"Running a specific command with the help flag (via: '${getAppBin(\n this\n )} <specific command> --help') will provide additional information that is specific to that command.\");\n writeLine(\"\");`}\n </Show>\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsCA,MAAaiB,UACXC,UAA4B,EAAE,KAC3B;AACH,QAAO;EACLZ,MAAM,EACJA,OAAOY,QAAQZ,OAChB,CAAC;EACF;GACEa,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,oEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEHM,iBAAiB;AACf,SAAKC,aAAaC,cAAc;;GAElC,MAAMC,UAAU;AACd,SAAKN,MACH,+DACD;AAED,WAAOjB,OACL,MAAI,CAAAwB,gBAEDf,cAAY,EAAA,CAAA,EAAAe,gBACZlB,gBAAc,EAAA,IAACmB,SAAM;AAAA,YAAAD,gBAAGb,2BAAyB,EAAA,CAAA;OAAA,CAAA,CAEtD,CAAC;;GAEJ;EACD;GACEI,MAAM;GACNQ,SAAS;IACPG,OAAO;IACP,MAAMC,UAAU;KAAA,MAAAC,SAAA;AACd,UAAKX,MACH,iEACD;AAED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gBAAc;YACdC,QAAQjD,IAAI;YACZkD,OAAOlD,IAAI;YAAiBoC,WAC3Be,UAAK;aAAAC,WAEDpD,IAAI;yDAC4BmD,MAAME,MAAK,GAAIF,MAAMG,YAAY,KAAK,UAAS;;wDAEhDH,MAAMI,YAAW;;kBAExD;aAAAX,gBAAA,OAAA,EAAA,CAAA;aAAAhB,gBAEQjB,MAAI;cAAC6C,SAASL;cAAOM,QAAQ;cAAC,CAAA;aAAAb,gBAAA,OAAA,EAAA,CAAA;aAAA;YAGlC,CAAA;WAAAQ,WAEFpD,IAAI,8DAA8DK,UAAS2B,OAE3E,CAAA;kCACc;WAAA;;SAAA,CAAA;QAAA;;MAAA,CAAA,EAAAJ,gBAGlB1B,MAAI;MAAA,IAACmC,OAAI;AAAA,cAAEC,OAAOS,OAAOf,OAAKQ,SAAS,CAACC,SAAS;;MAAC,IAAAL,WAAA;AAAA,cAAAR,gBAChD3B,KAAG;QAAA,IAAC6C,OAAI;AAAA,gBAAER,OAAOS,OAAOf,OAAKQ,SAAS;;QAAEQ,gBAAc;QAAAZ,WACpDe,UAAKvB,gBACH1B,MAAI;SAAA,IACHmC,OAAI;AAAA,iBAAEc,MAAMG;;SAAS,IACrBI,WAAQ;AAAA,iBAAA9B,gBAAGpB,cAAY,EAACgD,SAASL,OAAK,CAAA;;SAAA,IAAAf,WAAA;AAAA,iBAAAR,gBACrCd,qBAAmB,EAAC0C,SAASL,OAAK,CAAA;;SAAA,CAAA;QAEtC,CAAA;;MAAA,CAAA,CAIT,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAelC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/preset-cli",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Shell Shock plugin to generate source code given a list design tokens.",
|
|
6
6
|
"repository": {
|
|
@@ -127,16 +127,16 @@
|
|
|
127
127
|
"@powerlines/deepkit": "^0.6.47",
|
|
128
128
|
"@powerlines/plugin-alloy": "^0.20.10",
|
|
129
129
|
"@powerlines/plugin-plugin": "^0.12.218",
|
|
130
|
-
"@shell-shock/core": "^0.4.
|
|
131
|
-
"@shell-shock/plugin-theme": "^0.0.
|
|
132
|
-
"@shell-shock/preset-script": "^0.3.
|
|
130
|
+
"@shell-shock/core": "^0.4.4",
|
|
131
|
+
"@shell-shock/plugin-theme": "^0.0.12",
|
|
132
|
+
"@shell-shock/preset-script": "^0.3.2",
|
|
133
133
|
"@stryke/string-format": "^0.13.7",
|
|
134
134
|
"cfonts": "^3.3.1",
|
|
135
135
|
"powerlines": "^0.38.34"
|
|
136
136
|
},
|
|
137
137
|
"devDependencies": {
|
|
138
138
|
"@babel/core": "^7.29.0",
|
|
139
|
-
"@types/node": "^22.19.
|
|
139
|
+
"@types/node": "^22.19.9",
|
|
140
140
|
"@types/react": "^19.2.13"
|
|
141
141
|
},
|
|
142
142
|
"publishConfig": {
|
|
@@ -163,5 +163,5 @@
|
|
|
163
163
|
}
|
|
164
164
|
},
|
|
165
165
|
"types": "./dist/index.d.cts",
|
|
166
|
-
"gitHead": "
|
|
166
|
+
"gitHead": "2905cdd0c86c5c4f8b4205e82fd180ee0b97351e"
|
|
167
167
|
}
|