@shell-shock/core 0.1.1 → 0.2.1
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 +221 -0
- package/dist/_virtual/rolldown_runtime.cjs +29 -1
- package/dist/api.cjs +45 -1
- package/dist/api.d.cts +7 -0
- package/dist/api.d.mts +7 -0
- package/dist/api.mjs +44 -1
- package/dist/components/index.cjs +7 -0
- package/dist/components/index.d.cts +2 -0
- package/dist/components/index.d.mts +2 -0
- package/dist/components/index.mjs +3 -0
- package/dist/components/utils-builtin.cjs +453 -0
- package/dist/components/utils-builtin.d.cts +27 -0
- package/dist/components/utils-builtin.d.mts +27 -0
- package/dist/components/utils-builtin.mjs +447 -0
- package/dist/config.cjs +17 -1
- package/dist/config.mjs +16 -1
- package/dist/helpers/persistence.cjs +49 -0
- package/dist/helpers/persistence.mjs +46 -0
- package/dist/helpers/resolve-command.cjs +92 -1
- package/dist/helpers/resolve-command.mjs +88 -1
- package/dist/helpers/update-package-json.cjs +28 -1
- package/dist/helpers/update-package-json.mjs +27 -1
- package/dist/helpers/utilities.cjs +41 -0
- package/dist/helpers/utilities.mjs +38 -0
- package/dist/index.cjs +24 -1
- package/dist/index.d.cts +16 -2
- package/dist/index.d.mts +15 -2
- package/dist/index.mjs +19 -1
- package/dist/plugin-utils/get-command-tree.cjs +22 -0
- package/dist/plugin-utils/get-command-tree.d.cts +15 -0
- package/dist/plugin-utils/get-command-tree.d.mts +15 -0
- package/dist/plugin-utils/get-command-tree.mjs +21 -0
- package/dist/plugin-utils/index.cjs +3 -0
- package/dist/plugin-utils/index.d.cts +2 -0
- package/dist/plugin-utils/index.d.mts +2 -0
- package/dist/plugin-utils/index.mjs +3 -0
- package/dist/powerlines.cjs +172 -2
- package/dist/powerlines.d.cts +2 -2
- package/dist/powerlines.d.mts +2 -2
- package/dist/powerlines.mjs +168 -2
- package/dist/types/command.d.cts +63 -0
- package/dist/types/command.d.mts +63 -0
- package/dist/types/command.mjs +1 -0
- package/dist/types/config.d.cts +9 -26
- package/dist/types/config.d.mts +9 -26
- package/dist/types/config.mjs +1 -1
- package/dist/types/context.cjs +0 -0
- package/dist/types/context.d.cts +26 -0
- package/dist/types/context.d.mts +26 -0
- package/dist/types/context.mjs +1 -0
- package/dist/types/index.d.cts +4 -2
- package/dist/types/index.d.mts +4 -2
- package/dist/types/index.mjs +1 -1
- package/dist/types/options.cjs +0 -0
- package/dist/types/options.d.cts +7 -0
- package/dist/types/options.d.mts +7 -0
- package/dist/types/options.mjs +1 -0
- package/package.json +76 -13
- package/dist/types/build.d.cts +0 -66
- package/dist/types/build.d.mts +0 -66
- package/dist/types/build.mjs +0 -1
- /package/dist/types/{build.cjs → command.cjs} +0 -0
package/dist/powerlines.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Context } from "./types/context.mjs";
|
|
1
2
|
import { Options } from "./types/config.mjs";
|
|
2
|
-
import { BuildContext } from "./types/build.mjs";
|
|
3
3
|
import { Plugin } from "powerlines";
|
|
4
4
|
|
|
5
5
|
//#region src/powerlines.d.ts
|
|
@@ -7,6 +7,6 @@ import { Plugin } from "powerlines";
|
|
|
7
7
|
/**
|
|
8
8
|
* The core Powerlines plugin to build Shell Shock projects.
|
|
9
9
|
*/
|
|
10
|
-
declare const shellShock: <TContext extends
|
|
10
|
+
declare const shellShock: <TContext extends Context = Context>(options?: Options) => Plugin<TContext>[];
|
|
11
11
|
//#endregion
|
|
12
12
|
export { shellShock as default, shellShock };
|
package/dist/powerlines.mjs
CHANGED
|
@@ -1,2 +1,168 @@
|
|
|
1
|
-
import{
|
|
2
|
-
|
|
1
|
+
import { getCommandsPersistencePath, readCommandsPersistence, writeCommandsPersistence } from "./helpers/persistence.mjs";
|
|
2
|
+
import { findCommandName, findCommandsRoot, reflectCommandTree, resolveCommandPath } from "./helpers/resolve-command.mjs";
|
|
3
|
+
import { updatePackageJsonBinary } from "./helpers/update-package-json.mjs";
|
|
4
|
+
import { getAppDescription, getAppName, getAppTitle } from "./helpers/utilities.mjs";
|
|
5
|
+
import tsdown from "@powerlines/plugin-tsdown";
|
|
6
|
+
import { chmodX } from "@stryke/fs/chmod-x";
|
|
7
|
+
import { getUniqueBy } from "@stryke/helpers/get-unique";
|
|
8
|
+
import { appendPath } from "@stryke/path/append";
|
|
9
|
+
import { findFileName, findFilePath } from "@stryke/path/file-path-fns";
|
|
10
|
+
import { isParentPath } from "@stryke/path/is-parent-path";
|
|
11
|
+
import { joinPaths } from "@stryke/path/join-paths";
|
|
12
|
+
import { replacePath } from "@stryke/path/replace";
|
|
13
|
+
import { resolveParentPath } from "@stryke/path/resolve-parent-path";
|
|
14
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
15
|
+
import { isFunction } from "@stryke/type-checks/is-function";
|
|
16
|
+
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
17
|
+
import { defu } from "defu";
|
|
18
|
+
|
|
19
|
+
//#region src/powerlines.ts
|
|
20
|
+
const MAX_DEPTH = 50;
|
|
21
|
+
/**
|
|
22
|
+
* The core Powerlines plugin to build Shell Shock projects.
|
|
23
|
+
*/
|
|
24
|
+
const shellShock = (options = {}) => {
|
|
25
|
+
return [
|
|
26
|
+
tsdown(),
|
|
27
|
+
{
|
|
28
|
+
name: "shell-shock:config",
|
|
29
|
+
async config() {
|
|
30
|
+
this.trace("Resolving the Shell Shock configuration.");
|
|
31
|
+
return defu(options, {
|
|
32
|
+
entry: !this.config.entry || Array.isArray(this.config.entry) && this.config.entry.length === 0 ? [joinPaths(this.config.sourceRoot, "**/*")] : void 0,
|
|
33
|
+
build: {
|
|
34
|
+
target: "node22",
|
|
35
|
+
platform: "node"
|
|
36
|
+
},
|
|
37
|
+
type: "application",
|
|
38
|
+
framework: "shell-shock"
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
configResolved: {
|
|
42
|
+
order: "pre",
|
|
43
|
+
async handler() {
|
|
44
|
+
this.trace("Shell Shock configuration has been resolved.");
|
|
45
|
+
await updatePackageJsonBinary(this);
|
|
46
|
+
this.config.name = getAppName(this);
|
|
47
|
+
this.config.title = getAppTitle(this);
|
|
48
|
+
this.config.description = getAppDescription(this);
|
|
49
|
+
if (this.config.defaultOptions === false) this.options = [];
|
|
50
|
+
else if (Array.isArray(this.config.defaultOptions)) this.options = getUniqueBy(this.config.defaultOptions, (item) => item.name);
|
|
51
|
+
else if (isFunction(this.config.defaultOptions)) this.options = getUniqueBy(this.config.defaultOptions(this, {
|
|
52
|
+
id: null,
|
|
53
|
+
name: this.config.name,
|
|
54
|
+
title: this.config.title,
|
|
55
|
+
description: this.config.description,
|
|
56
|
+
path: [],
|
|
57
|
+
isVirtual: false
|
|
58
|
+
}), (item) => item.name);
|
|
59
|
+
this.inputs ??= [];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "shell-shock:inputs",
|
|
65
|
+
async configResolved() {
|
|
66
|
+
this.trace("Finding command entry points.");
|
|
67
|
+
this.commandsPath = findCommandsRoot(this);
|
|
68
|
+
this.inputs = this.entry.filter((entry) => findFileName(entry.file, { withExtension: false }) === "command").reduce((ret, entry) => {
|
|
69
|
+
const file = appendPath(appendPath(entry.file, this.config.projectRoot), this.workspaceConfig.workspaceRoot);
|
|
70
|
+
if (!isParentPath(file, this.commandsPath)) throw new Error(`Command entry point "${file}" is not located within the commands root "${this.commandsPath}". Please ensure that all command entry points are located within the current project.`);
|
|
71
|
+
const path = resolveCommandPath(this, file);
|
|
72
|
+
const id = path.replaceAll("/", "-");
|
|
73
|
+
if (!ret.some((existing) => existing.id === id)) {
|
|
74
|
+
const name = findCommandName(file);
|
|
75
|
+
ret.push({
|
|
76
|
+
id,
|
|
77
|
+
path: path.split("/").filter(Boolean),
|
|
78
|
+
name,
|
|
79
|
+
title: titleCase(name),
|
|
80
|
+
isVirtual: false,
|
|
81
|
+
entry: {
|
|
82
|
+
...entry,
|
|
83
|
+
file,
|
|
84
|
+
input: {
|
|
85
|
+
file: entry.file,
|
|
86
|
+
name: entry.name
|
|
87
|
+
},
|
|
88
|
+
output: name
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return ret;
|
|
93
|
+
}, this.inputs);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: "shell-shock:virtual-inputs",
|
|
98
|
+
configResolved: {
|
|
99
|
+
order: "post",
|
|
100
|
+
async handler() {
|
|
101
|
+
if (this.inputs.length === 0) this.warn("No commands were found in the project. Please ensure at least one command exists.");
|
|
102
|
+
else {
|
|
103
|
+
this.info(`Shell Shock will create an application with the following commands: \n${this.inputs.filter((cmd) => !cmd.isVirtual).map((command) => ` - ${command.id}: ${replacePath(command.entry.file, this.commandsPath)}${command.isVirtual ? " (virtual)" : ""}`).join("\n")}`);
|
|
104
|
+
this.trace("Finding and adding virtual command inputs for each command previously found.");
|
|
105
|
+
this.inputs = this.inputs.reduce((ret, command) => {
|
|
106
|
+
let depth = 0;
|
|
107
|
+
let parentPath = resolveParentPath(findFilePath(command.entry.file));
|
|
108
|
+
while (parentPath !== this.commandsPath) {
|
|
109
|
+
if (depth++ > MAX_DEPTH) throw new Error(`Maximum command virtual parent depth of ${MAX_DEPTH} exceeded while processing command: ${command.name}`);
|
|
110
|
+
if (!ret.some((existing) => findFilePath(existing.entry.file) === parentPath)) {
|
|
111
|
+
const file = joinPaths(parentPath, "command.ts");
|
|
112
|
+
const path = resolveCommandPath(this, file);
|
|
113
|
+
const id = path.replaceAll("/", "-");
|
|
114
|
+
if (!ret.some((existing) => existing.id === id)) {
|
|
115
|
+
const name = findCommandName(file);
|
|
116
|
+
ret.push({
|
|
117
|
+
id,
|
|
118
|
+
path: path.split("/").filter(Boolean),
|
|
119
|
+
name,
|
|
120
|
+
title: titleCase(name),
|
|
121
|
+
isVirtual: true,
|
|
122
|
+
entry: {
|
|
123
|
+
file,
|
|
124
|
+
input: { file }
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
parentPath = resolveParentPath(parentPath);
|
|
130
|
+
}
|
|
131
|
+
return ret;
|
|
132
|
+
}, this.inputs).sort((a, b) => a.path.length - b.path.length);
|
|
133
|
+
this.trace(`Final command input list: \n${this.inputs.map((command) => ` - ${command.id}: ${replacePath(command.entry.file, this.commandsPath)}${command.isVirtual ? " (virtual)" : ""}`).join("\n")}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "shell-shock:reflect-commands",
|
|
140
|
+
async prepare() {
|
|
141
|
+
this.entry = [];
|
|
142
|
+
this.commands = {};
|
|
143
|
+
if (this.config.command !== "prepare" && this.config.skipCache !== true && this.persistedMeta?.checksum === this.meta.checksum && this.fs.existsSync(getCommandsPersistencePath(this))) {
|
|
144
|
+
this.debug(`Skipping reflection initialization as the meta checksum has not changed.`);
|
|
145
|
+
await readCommandsPersistence(this);
|
|
146
|
+
} else {
|
|
147
|
+
for (const input of this.inputs.filter((input$1) => input$1.path.length === 1)) this.commands[input.name] = await reflectCommandTree(this, input);
|
|
148
|
+
await writeCommandsPersistence(this);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: "shell-shock:chmod+x",
|
|
154
|
+
async buildEnd() {
|
|
155
|
+
if (!isSetObject(this.packageJson.bin)) {
|
|
156
|
+
this.warn("No binaries were found in package.json. Please ensure the binaries are correctly configured.");
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
this.debug("Adding executable permissions to binaries.");
|
|
160
|
+
for (const executablePath of Object.values(this.packageJson.bin)) if (this.fs.existsSync(appendPath(executablePath, this.config.output.buildPath))) await chmodX(appendPath(executablePath, this.config.output.buildPath));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
];
|
|
164
|
+
};
|
|
165
|
+
var powerlines_default = shellShock;
|
|
166
|
+
|
|
167
|
+
//#endregion
|
|
168
|
+
export { powerlines_default as default, shellShock };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
2
|
+
import { ResolvedEntryTypeDefinition } from "powerlines/types/resolved";
|
|
3
|
+
|
|
4
|
+
//#region src/types/command.d.ts
|
|
5
|
+
interface BaseCommandOption {
|
|
6
|
+
name: string;
|
|
7
|
+
kind: ReflectionKind;
|
|
8
|
+
title: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
alias: string[];
|
|
11
|
+
optional: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface StringCommandOption extends BaseCommandOption {
|
|
14
|
+
kind: ReflectionKind.string;
|
|
15
|
+
format?: "path" | "url" | "date" | "time" | "datetime" | "json" | "regex" | string;
|
|
16
|
+
default?: string;
|
|
17
|
+
variadic: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface NumberCommandOption extends BaseCommandOption {
|
|
20
|
+
kind: ReflectionKind.number;
|
|
21
|
+
default?: number;
|
|
22
|
+
variadic: boolean;
|
|
23
|
+
}
|
|
24
|
+
interface BooleanCommandOption extends BaseCommandOption {
|
|
25
|
+
kind: ReflectionKind.boolean;
|
|
26
|
+
default?: boolean;
|
|
27
|
+
isNegativeOf?: string;
|
|
28
|
+
skipAddingNegative?: boolean;
|
|
29
|
+
}
|
|
30
|
+
type CommandOption = StringCommandOption | NumberCommandOption | BooleanCommandOption;
|
|
31
|
+
interface CommandParam {
|
|
32
|
+
name: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
default?: string;
|
|
35
|
+
optional: boolean;
|
|
36
|
+
variadic: boolean;
|
|
37
|
+
}
|
|
38
|
+
interface CommandBase {
|
|
39
|
+
id: string | null;
|
|
40
|
+
name: string;
|
|
41
|
+
title?: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
path: string[];
|
|
44
|
+
isVirtual: boolean;
|
|
45
|
+
}
|
|
46
|
+
interface CommandInput extends CommandBase {
|
|
47
|
+
id: string;
|
|
48
|
+
entry: ResolvedEntryTypeDefinition;
|
|
49
|
+
}
|
|
50
|
+
type CommandTree = CommandInput & {
|
|
51
|
+
title: string;
|
|
52
|
+
description: string;
|
|
53
|
+
options: Record<string, CommandOption>;
|
|
54
|
+
params: CommandParam[];
|
|
55
|
+
parent: null | CommandTree;
|
|
56
|
+
children: Record<string, CommandTree>;
|
|
57
|
+
};
|
|
58
|
+
type SerializedCommandTree = Omit<CommandTree, "parent" | "children"> & {
|
|
59
|
+
parent: null | string;
|
|
60
|
+
children: Record<string, SerializedCommandTree>;
|
|
61
|
+
};
|
|
62
|
+
//#endregion
|
|
63
|
+
export { BaseCommandOption, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, NumberCommandOption, SerializedCommandTree, StringCommandOption };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
2
|
+
import { ResolvedEntryTypeDefinition } from "powerlines/types/resolved";
|
|
3
|
+
|
|
4
|
+
//#region src/types/command.d.ts
|
|
5
|
+
interface BaseCommandOption {
|
|
6
|
+
name: string;
|
|
7
|
+
kind: ReflectionKind;
|
|
8
|
+
title: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
alias: string[];
|
|
11
|
+
optional: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface StringCommandOption extends BaseCommandOption {
|
|
14
|
+
kind: ReflectionKind.string;
|
|
15
|
+
format?: "path" | "url" | "date" | "time" | "datetime" | "json" | "regex" | string;
|
|
16
|
+
default?: string;
|
|
17
|
+
variadic: boolean;
|
|
18
|
+
}
|
|
19
|
+
interface NumberCommandOption extends BaseCommandOption {
|
|
20
|
+
kind: ReflectionKind.number;
|
|
21
|
+
default?: number;
|
|
22
|
+
variadic: boolean;
|
|
23
|
+
}
|
|
24
|
+
interface BooleanCommandOption extends BaseCommandOption {
|
|
25
|
+
kind: ReflectionKind.boolean;
|
|
26
|
+
default?: boolean;
|
|
27
|
+
isNegativeOf?: string;
|
|
28
|
+
skipAddingNegative?: boolean;
|
|
29
|
+
}
|
|
30
|
+
type CommandOption = StringCommandOption | NumberCommandOption | BooleanCommandOption;
|
|
31
|
+
interface CommandParam {
|
|
32
|
+
name: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
default?: string;
|
|
35
|
+
optional: boolean;
|
|
36
|
+
variadic: boolean;
|
|
37
|
+
}
|
|
38
|
+
interface CommandBase {
|
|
39
|
+
id: string | null;
|
|
40
|
+
name: string;
|
|
41
|
+
title?: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
path: string[];
|
|
44
|
+
isVirtual: boolean;
|
|
45
|
+
}
|
|
46
|
+
interface CommandInput extends CommandBase {
|
|
47
|
+
id: string;
|
|
48
|
+
entry: ResolvedEntryTypeDefinition;
|
|
49
|
+
}
|
|
50
|
+
type CommandTree = CommandInput & {
|
|
51
|
+
title: string;
|
|
52
|
+
description: string;
|
|
53
|
+
options: Record<string, CommandOption>;
|
|
54
|
+
params: CommandParam[];
|
|
55
|
+
parent: null | CommandTree;
|
|
56
|
+
children: Record<string, CommandTree>;
|
|
57
|
+
};
|
|
58
|
+
type SerializedCommandTree = Omit<CommandTree, "parent" | "children"> & {
|
|
59
|
+
parent: null | string;
|
|
60
|
+
children: Record<string, SerializedCommandTree>;
|
|
61
|
+
};
|
|
62
|
+
//#endregion
|
|
63
|
+
export { BaseCommandOption, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, NumberCommandOption, SerializedCommandTree, StringCommandOption };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/types/config.d.cts
CHANGED
|
@@ -1,41 +1,24 @@
|
|
|
1
|
+
import { CommandBase, CommandOption } from "./command.cjs";
|
|
2
|
+
import { Context } from "./context.cjs";
|
|
3
|
+
import { NodeJsPluginOptions, NodeJsPluginResolvedConfig, NodeJsPluginUserConfig } from "@powerlines/plugin-nodejs/types/plugin";
|
|
1
4
|
import { TsdownPluginResolvedConfig, TsdownPluginUserConfig } from "@powerlines/plugin-tsdown";
|
|
2
5
|
|
|
3
6
|
//#region src/types/config.d.ts
|
|
4
|
-
interface Options {
|
|
7
|
+
interface Options extends NodeJsPluginOptions {
|
|
5
8
|
/**
|
|
6
|
-
*
|
|
9
|
+
* A set of default command options to apply to each command.
|
|
7
10
|
*
|
|
8
11
|
* @remarks
|
|
9
|
-
*
|
|
10
|
-
* - `true`: Enable interactivity when a TTY is detected and no explicit interactive flag is set (default).
|
|
11
|
-
* - `false`: Disable interactivity unless an explicit interactive flag is set.
|
|
12
|
-
* - `"never"`: Always disable interactivity, regardless of TTY presence or flags.
|
|
13
|
-
*
|
|
14
|
-
* @defaultValue `true`
|
|
15
|
-
*/
|
|
16
|
-
interactive?: boolean | "never";
|
|
17
|
-
/**
|
|
18
|
-
* Whether to skip adding the default arguments to commands.
|
|
19
|
-
*
|
|
20
|
-
* @remarks
|
|
21
|
-
* By default, Shell Shock adds the following set of default arguments to each command:
|
|
22
|
-
* - `--help` (`-h`, `-?`): Show help information.
|
|
23
|
-
* - `--version` (`-v`): Show the version of the application.
|
|
24
|
-
* - `--interactive` (`-i`, `--interact`): Enable interactive mode.
|
|
25
|
-
* - `--no-interactive`: Disable interactive mode.
|
|
26
|
-
* - `--no-banner`: Hide the banner displayed while running the CLI application.
|
|
27
|
-
* - `--verbose`: Enable verbose output.
|
|
28
|
-
*
|
|
29
|
-
* @defaultValue `false`
|
|
12
|
+
* To disable the addition of these default options, set this property to `false`, or provide a custom set of options/a function that returns them.
|
|
30
13
|
*/
|
|
31
|
-
|
|
14
|
+
defaultOptions?: CommandOption[] | ((context: Context, input: CommandBase) => CommandOption[]) | false;
|
|
32
15
|
/**
|
|
33
16
|
* The name(s) of the binary that will be generated to run the CLI
|
|
34
17
|
*/
|
|
35
18
|
bin?: string | string[];
|
|
36
19
|
}
|
|
37
|
-
type UserConfig = Partial<Omit<TsdownPluginUserConfig, "type" | "framework" | "singleBuild" | "environments">> & Options
|
|
38
|
-
type ResolvedConfig = TsdownPluginResolvedConfig & Required<Omit<Options, "bin"> & {
|
|
20
|
+
type UserConfig = Partial<Omit<TsdownPluginUserConfig, "type" | "framework" | "singleBuild" | "environments">> & Partial<NodeJsPluginUserConfig> & Omit<Options, "env">;
|
|
21
|
+
type ResolvedConfig = TsdownPluginResolvedConfig & NodeJsPluginResolvedConfig & Required<Omit<Options, "bin" | "env"> & {
|
|
39
22
|
bin: string[];
|
|
40
23
|
}>;
|
|
41
24
|
//#endregion
|
package/dist/types/config.d.mts
CHANGED
|
@@ -1,41 +1,24 @@
|
|
|
1
|
+
import { CommandBase, CommandOption } from "./command.mjs";
|
|
2
|
+
import { Context } from "./context.mjs";
|
|
1
3
|
import { TsdownPluginResolvedConfig, TsdownPluginUserConfig } from "@powerlines/plugin-tsdown";
|
|
4
|
+
import { NodeJsPluginOptions, NodeJsPluginResolvedConfig, NodeJsPluginUserConfig } from "@powerlines/plugin-nodejs/types/plugin";
|
|
2
5
|
|
|
3
6
|
//#region src/types/config.d.ts
|
|
4
|
-
interface Options {
|
|
7
|
+
interface Options extends NodeJsPluginOptions {
|
|
5
8
|
/**
|
|
6
|
-
*
|
|
9
|
+
* A set of default command options to apply to each command.
|
|
7
10
|
*
|
|
8
11
|
* @remarks
|
|
9
|
-
*
|
|
10
|
-
* - `true`: Enable interactivity when a TTY is detected and no explicit interactive flag is set (default).
|
|
11
|
-
* - `false`: Disable interactivity unless an explicit interactive flag is set.
|
|
12
|
-
* - `"never"`: Always disable interactivity, regardless of TTY presence or flags.
|
|
13
|
-
*
|
|
14
|
-
* @defaultValue `true`
|
|
15
|
-
*/
|
|
16
|
-
interactive?: boolean | "never";
|
|
17
|
-
/**
|
|
18
|
-
* Whether to skip adding the default arguments to commands.
|
|
19
|
-
*
|
|
20
|
-
* @remarks
|
|
21
|
-
* By default, Shell Shock adds the following set of default arguments to each command:
|
|
22
|
-
* - `--help` (`-h`, `-?`): Show help information.
|
|
23
|
-
* - `--version` (`-v`): Show the version of the application.
|
|
24
|
-
* - `--interactive` (`-i`, `--interact`): Enable interactive mode.
|
|
25
|
-
* - `--no-interactive`: Disable interactive mode.
|
|
26
|
-
* - `--no-banner`: Hide the banner displayed while running the CLI application.
|
|
27
|
-
* - `--verbose`: Enable verbose output.
|
|
28
|
-
*
|
|
29
|
-
* @defaultValue `false`
|
|
12
|
+
* To disable the addition of these default options, set this property to `false`, or provide a custom set of options/a function that returns them.
|
|
30
13
|
*/
|
|
31
|
-
|
|
14
|
+
defaultOptions?: CommandOption[] | ((context: Context, input: CommandBase) => CommandOption[]) | false;
|
|
32
15
|
/**
|
|
33
16
|
* The name(s) of the binary that will be generated to run the CLI
|
|
34
17
|
*/
|
|
35
18
|
bin?: string | string[];
|
|
36
19
|
}
|
|
37
|
-
type UserConfig = Partial<Omit<TsdownPluginUserConfig, "type" | "framework" | "singleBuild" | "environments">> & Options
|
|
38
|
-
type ResolvedConfig = TsdownPluginResolvedConfig & Required<Omit<Options, "bin"> & {
|
|
20
|
+
type UserConfig = Partial<Omit<TsdownPluginUserConfig, "type" | "framework" | "singleBuild" | "environments">> & Partial<NodeJsPluginUserConfig> & Omit<Options, "env">;
|
|
21
|
+
type ResolvedConfig = TsdownPluginResolvedConfig & NodeJsPluginResolvedConfig & Required<Omit<Options, "bin" | "env"> & {
|
|
39
22
|
bin: string[];
|
|
40
23
|
}>;
|
|
41
24
|
//#endregion
|
package/dist/types/config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CommandInput, CommandOption, CommandTree } from "./command.cjs";
|
|
2
|
+
import { ResolvedConfig } from "./config.cjs";
|
|
3
|
+
import { TsdownPluginContext } from "@powerlines/plugin-tsdown";
|
|
4
|
+
import { EnvPluginContext } from "@powerlines/plugin-env/types/plugin";
|
|
5
|
+
|
|
6
|
+
//#region src/types/context.d.ts
|
|
7
|
+
type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = TsdownPluginContext<TResolvedConfig> & EnvPluginContext<TResolvedConfig> & {
|
|
8
|
+
/**
|
|
9
|
+
* The root path where commands are located.
|
|
10
|
+
*/
|
|
11
|
+
commandsPath: string;
|
|
12
|
+
/**
|
|
13
|
+
* The default command arguments to apply to all application commands.
|
|
14
|
+
*/
|
|
15
|
+
options: CommandOption[];
|
|
16
|
+
/**
|
|
17
|
+
* The list of commands discovered in the project.
|
|
18
|
+
*/
|
|
19
|
+
inputs: CommandInput[];
|
|
20
|
+
/**
|
|
21
|
+
* The command-line application structure.
|
|
22
|
+
*/
|
|
23
|
+
commands: Record<string, CommandTree>;
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { Context };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CommandInput, CommandOption, CommandTree } from "./command.mjs";
|
|
2
|
+
import { ResolvedConfig } from "./config.mjs";
|
|
3
|
+
import { TsdownPluginContext } from "@powerlines/plugin-tsdown";
|
|
4
|
+
import { EnvPluginContext } from "@powerlines/plugin-env/types/plugin";
|
|
5
|
+
|
|
6
|
+
//#region src/types/context.d.ts
|
|
7
|
+
type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = TsdownPluginContext<TResolvedConfig> & EnvPluginContext<TResolvedConfig> & {
|
|
8
|
+
/**
|
|
9
|
+
* The root path where commands are located.
|
|
10
|
+
*/
|
|
11
|
+
commandsPath: string;
|
|
12
|
+
/**
|
|
13
|
+
* The default command arguments to apply to all application commands.
|
|
14
|
+
*/
|
|
15
|
+
options: CommandOption[];
|
|
16
|
+
/**
|
|
17
|
+
* The list of commands discovered in the project.
|
|
18
|
+
*/
|
|
19
|
+
inputs: CommandInput[];
|
|
20
|
+
/**
|
|
21
|
+
* The command-line application structure.
|
|
22
|
+
*/
|
|
23
|
+
commands: Record<string, CommandTree>;
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { Context };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { BaseCommandOption, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, NumberCommandOption, SerializedCommandTree, StringCommandOption } from "./command.cjs";
|
|
2
|
+
import { Context } from "./context.cjs";
|
|
1
3
|
import { Options, ResolvedConfig, UserConfig } from "./config.cjs";
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
+
import { BaseCommandOptions } from "./options.cjs";
|
|
5
|
+
export { BaseCommandOption, BaseCommandOptions, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, Context, NumberCommandOption, Options, ResolvedConfig, SerializedCommandTree, StringCommandOption, UserConfig };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { BaseCommandOption, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, NumberCommandOption, SerializedCommandTree, StringCommandOption } from "./command.mjs";
|
|
2
|
+
import { Context } from "./context.mjs";
|
|
1
3
|
import { Options, ResolvedConfig, UserConfig } from "./config.mjs";
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
+
import { BaseCommandOptions } from "./options.mjs";
|
|
5
|
+
export { BaseCommandOption, BaseCommandOptions, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, Context, NumberCommandOption, Options, ResolvedConfig, SerializedCommandTree, StringCommandOption, UserConfig };
|
package/dist/types/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "A package containing
|
|
5
|
+
"description": "A package containing the core Shell Shock functionality used to build and manage a command-line application.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "github",
|
|
8
8
|
"url": "https://github.com/storm-software/shell-shock.git",
|
|
@@ -131,23 +131,86 @@
|
|
|
131
131
|
"types": "./dist/types/*.d.mts",
|
|
132
132
|
"default": "./dist/types/*.mjs"
|
|
133
133
|
}
|
|
134
|
+
},
|
|
135
|
+
"./plugin-utils": {
|
|
136
|
+
"import": {
|
|
137
|
+
"types": "./dist/plugin-utils/index.d.mts",
|
|
138
|
+
"default": "./dist/plugin-utils/index.mjs"
|
|
139
|
+
},
|
|
140
|
+
"require": {
|
|
141
|
+
"types": "./dist/plugin-utils/index.d.cts",
|
|
142
|
+
"default": "./dist/plugin-utils/index.cjs"
|
|
143
|
+
},
|
|
144
|
+
"default": {
|
|
145
|
+
"types": "./dist/plugin-utils/index.d.mts",
|
|
146
|
+
"default": "./dist/plugin-utils/index.mjs"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"./plugin-utils/*": {
|
|
150
|
+
"import": {
|
|
151
|
+
"types": "./dist/plugin-utils/*.d.mts",
|
|
152
|
+
"default": "./dist/plugin-utils/*.mjs"
|
|
153
|
+
},
|
|
154
|
+
"require": {
|
|
155
|
+
"types": "./dist/plugin-utils/*.d.cts",
|
|
156
|
+
"default": "./dist/plugin-utils/*.cjs"
|
|
157
|
+
},
|
|
158
|
+
"default": {
|
|
159
|
+
"types": "./dist/plugin-utils/*.d.mts",
|
|
160
|
+
"default": "./dist/plugin-utils/*.mjs"
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"./components": {
|
|
164
|
+
"import": {
|
|
165
|
+
"types": "./dist/components/index.d.mts",
|
|
166
|
+
"default": "./dist/components/index.mjs"
|
|
167
|
+
},
|
|
168
|
+
"require": {
|
|
169
|
+
"types": "./dist/components/index.d.cts",
|
|
170
|
+
"default": "./dist/components/index.cjs"
|
|
171
|
+
},
|
|
172
|
+
"default": {
|
|
173
|
+
"types": "./dist/components/index.d.mts",
|
|
174
|
+
"default": "./dist/components/index.mjs"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"./components/*": {
|
|
178
|
+
"import": {
|
|
179
|
+
"types": "./dist/components/*.d.mts",
|
|
180
|
+
"default": "./dist/components/*.mjs"
|
|
181
|
+
},
|
|
182
|
+
"require": {
|
|
183
|
+
"types": "./dist/components/*.d.cts",
|
|
184
|
+
"default": "./dist/components/*.cjs"
|
|
185
|
+
},
|
|
186
|
+
"default": {
|
|
187
|
+
"types": "./dist/components/*.d.mts",
|
|
188
|
+
"default": "./dist/components/*.mjs"
|
|
189
|
+
}
|
|
134
190
|
}
|
|
135
191
|
},
|
|
136
192
|
"files": ["dist/**/*"],
|
|
137
193
|
"keywords": ["shell-shock", "powerlines", "storm-software"],
|
|
138
194
|
"dependencies": {
|
|
139
|
-
"@
|
|
140
|
-
"@
|
|
141
|
-
"@
|
|
142
|
-
"@
|
|
143
|
-
"@
|
|
144
|
-
"@
|
|
145
|
-
"@stryke/
|
|
146
|
-
"@stryke/
|
|
195
|
+
"@alloy-js/core": "^0.22.0",
|
|
196
|
+
"@alloy-js/typescript": "^0.22.0",
|
|
197
|
+
"@powerlines/deepkit": "^0.5.56",
|
|
198
|
+
"@powerlines/plugin-alloy": "^0.18.24",
|
|
199
|
+
"@powerlines/plugin-plugin": "^0.12.92",
|
|
200
|
+
"@powerlines/plugin-tsdown": "^0.1.93",
|
|
201
|
+
"@stryke/convert": "^0.6.30",
|
|
202
|
+
"@stryke/fs": "^0.33.27",
|
|
203
|
+
"@stryke/helpers": "^0.9.32",
|
|
204
|
+
"@stryke/json": "^0.9.33",
|
|
205
|
+
"@stryke/path": "^0.24.1",
|
|
206
|
+
"@stryke/string-format": "^0.12.30",
|
|
207
|
+
"@stryke/type-checks": "^0.5.15",
|
|
147
208
|
"defu": "^6.1.4",
|
|
148
|
-
"powerlines": "^0.
|
|
209
|
+
"powerlines": "^0.37.14",
|
|
210
|
+
"@powerlines/plugin-env": "^0.15.27",
|
|
211
|
+
"@powerlines/plugin-nodejs": "^0.1.22"
|
|
149
212
|
},
|
|
150
|
-
"devDependencies": { "@types/node": "^
|
|
213
|
+
"devDependencies": { "@types/node": "^22.19.3", "typescript": "^5.9.3" },
|
|
151
214
|
"publishConfig": { "access": "public" },
|
|
152
|
-
"gitHead": "
|
|
215
|
+
"gitHead": "5a8ce9d8f2cefeec8df5147bf80b5c3af71c6c16"
|
|
153
216
|
}
|