@shell-shock/preset-cli 0.9.20 → 0.9.22
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/dist/_virtual/_rolldown/runtime.cjs +29 -1
- package/dist/components/banner-builtin.cjs +93 -5
- package/dist/components/banner-builtin.mjs +90 -5
- package/dist/components/banner-builtin.mjs.map +1 -1
- package/dist/components/command-entry.cjs +359 -56
- package/dist/components/command-entry.mjs +356 -56
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +60 -4
- package/dist/components/command-router.mjs +57 -4
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/index.cjs +15 -1
- package/dist/components/index.mjs +7 -1
- package/dist/components/upgrade-builtin.cjs +135 -14
- package/dist/components/upgrade-builtin.mjs +132 -14
- package/dist/components/upgrade-builtin.mjs.map +1 -1
- package/dist/components/virtual-command-entry.cjs +116 -1
- package/dist/components/virtual-command-entry.mjs +113 -1
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/helpers/get-global-options.cjs +39 -1
- package/dist/helpers/get-global-options.mjs +38 -1
- package/dist/helpers/get-global-options.mjs.map +1 -1
- package/dist/index.cjs +178 -1
- package/dist/index.mjs +169 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +21 -21
package/dist/index.cjs
CHANGED
|
@@ -1 +1,178 @@
|
|
|
1
|
-
Object.defineProperties(exports,
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_components_banner_builtin = require('./components/banner-builtin.cjs');
|
|
4
|
+
const require_components_command_router = require('./components/command-router.cjs');
|
|
5
|
+
const require_components_virtual_command_entry = require('./components/virtual-command-entry.cjs');
|
|
6
|
+
const require_components_command_entry = require('./components/command-entry.cjs');
|
|
7
|
+
const require_components_upgrade_builtin = require('./components/upgrade-builtin.cjs');
|
|
8
|
+
const require_get_global_options = require('./helpers/get-global-options.cjs');
|
|
9
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
10
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
11
|
+
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
12
|
+
let _powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy/core/components");
|
|
13
|
+
let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
|
|
14
|
+
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
15
|
+
let _shell_shock_plugin_changelog = require("@shell-shock/plugin-changelog");
|
|
16
|
+
_shell_shock_plugin_changelog = require_runtime.__toESM(_shell_shock_plugin_changelog);
|
|
17
|
+
let _shell_shock_plugin_completions = require("@shell-shock/plugin-completions");
|
|
18
|
+
_shell_shock_plugin_completions = require_runtime.__toESM(_shell_shock_plugin_completions);
|
|
19
|
+
let _shell_shock_plugin_console = require("@shell-shock/plugin-console");
|
|
20
|
+
_shell_shock_plugin_console = require_runtime.__toESM(_shell_shock_plugin_console);
|
|
21
|
+
let _shell_shock_plugin_help = require("@shell-shock/plugin-help");
|
|
22
|
+
_shell_shock_plugin_help = require_runtime.__toESM(_shell_shock_plugin_help);
|
|
23
|
+
let _shell_shock_plugin_prompts = require("@shell-shock/plugin-prompts");
|
|
24
|
+
_shell_shock_plugin_prompts = require_runtime.__toESM(_shell_shock_plugin_prompts);
|
|
25
|
+
let _shell_shock_plugin_upgrade = require("@shell-shock/plugin-upgrade");
|
|
26
|
+
_shell_shock_plugin_upgrade = require_runtime.__toESM(_shell_shock_plugin_upgrade);
|
|
27
|
+
let _shell_shock_preset_script_components_bin_entry = require("@shell-shock/preset-script/components/bin-entry");
|
|
28
|
+
|
|
29
|
+
//#region src/index.tsx
|
|
30
|
+
/**
|
|
31
|
+
* The Shell Shock CLI Preset plugin.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* This preset includes a set of built-in modules and commands to create a CLI application, as well as configuration options to customize the generated code. It also includes the `prompts` plugin to provide interactive prompts in the CLI application, and the `upgrade` plugin to manage upgrading the local application's version.
|
|
35
|
+
*/
|
|
36
|
+
const plugin = (options = {}) => {
|
|
37
|
+
return [
|
|
38
|
+
...(0, _shell_shock_plugin_console.default)(options),
|
|
39
|
+
...(0, _shell_shock_plugin_help.default)(options),
|
|
40
|
+
...(0, _shell_shock_plugin_prompts.default)(options),
|
|
41
|
+
...options.changelog !== false ? [(0, _shell_shock_plugin_changelog.default)(options.changelog)] : [],
|
|
42
|
+
...options.completions !== false ? (0, _shell_shock_plugin_completions.default)(options.completions) : [],
|
|
43
|
+
(0, _shell_shock_plugin_upgrade.default)(options),
|
|
44
|
+
{
|
|
45
|
+
name: "shell-shock:cli-preset",
|
|
46
|
+
config() {
|
|
47
|
+
this.debug("Providing default configuration for the Shell Shock `cli` preset.");
|
|
48
|
+
return {
|
|
49
|
+
globalOptions: require_get_global_options.getGlobalOptions,
|
|
50
|
+
isCaseSensitive: false,
|
|
51
|
+
...options,
|
|
52
|
+
env: {
|
|
53
|
+
types: "@shell-shock/plugin-upgrade/types/env#ShellShockUpgradeEnv",
|
|
54
|
+
validate: false
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
prepare: {
|
|
59
|
+
order: "post",
|
|
60
|
+
async handler() {
|
|
61
|
+
const _self$ = this;
|
|
62
|
+
this.debug("Rendering built-in modules.");
|
|
63
|
+
const commands = await (0, _shell_shock_core_plugin_utils.getCommandList)(this);
|
|
64
|
+
this.debug(`Rendering \`banner\` built-ins for each of the ${commands.length} command modules.`);
|
|
65
|
+
return (0, _powerlines_plugin_alloy_render.render)(this, [
|
|
66
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_upgrade_builtin.UpgradeBuiltin, {}),
|
|
67
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_banner_builtin.BannerBuiltin, { get command() {
|
|
68
|
+
return (0, _shell_shock_core_plugin_utils.computeBin)(_self$);
|
|
69
|
+
} }),
|
|
70
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
71
|
+
get each() {
|
|
72
|
+
return commands.sort((a, b) => a.name.localeCompare(b.name));
|
|
73
|
+
},
|
|
74
|
+
doubleHardline: true,
|
|
75
|
+
children: (command) => (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_banner_builtin.BannerBuiltin, { command })
|
|
76
|
+
})
|
|
77
|
+
]);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: "shell-shock:cli-preset:generate-entrypoint",
|
|
83
|
+
prepare: {
|
|
84
|
+
order: "post",
|
|
85
|
+
async handler() {
|
|
86
|
+
const _self$2 = this;
|
|
87
|
+
this.debug("Rendering entrypoint modules for the Shell Shock `cli` preset.");
|
|
88
|
+
return (0, _powerlines_plugin_alloy_render.render)(this, [(0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_preset_script_components_bin_entry.BinEntry, {
|
|
89
|
+
builtinImports: {
|
|
90
|
+
console: [
|
|
91
|
+
"info",
|
|
92
|
+
"debug",
|
|
93
|
+
"warn",
|
|
94
|
+
"help",
|
|
95
|
+
"error",
|
|
96
|
+
"cursor",
|
|
97
|
+
"divider",
|
|
98
|
+
"stripAnsi",
|
|
99
|
+
"writeLine",
|
|
100
|
+
"splitText"
|
|
101
|
+
],
|
|
102
|
+
utils: ["isMinimal", "isInteractive"],
|
|
103
|
+
state: ["useArgs", "isHelp"],
|
|
104
|
+
prompts: [
|
|
105
|
+
"text",
|
|
106
|
+
"numeric",
|
|
107
|
+
"toggle",
|
|
108
|
+
"select",
|
|
109
|
+
"confirm",
|
|
110
|
+
"isCancel"
|
|
111
|
+
],
|
|
112
|
+
env: ["env", "paths"],
|
|
113
|
+
upgrade: ["executeUpgrade"]
|
|
114
|
+
},
|
|
115
|
+
get children() {
|
|
116
|
+
return [
|
|
117
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
118
|
+
get when() {
|
|
119
|
+
return Object.keys(_self$2.commands).length > 0;
|
|
120
|
+
},
|
|
121
|
+
get children() {
|
|
122
|
+
return [
|
|
123
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
124
|
+
"let": true,
|
|
125
|
+
name: "args",
|
|
126
|
+
type: "string[]",
|
|
127
|
+
initializer: _alloy_js_core.code`useArgs();`
|
|
128
|
+
}),
|
|
129
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
130
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
|
|
131
|
+
segments: [],
|
|
132
|
+
get commands() {
|
|
133
|
+
return _self$2.commands ?? {};
|
|
134
|
+
}
|
|
135
|
+
}),
|
|
136
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
137
|
+
];
|
|
138
|
+
}
|
|
139
|
+
}),
|
|
140
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
141
|
+
_alloy_js_core.code`await showBanner(0);`,
|
|
142
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
|
|
143
|
+
_alloy_js_core.code`return showHelp(); `
|
|
144
|
+
];
|
|
145
|
+
}
|
|
146
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
147
|
+
get when() {
|
|
148
|
+
return Object.values(_self$2.commands).length > 0;
|
|
149
|
+
},
|
|
150
|
+
get children() {
|
|
151
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
152
|
+
get each() {
|
|
153
|
+
return Object.values(_self$2.commands);
|
|
154
|
+
},
|
|
155
|
+
doubleHardline: true,
|
|
156
|
+
children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
157
|
+
get when() {
|
|
158
|
+
return child.isVirtual;
|
|
159
|
+
},
|
|
160
|
+
get fallback() {
|
|
161
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
|
|
162
|
+
},
|
|
163
|
+
get children() {
|
|
164
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_virtual_command_entry.VirtualCommandEntry, { command: child });
|
|
165
|
+
}
|
|
166
|
+
})
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
})]);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
];
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
//#endregion
|
|
177
|
+
exports.default = plugin;
|
|
178
|
+
exports.plugin = plugin;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,170 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BannerBuiltin } from "./components/banner-builtin.mjs";
|
|
2
|
+
import { CommandRouter } from "./components/command-router.mjs";
|
|
3
|
+
import { VirtualCommandEntry } from "./components/virtual-command-entry.mjs";
|
|
4
|
+
import { CommandEntry } from "./components/command-entry.mjs";
|
|
5
|
+
import { UpgradeBuiltin } from "./components/upgrade-builtin.mjs";
|
|
6
|
+
import { getGlobalOptions } from "./helpers/get-global-options.mjs";
|
|
7
|
+
import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
|
|
8
|
+
import { For, Show, code } from "@alloy-js/core";
|
|
9
|
+
import { VarDeclaration } from "@alloy-js/typescript";
|
|
10
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components";
|
|
11
|
+
import { render } from "@powerlines/plugin-alloy/render";
|
|
12
|
+
import { computeBin, getCommandList } from "@shell-shock/core/plugin-utils";
|
|
13
|
+
import changelog from "@shell-shock/plugin-changelog";
|
|
14
|
+
import completions from "@shell-shock/plugin-completions";
|
|
15
|
+
import console from "@shell-shock/plugin-console";
|
|
16
|
+
import help from "@shell-shock/plugin-help";
|
|
17
|
+
import prompts from "@shell-shock/plugin-prompts";
|
|
18
|
+
import upgrade from "@shell-shock/plugin-upgrade";
|
|
19
|
+
import { BinEntry } from "@shell-shock/preset-script/components/bin-entry";
|
|
20
|
+
|
|
21
|
+
//#region src/index.tsx
|
|
22
|
+
/**
|
|
23
|
+
* The Shell Shock CLI Preset plugin.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* This preset includes a set of built-in modules and commands to create a CLI application, as well as configuration options to customize the generated code. It also includes the `prompts` plugin to provide interactive prompts in the CLI application, and the `upgrade` plugin to manage upgrading the local application's version.
|
|
27
|
+
*/
|
|
28
|
+
const plugin = (options = {}) => {
|
|
29
|
+
return [
|
|
30
|
+
...console(options),
|
|
31
|
+
...help(options),
|
|
32
|
+
...prompts(options),
|
|
33
|
+
...options.changelog !== false ? [changelog(options.changelog)] : [],
|
|
34
|
+
...options.completions !== false ? completions(options.completions) : [],
|
|
35
|
+
upgrade(options),
|
|
36
|
+
{
|
|
37
|
+
name: "shell-shock:cli-preset",
|
|
38
|
+
config() {
|
|
39
|
+
this.debug("Providing default configuration for the Shell Shock `cli` preset.");
|
|
40
|
+
return {
|
|
41
|
+
globalOptions: getGlobalOptions,
|
|
42
|
+
isCaseSensitive: false,
|
|
43
|
+
...options,
|
|
44
|
+
env: {
|
|
45
|
+
types: "@shell-shock/plugin-upgrade/types/env#ShellShockUpgradeEnv",
|
|
46
|
+
validate: false
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
prepare: {
|
|
51
|
+
order: "post",
|
|
52
|
+
async handler() {
|
|
53
|
+
const _self$ = this;
|
|
54
|
+
this.debug("Rendering built-in modules.");
|
|
55
|
+
const commands = await getCommandList(this);
|
|
56
|
+
this.debug(`Rendering \`banner\` built-ins for each of the ${commands.length} command modules.`);
|
|
57
|
+
return render(this, [
|
|
58
|
+
createComponent(UpgradeBuiltin, {}),
|
|
59
|
+
createComponent(BannerBuiltin, { get command() {
|
|
60
|
+
return computeBin(_self$);
|
|
61
|
+
} }),
|
|
62
|
+
createComponent(For, {
|
|
63
|
+
get each() {
|
|
64
|
+
return commands.sort((a, b) => a.name.localeCompare(b.name));
|
|
65
|
+
},
|
|
66
|
+
doubleHardline: true,
|
|
67
|
+
children: (command) => createComponent(BannerBuiltin, { command })
|
|
68
|
+
})
|
|
69
|
+
]);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "shell-shock:cli-preset:generate-entrypoint",
|
|
75
|
+
prepare: {
|
|
76
|
+
order: "post",
|
|
77
|
+
async handler() {
|
|
78
|
+
const _self$2 = this;
|
|
79
|
+
this.debug("Rendering entrypoint modules for the Shell Shock `cli` preset.");
|
|
80
|
+
return render(this, [createComponent(BinEntry, {
|
|
81
|
+
builtinImports: {
|
|
82
|
+
console: [
|
|
83
|
+
"info",
|
|
84
|
+
"debug",
|
|
85
|
+
"warn",
|
|
86
|
+
"help",
|
|
87
|
+
"error",
|
|
88
|
+
"cursor",
|
|
89
|
+
"divider",
|
|
90
|
+
"stripAnsi",
|
|
91
|
+
"writeLine",
|
|
92
|
+
"splitText"
|
|
93
|
+
],
|
|
94
|
+
utils: ["isMinimal", "isInteractive"],
|
|
95
|
+
state: ["useArgs", "isHelp"],
|
|
96
|
+
prompts: [
|
|
97
|
+
"text",
|
|
98
|
+
"numeric",
|
|
99
|
+
"toggle",
|
|
100
|
+
"select",
|
|
101
|
+
"confirm",
|
|
102
|
+
"isCancel"
|
|
103
|
+
],
|
|
104
|
+
env: ["env", "paths"],
|
|
105
|
+
upgrade: ["executeUpgrade"]
|
|
106
|
+
},
|
|
107
|
+
get children() {
|
|
108
|
+
return [
|
|
109
|
+
createComponent(Show, {
|
|
110
|
+
get when() {
|
|
111
|
+
return Object.keys(_self$2.commands).length > 0;
|
|
112
|
+
},
|
|
113
|
+
get children() {
|
|
114
|
+
return [
|
|
115
|
+
createComponent(VarDeclaration, {
|
|
116
|
+
"let": true,
|
|
117
|
+
name: "args",
|
|
118
|
+
type: "string[]",
|
|
119
|
+
initializer: code`useArgs();`
|
|
120
|
+
}),
|
|
121
|
+
createIntrinsic("hbr", {}),
|
|
122
|
+
createComponent(CommandRouter, {
|
|
123
|
+
segments: [],
|
|
124
|
+
get commands() {
|
|
125
|
+
return _self$2.commands ?? {};
|
|
126
|
+
}
|
|
127
|
+
}),
|
|
128
|
+
createIntrinsic("hbr", {})
|
|
129
|
+
];
|
|
130
|
+
}
|
|
131
|
+
}),
|
|
132
|
+
createIntrinsic("hbr", {}),
|
|
133
|
+
code`await showBanner(0);`,
|
|
134
|
+
createComponent(Spacing, {}),
|
|
135
|
+
code`return showHelp(); `
|
|
136
|
+
];
|
|
137
|
+
}
|
|
138
|
+
}), createComponent(Show, {
|
|
139
|
+
get when() {
|
|
140
|
+
return Object.values(_self$2.commands).length > 0;
|
|
141
|
+
},
|
|
142
|
+
get children() {
|
|
143
|
+
return createComponent(For, {
|
|
144
|
+
get each() {
|
|
145
|
+
return Object.values(_self$2.commands);
|
|
146
|
+
},
|
|
147
|
+
doubleHardline: true,
|
|
148
|
+
children: (child) => createComponent(Show, {
|
|
149
|
+
get when() {
|
|
150
|
+
return child.isVirtual;
|
|
151
|
+
},
|
|
152
|
+
get fallback() {
|
|
153
|
+
return createComponent(CommandEntry, { command: child });
|
|
154
|
+
},
|
|
155
|
+
get children() {
|
|
156
|
+
return createComponent(VirtualCommandEntry, { command: child });
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
})]);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
];
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
//#endregion
|
|
169
|
+
export { plugin as default, plugin };
|
|
2
170
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"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 { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport { computeBin, getCommandList } from \"@shell-shock/core/plugin-utils\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport changelog from \"@shell-shock/plugin-changelog\";\nimport completions from \"@shell-shock/plugin-completions\";\nimport console from \"@shell-shock/plugin-console\";\nimport help from \"@shell-shock/plugin-help\";\nimport prompts from \"@shell-shock/plugin-prompts\";\nimport upgrade from \"@shell-shock/plugin-upgrade\";\nimport { BinEntry } from \"@shell-shock/preset-script/components/bin-entry\";\nimport type { Plugin } from \"powerlines\";\nimport { BannerBuiltin } from \"./components/banner-builtin\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { UpgradeBuiltin } from \"./components/upgrade-builtin\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getGlobalOptions } from \"./helpers/get-global-options\";\nimport type { CLIPresetContext, CLIPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock CLI Preset plugin.\n *\n * @remarks\n * This preset includes a set of built-in modules and commands to create a CLI application, as well as configuration options to customize the generated code. It also includes the `prompts` plugin to provide interactive prompts in the CLI application, and the `upgrade` plugin to manage upgrading the local application's version.\n */\nexport const plugin = <TContext extends CLIPresetContext = CLIPresetContext>(\n options: CLIPresetOptions = {}\n): Plugin<TContext>[] => {\n return [\n ...console<TContext>(options),\n ...help<TContext>(options),\n ...prompts<TContext>(options),\n ...(options.changelog !== false\n ? [changelog<TContext>(options.changelog)]\n : []),\n ...(options.completions !== false\n ? completions<TContext>(options.completions)\n : []),\n upgrade<TContext>(options),\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 globalOptions: getGlobalOptions,\n isCaseSensitive: false,\n ...options,\n env: {\n types
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"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 { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport { computeBin, getCommandList } from \"@shell-shock/core/plugin-utils\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport changelog from \"@shell-shock/plugin-changelog\";\nimport completions from \"@shell-shock/plugin-completions\";\nimport console from \"@shell-shock/plugin-console\";\nimport help from \"@shell-shock/plugin-help\";\nimport prompts from \"@shell-shock/plugin-prompts\";\nimport upgrade from \"@shell-shock/plugin-upgrade\";\nimport { BinEntry } from \"@shell-shock/preset-script/components/bin-entry\";\nimport type { Plugin } from \"powerlines\";\nimport { BannerBuiltin } from \"./components/banner-builtin\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { UpgradeBuiltin } from \"./components/upgrade-builtin\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getGlobalOptions } from \"./helpers/get-global-options\";\nimport type { CLIPresetContext, CLIPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock CLI Preset plugin.\n *\n * @remarks\n * This preset includes a set of built-in modules and commands to create a CLI application, as well as configuration options to customize the generated code. It also includes the `prompts` plugin to provide interactive prompts in the CLI application, and the `upgrade` plugin to manage upgrading the local application's version.\n */\nexport const plugin = <TContext extends CLIPresetContext = CLIPresetContext>(\n options: CLIPresetOptions = {}\n): Plugin<TContext>[] => {\n return [\n ...console<TContext>(options),\n ...help<TContext>(options),\n ...prompts<TContext>(options),\n ...(options.changelog !== false\n ? [changelog<TContext>(options.changelog)]\n : []),\n ...(options.completions !== false\n ? completions<TContext>(options.completions)\n : []),\n upgrade<TContext>(options),\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 globalOptions: getGlobalOptions,\n isCaseSensitive: false,\n ...options,\n env: {\n types: \"@shell-shock/plugin-upgrade/types/env#ShellShockUpgradeEnv\",\n validate: false\n }\n };\n },\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\"Rendering built-in modules.\");\n\n const commands = await getCommandList(this);\n this.debug(\n `Rendering \\`banner\\` built-ins for each of the ${\n commands.length\n } command modules.`\n );\n\n return render(\n this,\n <>\n <UpgradeBuiltin />\n <BannerBuiltin command={computeBin(this)} />\n <For\n each={commands.sort((a, b) => a.name.localeCompare(b.name))}\n doubleHardline>\n {command => <BannerBuiltin command={command} />}\n </For>\n </>\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: [\n \"info\",\n \"debug\",\n \"warn\",\n \"help\",\n \"error\",\n \"cursor\",\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\"\n ],\n utils: [\"isMinimal\", \"isInteractive\"],\n state: [\"useArgs\", \"isHelp\"],\n prompts: [\n \"text\",\n \"numeric\",\n \"toggle\",\n \"select\",\n \"confirm\",\n \"isCancel\"\n ],\n env: [\"env\", \"paths\"],\n upgrade: [\"executeUpgrade\"]\n }}>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n let\n name=\"args\"\n type=\"string[]\"\n initializer={code`useArgs();`}\n />\n <hbr />\n <CommandRouter segments={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <hbr />\n {code`await showBanner(0);`}\n <Spacing />\n {code`return showHelp(); `}\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For\n each={Object.values(\n this.commands as Record<string, CommandTree>\n )}\n 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 ];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAI,UAAA,UAAA,EAAA,KAAA;AACF,QAAM;EAAA,GAAA,QAAO,QAAc;EAAC,GAAG,KAAM,QAAG;EAAO,GAAC,QAAI,QAAY;EAAA,GAAQ,QAAK,cAAgB,QAAQ,CAAA,UAAA,QAAc,UAAW,CAAA,GAAS,EAAC;EAAI,GAAA,QAAU,gBAAc,QAAY,YAAW,QAAS,YAAS,GAAA,EAAA;EAAW,QAAQ,QAAQ;EAAA;GACxO,MAAA;GACF,SAAa;AACX,SAAS,MAAA,oEAAoB;AAC5B,WAAO;KACF,eAAC;KACF,iBAAkB;KAClB,GAAI;KACJ,KAAA;MACC,OAAQ;MACP,UAAU;MACV;KACF;;GAEH,SAAO;IACP,OAAQ;IACR,MAAA,UAAA;KACE,MAAO,SAAM;AACb,UAAO,MAAE,8BAAA;KACP,MAAK,WAAK,MAAA,eAAA,KAAA;AACV,UAAG,MAAA,kDAA0D,SAAO,OAAA,mBAAA;AACpE,YAAC,OAAA,MAAA;MAAA,gBAAA,gBAAA,EAAA,CAAA;MAAA,gBAAA,eAAA;AAED,cAAO,WAAA,OAAA;SAEN,CAAC;MAAA,gBAAiB,KAAK;OACtB,IAAG,OAAO;AACV,eAAK,SAAA,MAAA,GAAA,MAAA,EAAA,KAAA,cAAA,EAAA,KAAA,CAAA;;OAEL,gBAAY;OACZ,WAAA,YAAA,gBAAA,eAAA,EACD,SACF,CAAA;OACD,CAAA;MAAA,CAAA;;IAED;GACF;EAAE;;GAED,SAAM;IACJ,OAAI;IACJ,MAAM,UAAU;KACd,MAAM,UAAS;AACf,UAAK,MAAC,iEAAgB;AACtB,YAAG,OAAA,MAAA,CAAA,gBAAA,UAAA;;OAED,SAAO;QAAA;QAAM;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;OACX,OAAI,CAAA,aAAA,gBAAA;OACJ,OAAC,CAAA,WAAA,SAAA;OACD,SAAG;QAAA;QAAe;QAAC;QAAA;QAAA;QAAA;QAAA;OACnB,KAAG,CAAA,OAAA,QAAc;OACjB,SAAG,CAAA,iBAAA;OACJ;MACD,IAAI,WAAE;AACJ,cAAK;QAAA,gBAAY,MAAc;SAC7B,IAAE,OAAG;AACL,iBAAA,OAAA,KAAA,QAAA,SAAA,CAAA,SAAA;;SAEN,IAAA,WAAA;AACF,iBAAA;WAAA,gBAAA,gBAAA;YACD,OAAA;YACD,MAAA;YACc,MAAM;YACT,aAAA,IAAA;YACC,CAAA;WAAI,gBAAC,OAAA,EAAA,CAAA;WAAA,gBAAA,eAAA;YACP,UAAU,EAAA;YACT,IAAK,WAAA;AACP,oBAAU,QAAW,YAAY,EAAG;;;;;;SAIrC,CAAA;QAAI,gBAAA,OAAA,EAAA,CAAA;QAAA,IAAA;QAAA,gBAAA,SAAA,EAAA,CAAA;QAAA,IAAA;QAAA;;MAEP,CAAC,EAAE,gBAAG,MAAA;MACL,IAAI,OAAE;AACJ,cAAM,OAAQ,OAAC,QAAA,SAAA,CAAA,SAAA;;MAEjB,IAAI,WAAO;AACT,cAAO,gBAAO,KAAA;QACZ,IAAI,OAAO;AACT,gBAAK,OAAM,OAAA,QAAA,SAAA;;QAEb,gBAAe;QACf,WAAO,UAAU,gBAAA,MAAA;SACf,IAAI,OAAC;AACH,iBAAG,MAAS;;SAEd,IAAE,WAAS;AACT,iBAAO,gBAAa,cAAQ,EAC5B,SAAS,OACR,CAAC;;SAEJ,IAAI,WAAQ;AACV,iBAAG,gBAAO,qBAAA,EACR,SAAS,OACV,CAAC;;SAEL,CAAC;QACH,CAAC;;MAEL,CAAC,CAAC,CAAC;;IAEP;GACF;EAAC"}
|
package/dist/types/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/dist/types/plugin.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/preset-cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.22",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing a Shell Shock plugin to generate source code given a list design tokens.",
|
|
6
6
|
"keywords": [
|
|
@@ -181,28 +181,28 @@
|
|
|
181
181
|
"dependencies": {
|
|
182
182
|
"@alloy-js/core": "0.23.0-dev.8",
|
|
183
183
|
"@alloy-js/typescript": "0.23.0-dev.4",
|
|
184
|
-
"@powerlines/deepkit": "^0.8.
|
|
185
|
-
"@powerlines/plugin-alloy": "^0.26.
|
|
186
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
187
|
-
"@shell-shock/core": "^0.17.
|
|
188
|
-
"@shell-shock/plugin-banner": "^0.1.
|
|
189
|
-
"@shell-shock/plugin-changelog": "^0.1.
|
|
190
|
-
"@shell-shock/plugin-completions": "^0.4.
|
|
191
|
-
"@shell-shock/plugin-console": "^0.2.
|
|
192
|
-
"@shell-shock/plugin-help": "^0.2.
|
|
193
|
-
"@shell-shock/plugin-prompts": "^0.3.
|
|
194
|
-
"@shell-shock/plugin-theme": "^0.4.
|
|
195
|
-
"@shell-shock/plugin-upgrade": "^0.1.
|
|
196
|
-
"@shell-shock/preset-script": "^0.6.
|
|
197
|
-
"@stryke/path": "^0.28.
|
|
198
|
-
"@stryke/string-format": "^0.17.
|
|
199
|
-
"@stryke/type-checks": "^0.6.
|
|
200
|
-
"@stryke/types": "^0.
|
|
184
|
+
"@powerlines/deepkit": "^0.8.64",
|
|
185
|
+
"@powerlines/plugin-alloy": "^0.26.84",
|
|
186
|
+
"@powerlines/plugin-plugin": "^0.12.416",
|
|
187
|
+
"@shell-shock/core": "^0.17.10",
|
|
188
|
+
"@shell-shock/plugin-banner": "^0.1.37",
|
|
189
|
+
"@shell-shock/plugin-changelog": "^0.1.13",
|
|
190
|
+
"@shell-shock/plugin-completions": "^0.4.18",
|
|
191
|
+
"@shell-shock/plugin-console": "^0.2.14",
|
|
192
|
+
"@shell-shock/plugin-help": "^0.2.28",
|
|
193
|
+
"@shell-shock/plugin-prompts": "^0.3.51",
|
|
194
|
+
"@shell-shock/plugin-theme": "^0.4.23",
|
|
195
|
+
"@shell-shock/plugin-upgrade": "^0.1.55",
|
|
196
|
+
"@shell-shock/preset-script": "^0.6.65",
|
|
197
|
+
"@stryke/path": "^0.28.2",
|
|
198
|
+
"@stryke/string-format": "^0.17.13",
|
|
199
|
+
"@stryke/type-checks": "^0.6.5",
|
|
200
|
+
"@stryke/types": "^0.12.0",
|
|
201
201
|
"cfonts": "^3.3.1",
|
|
202
202
|
"defu": "^6.1.7",
|
|
203
|
-
"powerlines": "^0.
|
|
203
|
+
"powerlines": "^0.47.4"
|
|
204
204
|
},
|
|
205
|
-
"devDependencies": { "@stryke/types": "^0.
|
|
205
|
+
"devDependencies": { "@stryke/types": "^0.12.0", "@types/node": "^25.6.0" },
|
|
206
206
|
"publishConfig": { "access": "public" },
|
|
207
|
-
"gitHead": "
|
|
207
|
+
"gitHead": "7b4030fd6be000c960e8cc4c4f7b4db205054e69"
|
|
208
208
|
}
|