kist 0.0.0 → 0.1.31
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/LICENSE +21 -0
- package/README.md +298 -3
- package/js/actions/CoreActions.d.ts +6 -0
- package/js/actions/CoreActions.js +47 -0
- package/js/actions/DirectoryCleanAction/DirectoryCleanAction.d.ts +36 -0
- package/js/actions/DirectoryCleanAction/DirectoryCleanAction.js +123 -0
- package/js/actions/DirectoryCleanAction/index.d.ts +2 -0
- package/js/actions/DirectoryCleanAction/index.js +8 -0
- package/js/actions/DirectoryCopyAction/DirectoryCopyAction.d.ts +42 -0
- package/js/actions/DirectoryCopyAction/DirectoryCopyAction.js +118 -0
- package/js/actions/DirectoryCopyAction/index.d.ts +2 -0
- package/js/actions/DirectoryCopyAction/index.js +8 -0
- package/js/actions/DirectoryCreateAction/DirectoryCreateAction.d.ts +30 -0
- package/js/actions/DirectoryCreateAction/DirectoryCreateAction.js +85 -0
- package/js/actions/DirectoryCreateAction/index.d.ts +2 -0
- package/js/actions/DirectoryCreateAction/index.js +8 -0
- package/js/actions/DocumentationAction/DocumentationAction.d.ts +23 -0
- package/js/actions/DocumentationAction/DocumentationAction.js +88 -0
- package/js/actions/DocumentationAction/index.d.ts +2 -0
- package/js/actions/DocumentationAction/index.js +8 -0
- package/js/actions/FileCopyAction/FileCopyAction.d.ts +42 -0
- package/js/actions/FileCopyAction/FileCopyAction.js +127 -0
- package/js/actions/FileCopyAction/index.d.ts +2 -0
- package/js/actions/FileCopyAction/index.js +8 -0
- package/js/actions/FileRenameAction/FileRenameAction.d.ts +30 -0
- package/js/actions/FileRenameAction/FileRenameAction.js +84 -0
- package/js/actions/FileRenameAction/index.d.ts +2 -0
- package/js/actions/FileRenameAction/index.js +8 -0
- package/js/actions/JavaScriptMinifyAction/JavaScriptMinifyAction.d.ts +31 -0
- package/js/actions/JavaScriptMinifyAction/JavaScriptMinifyAction.js +98 -0
- package/js/actions/JavaScriptMinifyAction/index.d.ts +2 -0
- package/js/actions/JavaScriptMinifyAction/index.js +8 -0
- package/js/actions/JavaScriptMinifyAction/terser.config.d.ts +27 -0
- package/js/actions/JavaScriptMinifyAction/terser.config.js +119 -0
- package/js/actions/LintAction/LintAction.d.ts +17 -0
- package/js/actions/LintAction/LintAction.js +63 -0
- package/js/actions/LintAction/index.d.ts +2 -0
- package/js/actions/LintAction/index.js +8 -0
- package/js/actions/PackageManagerAction/PackageManagerAction.d.ts +57 -0
- package/js/actions/PackageManagerAction/PackageManagerAction.js +161 -0
- package/js/actions/PackageManagerAction/index.d.ts +2 -0
- package/js/actions/PackageManagerAction/index.js +8 -0
- package/js/actions/PackageManagerAction/package.config.d.ts +16 -0
- package/js/actions/PackageManagerAction/package.config.js +91 -0
- package/js/actions/StyleProcessingAction/StyleProcessingAction.d.ts +34 -0
- package/js/actions/StyleProcessingAction/StyleProcessingAction.js +164 -0
- package/js/actions/StyleProcessingAction/index.d.ts +2 -0
- package/js/actions/StyleProcessingAction/index.js +8 -0
- package/js/actions/StyleProcessingAction/postcss.config.compressed.d.ts +10 -0
- package/js/actions/StyleProcessingAction/postcss.config.compressed.js +31 -0
- package/js/actions/StyleProcessingAction/postcss.config.expanded.d.ts +16 -0
- package/js/actions/StyleProcessingAction/postcss.config.expanded.js +45 -0
- package/js/actions/SvgPackagerAction/SvgPackagerAction.d.ts +68 -0
- package/js/actions/SvgPackagerAction/SvgPackagerAction.js +186 -0
- package/js/actions/SvgPackagerAction/index.d.ts +2 -0
- package/js/actions/SvgPackagerAction/index.js +8 -0
- package/js/actions/SvgReaderAction/SvgReaderAction.d.ts +32 -0
- package/js/actions/SvgReaderAction/SvgReaderAction.js +87 -0
- package/js/actions/SvgReaderAction/index.d.ts +2 -0
- package/js/actions/SvgReaderAction/index.js +8 -0
- package/js/actions/SvgSpriteAction/SvgSpriteAction.d.ts +37 -0
- package/js/actions/SvgSpriteAction/SvgSpriteAction.js +114 -0
- package/js/actions/SvgSpriteAction/index.d.ts +2 -0
- package/js/actions/SvgSpriteAction/index.js +8 -0
- package/js/actions/SvgSpriteAction/svgsprite.config.d.ts +3 -0
- package/js/actions/SvgSpriteAction/svgsprite.config.js +117 -0
- package/js/actions/SvgToPngAction/SvgToPngAction.d.ts +28 -0
- package/js/actions/SvgToPngAction/SvgToPngAction.js +108 -0
- package/js/actions/SvgToPngAction/index.d.ts +2 -0
- package/js/actions/SvgToPngAction/index.js +8 -0
- package/js/actions/TypeScriptCompilerAction/TypeScriptCompilerAction.d.ts +28 -0
- package/js/actions/TypeScriptCompilerAction/TypeScriptCompilerAction.js +96 -0
- package/js/actions/TypeScriptCompilerAction/index.d.ts +2 -0
- package/js/actions/TypeScriptCompilerAction/index.js +8 -0
- package/js/actions/VersionWriteAction/VersionWriteAction.d.ts +45 -0
- package/js/actions/VersionWriteAction/VersionWriteAction.js +147 -0
- package/js/actions/VersionWriteAction/index.d.ts +2 -0
- package/js/actions/VersionWriteAction/index.js +8 -0
- package/js/cli/ArgumentParser.d.ts +62 -0
- package/js/cli/ArgumentParser.js +118 -0
- package/js/cli.d.ts +6 -0
- package/js/cli.js +58 -0
- package/js/core/abstract/AbstractProcess.d.ts +62 -0
- package/js/core/abstract/AbstractProcess.js +96 -0
- package/js/core/abstract/AbstractValidator.d.ts +72 -0
- package/js/core/abstract/AbstractValidator.js +128 -0
- package/js/core/config/ConfigLoader.d.ts +47 -0
- package/js/core/config/ConfigLoader.js +130 -0
- package/js/core/config/ConfigStore.d.ts +53 -0
- package/js/core/config/ConfigStore.js +136 -0
- package/js/core/config/defaultConfig.d.ts +5 -0
- package/js/core/config/defaultConfig.js +131 -0
- package/js/core/pipeline/Action.d.ts +60 -0
- package/js/core/pipeline/Action.js +77 -0
- package/js/core/pipeline/ActionRegistry.d.ts +80 -0
- package/js/core/pipeline/ActionRegistry.js +180 -0
- package/js/core/pipeline/Pipeline.d.ts +42 -0
- package/js/core/pipeline/Pipeline.js +107 -0
- package/js/core/pipeline/PipelineManager.d.ts +55 -0
- package/js/core/pipeline/PipelineManager.js +164 -0
- package/js/core/pipeline/Stage.d.ts +45 -0
- package/js/core/pipeline/Stage.js +110 -0
- package/js/core/pipeline/Step.d.ts +26 -0
- package/js/core/pipeline/Step.js +85 -0
- package/js/core/validation/OptionsValidator.d.ts +43 -0
- package/js/core/validation/OptionsValidator.js +123 -0
- package/js/index.d.ts +3 -0
- package/js/index.js +36 -0
- package/js/interface/ActionInterface.d.ts +57 -0
- package/js/interface/ActionInterface.js +5 -0
- package/js/interface/ActionPlugin.d.ts +4 -0
- package/js/interface/ActionPlugin.js +5 -0
- package/js/interface/ConfigInterface.d.ts +43 -0
- package/js/interface/ConfigInterface.js +5 -0
- package/js/interface/LiveOptionsInterface.d.ts +42 -0
- package/js/interface/LiveOptionsInterface.js +2 -0
- package/js/interface/MetadataInterface.d.ts +95 -0
- package/js/interface/MetadataInterface.js +2 -0
- package/js/interface/OptionsInterface.d.ts +45 -0
- package/js/interface/OptionsInterface.js +5 -0
- package/js/interface/PipelineOptionsInterface.d.ts +66 -0
- package/js/interface/PipelineOptionsInterface.js +5 -0
- package/js/interface/StageInterface.d.ts +79 -0
- package/js/interface/StageInterface.js +5 -0
- package/js/interface/StepInterface.d.ts +66 -0
- package/js/interface/StepInterface.js +5 -0
- package/js/interface/StepOptionsInterface.d.ts +38 -0
- package/js/interface/StepOptionsInterface.js +21 -0
- package/js/interface/index.d.ts +7 -0
- package/js/interface/index.js +3 -0
- package/js/kist.d.ts +58 -0
- package/js/kist.js +145 -0
- package/js/live/LiveServer.d.ts +95 -0
- package/js/live/LiveServer.js +233 -0
- package/js/live/LiveWatcher.d.ts +45 -0
- package/js/live/LiveWatcher.js +140 -0
- package/js/logger/Logger.d.ts +94 -0
- package/js/logger/Logger.js +151 -0
- package/js/logger/LoggerStyles.d.ts +23 -0
- package/js/logger/LoggerStyles.js +30 -0
- package/js/types/ActionOptionsType.d.ts +8 -0
- package/js/types/ActionOptionsType.js +2 -0
- package/js/types/index.d.ts +1 -0
- package/js/types/index.js +3 -0
- package/package.json +93 -7
- package/ts/actions/CoreActions.ts +64 -0
- package/ts/actions/DirectoryCleanAction/DirectoryCleanAction.ts +121 -0
- package/ts/actions/DirectoryCleanAction/index.ts +11 -0
- package/ts/actions/DirectoryCopyAction/DirectoryCopyAction.ts +118 -0
- package/ts/actions/DirectoryCopyAction/index.ts +11 -0
- package/ts/actions/DirectoryCreateAction/DirectoryCreateAction.ts +81 -0
- package/ts/actions/DirectoryCreateAction/index.ts +11 -0
- package/ts/actions/DocumentationAction/DocumentationAction.ts +100 -0
- package/ts/actions/DocumentationAction/index.ts +11 -0
- package/ts/actions/FileCopyAction/FileCopyAction.ts +125 -0
- package/ts/actions/FileCopyAction/index.ts +11 -0
- package/ts/actions/FileRenameAction/FileRenameAction.ts +82 -0
- package/ts/actions/FileRenameAction/index.ts +11 -0
- package/ts/actions/JavaScriptMinifyAction/JavaScriptMinifyAction.ts +109 -0
- package/ts/actions/JavaScriptMinifyAction/index.ts +11 -0
- package/ts/actions/JavaScriptMinifyAction/terser.config.ts +177 -0
- package/ts/actions/LintAction/LintAction.ts +67 -0
- package/ts/actions/LintAction/index.ts +11 -0
- package/ts/actions/PackageManagerAction/PackageManagerAction.ts +176 -0
- package/ts/actions/PackageManagerAction/index.ts +11 -0
- package/ts/actions/PackageManagerAction/package.config.ts +94 -0
- package/ts/actions/SassDocAction/SassDocAction.ts +66 -0
- package/ts/actions/SassDocAction/index.ts +11 -0
- package/ts/actions/StyleProcessingAction/StyleProcessingAction.ts +142 -0
- package/ts/actions/StyleProcessingAction/index.ts +11 -0
- package/ts/actions/StyleProcessingAction/postcss.config.compressed.ts +31 -0
- package/ts/actions/StyleProcessingAction/postcss.config.expanded.ts +47 -0
- package/ts/actions/SvgPackagerAction/SvgPackagerAction.ts +187 -0
- package/ts/actions/SvgPackagerAction/index.ts +11 -0
- package/ts/actions/SvgReaderAction/SvgReaderAction.ts +77 -0
- package/ts/actions/SvgReaderAction/index.ts +11 -0
- package/ts/actions/SvgSpriteAction/SvgSpriteAction.ts +127 -0
- package/ts/actions/SvgSpriteAction/index.ts +11 -0
- package/ts/actions/SvgSpriteAction/svgsprite.config.ts +123 -0
- package/ts/actions/SvgToPngAction/SvgToPngAction.ts +113 -0
- package/ts/actions/SvgToPngAction/index.ts +11 -0
- package/ts/actions/TypeScriptCompilerAction/TypeScriptCompilerAction.ts +117 -0
- package/ts/actions/TypeScriptCompilerAction/index.ts +11 -0
- package/ts/actions/VersionWriteAction/VersionWriteAction.ts +174 -0
- package/ts/actions/VersionWriteAction/index.ts +11 -0
- package/ts/actions/index.ts +0 -0
- package/ts/cli/ArgumentParser.ts +150 -0
- package/ts/cli/index.ts +1 -0
- package/ts/cli.ts +56 -0
- package/ts/core/abstract/AbstractProcess.ts +109 -0
- package/ts/core/abstract/AbstractSingleton.ts +46 -0
- package/ts/core/abstract/AbstractValidator.ts +167 -0
- package/ts/core/abstract/index.ts +0 -0
- package/ts/core/config/ConfigLoader.ts +141 -0
- package/ts/core/config/ConfigStore copy.ts +201 -0
- package/ts/core/config/ConfigStore.ts +157 -0
- package/ts/core/config/defaultConfig.ts +154 -0
- package/ts/core/config/index.ts +0 -0
- package/ts/core/index.ts +34 -0
- package/ts/core/pipeline/Action.ts +101 -0
- package/ts/core/pipeline/ActionRegistry.ts +216 -0
- package/ts/core/pipeline/Pipeline.ts +121 -0
- package/ts/core/pipeline/PipelineManager.ts +170 -0
- package/ts/core/pipeline/Stage.ts +131 -0
- package/ts/core/pipeline/Step.ts +96 -0
- package/ts/core/pipeline/index.ts +0 -0
- package/ts/core/validation/ActionValidator.ts +97 -0
- package/ts/core/validation/ConfigValidator.ts +103 -0
- package/ts/core/validation/OptionsValidator.ts +179 -0
- package/ts/core/validation/StageValidator.ts +175 -0
- package/ts/core/validation/StepValidator.ts +203 -0
- package/ts/core/validation/index.ts +0 -0
- package/ts/index.ts +26 -0
- package/ts/interface/ActionInterface.ts +70 -0
- package/ts/interface/ActionPlugin.ts +14 -0
- package/ts/interface/ConfigInterface.ts +55 -0
- package/ts/interface/File.ts +24 -0
- package/ts/interface/LiveOptionsInterface.ts +46 -0
- package/ts/interface/MetadataInterface.ts +105 -0
- package/ts/interface/OptionsInterface.ts +58 -0
- package/ts/interface/PackageJson.ts +171 -0
- package/ts/interface/PipelineOptionsInterface.ts +74 -0
- package/ts/interface/SVG.ts +84 -0
- package/ts/interface/StageInterface.ts +96 -0
- package/ts/interface/StepInterface.ts +83 -0
- package/ts/interface/StepOptionsInterface.ts +57 -0
- package/ts/interface/index.ts +9 -0
- package/ts/kist.ts +161 -0
- package/ts/live/LiveServer.ts +311 -0
- package/ts/live/LiveWatcher.ts +150 -0
- package/ts/live/index.ts +11 -0
- package/ts/logger/Logger.ts +187 -0
- package/ts/logger/LoggerStyles.ts +28 -0
- package/ts/logger/index.ts +0 -0
- package/ts/types/ActionOptionsType.ts +10 -0
- package/ts/types/index.ts +3 -0
- package/index.js +0 -3
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Import
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
import { StepInterface } from "../../interface/StepInterface";
|
|
6
|
+
import { StepOptionsInterface } from "../../interface/StepOptionsInterface";
|
|
7
|
+
import { AbstractValidator } from "../abstract/AbstractValidator";
|
|
8
|
+
import { ActionValidator } from "./ActionValidator";
|
|
9
|
+
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Class
|
|
12
|
+
// ============================================================================
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Validates individual steps within a stage.
|
|
16
|
+
* Ensures steps conform to the expected structure and all associated
|
|
17
|
+
* actions are valid.
|
|
18
|
+
*/
|
|
19
|
+
export class StepValidator extends AbstractValidator<StepInterface> {
|
|
20
|
+
// Parameters
|
|
21
|
+
// ========================================================================
|
|
22
|
+
|
|
23
|
+
private actionValidator: ActionValidator;
|
|
24
|
+
|
|
25
|
+
// Constructor
|
|
26
|
+
// ========================================================================
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Initializes the StepValidator.
|
|
30
|
+
* Creates an instance of `ActionValidator` for validating actions.
|
|
31
|
+
*/
|
|
32
|
+
constructor() {
|
|
33
|
+
super();
|
|
34
|
+
this.actionValidator = new ActionValidator();
|
|
35
|
+
this.logInfo("StepValidator initialized.");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Methods
|
|
39
|
+
// ========================================================================
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Validates an entire step object.
|
|
43
|
+
*
|
|
44
|
+
* @param step - The step object to validate.
|
|
45
|
+
* @throws Error if the step or any of its properties are invalid.
|
|
46
|
+
*/
|
|
47
|
+
public validate(step: StepInterface): void {
|
|
48
|
+
this.logInfo(`Validating step: "${step.name}"`);
|
|
49
|
+
|
|
50
|
+
this.validateProperty("name", step.name);
|
|
51
|
+
this.validateActions(step.action); // Validate the action object
|
|
52
|
+
if (step.options) {
|
|
53
|
+
this.validateProperty("options", step.options);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
this.logInfo(`Step "${step.name}" validated successfully.`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Validates a specific property of a step.
|
|
61
|
+
*
|
|
62
|
+
* @param key - The property key to validate (e.g., "name", "action").
|
|
63
|
+
* @param value - The property value to validate.
|
|
64
|
+
* @throws Error if validation fails.
|
|
65
|
+
*/
|
|
66
|
+
public validateProperty<K extends keyof StepInterface>(
|
|
67
|
+
key: K,
|
|
68
|
+
value: StepInterface[K],
|
|
69
|
+
): void {
|
|
70
|
+
switch (key) {
|
|
71
|
+
case "name":
|
|
72
|
+
this.validateName(value as string);
|
|
73
|
+
break;
|
|
74
|
+
case "options":
|
|
75
|
+
this.validateOptions(value as Record<string, any>);
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
this.throwValidationError(
|
|
79
|
+
key,
|
|
80
|
+
value,
|
|
81
|
+
"Unknown key provided for validation.",
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
this.logValidationSuccess(key, value);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Validates the step name.
|
|
90
|
+
* Ensures it is a non-empty string.
|
|
91
|
+
*
|
|
92
|
+
* @param name - The step name to validate.
|
|
93
|
+
* @throws Error if the name is invalid.
|
|
94
|
+
*/
|
|
95
|
+
private validateName(name: string): void {
|
|
96
|
+
if (!name || typeof name !== "string" || name.trim() === "") {
|
|
97
|
+
this.throwValidationError(
|
|
98
|
+
"name",
|
|
99
|
+
name,
|
|
100
|
+
"Each step must have a valid, non-empty 'name' property.",
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Validates the action object of the step.
|
|
107
|
+
* Uses `ActionValidator` to validate the action's `name`.
|
|
108
|
+
*
|
|
109
|
+
* @param action - The action object to validate.
|
|
110
|
+
* @throws Error if the action is invalid.
|
|
111
|
+
*/
|
|
112
|
+
private validateActions(action: StepInterface["action"]): void {
|
|
113
|
+
if (
|
|
114
|
+
!action ||
|
|
115
|
+
typeof action.name !== "string" ||
|
|
116
|
+
action.name.trim() === ""
|
|
117
|
+
) {
|
|
118
|
+
this.throwValidationError(
|
|
119
|
+
"action",
|
|
120
|
+
action,
|
|
121
|
+
"Each step must have a valid 'action' object with a non-empty 'name' property.",
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
try {
|
|
126
|
+
this.actionValidator.validate({ action: action.name }); // Validate the action name
|
|
127
|
+
} catch (error) {
|
|
128
|
+
this.throwValidationError(
|
|
129
|
+
"action",
|
|
130
|
+
action,
|
|
131
|
+
(error as Error).message,
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Validates the step options.
|
|
138
|
+
* Ensures options conform to `StepOptionsInterface`.
|
|
139
|
+
*
|
|
140
|
+
* @param options - The options object to validate.
|
|
141
|
+
* @throws Error if the options are invalid.
|
|
142
|
+
*/
|
|
143
|
+
private validateOptions(options: StepOptionsInterface | undefined): void {
|
|
144
|
+
// Ensure options are not null
|
|
145
|
+
if (options === null) {
|
|
146
|
+
this.throwValidationError(
|
|
147
|
+
"options",
|
|
148
|
+
options,
|
|
149
|
+
"Step options must be a valid object or undefined, but 'null' was provided.",
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (
|
|
154
|
+
options &&
|
|
155
|
+
(typeof options !== "object" || Array.isArray(options))
|
|
156
|
+
) {
|
|
157
|
+
this.throwValidationError(
|
|
158
|
+
"options",
|
|
159
|
+
options,
|
|
160
|
+
"Step options must be a valid object conforming to StepOptionsInterface.",
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Validate individual properties within `options`
|
|
165
|
+
if (options) {
|
|
166
|
+
for (const [key, value] of Object.entries(options)) {
|
|
167
|
+
switch (key) {
|
|
168
|
+
case "description":
|
|
169
|
+
if (value !== undefined && typeof value !== "string") {
|
|
170
|
+
this.throwValidationError(
|
|
171
|
+
"options",
|
|
172
|
+
value,
|
|
173
|
+
`Invalid value for "description": must be a string.`,
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
break;
|
|
177
|
+
|
|
178
|
+
case "enabled":
|
|
179
|
+
if (
|
|
180
|
+
value !== undefined &&
|
|
181
|
+
typeof value !== "boolean"
|
|
182
|
+
) {
|
|
183
|
+
this.throwValidationError(
|
|
184
|
+
"options",
|
|
185
|
+
value,
|
|
186
|
+
`Invalid value for "enabled": must be a boolean.`,
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
break;
|
|
190
|
+
|
|
191
|
+
default:
|
|
192
|
+
// For additional custom keys, you can implement further checks
|
|
193
|
+
this.logInfo(
|
|
194
|
+
`Validating additional key "${key}" with value "${value}".`,
|
|
195
|
+
);
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
this.logInfo("Step options validated successfully.");
|
|
202
|
+
}
|
|
203
|
+
}
|
|
File without changes
|
package/ts/index.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Import
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
// Core Modules
|
|
8
|
+
// export { Pipeline } from "./core/Pipeline";
|
|
9
|
+
// export { ConfigLoader } from "./core/ConfigLoader";
|
|
10
|
+
// export { PipelineManager } from "./core/PipelineManager";
|
|
11
|
+
|
|
12
|
+
// Live Modules
|
|
13
|
+
// export { LiveReloadServer } from "./live/LiveReloadServer";
|
|
14
|
+
// export { FileWatcher } from "./live/FileWatcher";
|
|
15
|
+
|
|
16
|
+
// Actions and Other Utilities
|
|
17
|
+
// export { Action } from "./core/Action";
|
|
18
|
+
|
|
19
|
+
// Main Function
|
|
20
|
+
export { Kist } from "./kist";
|
|
21
|
+
|
|
22
|
+
// Additional Types
|
|
23
|
+
export * from "./types";
|
|
24
|
+
|
|
25
|
+
// CLI Functions (if required programmatically)
|
|
26
|
+
export * from "./cli.js";
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Import
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
import { ActionOptionsType } from "../types/ActionOptionsType";
|
|
6
|
+
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// Interfaces
|
|
9
|
+
// ============================================================================
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* ActionInterface defines the contract for step action classes in pack.gl.
|
|
13
|
+
* Implementing this interface allows actions to be dynamically integrated into
|
|
14
|
+
* the pipeline, offering a flexible and extensible system for defining custom
|
|
15
|
+
* behaviors within different stages.
|
|
16
|
+
*/
|
|
17
|
+
export interface ActionInterface {
|
|
18
|
+
/**
|
|
19
|
+
* A unique name identifying the action.
|
|
20
|
+
* This property is used for logging, registration in the ActionRegistry,
|
|
21
|
+
* and debugging purposes.
|
|
22
|
+
*/
|
|
23
|
+
name: string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Executes the action with the provided options.
|
|
27
|
+
* Implementations of this method should perform the main logic of the
|
|
28
|
+
* action, such as building, testing, linting, packaging, or other
|
|
29
|
+
* custom-defined processes.
|
|
30
|
+
*
|
|
31
|
+
* @param options - A structured set of options specific to the action's
|
|
32
|
+
* configuration. Implementations are responsible for validating and
|
|
33
|
+
* applying these options. Example configurations might include:
|
|
34
|
+
* - For 'build': { minify: boolean, sourceMap: boolean, target: string }
|
|
35
|
+
* - For 'lint': { fix: boolean, formatter: string }
|
|
36
|
+
* @returns A Promise that resolves when the action completes successfully,
|
|
37
|
+
* or rejects with an error if the action fails.
|
|
38
|
+
*/
|
|
39
|
+
execute(options: ActionOptionsType): Promise<void>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Validates the provided options before execution.
|
|
43
|
+
* This method can be used to check the integrity and correctness of the
|
|
44
|
+
* options object, ensuring that required fields are present and valid.
|
|
45
|
+
*
|
|
46
|
+
* @param options - The options to validate, ensuring they meet the
|
|
47
|
+
* action's specific requirements.
|
|
48
|
+
* @returns A boolean indicating whether the options are valid. Throws an
|
|
49
|
+
* error or returns false if validation fails.
|
|
50
|
+
*/
|
|
51
|
+
validateOptions?(options: ActionOptionsType): boolean;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Provides a summary or description of the action.
|
|
55
|
+
* This can be used for logging, debugging, or documentation purposes to
|
|
56
|
+
* describe what the action does.
|
|
57
|
+
*
|
|
58
|
+
* @returns A string description of the action.
|
|
59
|
+
*/
|
|
60
|
+
describe?(): string;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Optional cleanup logic to execute after the main action completes.
|
|
64
|
+
* Implementations can use this for teardown tasks, like removing
|
|
65
|
+
* temporary files or restoring the state altered during execution.
|
|
66
|
+
*
|
|
67
|
+
* @returns A promise that resolves after cleanup is complete.
|
|
68
|
+
*/
|
|
69
|
+
cleanup?(): Promise<void>;
|
|
70
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Import
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
import { ActionInterface } from "./ActionInterface";
|
|
6
|
+
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// Interfaces
|
|
9
|
+
// ============================================================================
|
|
10
|
+
|
|
11
|
+
// ActionPlugin.ts
|
|
12
|
+
export interface ActionPlugin {
|
|
13
|
+
registerActions(): Record<string, new () => ActionInterface>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Import
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
import { MetadataInterface } from "./MetadataInterface";
|
|
6
|
+
import { OptionsInterface } from "./OptionsInterface";
|
|
7
|
+
import { StageInterface } from "./StageInterface";
|
|
8
|
+
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// Interfaces
|
|
11
|
+
// ============================================================================
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* ConfigInterface defines the overall configuration for the packaging
|
|
15
|
+
* pipeline. This configuration determines the structure, behavior, and
|
|
16
|
+
* execution flow of the entire pipeline, including stages, global settings,
|
|
17
|
+
* and optional metadata.
|
|
18
|
+
*/
|
|
19
|
+
export interface ConfigInterface {
|
|
20
|
+
/**
|
|
21
|
+
* Optional metadata that provides additional context or descriptive
|
|
22
|
+
* information about the pipeline configuration. This can include the
|
|
23
|
+
* pipeline name, version, author, or any other relevant details. Useful
|
|
24
|
+
* for documentation, tracking, and integration with external systems.
|
|
25
|
+
*/
|
|
26
|
+
metadata?: MetadataInterface;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Optional global options that apply universally across the entire
|
|
30
|
+
* pipeline. These options can control aspects like logging levels, step
|
|
31
|
+
* timeouts, error handling, concurrency limits, and other settings that
|
|
32
|
+
* affect the overall pipeline behavior.
|
|
33
|
+
*/
|
|
34
|
+
options?: OptionsInterface;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A list of stages to be executed in the pipeline. Stages run in parallel
|
|
38
|
+
* by default, but dependencies specified in each stage can enforce a
|
|
39
|
+
* specific execution order. Stages should be defined in the logical
|
|
40
|
+
* sequence that aligns with the pipeline's objectives.
|
|
41
|
+
*/
|
|
42
|
+
stages: StageInterface[];
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* An optional function or set of rules for validating the configuration
|
|
46
|
+
* before execution. This can be used to ensure that the pipeline meets
|
|
47
|
+
* certain criteria or standards before running, catching potential
|
|
48
|
+
* configuration errors early.
|
|
49
|
+
*
|
|
50
|
+
* @param config - The full configuration object to validate.
|
|
51
|
+
* @returns A boolean indicating whether the configuration is valid, or
|
|
52
|
+
* throws an error if validation fails.
|
|
53
|
+
*/
|
|
54
|
+
validateConfig?(config: ConfigInterface): boolean;
|
|
55
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Interfaces
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Interface for representing a file within the system.
|
|
7
|
+
* This interface is used to define the structure of file data objects
|
|
8
|
+
* that include both the file path and its source content.
|
|
9
|
+
*/
|
|
10
|
+
export interface File {
|
|
11
|
+
/**
|
|
12
|
+
* The full path to the file.
|
|
13
|
+
* This should include the complete directory path and the file name with
|
|
14
|
+
* its extension.
|
|
15
|
+
*/
|
|
16
|
+
filepath: string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The source content of the file.
|
|
20
|
+
* This could be any form of text, such as code, configuration, or plain
|
|
21
|
+
* text.
|
|
22
|
+
*/
|
|
23
|
+
source: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LiveOptionsInterface defines the configuration settings for live reload
|
|
3
|
+
* functionality, which enables dynamic updates to the application during
|
|
4
|
+
* development.
|
|
5
|
+
*/
|
|
6
|
+
export interface LiveOptionsInterface {
|
|
7
|
+
/**
|
|
8
|
+
* Enables or disables the live reload feature.
|
|
9
|
+
* - `true`: Live reload is enabled, and the server will listen for changes.
|
|
10
|
+
* - `false`: Live reload is disabled.
|
|
11
|
+
*
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
enabled?: boolean;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The port number on which the live reload server will listen.
|
|
18
|
+
* If not specified, a default port (e.g., 3000) may be used.
|
|
19
|
+
*
|
|
20
|
+
* @example 3000
|
|
21
|
+
* @default 3000
|
|
22
|
+
*/
|
|
23
|
+
port?: number;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The root directory for serving static files during live reload.
|
|
27
|
+
* This path is relative to the project root and is used to serve public
|
|
28
|
+
* assets.
|
|
29
|
+
*
|
|
30
|
+
* @example "public"
|
|
31
|
+
* @default "public"
|
|
32
|
+
*/
|
|
33
|
+
root?: string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* An array of paths to monitor for file changes. These paths can use glob
|
|
37
|
+
* patterns for flexibility
|
|
38
|
+
*/
|
|
39
|
+
watchPaths?: string[];
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* An array of paths or patterns to exclude from monitoring. Use this to
|
|
43
|
+
* ignore directories or files that do not need to trigger reloads
|
|
44
|
+
*/
|
|
45
|
+
ignoredPaths?: string[];
|
|
46
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MetadataInterface provides contextual information about the pipeline
|
|
3
|
+
* configuration. This metadata is useful for tracking changes, documentation,
|
|
4
|
+
* and integration with external systems.
|
|
5
|
+
*/
|
|
6
|
+
export interface MetadataInterface {
|
|
7
|
+
/**
|
|
8
|
+
* A human-readable name for the pipeline.
|
|
9
|
+
* Used for identification and reporting purposes.
|
|
10
|
+
*
|
|
11
|
+
* @example "Data Processing Pipeline"
|
|
12
|
+
*/
|
|
13
|
+
name?: string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The semantic version of the pipeline configuration.
|
|
17
|
+
* Helps in tracking changes, maintaining compatibility, and managing
|
|
18
|
+
* different setups.
|
|
19
|
+
*
|
|
20
|
+
* @example "1.0.0"
|
|
21
|
+
*/
|
|
22
|
+
version?: string;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A detailed description outlining the pipeline's purpose, objectives,
|
|
26
|
+
* or key features.
|
|
27
|
+
* Useful for providing context to users and maintainers.
|
|
28
|
+
*
|
|
29
|
+
* @example "A pipeline for processing and analyzing large datasets,
|
|
30
|
+
* including ETL operations."
|
|
31
|
+
*/
|
|
32
|
+
description?: string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The author or owner of the pipeline configuration.
|
|
36
|
+
* Can include details such as name, email, or organization.
|
|
37
|
+
*
|
|
38
|
+
* @example "John Doe <john.doe@example.com>"
|
|
39
|
+
*/
|
|
40
|
+
author?: string;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A collection of arbitrary key-value pairs to further describe the
|
|
44
|
+
* pipeline configuration. This can be used for categorization or
|
|
45
|
+
* custom metadata.
|
|
46
|
+
*
|
|
47
|
+
* @example { category: "ETL", team: "Data Engineering" }
|
|
48
|
+
*/
|
|
49
|
+
tags?: Record<string, string>;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* A timestamp indicating when the configuration was created or last
|
|
53
|
+
* updated. Should follow the ISO 8601 format (e.g.,
|
|
54
|
+
* "2024-01-01T12:00:00Z").
|
|
55
|
+
*
|
|
56
|
+
* @example "2024-01-01T12:00:00Z"
|
|
57
|
+
*/
|
|
58
|
+
timestamp?: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The license under which the pipeline configuration is shared or used.
|
|
62
|
+
* This defines the terms and conditions for using the configuration.
|
|
63
|
+
*
|
|
64
|
+
* @example "MIT"
|
|
65
|
+
* @example "GPL-3.0"
|
|
66
|
+
*/
|
|
67
|
+
license?: string;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* A URL pointing to documentation or additional resources related to
|
|
71
|
+
* the pipeline.
|
|
72
|
+
* Can include links to GitHub repos, wikis, or help pages.
|
|
73
|
+
*
|
|
74
|
+
* @example "https://github.com/username/repo"
|
|
75
|
+
*/
|
|
76
|
+
documentation?: string;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Contact information for questions or support regarding the pipeline
|
|
80
|
+
* configuration.
|
|
81
|
+
* This can include an email address, a support page URL, or a
|
|
82
|
+
* team/organization name.
|
|
83
|
+
*
|
|
84
|
+
* @example "support@example.com"
|
|
85
|
+
* @example "https://example.com/support"
|
|
86
|
+
*/
|
|
87
|
+
contact?: string;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Dependencies or related systems required by the pipeline configuration.
|
|
91
|
+
* Useful for tracking external systems or tools that interact with this
|
|
92
|
+
* pipeline.
|
|
93
|
+
*
|
|
94
|
+
* @example ["Node.js >=14.0", "Docker >=20.10"]
|
|
95
|
+
*/
|
|
96
|
+
dependencies?: string[];
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* A list of intended runtime environment(s) for the pipeline.
|
|
100
|
+
* This helps clarify where the pipeline is designed to be executed.
|
|
101
|
+
*
|
|
102
|
+
* @example ["local", "CI/CD", "staging", "production"]
|
|
103
|
+
*/
|
|
104
|
+
environments?: string[];
|
|
105
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Import
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
import { LiveOptionsInterface } from "./LiveOptionsInterface";
|
|
6
|
+
import { PipelineOptionsInterface } from "./PipelineOptionsInterface";
|
|
7
|
+
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Interfaces
|
|
10
|
+
// ============================================================================
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* OptionsInterface represents the global configuration options that
|
|
14
|
+
* apply to the entire pipeline. These settings provide overarching controls
|
|
15
|
+
* that affect how all stages and steps within the pipeline operate.
|
|
16
|
+
*/
|
|
17
|
+
export interface OptionsInterface {
|
|
18
|
+
/**
|
|
19
|
+
* Configuration settings for live reload functionality, enabling
|
|
20
|
+
* real-time updates during development.
|
|
21
|
+
*/
|
|
22
|
+
live?: LiveOptionsInterface;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Pipeline-specific configuration options.
|
|
26
|
+
*/
|
|
27
|
+
pipeline?: PipelineOptionsInterface;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Path to the configuration file. This can be used to override default
|
|
31
|
+
* or automatically located configuration files.
|
|
32
|
+
*
|
|
33
|
+
* @example "./config/pack.yaml"
|
|
34
|
+
*/
|
|
35
|
+
configPath?: string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Specifies the level of logging to be used throughout the pipeline.
|
|
39
|
+
*
|
|
40
|
+
* The available levels are:
|
|
41
|
+
* - "debug": Provides detailed logging, useful for debugging and
|
|
42
|
+
* tracing execution flow.
|
|
43
|
+
* - "info": Standard logging level, providing key information about
|
|
44
|
+
* pipeline progress and outcomes.
|
|
45
|
+
* - "warn": Logs only warnings and errors, useful for highlighting
|
|
46
|
+
* potential issues without excessive details.
|
|
47
|
+
* - "error": Logs only errors, minimizing output to essential problem
|
|
48
|
+
* notifications. Default is "info".
|
|
49
|
+
*
|
|
50
|
+
* @default "info"
|
|
51
|
+
*/
|
|
52
|
+
logLevel?: "debug" | "info" | "warn" | "error";
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Additional properties can be included dynamically.
|
|
56
|
+
*/
|
|
57
|
+
[key: string]: unknown;
|
|
58
|
+
}
|