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.
Files changed (237) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +298 -3
  3. package/js/actions/CoreActions.d.ts +6 -0
  4. package/js/actions/CoreActions.js +47 -0
  5. package/js/actions/DirectoryCleanAction/DirectoryCleanAction.d.ts +36 -0
  6. package/js/actions/DirectoryCleanAction/DirectoryCleanAction.js +123 -0
  7. package/js/actions/DirectoryCleanAction/index.d.ts +2 -0
  8. package/js/actions/DirectoryCleanAction/index.js +8 -0
  9. package/js/actions/DirectoryCopyAction/DirectoryCopyAction.d.ts +42 -0
  10. package/js/actions/DirectoryCopyAction/DirectoryCopyAction.js +118 -0
  11. package/js/actions/DirectoryCopyAction/index.d.ts +2 -0
  12. package/js/actions/DirectoryCopyAction/index.js +8 -0
  13. package/js/actions/DirectoryCreateAction/DirectoryCreateAction.d.ts +30 -0
  14. package/js/actions/DirectoryCreateAction/DirectoryCreateAction.js +85 -0
  15. package/js/actions/DirectoryCreateAction/index.d.ts +2 -0
  16. package/js/actions/DirectoryCreateAction/index.js +8 -0
  17. package/js/actions/DocumentationAction/DocumentationAction.d.ts +23 -0
  18. package/js/actions/DocumentationAction/DocumentationAction.js +88 -0
  19. package/js/actions/DocumentationAction/index.d.ts +2 -0
  20. package/js/actions/DocumentationAction/index.js +8 -0
  21. package/js/actions/FileCopyAction/FileCopyAction.d.ts +42 -0
  22. package/js/actions/FileCopyAction/FileCopyAction.js +127 -0
  23. package/js/actions/FileCopyAction/index.d.ts +2 -0
  24. package/js/actions/FileCopyAction/index.js +8 -0
  25. package/js/actions/FileRenameAction/FileRenameAction.d.ts +30 -0
  26. package/js/actions/FileRenameAction/FileRenameAction.js +84 -0
  27. package/js/actions/FileRenameAction/index.d.ts +2 -0
  28. package/js/actions/FileRenameAction/index.js +8 -0
  29. package/js/actions/JavaScriptMinifyAction/JavaScriptMinifyAction.d.ts +31 -0
  30. package/js/actions/JavaScriptMinifyAction/JavaScriptMinifyAction.js +98 -0
  31. package/js/actions/JavaScriptMinifyAction/index.d.ts +2 -0
  32. package/js/actions/JavaScriptMinifyAction/index.js +8 -0
  33. package/js/actions/JavaScriptMinifyAction/terser.config.d.ts +27 -0
  34. package/js/actions/JavaScriptMinifyAction/terser.config.js +119 -0
  35. package/js/actions/LintAction/LintAction.d.ts +17 -0
  36. package/js/actions/LintAction/LintAction.js +63 -0
  37. package/js/actions/LintAction/index.d.ts +2 -0
  38. package/js/actions/LintAction/index.js +8 -0
  39. package/js/actions/PackageManagerAction/PackageManagerAction.d.ts +57 -0
  40. package/js/actions/PackageManagerAction/PackageManagerAction.js +161 -0
  41. package/js/actions/PackageManagerAction/index.d.ts +2 -0
  42. package/js/actions/PackageManagerAction/index.js +8 -0
  43. package/js/actions/PackageManagerAction/package.config.d.ts +16 -0
  44. package/js/actions/PackageManagerAction/package.config.js +91 -0
  45. package/js/actions/StyleProcessingAction/StyleProcessingAction.d.ts +34 -0
  46. package/js/actions/StyleProcessingAction/StyleProcessingAction.js +164 -0
  47. package/js/actions/StyleProcessingAction/index.d.ts +2 -0
  48. package/js/actions/StyleProcessingAction/index.js +8 -0
  49. package/js/actions/StyleProcessingAction/postcss.config.compressed.d.ts +10 -0
  50. package/js/actions/StyleProcessingAction/postcss.config.compressed.js +31 -0
  51. package/js/actions/StyleProcessingAction/postcss.config.expanded.d.ts +16 -0
  52. package/js/actions/StyleProcessingAction/postcss.config.expanded.js +45 -0
  53. package/js/actions/SvgPackagerAction/SvgPackagerAction.d.ts +68 -0
  54. package/js/actions/SvgPackagerAction/SvgPackagerAction.js +186 -0
  55. package/js/actions/SvgPackagerAction/index.d.ts +2 -0
  56. package/js/actions/SvgPackagerAction/index.js +8 -0
  57. package/js/actions/SvgReaderAction/SvgReaderAction.d.ts +32 -0
  58. package/js/actions/SvgReaderAction/SvgReaderAction.js +87 -0
  59. package/js/actions/SvgReaderAction/index.d.ts +2 -0
  60. package/js/actions/SvgReaderAction/index.js +8 -0
  61. package/js/actions/SvgSpriteAction/SvgSpriteAction.d.ts +37 -0
  62. package/js/actions/SvgSpriteAction/SvgSpriteAction.js +114 -0
  63. package/js/actions/SvgSpriteAction/index.d.ts +2 -0
  64. package/js/actions/SvgSpriteAction/index.js +8 -0
  65. package/js/actions/SvgSpriteAction/svgsprite.config.d.ts +3 -0
  66. package/js/actions/SvgSpriteAction/svgsprite.config.js +117 -0
  67. package/js/actions/SvgToPngAction/SvgToPngAction.d.ts +28 -0
  68. package/js/actions/SvgToPngAction/SvgToPngAction.js +108 -0
  69. package/js/actions/SvgToPngAction/index.d.ts +2 -0
  70. package/js/actions/SvgToPngAction/index.js +8 -0
  71. package/js/actions/TypeScriptCompilerAction/TypeScriptCompilerAction.d.ts +28 -0
  72. package/js/actions/TypeScriptCompilerAction/TypeScriptCompilerAction.js +96 -0
  73. package/js/actions/TypeScriptCompilerAction/index.d.ts +2 -0
  74. package/js/actions/TypeScriptCompilerAction/index.js +8 -0
  75. package/js/actions/VersionWriteAction/VersionWriteAction.d.ts +45 -0
  76. package/js/actions/VersionWriteAction/VersionWriteAction.js +147 -0
  77. package/js/actions/VersionWriteAction/index.d.ts +2 -0
  78. package/js/actions/VersionWriteAction/index.js +8 -0
  79. package/js/cli/ArgumentParser.d.ts +62 -0
  80. package/js/cli/ArgumentParser.js +118 -0
  81. package/js/cli.d.ts +6 -0
  82. package/js/cli.js +58 -0
  83. package/js/core/abstract/AbstractProcess.d.ts +62 -0
  84. package/js/core/abstract/AbstractProcess.js +96 -0
  85. package/js/core/abstract/AbstractValidator.d.ts +72 -0
  86. package/js/core/abstract/AbstractValidator.js +128 -0
  87. package/js/core/config/ConfigLoader.d.ts +47 -0
  88. package/js/core/config/ConfigLoader.js +130 -0
  89. package/js/core/config/ConfigStore.d.ts +53 -0
  90. package/js/core/config/ConfigStore.js +136 -0
  91. package/js/core/config/defaultConfig.d.ts +5 -0
  92. package/js/core/config/defaultConfig.js +131 -0
  93. package/js/core/pipeline/Action.d.ts +60 -0
  94. package/js/core/pipeline/Action.js +77 -0
  95. package/js/core/pipeline/ActionRegistry.d.ts +80 -0
  96. package/js/core/pipeline/ActionRegistry.js +180 -0
  97. package/js/core/pipeline/Pipeline.d.ts +42 -0
  98. package/js/core/pipeline/Pipeline.js +107 -0
  99. package/js/core/pipeline/PipelineManager.d.ts +55 -0
  100. package/js/core/pipeline/PipelineManager.js +164 -0
  101. package/js/core/pipeline/Stage.d.ts +45 -0
  102. package/js/core/pipeline/Stage.js +110 -0
  103. package/js/core/pipeline/Step.d.ts +26 -0
  104. package/js/core/pipeline/Step.js +85 -0
  105. package/js/core/validation/OptionsValidator.d.ts +43 -0
  106. package/js/core/validation/OptionsValidator.js +123 -0
  107. package/js/index.d.ts +3 -0
  108. package/js/index.js +36 -0
  109. package/js/interface/ActionInterface.d.ts +57 -0
  110. package/js/interface/ActionInterface.js +5 -0
  111. package/js/interface/ActionPlugin.d.ts +4 -0
  112. package/js/interface/ActionPlugin.js +5 -0
  113. package/js/interface/ConfigInterface.d.ts +43 -0
  114. package/js/interface/ConfigInterface.js +5 -0
  115. package/js/interface/LiveOptionsInterface.d.ts +42 -0
  116. package/js/interface/LiveOptionsInterface.js +2 -0
  117. package/js/interface/MetadataInterface.d.ts +95 -0
  118. package/js/interface/MetadataInterface.js +2 -0
  119. package/js/interface/OptionsInterface.d.ts +45 -0
  120. package/js/interface/OptionsInterface.js +5 -0
  121. package/js/interface/PipelineOptionsInterface.d.ts +66 -0
  122. package/js/interface/PipelineOptionsInterface.js +5 -0
  123. package/js/interface/StageInterface.d.ts +79 -0
  124. package/js/interface/StageInterface.js +5 -0
  125. package/js/interface/StepInterface.d.ts +66 -0
  126. package/js/interface/StepInterface.js +5 -0
  127. package/js/interface/StepOptionsInterface.d.ts +38 -0
  128. package/js/interface/StepOptionsInterface.js +21 -0
  129. package/js/interface/index.d.ts +7 -0
  130. package/js/interface/index.js +3 -0
  131. package/js/kist.d.ts +58 -0
  132. package/js/kist.js +145 -0
  133. package/js/live/LiveServer.d.ts +95 -0
  134. package/js/live/LiveServer.js +233 -0
  135. package/js/live/LiveWatcher.d.ts +45 -0
  136. package/js/live/LiveWatcher.js +140 -0
  137. package/js/logger/Logger.d.ts +94 -0
  138. package/js/logger/Logger.js +151 -0
  139. package/js/logger/LoggerStyles.d.ts +23 -0
  140. package/js/logger/LoggerStyles.js +30 -0
  141. package/js/types/ActionOptionsType.d.ts +8 -0
  142. package/js/types/ActionOptionsType.js +2 -0
  143. package/js/types/index.d.ts +1 -0
  144. package/js/types/index.js +3 -0
  145. package/package.json +93 -7
  146. package/ts/actions/CoreActions.ts +64 -0
  147. package/ts/actions/DirectoryCleanAction/DirectoryCleanAction.ts +121 -0
  148. package/ts/actions/DirectoryCleanAction/index.ts +11 -0
  149. package/ts/actions/DirectoryCopyAction/DirectoryCopyAction.ts +118 -0
  150. package/ts/actions/DirectoryCopyAction/index.ts +11 -0
  151. package/ts/actions/DirectoryCreateAction/DirectoryCreateAction.ts +81 -0
  152. package/ts/actions/DirectoryCreateAction/index.ts +11 -0
  153. package/ts/actions/DocumentationAction/DocumentationAction.ts +100 -0
  154. package/ts/actions/DocumentationAction/index.ts +11 -0
  155. package/ts/actions/FileCopyAction/FileCopyAction.ts +125 -0
  156. package/ts/actions/FileCopyAction/index.ts +11 -0
  157. package/ts/actions/FileRenameAction/FileRenameAction.ts +82 -0
  158. package/ts/actions/FileRenameAction/index.ts +11 -0
  159. package/ts/actions/JavaScriptMinifyAction/JavaScriptMinifyAction.ts +109 -0
  160. package/ts/actions/JavaScriptMinifyAction/index.ts +11 -0
  161. package/ts/actions/JavaScriptMinifyAction/terser.config.ts +177 -0
  162. package/ts/actions/LintAction/LintAction.ts +67 -0
  163. package/ts/actions/LintAction/index.ts +11 -0
  164. package/ts/actions/PackageManagerAction/PackageManagerAction.ts +176 -0
  165. package/ts/actions/PackageManagerAction/index.ts +11 -0
  166. package/ts/actions/PackageManagerAction/package.config.ts +94 -0
  167. package/ts/actions/SassDocAction/SassDocAction.ts +66 -0
  168. package/ts/actions/SassDocAction/index.ts +11 -0
  169. package/ts/actions/StyleProcessingAction/StyleProcessingAction.ts +142 -0
  170. package/ts/actions/StyleProcessingAction/index.ts +11 -0
  171. package/ts/actions/StyleProcessingAction/postcss.config.compressed.ts +31 -0
  172. package/ts/actions/StyleProcessingAction/postcss.config.expanded.ts +47 -0
  173. package/ts/actions/SvgPackagerAction/SvgPackagerAction.ts +187 -0
  174. package/ts/actions/SvgPackagerAction/index.ts +11 -0
  175. package/ts/actions/SvgReaderAction/SvgReaderAction.ts +77 -0
  176. package/ts/actions/SvgReaderAction/index.ts +11 -0
  177. package/ts/actions/SvgSpriteAction/SvgSpriteAction.ts +127 -0
  178. package/ts/actions/SvgSpriteAction/index.ts +11 -0
  179. package/ts/actions/SvgSpriteAction/svgsprite.config.ts +123 -0
  180. package/ts/actions/SvgToPngAction/SvgToPngAction.ts +113 -0
  181. package/ts/actions/SvgToPngAction/index.ts +11 -0
  182. package/ts/actions/TypeScriptCompilerAction/TypeScriptCompilerAction.ts +117 -0
  183. package/ts/actions/TypeScriptCompilerAction/index.ts +11 -0
  184. package/ts/actions/VersionWriteAction/VersionWriteAction.ts +174 -0
  185. package/ts/actions/VersionWriteAction/index.ts +11 -0
  186. package/ts/actions/index.ts +0 -0
  187. package/ts/cli/ArgumentParser.ts +150 -0
  188. package/ts/cli/index.ts +1 -0
  189. package/ts/cli.ts +56 -0
  190. package/ts/core/abstract/AbstractProcess.ts +109 -0
  191. package/ts/core/abstract/AbstractSingleton.ts +46 -0
  192. package/ts/core/abstract/AbstractValidator.ts +167 -0
  193. package/ts/core/abstract/index.ts +0 -0
  194. package/ts/core/config/ConfigLoader.ts +141 -0
  195. package/ts/core/config/ConfigStore copy.ts +201 -0
  196. package/ts/core/config/ConfigStore.ts +157 -0
  197. package/ts/core/config/defaultConfig.ts +154 -0
  198. package/ts/core/config/index.ts +0 -0
  199. package/ts/core/index.ts +34 -0
  200. package/ts/core/pipeline/Action.ts +101 -0
  201. package/ts/core/pipeline/ActionRegistry.ts +216 -0
  202. package/ts/core/pipeline/Pipeline.ts +121 -0
  203. package/ts/core/pipeline/PipelineManager.ts +170 -0
  204. package/ts/core/pipeline/Stage.ts +131 -0
  205. package/ts/core/pipeline/Step.ts +96 -0
  206. package/ts/core/pipeline/index.ts +0 -0
  207. package/ts/core/validation/ActionValidator.ts +97 -0
  208. package/ts/core/validation/ConfigValidator.ts +103 -0
  209. package/ts/core/validation/OptionsValidator.ts +179 -0
  210. package/ts/core/validation/StageValidator.ts +175 -0
  211. package/ts/core/validation/StepValidator.ts +203 -0
  212. package/ts/core/validation/index.ts +0 -0
  213. package/ts/index.ts +26 -0
  214. package/ts/interface/ActionInterface.ts +70 -0
  215. package/ts/interface/ActionPlugin.ts +14 -0
  216. package/ts/interface/ConfigInterface.ts +55 -0
  217. package/ts/interface/File.ts +24 -0
  218. package/ts/interface/LiveOptionsInterface.ts +46 -0
  219. package/ts/interface/MetadataInterface.ts +105 -0
  220. package/ts/interface/OptionsInterface.ts +58 -0
  221. package/ts/interface/PackageJson.ts +171 -0
  222. package/ts/interface/PipelineOptionsInterface.ts +74 -0
  223. package/ts/interface/SVG.ts +84 -0
  224. package/ts/interface/StageInterface.ts +96 -0
  225. package/ts/interface/StepInterface.ts +83 -0
  226. package/ts/interface/StepOptionsInterface.ts +57 -0
  227. package/ts/interface/index.ts +9 -0
  228. package/ts/kist.ts +161 -0
  229. package/ts/live/LiveServer.ts +311 -0
  230. package/ts/live/LiveWatcher.ts +150 -0
  231. package/ts/live/index.ts +11 -0
  232. package/ts/logger/Logger.ts +187 -0
  233. package/ts/logger/LoggerStyles.ts +28 -0
  234. package/ts/logger/index.ts +0 -0
  235. package/ts/types/ActionOptionsType.ts +10 -0
  236. package/ts/types/index.ts +3 -0
  237. package/index.js +0 -3
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // Import
4
+ // ============================================================================
5
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
6
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7
+ return new (P || (P = Promise))(function (resolve, reject) {
8
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
12
+ });
13
+ };
14
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.DirectoryCopyAction = void 0;
19
+ const fs_1 = require("fs");
20
+ const path_1 = __importDefault(require("path"));
21
+ const Action_1 = require("../../core/pipeline/Action");
22
+ // ============================================================================
23
+ // Classes
24
+ // ============================================================================
25
+ /**
26
+ * DirectoryCopyAction is a step action responsible for copying all files and
27
+ * subdirectories from one directory to another, using asynchronous operations
28
+ * for efficient handling.
29
+ */
30
+ class DirectoryCopyAction extends Action_1.Action {
31
+ // Methods
32
+ // ========================================================================
33
+ /**
34
+ * Executes the directory copy action.
35
+ * @param options - The options specific to directory copying, including
36
+ * the source and destination paths.
37
+ * @returns A Promise that resolves when the directory contents have been
38
+ * successfully copied, or rejects with an error if the action fails.
39
+ */
40
+ execute(options) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ const srcDir = options.srcDir;
43
+ const destDir = options.destDir;
44
+ if (!srcDir || !destDir) {
45
+ throw new Error("Missing required options: srcDir or destDir.");
46
+ }
47
+ this.logInfo(`Copying files from ${srcDir} to ${destDir}`);
48
+ try {
49
+ yield this.copyFiles(srcDir, destDir);
50
+ this.logInfo(`Files copied successfully from ${srcDir} to ${destDir}`);
51
+ }
52
+ catch (error) {
53
+ this.logError(`Error copying files from ${srcDir} to ${destDir}: ${error}`);
54
+ throw error;
55
+ }
56
+ });
57
+ }
58
+ /**
59
+ * Asynchronously copies all files and subdirectories from the source
60
+ * directory to the destination directory. If the destination directory
61
+ * does not exist, it will be created.
62
+ *
63
+ * @param srcDir - The path of the source directory.
64
+ * @param destDir - The path of the destination directory.
65
+ * @throws {Error} If any file or directory could not be copied.
66
+ */
67
+ copyFiles(srcDir, destDir) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ const resolvedSrcDir = path_1.default.resolve(srcDir);
70
+ const resolvedDestDir = path_1.default.resolve(destDir);
71
+ try {
72
+ yield this.recursiveCopy(resolvedSrcDir, resolvedDestDir);
73
+ }
74
+ catch (error) {
75
+ throw new Error(`Failed to copy from ${resolvedSrcDir} to ${resolvedDestDir}: ${error}`);
76
+ }
77
+ });
78
+ }
79
+ /**
80
+ * Recursively copies files and directories from the source to the
81
+ * destination directory.
82
+ * This method creates the destination directory if it does not exist and
83
+ * recursively copies all nested files and directories.
84
+ *
85
+ * @param srcDir - Source directory.
86
+ * @param destDir - Destination directory.
87
+ */
88
+ recursiveCopy(srcDir, destDir) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ yield fs_1.promises.mkdir(destDir, { recursive: true });
91
+ const entries = yield fs_1.promises.readdir(srcDir, { withFileTypes: true });
92
+ for (const entry of entries) {
93
+ const srcPath = path_1.default.join(srcDir, entry.name);
94
+ const destPath = path_1.default.join(destDir, entry.name);
95
+ if (entry.isDirectory()) {
96
+ // Recursively copy subdirectory
97
+ yield this.recursiveCopy(srcPath, destPath);
98
+ }
99
+ else {
100
+ // Copy file
101
+ yield fs_1.promises.copyFile(srcPath, destPath);
102
+ }
103
+ }
104
+ });
105
+ }
106
+ /**
107
+ * Provides a description of the action.
108
+ * @returns A string description of the action.
109
+ */
110
+ describe() {
111
+ return "Copies all files and subdirectories from one directory to another, including handling of nested directories.";
112
+ }
113
+ }
114
+ exports.DirectoryCopyAction = DirectoryCopyAction;
115
+ // ============================================================================
116
+ // Export
117
+ // ============================================================================
118
+ // export default DirectoryCopyAction;
@@ -0,0 +1,2 @@
1
+ import { DirectoryCopyAction } from "./DirectoryCopyAction";
2
+ export { DirectoryCopyAction };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // Import
4
+ // ============================================================================
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DirectoryCopyAction = void 0;
7
+ const DirectoryCopyAction_1 = require("./DirectoryCopyAction");
8
+ Object.defineProperty(exports, "DirectoryCopyAction", { enumerable: true, get: function () { return DirectoryCopyAction_1.DirectoryCopyAction; } });
@@ -0,0 +1,30 @@
1
+ import { Action } from "../../core/pipeline/Action";
2
+ import { ActionOptionsType } from "../../types/ActionOptionsType";
3
+ /**
4
+ * DirectoryCreatorAction ensures that specified directory structures
5
+ * exist within a base path. It creates missing directories recursively.
6
+ */
7
+ export declare class DirectoryCreateAction extends Action {
8
+ /**
9
+ * Executes the directory creation action.
10
+ *
11
+ * @param options - The options specifying the base directory and
12
+ * the list of directories to create.
13
+ * @returns A Promise that resolves when all directories are created.
14
+ */
15
+ execute(options: ActionOptionsType): Promise<void>;
16
+ /**
17
+ * Ensures that directories exist under the specified base path.
18
+ *
19
+ * @param basePath - The base directory where subdirectories should be created.
20
+ * @param directories - An array of relative paths for directories to create.
21
+ * @returns A Promise that resolves when all directories exist.
22
+ */
23
+ private createDirectories;
24
+ /**
25
+ * Provides a description of the action.
26
+ *
27
+ * @returns A string description of the action.
28
+ */
29
+ describe(): string;
30
+ }
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // Import
4
+ // ============================================================================
5
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
6
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7
+ return new (P || (P = Promise))(function (resolve, reject) {
8
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
12
+ });
13
+ };
14
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.DirectoryCreateAction = void 0;
19
+ const fs_1 = require("fs");
20
+ const path_1 = __importDefault(require("path"));
21
+ const Action_1 = require("../../core/pipeline/Action");
22
+ // ============================================================================
23
+ // Classes
24
+ // ============================================================================
25
+ /**
26
+ * DirectoryCreatorAction ensures that specified directory structures
27
+ * exist within a base path. It creates missing directories recursively.
28
+ */
29
+ class DirectoryCreateAction extends Action_1.Action {
30
+ /**
31
+ * Executes the directory creation action.
32
+ *
33
+ * @param options - The options specifying the base directory and
34
+ * the list of directories to create.
35
+ * @returns A Promise that resolves when all directories are created.
36
+ */
37
+ execute(options) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ const { basePath, directories } = options;
40
+ if (!basePath || !directories || !Array.isArray(directories)) {
41
+ throw new Error("Invalid options: 'basePath' (string) and 'directories' (array) are required.");
42
+ }
43
+ this.logInfo(`Ensuring directory structure under base path: ${basePath}`);
44
+ try {
45
+ yield this.createDirectories(basePath, directories);
46
+ this.logInfo("All specified directories have been created successfully.");
47
+ }
48
+ catch (error) {
49
+ this.logError("Failed to create directories.", error);
50
+ throw error;
51
+ }
52
+ });
53
+ }
54
+ /**
55
+ * Ensures that directories exist under the specified base path.
56
+ *
57
+ * @param basePath - The base directory where subdirectories should be created.
58
+ * @param directories - An array of relative paths for directories to create.
59
+ * @returns A Promise that resolves when all directories exist.
60
+ */
61
+ createDirectories(basePath, directories) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ for (const dir of directories) {
64
+ const dirPath = path_1.default.join(basePath, dir);
65
+ try {
66
+ yield fs_1.promises.mkdir(dirPath, { recursive: true });
67
+ this.logDebug(`Directory ensured: ${dirPath}`);
68
+ }
69
+ catch (error) {
70
+ this.logError(`Error creating directory: ${dirPath}`, error);
71
+ throw error;
72
+ }
73
+ }
74
+ });
75
+ }
76
+ /**
77
+ * Provides a description of the action.
78
+ *
79
+ * @returns A string description of the action.
80
+ */
81
+ describe() {
82
+ return "Creates specified directory structures under a given base path.";
83
+ }
84
+ }
85
+ exports.DirectoryCreateAction = DirectoryCreateAction;
@@ -0,0 +1,2 @@
1
+ import { DirectoryCreateAction } from "./DirectoryCreateAction";
2
+ export { DirectoryCreateAction };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // Import
4
+ // ============================================================================
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DirectoryCreateAction = void 0;
7
+ const DirectoryCreateAction_1 = require("./DirectoryCreateAction");
8
+ Object.defineProperty(exports, "DirectoryCreateAction", { enumerable: true, get: function () { return DirectoryCreateAction_1.DirectoryCreateAction; } });
@@ -0,0 +1,23 @@
1
+ import { Action } from "../../core/pipeline/Action";
2
+ import { ActionOptionsType } from "../../types/ActionOptionsType";
3
+ /**
4
+ * DocumentationAction automates the generation of documentation for software
5
+ * projects. This action allows specifying a documentation generator, source
6
+ * paths, and output locations.
7
+ */
8
+ export declare class DocumentationAction extends Action {
9
+ /**
10
+ * Executes the documentation generation process using the specified command-line tool.
11
+ *
12
+ * @param options - The options specifying the generator tool, source path, and output path.
13
+ * @returns A Promise that resolves when documentation generation completes successfully.
14
+ * @throws {Error} Throws an error if the documentation process fails.
15
+ */
16
+ execute(options: ActionOptionsType): Promise<void>;
17
+ /**
18
+ * Provides a description of the action.
19
+ *
20
+ * @returns A string description of the action.
21
+ */
22
+ describe(): string;
23
+ }
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // Imports
4
+ // ============================================================================
5
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
6
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7
+ return new (P || (P = Promise))(function (resolve, reject) {
8
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
12
+ });
13
+ };
14
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.DocumentationAction = void 0;
19
+ const child_process_1 = require("child_process");
20
+ const path_1 = __importDefault(require("path"));
21
+ const util_1 = __importDefault(require("util"));
22
+ const Action_1 = require("../../core/pipeline/Action");
23
+ // ============================================================================
24
+ // Constants
25
+ // ============================================================================
26
+ const execFileAsync = util_1.default.promisify(child_process_1.execFile);
27
+ // ============================================================================
28
+ // Classes
29
+ // ============================================================================
30
+ /**
31
+ * DocumentationAction automates the generation of documentation for software
32
+ * projects. This action allows specifying a documentation generator, source
33
+ * paths, and output locations.
34
+ */
35
+ class DocumentationAction extends Action_1.Action {
36
+ /**
37
+ * Executes the documentation generation process using the specified command-line tool.
38
+ *
39
+ * @param options - The options specifying the generator tool, source path, and output path.
40
+ * @returns A Promise that resolves when documentation generation completes successfully.
41
+ * @throws {Error} Throws an error if the documentation process fails.
42
+ */
43
+ execute(options) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ const { generatorCommand = "jsdoc", sourcePath = "./src", outputPath = "./docs", configPath = "", } = options;
46
+ if (!generatorCommand) {
47
+ throw new Error("Invalid options: 'generatorCommand' must be specified.");
48
+ }
49
+ const resolvedSourcePath = path_1.default.resolve(sourcePath);
50
+ const resolvedOutputPath = path_1.default.resolve(outputPath);
51
+ const resolvedConfigPath = configPath
52
+ ? path_1.default.resolve(configPath)
53
+ : null;
54
+ this.logInfo(`Generating documentation with ${generatorCommand}...`);
55
+ this.logDebug(`Source Path: ${resolvedSourcePath}`);
56
+ this.logDebug(`Output Path: ${resolvedOutputPath}`);
57
+ if (resolvedConfigPath)
58
+ this.logDebug(`Config Path: ${resolvedConfigPath}`);
59
+ try {
60
+ // Construct command arguments
61
+ const args = resolvedConfigPath
62
+ ? ["-c", resolvedConfigPath, "-d", resolvedOutputPath]
63
+ : [resolvedSourcePath, "-d", resolvedOutputPath];
64
+ // Execute documentation generation command safely
65
+ const { stdout, stderr } = yield execFileAsync(generatorCommand, args);
66
+ if (stderr) {
67
+ this.logError(`Documentation generation failed: ${stderr}`);
68
+ throw new Error(stderr);
69
+ }
70
+ this.logInfo(stdout);
71
+ this.logInfo(`Documentation successfully generated at: ${resolvedOutputPath}`);
72
+ }
73
+ catch (error) {
74
+ this.logError("Error occurred while generating documentation.", error);
75
+ throw new Error(`Documentation generation failed: ${error.message}`);
76
+ }
77
+ });
78
+ }
79
+ /**
80
+ * Provides a description of the action.
81
+ *
82
+ * @returns A string description of the action.
83
+ */
84
+ describe() {
85
+ return "Generates project documentation using a specified tool (e.g., JSDoc, TypeDoc).";
86
+ }
87
+ }
88
+ exports.DocumentationAction = DocumentationAction;
@@ -0,0 +1,2 @@
1
+ import { DocumentationAction } from "./DocumentationAction";
2
+ export { DocumentationAction };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // Import
4
+ // ============================================================================
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DocumentationAction = void 0;
7
+ const DocumentationAction_1 = require("./DocumentationAction");
8
+ Object.defineProperty(exports, "DocumentationAction", { enumerable: true, get: function () { return DocumentationAction_1.DocumentationAction; } });
@@ -0,0 +1,42 @@
1
+ import { Action } from "../../core/pipeline/Action";
2
+ import { ActionOptionsType } from "../../types/ActionOptionsType";
3
+ /**
4
+ * FileCopyAction is a step action responsible for copying files from a source
5
+ * location to a destination directory. This action handles file path
6
+ * resolution and ensures that existing files in the destination can be
7
+ * replaced if necessary.
8
+ */
9
+ export declare class FileCopyAction extends Action {
10
+ /**
11
+ * Executes the file copy action.
12
+ * @param options - The options specific to file copying, including source
13
+ * file and destination directory.
14
+ * @returns A Promise that resolves when the file has been successfully
15
+ * copied, or rejects with an error if the action fails.
16
+ */
17
+ execute(options: ActionOptionsType): Promise<void>;
18
+ /**
19
+ * Copies a file from a specified source to a destination directory.
20
+ * Handles file path resolution and ensures the destination directory
21
+ * exists.
22
+ *
23
+ * @param srcFile - The path of the source file to be copied.
24
+ * @param destDir - The destination directory where the file should
25
+ * be placed.
26
+ * @returns A Promise that resolves when the file has been successfully
27
+ * copied.
28
+ * @throws {Error} If the file cannot be copied, including due to
29
+ * permission errors or the source file not existing.
30
+ */
31
+ private copyFileToDirectory;
32
+ /**
33
+ * Ensures that the given directory exists, creating it if it does not.
34
+ * @param dirPath - The path of the directory to check and create.
35
+ */
36
+ private ensureDirectoryExists;
37
+ /**
38
+ * Provides a description of the action.
39
+ * @returns A string description of the action.
40
+ */
41
+ describe(): string;
42
+ }
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // Import
4
+ // ============================================================================
5
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
6
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7
+ return new (P || (P = Promise))(function (resolve, reject) {
8
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
12
+ });
13
+ };
14
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.FileCopyAction = void 0;
19
+ const fs_1 = __importDefault(require("fs"));
20
+ const path_1 = __importDefault(require("path"));
21
+ const Action_1 = require("../../core/pipeline/Action");
22
+ // ============================================================================
23
+ // Classes
24
+ // ============================================================================
25
+ /**
26
+ * FileCopyAction is a step action responsible for copying files from a source
27
+ * location to a destination directory. This action handles file path
28
+ * resolution and ensures that existing files in the destination can be
29
+ * replaced if necessary.
30
+ */
31
+ class FileCopyAction extends Action_1.Action {
32
+ // Parameters
33
+ // ========================================================================
34
+ // Constructor
35
+ // ========================================================================
36
+ // Methods
37
+ // ========================================================================
38
+ /**
39
+ * Executes the file copy action.
40
+ * @param options - The options specific to file copying, including source
41
+ * file and destination directory.
42
+ * @returns A Promise that resolves when the file has been successfully
43
+ * copied, or rejects with an error if the action fails.
44
+ */
45
+ execute(options) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ const srcFile = options.srcFile;
48
+ const destDir = options.destDir;
49
+ if (!srcFile || !destDir) {
50
+ throw new Error("Missing required options: srcFile or destDir.");
51
+ }
52
+ this.logInfo(`Copying file from ${srcFile} to ${destDir}.`);
53
+ try {
54
+ yield this.copyFileToDirectory(srcFile, destDir);
55
+ this.logInfo(`File copied successfully from ${srcFile} to ${destDir}.`);
56
+ }
57
+ catch (error) {
58
+ this.logError(`Error copying file from ${srcFile} to ${destDir}: ${error}`);
59
+ throw error;
60
+ }
61
+ });
62
+ }
63
+ /**
64
+ * Copies a file from a specified source to a destination directory.
65
+ * Handles file path resolution and ensures the destination directory
66
+ * exists.
67
+ *
68
+ * @param srcFile - The path of the source file to be copied.
69
+ * @param destDir - The destination directory where the file should
70
+ * be placed.
71
+ * @returns A Promise that resolves when the file has been successfully
72
+ * copied.
73
+ * @throws {Error} If the file cannot be copied, including due to
74
+ * permission errors or the source file not existing.
75
+ */
76
+ copyFileToDirectory(srcFile, destDir) {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ try {
79
+ // Ensure the destination directory exists
80
+ yield this.ensureDirectoryExists(destDir);
81
+ // Resolve the destination file path
82
+ const fileName = path_1.default.basename(srcFile);
83
+ const destFilePath = path_1.default.join(destDir, fileName);
84
+ // Copy the file
85
+ yield fs_1.default.promises.copyFile(srcFile, destFilePath);
86
+ }
87
+ catch (error) {
88
+ this.logError(`Error copying file: ${error}`);
89
+ throw error;
90
+ }
91
+ });
92
+ }
93
+ /**
94
+ * Ensures that the given directory exists, creating it if it does not.
95
+ * @param dirPath - The path of the directory to check and create.
96
+ */
97
+ ensureDirectoryExists(dirPath) {
98
+ return __awaiter(this, void 0, void 0, function* () {
99
+ try {
100
+ yield fs_1.default.promises.mkdir(dirPath, { recursive: true });
101
+ }
102
+ catch (error) {
103
+ if (error instanceof Error) {
104
+ const nodeError = error;
105
+ if (nodeError.code !== "EEXIST") {
106
+ throw nodeError;
107
+ }
108
+ }
109
+ else {
110
+ throw error;
111
+ }
112
+ }
113
+ });
114
+ }
115
+ /**
116
+ * Provides a description of the action.
117
+ * @returns A string description of the action.
118
+ */
119
+ describe() {
120
+ return "Copies a file from a source location to a destination directory, ensuring directories exist and handling errors gracefully.";
121
+ }
122
+ }
123
+ exports.FileCopyAction = FileCopyAction;
124
+ // ============================================================================
125
+ // Export
126
+ // ============================================================================
127
+ // export default FileCopyAction;
@@ -0,0 +1,2 @@
1
+ import { FileCopyAction } from "./FileCopyAction";
2
+ export { FileCopyAction };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // Import
4
+ // ============================================================================
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.FileCopyAction = void 0;
7
+ const FileCopyAction_1 = require("./FileCopyAction");
8
+ Object.defineProperty(exports, "FileCopyAction", { enumerable: true, get: function () { return FileCopyAction_1.FileCopyAction; } });
@@ -0,0 +1,30 @@
1
+ import { Action } from "../../core/pipeline/Action";
2
+ import { ActionOptionsType } from "../../types/ActionOptionsType";
3
+ /**
4
+ * FileRenameAction handles renaming files within the file system.
5
+ * Ensures that file renaming operations are handled efficiently and safely.
6
+ */
7
+ export declare class FileRenameAction extends Action {
8
+ /**
9
+ * Executes the file renaming action.
10
+ *
11
+ * @param options - The options specifying the source and target file paths.
12
+ * @returns A Promise that resolves when the file has been successfully renamed.
13
+ * @throws {Error} If the source file does not exist or cannot be renamed.
14
+ */
15
+ execute(options: ActionOptionsType): Promise<void>;
16
+ /**
17
+ * Renames a file from its current path to a new path.
18
+ *
19
+ * @param srcPath - The current file path.
20
+ * @param targetPath - The new file path.
21
+ * @returns A Promise that resolves once the file is successfully renamed.
22
+ */
23
+ private renameFile;
24
+ /**
25
+ * Provides a description of the action.
26
+ *
27
+ * @returns A string description of the action.
28
+ */
29
+ describe(): string;
30
+ }