@shell-shock/preset-cli 0.3.0 → 0.4.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-function-declaration.cjs +11 -2
- package/dist/components/banner-function-declaration.d.cts +2 -2
- package/dist/components/banner-function-declaration.d.mts +2 -2
- package/dist/components/banner-function-declaration.mjs +12 -3
- package/dist/components/banner-function-declaration.mjs.map +1 -1
- package/dist/components/command-entry.cjs +45 -59
- package/dist/components/command-entry.d.cts +2 -2
- package/dist/components/command-entry.d.cts.map +1 -1
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +45 -59
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +24 -32
- package/dist/components/command-router.d.cts.map +1 -1
- package/dist/components/command-router.d.mts.map +1 -1
- package/dist/components/command-router.mjs +25 -33
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/index.cjs +11 -0
- package/dist/components/index.d.cts +3 -1
- package/dist/components/index.d.mts +3 -1
- package/dist/components/index.mjs +3 -1
- package/dist/components/prompts-builtin.cjs +2284 -0
- package/dist/components/prompts-builtin.d.cts +36 -0
- package/dist/components/prompts-builtin.d.cts.map +1 -0
- package/dist/components/prompts-builtin.d.mts +36 -0
- package/dist/components/prompts-builtin.d.mts.map +1 -0
- package/dist/components/prompts-builtin.mjs +2277 -0
- package/dist/components/prompts-builtin.mjs.map +1 -0
- package/dist/components/virtual-command-entry.cjs +8 -6
- package/dist/components/virtual-command-entry.d.cts +2 -2
- package/dist/components/virtual-command-entry.d.cts.map +1 -1
- package/dist/components/virtual-command-entry.d.mts +2 -2
- package/dist/components/virtual-command-entry.d.mts.map +1 -1
- package/dist/components/virtual-command-entry.mjs +8 -6
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/helpers/get-default-options.cjs +2 -2
- package/dist/helpers/get-default-options.mjs +2 -2
- package/dist/helpers/get-default-options.mjs.map +1 -1
- package/dist/index.cjs +16 -25
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +16 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +29 -15
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,8 @@ import { BannerFunctionDeclaration } from "./components/banner-function-declarat
|
|
|
2
2
|
import { CommandRouter } from "./components/command-router.mjs";
|
|
3
3
|
import { VirtualCommandEntry } from "./components/virtual-command-entry.mjs";
|
|
4
4
|
import { CommandEntry } from "./components/command-entry.mjs";
|
|
5
|
+
import { PromptsBuiltin } from "./components/prompts-builtin.mjs";
|
|
6
|
+
import "./components/index.mjs";
|
|
5
7
|
import { getDefaultOptions } from "./helpers/get-default-options.mjs";
|
|
6
8
|
import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
|
|
7
9
|
import { For, Show, code } from "@alloy-js/core";
|
|
@@ -32,27 +34,14 @@ const plugin = (options = {}) => {
|
|
|
32
34
|
},
|
|
33
35
|
configResolved() {
|
|
34
36
|
this.dependencies.didyoumean2 = "^7.0.4";
|
|
35
|
-
this.dependencies["@clack/prompts"] = "^1.0.0";
|
|
36
37
|
},
|
|
37
38
|
async prepare() {
|
|
38
39
|
this.debug("Rendering built-in modules for the Shell Shock `cli` preset.");
|
|
39
|
-
return render(this, [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
confirm,
|
|
45
|
-
select,
|
|
46
|
-
text,
|
|
47
|
-
multiselect,
|
|
48
|
-
password,
|
|
49
|
-
progress,
|
|
50
|
-
spinner,
|
|
51
|
-
intro,
|
|
52
|
-
outro
|
|
53
|
-
} from "@clack/prompts";
|
|
54
|
-
|
|
55
|
-
` })]);
|
|
40
|
+
return render(this, [
|
|
41
|
+
createComponent(UtilsBuiltin, {}),
|
|
42
|
+
createComponent(ConsoleBuiltin, {}),
|
|
43
|
+
createComponent(PromptsBuiltin, {})
|
|
44
|
+
]);
|
|
56
45
|
}
|
|
57
46
|
},
|
|
58
47
|
{
|
|
@@ -73,11 +62,7 @@ export {
|
|
|
73
62
|
"help",
|
|
74
63
|
"writeLine",
|
|
75
64
|
"splitText",
|
|
76
|
-
"stripAnsi"
|
|
77
|
-
"intro",
|
|
78
|
-
"outro",
|
|
79
|
-
"select",
|
|
80
|
-
"isCancel"
|
|
65
|
+
"stripAnsi"
|
|
81
66
|
],
|
|
82
67
|
utils: [
|
|
83
68
|
"useApp",
|
|
@@ -85,6 +70,13 @@ export {
|
|
|
85
70
|
"isMinimal",
|
|
86
71
|
"isInteractive",
|
|
87
72
|
"isHelp"
|
|
73
|
+
],
|
|
74
|
+
prompts: [
|
|
75
|
+
"text",
|
|
76
|
+
"toggle",
|
|
77
|
+
"select",
|
|
78
|
+
"isCancel",
|
|
79
|
+
"sleep"
|
|
88
80
|
]
|
|
89
81
|
},
|
|
90
82
|
get prefix() {
|
|
@@ -120,8 +112,7 @@ export {
|
|
|
120
112
|
}
|
|
121
113
|
}),
|
|
122
114
|
createIntrinsic("hbr", {}),
|
|
123
|
-
code`
|
|
124
|
-
banner();`,
|
|
115
|
+
code`await banner(0);`,
|
|
125
116
|
createIntrinsic("hbr", {}),
|
|
126
117
|
createIntrinsic("hbr", {}),
|
|
127
118
|
createComponent(VirtualHelp, {
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","theme","BinEntry","ConsoleBuiltin","VirtualHelp","UtilsBuiltin","BannerFunctionDeclaration","CommandEntry","CommandRouter","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","theme","BinEntry","ConsoleBuiltin","VirtualHelp","UtilsBuiltin","PromptsBuiltin","BannerFunctionDeclaration","CommandEntry","CommandRouter","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","order","handler","_self$","builtinImports","console","utils","prompts","prefix","_$createIntrinsic","children","when","Object","keys","commands","length","type","initializer","segments","values","each","doubleHardline","child","isVirtual","fallback","command"],"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 theme from \"@shell-shock/plugin-theme\";\nimport { BinEntry } from \"@shell-shock/preset-script/components/bin-entry\";\nimport { ConsoleBuiltin } from \"@shell-shock/preset-script/components/console-builtin\";\nimport { VirtualHelp } from \"@shell-shock/preset-script/components/help\";\nimport { UtilsBuiltin } from \"@shell-shock/preset-script/components/utils-builtin\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { PromptsBuiltin } from \"./components\";\nimport { BannerFunctionDeclaration } from \"./components/banner-function-declaration\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\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 />\n <PromptsBuiltin />\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 \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\",\n \"help\",\n \"writeLine\",\n \"splitText\",\n \"stripAnsi\"\n ],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"isMinimal\",\n \"isInteractive\",\n \"isHelp\"\n ],\n prompts: [\"text\", \"toggle\", \"select\", \"isCancel\", \"sleep\"]\n }}\n prefix={\n <>\n <BannerFunctionDeclaration />\n <hbr />\n <hbr />\n </>\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 banner(0);`}\n <hbr />\n <hbr />\n <VirtualHelp\n options={this.options}\n commands={this.commands ?? {}}\n />\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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AA,EAAA,CAAA;WAAAT,gBAG9Bd,eAAa;YAACgC,UAAU,EAAE;YAAA,IAAEJ,WAAQ;AAAA,oBAAEX,OAAKW,YAAY,EAAE;;YAAA,CAAA;WAAAL,gBAAA,OAAA,EAAA,CAAA;WAAA;;SAAA,CAAA;QAAAA,gBAAA,OAAA,EAAA,CAAA;QAI3DpC,IAAI;QAAkBoC,gBAAA,OAAA,EAAA,CAAA;QAAAA,gBAAA,OAAA,EAAA,CAAA;QAAAT,gBAGtBnB,aAAW;SAAA,IACVS,UAAO;AAAA,iBAAEa,OAAKb;;SAAO,IACrBwB,WAAQ;AAAA,iBAAEX,OAAKW,YAAY,EAAE;;SAAA,CAAA;QAAA;;MAAA,CAAA,EAAAd,gBAGhCzB,MAAI;MAAA,IAACoC,OAAI;AAAA,cAAEC,OAAOO,OAAOhB,OAAKW,SAAS,CAACC,SAAS;;MAAC,IAAAL,WAAA;AAAA,cAAAV,gBAChD1B,KAAG;QAAA,IAAC8C,OAAI;AAAA,gBAAER,OAAOO,OAAOhB,OAAKW,SAAS;;QAAEO,gBAAc;QAAAX,WACpDY,UAAKtB,gBACHzB,MAAI;SAAA,IACHoC,OAAI;AAAA,iBAAEW,MAAMC;;SAAS,IACrBC,WAAQ;AAAA,iBAAAxB,gBAAGf,cAAY,EAACwC,SAASH,OAAK,CAAA;;SAAA,IAAAZ,WAAA;AAAA,iBAAAV,gBACrCb,qBAAmB,EAACsC,SAASH,OAAK,CAAA;;SAAA,CAAA;QAEtC,CAAA;;MAAA,CAAA,CAIT,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAejC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/preset-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.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": {
|
|
@@ -111,6 +111,20 @@
|
|
|
111
111
|
"default": "./dist/components/command-router.mjs"
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
|
+
"./components/prompts-builtin": {
|
|
115
|
+
"require": {
|
|
116
|
+
"types": "./dist/components/prompts-builtin.d.cts",
|
|
117
|
+
"default": "./dist/components/prompts-builtin.cjs"
|
|
118
|
+
},
|
|
119
|
+
"import": {
|
|
120
|
+
"types": "./dist/components/prompts-builtin.d.mts",
|
|
121
|
+
"default": "./dist/components/prompts-builtin.mjs"
|
|
122
|
+
},
|
|
123
|
+
"default": {
|
|
124
|
+
"types": "./dist/components/prompts-builtin.d.mts",
|
|
125
|
+
"default": "./dist/components/prompts-builtin.mjs"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
114
128
|
"./components/virtual-command-entry": {
|
|
115
129
|
"require": {
|
|
116
130
|
"types": "./dist/components/virtual-command-entry.d.cts",
|
|
@@ -165,24 +179,24 @@
|
|
|
165
179
|
"storm-software"
|
|
166
180
|
],
|
|
167
181
|
"dependencies": {
|
|
168
|
-
"@alloy-js/core": "
|
|
169
|
-
"@alloy-js/typescript": "
|
|
170
|
-
"@powerlines/deepkit": "^0.6.
|
|
171
|
-
"@powerlines/plugin-alloy": "^0.
|
|
172
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
173
|
-
"@shell-shock/core": "^0.8.
|
|
174
|
-
"@shell-shock/plugin-theme": "^0.0
|
|
175
|
-
"@shell-shock/preset-script": "^0.6.
|
|
176
|
-
"@stryke/path": "
|
|
177
|
-
"@stryke/string-format": "^0.
|
|
182
|
+
"@alloy-js/core": "0.23.0-dev.8",
|
|
183
|
+
"@alloy-js/typescript": "0.23.0-dev.4",
|
|
184
|
+
"@powerlines/deepkit": "^0.6.61",
|
|
185
|
+
"@powerlines/plugin-alloy": "^0.23.11",
|
|
186
|
+
"@powerlines/plugin-plugin": "^0.12.232",
|
|
187
|
+
"@shell-shock/core": "^0.8.5",
|
|
188
|
+
"@shell-shock/plugin-theme": "^0.1.0",
|
|
189
|
+
"@shell-shock/preset-script": "^0.6.4",
|
|
190
|
+
"@stryke/path": "0.26.6",
|
|
191
|
+
"@stryke/string-format": "^0.14.2",
|
|
178
192
|
"cfonts": "^3.3.1",
|
|
179
193
|
"defu": "^6.1.4",
|
|
180
|
-
"powerlines": "^0.38.
|
|
194
|
+
"powerlines": "^0.38.48"
|
|
181
195
|
},
|
|
182
196
|
"devDependencies": {
|
|
183
197
|
"@babel/core": "^7.29.0",
|
|
184
|
-
"@types/node": "^22.19.
|
|
185
|
-
"@types/react": "^19.2.
|
|
198
|
+
"@types/node": "^22.19.11",
|
|
199
|
+
"@types/react": "^19.2.14"
|
|
186
200
|
},
|
|
187
201
|
"publishConfig": {
|
|
188
202
|
"access": "public",
|
|
@@ -207,5 +221,5 @@
|
|
|
207
221
|
"./package.json": "./package.json"
|
|
208
222
|
}
|
|
209
223
|
},
|
|
210
|
-
"gitHead": "
|
|
224
|
+
"gitHead": "488f5e2d29227ff6f33792be8fae5214a6e64bed"
|
|
211
225
|
}
|