@shell-shock/core 0.17.18 → 0.17.20
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/api.d.cts +1 -1
- package/dist/api.d.mts +1 -1
- package/dist/components/command-validation-logic.cjs +1 -1
- package/dist/components/command-validation-logic.mjs +1 -1
- package/dist/components/docs.cjs +103 -18
- package/dist/components/docs.d.cts +8 -4
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts +8 -4
- package/dist/components/docs.mjs +102 -18
- package/dist/components/index.cjs +2 -1
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.mjs +2 -2
- package/dist/components/usage.cjs +2 -5
- package/dist/components/usage.mjs +2 -5
- package/dist/helpers/automd.cjs +133 -10
- package/dist/helpers/automd.mjs +132 -12
- package/dist/helpers/persistence.cjs +1 -0
- package/dist/helpers/persistence.mjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/plugin.cjs +27 -22
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.mjs +29 -24
- package/dist/types/index.cjs +2 -2
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +2 -2
- package/package.json +13 -27
- package/dist/types/options.cjs +0 -13
- package/dist/types/options.cjs.map +0 -1
- package/dist/types/options.d.cts +0 -8
- package/dist/types/options.d.cts.map +0 -1
- package/dist/types/options.d.mts +0 -8
- package/dist/types/options.d.mts.map +0 -1
- package/dist/types/options.mjs +0 -11
- package/dist/types/options.mjs.map +0 -1
|
@@ -53,20 +53,17 @@ function Usage(props) {
|
|
|
53
53
|
"segment",
|
|
54
54
|
"",
|
|
55
55
|
"P\"2!\"/\""
|
|
56
|
-
])).join(" ")}` : ""}${Object.values(command.children).length > 0 ? " <commands>" : ""}${command.args.length > 0 ? command.args.map(__assignType((param) => `<${snakeCase(param.name)}${(param.type === "string" || param.type === "number") && param.variadic ? "..." : ""}>`, [
|
|
56
|
+
])).join(" ")}` : ""}${Object.values(command.children).length > 0 ? " <commands>" : ""}${command.args.length > 0 ? ` ${command.args.map(__assignType((param) => `<${snakeCase(param.name)}${(param.type === "string" || param.type === "number") && param.variadic ? "..." : ""}>`, [
|
|
57
57
|
"param",
|
|
58
58
|
"",
|
|
59
59
|
"P\"2!\"/\""
|
|
60
|
-
])).join(" ") : ""} [options]`),
|
|
60
|
+
])).join(" ")}` : ""} [options]`),
|
|
61
61
|
createComponent(Show, {
|
|
62
62
|
get when() {
|
|
63
63
|
return command.args.length > 0;
|
|
64
64
|
},
|
|
65
65
|
get children() {
|
|
66
66
|
return [
|
|
67
|
-
createIntrinsic("hbr", {}),
|
|
68
|
-
createIntrinsic("hbr", {}),
|
|
69
|
-
code`# or with options before arguments: `,
|
|
70
67
|
createIntrinsic("hbr", {}),
|
|
71
68
|
createComponent(Switch, { get children() {
|
|
72
69
|
return [
|
package/dist/helpers/automd.cjs
CHANGED
|
@@ -23,19 +23,35 @@ function __assignType(fn, args) {
|
|
|
23
23
|
*/
|
|
24
24
|
const commands = __assignType((context) => (0, automd.defineGenerator)({
|
|
25
25
|
name: "commands",
|
|
26
|
-
async generate() {
|
|
26
|
+
async generate(ctx) {
|
|
27
|
+
let commands = Object.values(context.commands).filter(__assignType((cmd) => !cmd.virtual, [
|
|
28
|
+
"cmd",
|
|
29
|
+
"",
|
|
30
|
+
"P\"2!\"/\""
|
|
31
|
+
]));
|
|
32
|
+
if (ctx.args.command) {
|
|
33
|
+
if (!context.commands[ctx.args.command]) throw new Error(`The command "${ctx.args.command}" does not exist in the application.`);
|
|
34
|
+
commands = [context.commands[ctx.args.command]];
|
|
35
|
+
}
|
|
27
36
|
return { contents: (0, _powerlines_plugin_alloy_render.renderString)(context, [
|
|
28
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
38
|
+
get when() {
|
|
39
|
+
return !ctx.args.command;
|
|
40
|
+
},
|
|
41
|
+
get children() {
|
|
42
|
+
return [
|
|
43
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_markdown.Heading, {
|
|
44
|
+
level: 2,
|
|
45
|
+
children: "Commands"
|
|
46
|
+
}),
|
|
47
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
48
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`The following commands are available in the ${require_context_helpers.getAppTitle(context, true)} command-line interface application:`),
|
|
49
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
50
|
+
];
|
|
51
|
+
}
|
|
31
52
|
}),
|
|
32
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
33
|
-
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`The following commands are available in the ${require_context_helpers.getAppTitle(context, true)} command-line interface application:`),
|
|
34
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
35
53
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
36
|
-
|
|
37
|
-
return Object.values(context.commands);
|
|
38
|
-
},
|
|
54
|
+
each: commands,
|
|
39
55
|
doubleHardline: true,
|
|
40
56
|
get children() {
|
|
41
57
|
return __assignType((child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
@@ -64,7 +80,114 @@ const commands = __assignType((context) => (0, automd.defineGenerator)({
|
|
|
64
80
|
"",
|
|
65
81
|
"P\"w!2\"\"/#"
|
|
66
82
|
]);
|
|
83
|
+
/**
|
|
84
|
+
* AutoMD generator to generate usage examples for a specific command.
|
|
85
|
+
*
|
|
86
|
+
* @param context - The generator context.
|
|
87
|
+
* @returns The generated usage content.
|
|
88
|
+
*/
|
|
89
|
+
const usage = __assignType((context) => (0, automd.defineGenerator)({
|
|
90
|
+
name: "usage",
|
|
91
|
+
async generate(ctx) {
|
|
92
|
+
if (!ctx.args.command) throw new Error("The 'usage' generator requires the \"command\" argument.");
|
|
93
|
+
if (!context.commands[ctx.args.command]) throw new Error(`The command "${ctx.args.command}" does not exist in the application.`);
|
|
94
|
+
let packageManagers = [
|
|
95
|
+
"npm",
|
|
96
|
+
"yarn",
|
|
97
|
+
"pnpm",
|
|
98
|
+
"bun"
|
|
99
|
+
];
|
|
100
|
+
if (ctx.args.packageManager) packageManagers = [String(ctx.args.packageManager)];
|
|
101
|
+
if (packageManagers.some(__assignType((pm) => ![
|
|
102
|
+
"npm",
|
|
103
|
+
"yarn",
|
|
104
|
+
"pnpm",
|
|
105
|
+
"bun"
|
|
106
|
+
].includes(pm), [
|
|
107
|
+
"pm",
|
|
108
|
+
"",
|
|
109
|
+
"P\"2!\"/\""
|
|
110
|
+
]))) throw new Error(`Invalid package manager specified. Supported package managers are: npm, yarn, pnpm, and bun.`);
|
|
111
|
+
return { contents: (0, _powerlines_plugin_alloy_render.renderString)(context, [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
112
|
+
each: packageManagers,
|
|
113
|
+
doubleHardline: true,
|
|
114
|
+
get children() {
|
|
115
|
+
return __assignType((packageManager) => [(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_docs.CommandDocsUsageExample, {
|
|
116
|
+
packageManager,
|
|
117
|
+
get command() {
|
|
118
|
+
return context.commands[ctx.args.command];
|
|
119
|
+
},
|
|
120
|
+
get expand() {
|
|
121
|
+
return packageManagers && packageManagers.length > 1;
|
|
122
|
+
}
|
|
123
|
+
})], [
|
|
124
|
+
"packageManager",
|
|
125
|
+
"",
|
|
126
|
+
"P\"2!\"/\""
|
|
127
|
+
]);
|
|
128
|
+
}
|
|
129
|
+
})]) };
|
|
130
|
+
}
|
|
131
|
+
}), [
|
|
132
|
+
"Context",
|
|
133
|
+
"context",
|
|
134
|
+
"",
|
|
135
|
+
"P\"w!2\"\"/#"
|
|
136
|
+
]);
|
|
137
|
+
/**
|
|
138
|
+
* AutoMD generator to generate options for a specific command.
|
|
139
|
+
*
|
|
140
|
+
* @param context - The generator context.
|
|
141
|
+
* @returns The generated options content.
|
|
142
|
+
*/
|
|
143
|
+
const options = __assignType((context) => (0, automd.defineGenerator)({
|
|
144
|
+
name: "options",
|
|
145
|
+
generate: __assignType(async function generate(ctx) {
|
|
146
|
+
if (!ctx.args.command) throw new Error("The 'options' generator requires the \"command\" argument.");
|
|
147
|
+
if (!context.commands[ctx.args.command]) throw new Error(`The command "${ctx.args.command}" does not exist in the application.`);
|
|
148
|
+
return { contents: (0, _powerlines_plugin_alloy_render.renderString)(context, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_docs.CommandOptionsDocs, { get command() {
|
|
149
|
+
return context.commands[ctx.args.command];
|
|
150
|
+
} })) };
|
|
151
|
+
}, [
|
|
152
|
+
"ctx",
|
|
153
|
+
"generate",
|
|
154
|
+
"P\"2!\"/\""
|
|
155
|
+
])
|
|
156
|
+
}), [
|
|
157
|
+
"Context",
|
|
158
|
+
"context",
|
|
159
|
+
"",
|
|
160
|
+
"P\"w!2\"\"/#"
|
|
161
|
+
]);
|
|
162
|
+
/**
|
|
163
|
+
* AutoMD generator to generate arguments for a specific command.
|
|
164
|
+
*
|
|
165
|
+
* @param context - The generator context.
|
|
166
|
+
* @returns The generated arguments content.
|
|
167
|
+
*/
|
|
168
|
+
const args = __assignType((context) => (0, automd.defineGenerator)({
|
|
169
|
+
name: "args",
|
|
170
|
+
generate: __assignType(async function generate(ctx) {
|
|
171
|
+
if (!ctx.args.command) throw new Error("The 'args' generator requires the \"command\" argument.");
|
|
172
|
+
if (!context.commands[ctx.args.command]) throw new Error(`The command "${ctx.args.command}" does not exist in the application.`);
|
|
173
|
+
return { contents: (0, _powerlines_plugin_alloy_render.renderString)(context, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_docs.CommandArgumentDocs, { get command() {
|
|
174
|
+
return context.commands[ctx.args.command];
|
|
175
|
+
} })) };
|
|
176
|
+
}, [
|
|
177
|
+
"ctx",
|
|
178
|
+
"generate",
|
|
179
|
+
"P\"2!\"/\""
|
|
180
|
+
])
|
|
181
|
+
}), [
|
|
182
|
+
"Context",
|
|
183
|
+
"context",
|
|
184
|
+
"",
|
|
185
|
+
"P\"w!2\"\"/#"
|
|
186
|
+
]);
|
|
67
187
|
|
|
68
188
|
//#endregion
|
|
189
|
+
exports.args = args;
|
|
69
190
|
exports.commands = commands;
|
|
191
|
+
exports.options = options;
|
|
192
|
+
exports.usage = usage;
|
|
70
193
|
//# sourceMappingURL=automd.cjs.map
|
package/dist/helpers/automd.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getAppTitle } from "../plugin-utils/context-helpers.mjs";
|
|
2
|
-
import { CommandDocs } from "../components/docs.mjs";
|
|
2
|
+
import { CommandArgumentDocs, CommandDocs, CommandDocsUsageExample, CommandOptionsDocs } from "../components/docs.mjs";
|
|
3
3
|
import "../plugin-utils/index.mjs";
|
|
4
4
|
import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
|
|
5
5
|
import { For, Show, code } from "@alloy-js/core";
|
|
@@ -23,19 +23,35 @@ function __assignType(fn, args) {
|
|
|
23
23
|
*/
|
|
24
24
|
const commands = __assignType((context) => defineGenerator({
|
|
25
25
|
name: "commands",
|
|
26
|
-
async generate() {
|
|
26
|
+
async generate(ctx) {
|
|
27
|
+
let commands = Object.values(context.commands).filter(__assignType((cmd) => !cmd.virtual, [
|
|
28
|
+
"cmd",
|
|
29
|
+
"",
|
|
30
|
+
"P\"2!\"/\""
|
|
31
|
+
]));
|
|
32
|
+
if (ctx.args.command) {
|
|
33
|
+
if (!context.commands[ctx.args.command]) throw new Error(`The command "${ctx.args.command}" does not exist in the application.`);
|
|
34
|
+
commands = [context.commands[ctx.args.command]];
|
|
35
|
+
}
|
|
27
36
|
return { contents: renderString(context, [
|
|
28
|
-
createComponent(
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
createComponent(Show, {
|
|
38
|
+
get when() {
|
|
39
|
+
return !ctx.args.command;
|
|
40
|
+
},
|
|
41
|
+
get children() {
|
|
42
|
+
return [
|
|
43
|
+
createComponent(Heading, {
|
|
44
|
+
level: 2,
|
|
45
|
+
children: "Commands"
|
|
46
|
+
}),
|
|
47
|
+
createComponent(Spacing, {}),
|
|
48
|
+
memo(() => code`The following commands are available in the ${getAppTitle(context, true)} command-line interface application:`),
|
|
49
|
+
createComponent(Spacing, {})
|
|
50
|
+
];
|
|
51
|
+
}
|
|
31
52
|
}),
|
|
32
|
-
createComponent(Spacing, {}),
|
|
33
|
-
memo(() => code`The following commands are available in the ${getAppTitle(context, true)} command-line interface application:`),
|
|
34
|
-
createComponent(Spacing, {}),
|
|
35
53
|
createComponent(For, {
|
|
36
|
-
|
|
37
|
-
return Object.values(context.commands);
|
|
38
|
-
},
|
|
54
|
+
each: commands,
|
|
39
55
|
doubleHardline: true,
|
|
40
56
|
get children() {
|
|
41
57
|
return __assignType((child) => createComponent(Show, {
|
|
@@ -64,7 +80,111 @@ const commands = __assignType((context) => defineGenerator({
|
|
|
64
80
|
"",
|
|
65
81
|
"P\"w!2\"\"/#"
|
|
66
82
|
]);
|
|
83
|
+
/**
|
|
84
|
+
* AutoMD generator to generate usage examples for a specific command.
|
|
85
|
+
*
|
|
86
|
+
* @param context - The generator context.
|
|
87
|
+
* @returns The generated usage content.
|
|
88
|
+
*/
|
|
89
|
+
const usage = __assignType((context) => defineGenerator({
|
|
90
|
+
name: "usage",
|
|
91
|
+
async generate(ctx) {
|
|
92
|
+
if (!ctx.args.command) throw new Error("The 'usage' generator requires the \"command\" argument.");
|
|
93
|
+
if (!context.commands[ctx.args.command]) throw new Error(`The command "${ctx.args.command}" does not exist in the application.`);
|
|
94
|
+
let packageManagers = [
|
|
95
|
+
"npm",
|
|
96
|
+
"yarn",
|
|
97
|
+
"pnpm",
|
|
98
|
+
"bun"
|
|
99
|
+
];
|
|
100
|
+
if (ctx.args.packageManager) packageManagers = [String(ctx.args.packageManager)];
|
|
101
|
+
if (packageManagers.some(__assignType((pm) => ![
|
|
102
|
+
"npm",
|
|
103
|
+
"yarn",
|
|
104
|
+
"pnpm",
|
|
105
|
+
"bun"
|
|
106
|
+
].includes(pm), [
|
|
107
|
+
"pm",
|
|
108
|
+
"",
|
|
109
|
+
"P\"2!\"/\""
|
|
110
|
+
]))) throw new Error(`Invalid package manager specified. Supported package managers are: npm, yarn, pnpm, and bun.`);
|
|
111
|
+
return { contents: renderString(context, [createComponent(For, {
|
|
112
|
+
each: packageManagers,
|
|
113
|
+
doubleHardline: true,
|
|
114
|
+
get children() {
|
|
115
|
+
return __assignType((packageManager) => [createComponent(CommandDocsUsageExample, {
|
|
116
|
+
packageManager,
|
|
117
|
+
get command() {
|
|
118
|
+
return context.commands[ctx.args.command];
|
|
119
|
+
},
|
|
120
|
+
get expand() {
|
|
121
|
+
return packageManagers && packageManagers.length > 1;
|
|
122
|
+
}
|
|
123
|
+
})], [
|
|
124
|
+
"packageManager",
|
|
125
|
+
"",
|
|
126
|
+
"P\"2!\"/\""
|
|
127
|
+
]);
|
|
128
|
+
}
|
|
129
|
+
})]) };
|
|
130
|
+
}
|
|
131
|
+
}), [
|
|
132
|
+
"Context",
|
|
133
|
+
"context",
|
|
134
|
+
"",
|
|
135
|
+
"P\"w!2\"\"/#"
|
|
136
|
+
]);
|
|
137
|
+
/**
|
|
138
|
+
* AutoMD generator to generate options for a specific command.
|
|
139
|
+
*
|
|
140
|
+
* @param context - The generator context.
|
|
141
|
+
* @returns The generated options content.
|
|
142
|
+
*/
|
|
143
|
+
const options = __assignType((context) => defineGenerator({
|
|
144
|
+
name: "options",
|
|
145
|
+
generate: __assignType(async function generate(ctx) {
|
|
146
|
+
if (!ctx.args.command) throw new Error("The 'options' generator requires the \"command\" argument.");
|
|
147
|
+
if (!context.commands[ctx.args.command]) throw new Error(`The command "${ctx.args.command}" does not exist in the application.`);
|
|
148
|
+
return { contents: renderString(context, createComponent(CommandOptionsDocs, { get command() {
|
|
149
|
+
return context.commands[ctx.args.command];
|
|
150
|
+
} })) };
|
|
151
|
+
}, [
|
|
152
|
+
"ctx",
|
|
153
|
+
"generate",
|
|
154
|
+
"P\"2!\"/\""
|
|
155
|
+
])
|
|
156
|
+
}), [
|
|
157
|
+
"Context",
|
|
158
|
+
"context",
|
|
159
|
+
"",
|
|
160
|
+
"P\"w!2\"\"/#"
|
|
161
|
+
]);
|
|
162
|
+
/**
|
|
163
|
+
* AutoMD generator to generate arguments for a specific command.
|
|
164
|
+
*
|
|
165
|
+
* @param context - The generator context.
|
|
166
|
+
* @returns The generated arguments content.
|
|
167
|
+
*/
|
|
168
|
+
const args = __assignType((context) => defineGenerator({
|
|
169
|
+
name: "args",
|
|
170
|
+
generate: __assignType(async function generate(ctx) {
|
|
171
|
+
if (!ctx.args.command) throw new Error("The 'args' generator requires the \"command\" argument.");
|
|
172
|
+
if (!context.commands[ctx.args.command]) throw new Error(`The command "${ctx.args.command}" does not exist in the application.`);
|
|
173
|
+
return { contents: renderString(context, createComponent(CommandArgumentDocs, { get command() {
|
|
174
|
+
return context.commands[ctx.args.command];
|
|
175
|
+
} })) };
|
|
176
|
+
}, [
|
|
177
|
+
"ctx",
|
|
178
|
+
"generate",
|
|
179
|
+
"P\"2!\"/\""
|
|
180
|
+
])
|
|
181
|
+
}), [
|
|
182
|
+
"Context",
|
|
183
|
+
"context",
|
|
184
|
+
"",
|
|
185
|
+
"P\"w!2\"\"/#"
|
|
186
|
+
]);
|
|
67
187
|
|
|
68
188
|
//#endregion
|
|
69
|
-
export { commands };
|
|
189
|
+
export { args, commands, options, usage };
|
|
70
190
|
//# sourceMappingURL=automd.mjs.map
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AsCommandParameterConfig, BaseBooleanCommandParameter, BaseCommandParameter, BaseNumberCommandParameter, BaseSingleCommandParameter, BaseStringCommandParameter, BaseVariadicCommandParameter, BooleanCommandOption, BooleanCommandParameter, BooleanCommandParameterConfig, CommandArgument, CommandArgumentConfig, CommandBase, CommandConfig, CommandMetadata, CommandModule, CommandOption, CommandOptionConfig, CommandParameter, CommandParameterConfig, CommandParameterType, CommandTree, NumberCommandParameter, NumberCommandParameterConfig, SerializedCommandTree, SingleBooleanCommandParameter, SingleNumberCommandParameter, SingleStringCommandParameter, StringCommandParameter, StringCommandParameterConfig, VariadicBooleanCommandParameter, VariadicNumberCommandParameter, VariadicStringCommandParameter } from "./types/command.cjs";
|
|
2
2
|
import { Context, ExecutionContext, UnresolvedContext } from "./types/context.cjs";
|
|
3
3
|
import { DocsOptions, EngineOptions, Options, OutputConfig, ResolvedConfig, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnObject, UserConfigFnPromise } from "./types/config.cjs";
|
|
4
|
-
import {
|
|
4
|
+
import { ShellShockEnv } from "./types/env.cjs";
|
|
5
5
|
import { defineConfig } from "./config.cjs";
|
|
6
6
|
|
|
7
7
|
//#region src/index.d.ts
|
|
@@ -77,5 +77,5 @@ declare function defineOptions(options: Record<string, CommandOptionConfig>): Re
|
|
|
77
77
|
*/
|
|
78
78
|
declare function defineArguments(args: CommandArgumentConfig[]): CommandArgumentConfig[];
|
|
79
79
|
//#endregion
|
|
80
|
-
export { type AsCommandParameterConfig, type BaseBooleanCommandParameter, type
|
|
80
|
+
export { type AsCommandParameterConfig, type BaseBooleanCommandParameter, type BaseCommandParameter, type BaseNumberCommandParameter, type BaseSingleCommandParameter, type BaseStringCommandParameter, type BaseVariadicCommandParameter, type BooleanCommandOption, type BooleanCommandParameter, type BooleanCommandParameterConfig, type CommandArgument, type CommandArgumentConfig, type CommandBase, type CommandConfig, type CommandMetadata, type CommandModule, type CommandOption, type CommandOptionConfig, type CommandParameter, type CommandParameterConfig, type CommandParameterType, type CommandTree, type Context, type DocsOptions, type EngineOptions, type ExecutionContext, type NumberCommandParameter, type NumberCommandParameterConfig, type Options, type OutputConfig, type ResolvedConfig, type SerializedCommandTree, type ShellShockEnv, type SingleBooleanCommandParameter, type SingleNumberCommandParameter, type SingleStringCommandParameter, type StringCommandParameter, type StringCommandParameterConfig, type UnresolvedContext, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type VariadicBooleanCommandParameter, type VariadicNumberCommandParameter, type VariadicStringCommandParameter, defineArguments, defineConfig, defineMetadata, defineOptions };
|
|
81
81
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AsCommandParameterConfig, BaseBooleanCommandParameter, BaseCommandParameter, BaseNumberCommandParameter, BaseSingleCommandParameter, BaseStringCommandParameter, BaseVariadicCommandParameter, BooleanCommandOption, BooleanCommandParameter, BooleanCommandParameterConfig, CommandArgument, CommandArgumentConfig, CommandBase, CommandConfig, CommandMetadata, CommandModule, CommandOption, CommandOptionConfig, CommandParameter, CommandParameterConfig, CommandParameterType, CommandTree, NumberCommandParameter, NumberCommandParameterConfig, SerializedCommandTree, SingleBooleanCommandParameter, SingleNumberCommandParameter, SingleStringCommandParameter, StringCommandParameter, StringCommandParameterConfig, VariadicBooleanCommandParameter, VariadicNumberCommandParameter, VariadicStringCommandParameter } from "./types/command.mjs";
|
|
2
2
|
import { Context, ExecutionContext, UnresolvedContext } from "./types/context.mjs";
|
|
3
3
|
import { DocsOptions, EngineOptions, Options, OutputConfig, ResolvedConfig, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnObject, UserConfigFnPromise } from "./types/config.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { ShellShockEnv } from "./types/env.mjs";
|
|
5
5
|
import { defineConfig } from "./config.mjs";
|
|
6
6
|
|
|
7
7
|
//#region src/index.d.ts
|
|
@@ -77,5 +77,5 @@ declare function defineOptions(options: Record<string, CommandOptionConfig>): Re
|
|
|
77
77
|
*/
|
|
78
78
|
declare function defineArguments(args: CommandArgumentConfig[]): CommandArgumentConfig[];
|
|
79
79
|
//#endregion
|
|
80
|
-
export { type AsCommandParameterConfig, type BaseBooleanCommandParameter, type
|
|
80
|
+
export { type AsCommandParameterConfig, type BaseBooleanCommandParameter, type BaseCommandParameter, type BaseNumberCommandParameter, type BaseSingleCommandParameter, type BaseStringCommandParameter, type BaseVariadicCommandParameter, type BooleanCommandOption, type BooleanCommandParameter, type BooleanCommandParameterConfig, type CommandArgument, type CommandArgumentConfig, type CommandBase, type CommandConfig, type CommandMetadata, type CommandModule, type CommandOption, type CommandOptionConfig, type CommandParameter, type CommandParameterConfig, type CommandParameterType, type CommandTree, type Context, type DocsOptions, type EngineOptions, type ExecutionContext, type NumberCommandParameter, type NumberCommandParameterConfig, type Options, type OutputConfig, type ResolvedConfig, type SerializedCommandTree, type ShellShockEnv, type SingleBooleanCommandParameter, type SingleNumberCommandParameter, type SingleStringCommandParameter, type StringCommandParameter, type StringCommandParameterConfig, type UnresolvedContext, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type VariadicBooleanCommandParameter, type VariadicNumberCommandParameter, type VariadicStringCommandParameter, defineArguments, defineConfig, defineMetadata, defineOptions };
|
|
81
81
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/package.cjs
CHANGED
package/dist/package.mjs
CHANGED
package/dist/plugin.cjs
CHANGED
|
@@ -53,7 +53,7 @@ const MAX_DEPTH = 50;
|
|
|
53
53
|
/**
|
|
54
54
|
* The core Powerlines plugin to build Shell Shock projects.
|
|
55
55
|
*/
|
|
56
|
-
const plugin = __assignType((options = {}) => {
|
|
56
|
+
const plugin = __assignType((options$1 = {}) => {
|
|
57
57
|
return [
|
|
58
58
|
(_powerlines_plugin_tsdown.default.Ω = [["Context", "\"w!"]], (0, _powerlines_plugin_tsdown.default)()),
|
|
59
59
|
(_powerlines_plugin_automd.default.Ω = [["Context", "\"w!"]], (0, _powerlines_plugin_automd.default)()),
|
|
@@ -61,7 +61,7 @@ const plugin = __assignType((options = {}) => {
|
|
|
61
61
|
name: "shell-shock/core:config",
|
|
62
62
|
config: __assignType(async function config() {
|
|
63
63
|
this.debug("Resolving the Shell Shock configuration.");
|
|
64
|
-
return (0, defu.defu)(options, {
|
|
64
|
+
return (0, defu.defu)(options$1, {
|
|
65
65
|
name: require_context_helpers.getAppName(this),
|
|
66
66
|
title: require_context_helpers.getAppTitle(this),
|
|
67
67
|
description: require_context_helpers.getAppDescription(this),
|
|
@@ -111,8 +111,7 @@ const plugin = __assignType((options = {}) => {
|
|
|
111
111
|
description: this.config.description,
|
|
112
112
|
alias: [],
|
|
113
113
|
virtual: false
|
|
114
|
-
}))
|
|
115
|
-
this.globalOptions = this.globalOptions.map(__assignType((option) => ({
|
|
114
|
+
})).map(__assignType((option) => ({
|
|
116
115
|
...option,
|
|
117
116
|
name: (0, _stryke_string_format_camel_case.camelCase)(option.name),
|
|
118
117
|
alias: option.alias ?? [],
|
|
@@ -125,7 +124,7 @@ const plugin = __assignType((options = {}) => {
|
|
|
125
124
|
}
|
|
126
125
|
}
|
|
127
126
|
},
|
|
128
|
-
...(_powerlines_plugin_nodejs.default.Ω = [["Context", "\"w!"]], (0, _powerlines_plugin_nodejs.default)((0, defu.defu)(options ?? {}, { env: {
|
|
127
|
+
...(_powerlines_plugin_nodejs.default.Ω = [["Context", "\"w!"]], (0, _powerlines_plugin_nodejs.default)((0, defu.defu)(options$1 ?? {}, { env: {
|
|
129
128
|
config: "@shell-shock/core/types/env#ShellShockEnv",
|
|
130
129
|
validate: false
|
|
131
130
|
} }))),
|
|
@@ -324,27 +323,29 @@ const plugin = __assignType((options = {}) => {
|
|
|
324
323
|
}
|
|
325
324
|
if (!(0, _powerlines_schema.isJsonSchemaObject)(this.env.config.schema)) throw new Error("Invalid environment variable schema extracted.");
|
|
326
325
|
const env = (0, _powerlines_schema.getProperties)(this.env.config);
|
|
327
|
-
|
|
326
|
+
this.globalOptions.filter(__assignType((option) => (0, _stryke_type_checks_is_set_string.isSetString)(option.env) && !env[option.env], [
|
|
328
327
|
"option",
|
|
329
328
|
"",
|
|
330
329
|
"P\"2!\"/\""
|
|
331
|
-
])).
|
|
330
|
+
])).forEach(__assignType((option) => {
|
|
331
|
+
(0, _powerlines_schema.addProperty)(this.env.config, option.env, {
|
|
332
|
+
...option,
|
|
333
|
+
name: option.env,
|
|
334
|
+
alias: option.alias.filter(__assignType((alias) => alias.length > 1, [
|
|
335
|
+
"alias",
|
|
336
|
+
"",
|
|
337
|
+
"P\"2!\"/\""
|
|
338
|
+
])).map(__assignType((alias) => (0, _stryke_string_format_constant_case.constantCase)(alias), [
|
|
339
|
+
"alias",
|
|
340
|
+
"",
|
|
341
|
+
"P\"2!\"/\""
|
|
342
|
+
]))
|
|
343
|
+
});
|
|
344
|
+
}, [
|
|
332
345
|
"option",
|
|
333
346
|
"",
|
|
334
347
|
"P\"2!\"/\""
|
|
335
|
-
]))
|
|
336
|
-
...option,
|
|
337
|
-
name: option.env,
|
|
338
|
-
alias: option.alias.filter(__assignType((alias) => alias.length > 1, [
|
|
339
|
-
"alias",
|
|
340
|
-
"",
|
|
341
|
-
"P\"2!\"/\""
|
|
342
|
-
])).map(__assignType((alias) => (0, _stryke_string_format_constant_case.constantCase)(alias), [
|
|
343
|
-
"alias",
|
|
344
|
-
"",
|
|
345
|
-
"P\"2!\"/\""
|
|
346
|
-
]))
|
|
347
|
-
});
|
|
348
|
+
]));
|
|
348
349
|
await (0, _powerlines_plugin_env_helpers_schema.writeEnv)(this);
|
|
349
350
|
}
|
|
350
351
|
}
|
|
@@ -359,6 +360,7 @@ const plugin = __assignType((options = {}) => {
|
|
|
359
360
|
if (this.config.command !== "prepare" && this.config.skipCache !== true && this.persistedMeta?.checksum === this.meta.checksum && this.fs.existsSync((0, _powerlines_schema.getCacheFilePath)(this, this.env.config))) {
|
|
360
361
|
this.debug(`Skipping command resolution as the meta checksum has not changed.`);
|
|
361
362
|
await (0, _powerlines_plugin_env_helpers_schema.extractEnv)(this);
|
|
363
|
+
await require_persistence.readCommandsPersistence(this);
|
|
362
364
|
} else {
|
|
363
365
|
for (const input of this.inputs.filter(__assignType((input) => input.segments.filter(__assignType((segment) => !require_context_helpers.isDynamicPathSegment(segment) && !require_context_helpers.isPathSegmentGroup(segment), [
|
|
364
366
|
"segment",
|
|
@@ -446,11 +448,14 @@ const plugin = __assignType((options = {}) => {
|
|
|
446
448
|
this.config.automd ??= {};
|
|
447
449
|
this.config.automd.generators = {
|
|
448
450
|
...this.config.automd.generators ?? {},
|
|
449
|
-
commands: require_automd.commands(this)
|
|
451
|
+
commands: require_automd.commands(this),
|
|
452
|
+
usage: require_automd.usage(this),
|
|
453
|
+
options: require_automd.options(this),
|
|
454
|
+
args: require_automd.args(this)
|
|
450
455
|
};
|
|
451
456
|
}, ["configResolved", "P\"/!"]),
|
|
452
457
|
async docs() {
|
|
453
|
-
this.debug("Rendering
|
|
458
|
+
this.debug("Rendering CLI command reference documentation and writing to the output directory.");
|
|
454
459
|
const commands = this.inputs.map(__assignType((input) => require_get_command_tree.getCommandTree(this, input.segments), [
|
|
455
460
|
"input",
|
|
456
461
|
"",
|
package/dist/plugin.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.tsx"],"mappings":";;;;;;;AAgGA;cAAa,MAAA,oBAA2B,OAAA,GAAU,OAAA,EAChD,OAAA,GAAS,OAAA,KACR,MAAA,CAAO,QAAA"}
|
package/dist/plugin.mjs
CHANGED
|
@@ -5,10 +5,10 @@ import { traverseCommands } from "./plugin-utils/traverse-command-tree.mjs";
|
|
|
5
5
|
import { getCommandTree } from "./plugin-utils/get-command-tree.mjs";
|
|
6
6
|
import { StateBuiltin } from "./components/state-builtin.mjs";
|
|
7
7
|
import { UtilsBuiltin } from "./components/utils-builtin.mjs";
|
|
8
|
-
import { commands } from "./helpers/automd.mjs";
|
|
8
|
+
import { args, commands, options, usage } from "./helpers/automd.mjs";
|
|
9
9
|
import { getFramework } from "./helpers/get-framework.mjs";
|
|
10
10
|
import { findCommandsRoot, resolveCommandId, resolveCommandName, resolveCommandPath } from "./helpers/paths.mjs";
|
|
11
|
-
import { writeCommandsPersistence } from "./helpers/persistence.mjs";
|
|
11
|
+
import { readCommandsPersistence, writeCommandsPersistence } from "./helpers/persistence.mjs";
|
|
12
12
|
import { formatBinaryPath, updatePackageJsonBinary } from "./helpers/update-package-json.mjs";
|
|
13
13
|
import { formatCommandTree, getGlobalOptions } from "./helpers/utilities.mjs";
|
|
14
14
|
import { validateCommand } from "./helpers/validations.mjs";
|
|
@@ -48,7 +48,7 @@ const MAX_DEPTH = 50;
|
|
|
48
48
|
/**
|
|
49
49
|
* The core Powerlines plugin to build Shell Shock projects.
|
|
50
50
|
*/
|
|
51
|
-
const plugin = __assignType((options = {}) => {
|
|
51
|
+
const plugin = __assignType((options$1 = {}) => {
|
|
52
52
|
return [
|
|
53
53
|
(tsdown.Ω = [["Context", "\"w!"]], tsdown()),
|
|
54
54
|
(automd.Ω = [["Context", "\"w!"]], automd()),
|
|
@@ -56,7 +56,7 @@ const plugin = __assignType((options = {}) => {
|
|
|
56
56
|
name: "shell-shock/core:config",
|
|
57
57
|
config: __assignType(async function config() {
|
|
58
58
|
this.debug("Resolving the Shell Shock configuration.");
|
|
59
|
-
return defu(options, {
|
|
59
|
+
return defu(options$1, {
|
|
60
60
|
name: getAppName(this),
|
|
61
61
|
title: getAppTitle(this),
|
|
62
62
|
description: getAppDescription(this),
|
|
@@ -106,8 +106,7 @@ const plugin = __assignType((options = {}) => {
|
|
|
106
106
|
description: this.config.description,
|
|
107
107
|
alias: [],
|
|
108
108
|
virtual: false
|
|
109
|
-
}))
|
|
110
|
-
this.globalOptions = this.globalOptions.map(__assignType((option) => ({
|
|
109
|
+
})).map(__assignType((option) => ({
|
|
111
110
|
...option,
|
|
112
111
|
name: camelCase(option.name),
|
|
113
112
|
alias: option.alias ?? [],
|
|
@@ -120,7 +119,7 @@ const plugin = __assignType((options = {}) => {
|
|
|
120
119
|
}
|
|
121
120
|
}
|
|
122
121
|
},
|
|
123
|
-
...(nodejs.Ω = [["Context", "\"w!"]], nodejs(defu(options ?? {}, { env: {
|
|
122
|
+
...(nodejs.Ω = [["Context", "\"w!"]], nodejs(defu(options$1 ?? {}, { env: {
|
|
124
123
|
config: "@shell-shock/core/types/env#ShellShockEnv",
|
|
125
124
|
validate: false
|
|
126
125
|
} }))),
|
|
@@ -319,27 +318,29 @@ const plugin = __assignType((options = {}) => {
|
|
|
319
318
|
}
|
|
320
319
|
if (!isJsonSchemaObject(this.env.config.schema)) throw new Error("Invalid environment variable schema extracted.");
|
|
321
320
|
const env = getProperties(this.env.config);
|
|
322
|
-
|
|
321
|
+
this.globalOptions.filter(__assignType((option) => isSetString(option.env) && !env[option.env], [
|
|
323
322
|
"option",
|
|
324
323
|
"",
|
|
325
324
|
"P\"2!\"/\""
|
|
326
|
-
])).
|
|
325
|
+
])).forEach(__assignType((option) => {
|
|
326
|
+
addProperty(this.env.config, option.env, {
|
|
327
|
+
...option,
|
|
328
|
+
name: option.env,
|
|
329
|
+
alias: option.alias.filter(__assignType((alias) => alias.length > 1, [
|
|
330
|
+
"alias",
|
|
331
|
+
"",
|
|
332
|
+
"P\"2!\"/\""
|
|
333
|
+
])).map(__assignType((alias) => constantCase(alias), [
|
|
334
|
+
"alias",
|
|
335
|
+
"",
|
|
336
|
+
"P\"2!\"/\""
|
|
337
|
+
]))
|
|
338
|
+
});
|
|
339
|
+
}, [
|
|
327
340
|
"option",
|
|
328
341
|
"",
|
|
329
342
|
"P\"2!\"/\""
|
|
330
|
-
]))
|
|
331
|
-
...option,
|
|
332
|
-
name: option.env,
|
|
333
|
-
alias: option.alias.filter(__assignType((alias) => alias.length > 1, [
|
|
334
|
-
"alias",
|
|
335
|
-
"",
|
|
336
|
-
"P\"2!\"/\""
|
|
337
|
-
])).map(__assignType((alias) => constantCase(alias), [
|
|
338
|
-
"alias",
|
|
339
|
-
"",
|
|
340
|
-
"P\"2!\"/\""
|
|
341
|
-
]))
|
|
342
|
-
});
|
|
343
|
+
]));
|
|
343
344
|
await writeEnv(this);
|
|
344
345
|
}
|
|
345
346
|
}
|
|
@@ -354,6 +355,7 @@ const plugin = __assignType((options = {}) => {
|
|
|
354
355
|
if (this.config.command !== "prepare" && this.config.skipCache !== true && this.persistedMeta?.checksum === this.meta.checksum && this.fs.existsSync(getCacheFilePath(this, this.env.config))) {
|
|
355
356
|
this.debug(`Skipping command resolution as the meta checksum has not changed.`);
|
|
356
357
|
await extractEnv(this);
|
|
358
|
+
await readCommandsPersistence(this);
|
|
357
359
|
} else {
|
|
358
360
|
for (const input of this.inputs.filter(__assignType((input) => input.segments.filter(__assignType((segment) => !isDynamicPathSegment(segment) && !isPathSegmentGroup(segment), [
|
|
359
361
|
"segment",
|
|
@@ -441,11 +443,14 @@ const plugin = __assignType((options = {}) => {
|
|
|
441
443
|
this.config.automd ??= {};
|
|
442
444
|
this.config.automd.generators = {
|
|
443
445
|
...this.config.automd.generators ?? {},
|
|
444
|
-
commands: commands(this)
|
|
446
|
+
commands: commands(this),
|
|
447
|
+
usage: usage(this),
|
|
448
|
+
options: options(this),
|
|
449
|
+
args: args(this)
|
|
445
450
|
};
|
|
446
451
|
}, ["configResolved", "P\"/!"]),
|
|
447
452
|
async docs() {
|
|
448
|
-
this.debug("Rendering
|
|
453
|
+
this.debug("Rendering CLI command reference documentation and writing to the output directory.");
|
|
449
454
|
const commands = this.inputs.map(__assignType((input) => getCommandTree(this, input.segments), [
|
|
450
455
|
"input",
|
|
451
456
|
"",
|