kist 0.1.57 → 0.1.59
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/js/actions/CoreActions.d.ts +12 -0
- package/js/actions/CoreActions.js +12 -16
- package/js/actions/FileCopyAction/FileCopyAction.d.ts +24 -2
- package/js/actions/FileCopyAction/FileCopyAction.js +131 -8
- package/js/config/actions.config.d.ts +20 -21
- package/js/config/actions.config.js +54 -73
- package/js/core/cache/BuildCache.d.ts +159 -0
- package/js/core/cache/BuildCache.js +418 -0
- package/js/core/cache/FileCache.d.ts +149 -0
- package/js/core/cache/FileCache.js +339 -0
- package/js/core/config/ConfigLoader.d.ts +42 -0
- package/js/core/config/ConfigLoader.js +140 -3
- package/js/core/pipeline/Pipeline.d.ts +34 -2
- package/js/core/pipeline/Pipeline.js +111 -8
- package/js/core/pipeline/Stage.d.ts +30 -4
- package/js/core/pipeline/Stage.js +94 -13
- package/js/core/plugin/PluginManager.d.ts +3 -3
- package/js/core/plugin/PluginManager.js +6 -6
- package/js/core/progress/ProgressReporter.d.ts +137 -0
- package/js/core/progress/ProgressReporter.js +221 -0
- package/js/index.d.ts +1 -1
- package/js/index.js +3 -3
- package/js/interface/ConfigInterface.d.ts +19 -0
- package/js/interface/OptionsInterface.d.ts +85 -0
- package/js/interface/StageInterface.d.ts +20 -0
- package/js/kist.js +1 -1
- package/package.json +27 -27
- package/ts/actions/CoreActions.ts +12 -21
- package/ts/actions/FileCopyAction/FileCopyAction.ts +159 -13
- package/ts/config/actions.config.ts +55 -77
- package/ts/core/cache/BuildCache.ts +504 -0
- package/ts/core/cache/FileCache.ts +395 -0
- package/ts/core/cache/index.ts +6 -0
- package/ts/core/config/ConfigLoader.ts +176 -7
- package/ts/core/index.ts +7 -0
- package/ts/core/pipeline/Pipeline.ts +131 -6
- package/ts/core/pipeline/Stage.ts +102 -14
- package/ts/core/plugin/PluginManager.ts +6 -6
- package/ts/core/progress/ProgressReporter.ts +297 -0
- package/ts/core/progress/index.ts +9 -0
- package/ts/core/validation/ConfigValidator.ts +11 -1
- package/ts/index.ts +3 -3
- package/ts/interface/ConfigInterface.ts +20 -0
- package/ts/interface/OptionsInterface.ts +100 -0
- package/ts/interface/StageInterface.ts +23 -0
- package/ts/kist.ts +1 -1
- package/js/actions/JavaScriptMinifyAction/JavaScriptMinifyAction.d.ts +0 -31
- package/js/actions/JavaScriptMinifyAction/JavaScriptMinifyAction.js +0 -98
- package/js/actions/JavaScriptMinifyAction/index.d.ts +0 -2
- package/js/actions/JavaScriptMinifyAction/index.js +0 -8
- package/js/actions/JavaScriptMinifyAction/terser.config.d.ts +0 -27
- package/js/actions/JavaScriptMinifyAction/terser.config.js +0 -119
- package/js/actions/LintAction/LintAction.d.ts +0 -17
- package/js/actions/LintAction/LintAction.js +0 -63
- package/js/actions/LintAction/index.d.ts +0 -2
- package/js/actions/LintAction/index.js +0 -8
- package/js/actions/StyleProcessingAction/StyleProcessingAction.d.ts +0 -34
- package/js/actions/StyleProcessingAction/StyleProcessingAction.js +0 -164
- package/js/actions/StyleProcessingAction/index.d.ts +0 -2
- package/js/actions/StyleProcessingAction/index.js +0 -8
- package/js/actions/StyleProcessingAction/postcss.config.compressed.d.ts +0 -10
- package/js/actions/StyleProcessingAction/postcss.config.compressed.js +0 -31
- package/js/actions/StyleProcessingAction/postcss.config.expanded.d.ts +0 -16
- package/js/actions/StyleProcessingAction/postcss.config.expanded.js +0 -45
- package/js/actions/SvgPackagerAction/SvgPackagerAction.d.ts +0 -68
- package/js/actions/SvgPackagerAction/SvgPackagerAction.js +0 -186
- package/js/actions/SvgPackagerAction/index.d.ts +0 -2
- package/js/actions/SvgPackagerAction/index.js +0 -8
- package/js/actions/SvgReaderAction/SvgReaderAction.d.ts +0 -32
- package/js/actions/SvgReaderAction/SvgReaderAction.js +0 -87
- package/js/actions/SvgReaderAction/index.d.ts +0 -2
- package/js/actions/SvgReaderAction/index.js +0 -8
- package/js/actions/SvgSpriteAction/SvgSpriteAction.d.ts +0 -37
- package/js/actions/SvgSpriteAction/SvgSpriteAction.js +0 -114
- package/js/actions/SvgSpriteAction/index.d.ts +0 -2
- package/js/actions/SvgSpriteAction/index.js +0 -8
- package/js/actions/SvgSpriteAction/svgsprite.config.d.ts +0 -3
- package/js/actions/SvgSpriteAction/svgsprite.config.js +0 -117
- package/js/actions/SvgToPngAction/SvgToPngAction.d.ts +0 -28
- package/js/actions/SvgToPngAction/SvgToPngAction.js +0 -111
- package/js/actions/SvgToPngAction/index.d.ts +0 -2
- package/js/actions/SvgToPngAction/index.js +0 -8
- package/js/actions/TemplateRenderAction/TemplateRenderAction.d.ts +0 -9
- package/js/actions/TemplateRenderAction/TemplateRenderAction.js +0 -95
- package/js/actions/TemplateRenderAction/index.d.ts +0 -2
- package/js/actions/TemplateRenderAction/index.js +0 -8
- package/js/actions/TemplateRenderAction/nunjucks.config.d.ts +0 -14
- package/js/actions/TemplateRenderAction/nunjucks.config.js +0 -33
- package/ts/actions/JavaScriptMinifyAction/JavaScriptMinifyAction.ts +0 -109
- package/ts/actions/JavaScriptMinifyAction/index.ts +0 -11
- package/ts/actions/JavaScriptMinifyAction/terser.config.ts +0 -177
- package/ts/actions/LintAction/LintAction.ts +0 -67
- package/ts/actions/LintAction/index.ts +0 -11
- package/ts/actions/StyleProcessingAction/StyleProcessingAction.ts +0 -142
- package/ts/actions/StyleProcessingAction/index.ts +0 -11
- package/ts/actions/StyleProcessingAction/postcss.config.compressed.ts +0 -31
- package/ts/actions/StyleProcessingAction/postcss.config.expanded.ts +0 -46
- package/ts/actions/SvgPackagerAction/SvgPackagerAction.ts +0 -187
- package/ts/actions/SvgPackagerAction/index.ts +0 -11
- package/ts/actions/SvgReaderAction/SvgReaderAction.ts +0 -77
- package/ts/actions/SvgReaderAction/index.ts +0 -11
- package/ts/actions/SvgSpriteAction/SvgSpriteAction.ts +0 -127
- package/ts/actions/SvgSpriteAction/index.ts +0 -11
- package/ts/actions/SvgSpriteAction/svgsprite.config.ts +0 -123
- package/ts/actions/SvgToPngAction/SvgToPngAction.ts +0 -121
- package/ts/actions/SvgToPngAction/index.ts +0 -11
- package/ts/actions/TemplateRenderAction/TemplateRenderAction.ts +0 -124
- package/ts/actions/TemplateRenderAction/index.ts +0 -11
- package/ts/actions/TemplateRenderAction/nunjucks.config.ts +0 -37
|
@@ -2,5 +2,17 @@ import { ActionInterface } from "../interface/ActionInterface";
|
|
|
2
2
|
/**
|
|
3
3
|
* A record of core actions, mapped by their unique `name` property.
|
|
4
4
|
* Automatically derives names from the action classes.
|
|
5
|
+
*
|
|
6
|
+
* Note: Additional actions are available in separate @getkist/action-* packages:
|
|
7
|
+
* - @getkist/action-eslint - ESLint linting
|
|
8
|
+
* - @getkist/action-jest - Jest test runner
|
|
9
|
+
* - @getkist/action-nunjucks - Nunjucks/Jinja templating
|
|
10
|
+
* - @getkist/action-postcss - PostCSS processing
|
|
11
|
+
* - @getkist/action-prettier - Prettier formatting
|
|
12
|
+
* - @getkist/action-sass - SASS/SCSS compilation
|
|
13
|
+
* - @getkist/action-svg - SVG sprite generation and optimization
|
|
14
|
+
* - @getkist/action-terser - JavaScript minification
|
|
15
|
+
* - @getkist/action-tsdown - tsdown bundling
|
|
16
|
+
* - @getkist/action-tsup - tsup bundling
|
|
5
17
|
*/
|
|
6
18
|
export declare const coreActions: Record<string, new () => ActionInterface>;
|
|
@@ -10,16 +10,8 @@ const DirectoryCreateAction_1 = require("../actions/DirectoryCreateAction");
|
|
|
10
10
|
const DocumentationAction_1 = require("../actions/DocumentationAction");
|
|
11
11
|
const FileCopyAction_1 = require("../actions/FileCopyAction");
|
|
12
12
|
const FileRenameAction_1 = require("../actions/FileRenameAction");
|
|
13
|
-
const JavaScriptMinifyAction_1 = require("../actions/JavaScriptMinifyAction");
|
|
14
|
-
const LintAction_1 = require("../actions/LintAction");
|
|
15
13
|
const PackageManagerAction_1 = require("../actions/PackageManagerAction");
|
|
16
14
|
const RunScriptAction_1 = require("../actions/RunScriptAction");
|
|
17
|
-
const StyleProcessingAction_1 = require("../actions/StyleProcessingAction");
|
|
18
|
-
const SvgPackagerAction_1 = require("../actions/SvgPackagerAction");
|
|
19
|
-
const SvgReaderAction_1 = require("../actions/SvgReaderAction");
|
|
20
|
-
const SvgSpriteAction_1 = require("../actions/SvgSpriteAction");
|
|
21
|
-
const SvgToPngAction_1 = require("../actions/SvgToPngAction");
|
|
22
|
-
const TemplateRenderAction_1 = require("../actions/TemplateRenderAction");
|
|
23
15
|
const TypeScriptCompilerAction_1 = require("../actions/TypeScriptCompilerAction");
|
|
24
16
|
const VersionWriteAction_1 = require("../actions/VersionWriteAction");
|
|
25
17
|
// ============================================================================
|
|
@@ -28,6 +20,18 @@ const VersionWriteAction_1 = require("../actions/VersionWriteAction");
|
|
|
28
20
|
/**
|
|
29
21
|
* A record of core actions, mapped by their unique `name` property.
|
|
30
22
|
* Automatically derives names from the action classes.
|
|
23
|
+
*
|
|
24
|
+
* Note: Additional actions are available in separate @getkist/action-* packages:
|
|
25
|
+
* - @getkist/action-eslint - ESLint linting
|
|
26
|
+
* - @getkist/action-jest - Jest test runner
|
|
27
|
+
* - @getkist/action-nunjucks - Nunjucks/Jinja templating
|
|
28
|
+
* - @getkist/action-postcss - PostCSS processing
|
|
29
|
+
* - @getkist/action-prettier - Prettier formatting
|
|
30
|
+
* - @getkist/action-sass - SASS/SCSS compilation
|
|
31
|
+
* - @getkist/action-svg - SVG sprite generation and optimization
|
|
32
|
+
* - @getkist/action-terser - JavaScript minification
|
|
33
|
+
* - @getkist/action-tsdown - tsdown bundling
|
|
34
|
+
* - @getkist/action-tsup - tsup bundling
|
|
31
35
|
*/
|
|
32
36
|
exports.coreActions = {
|
|
33
37
|
[new DirectoryCleanAction_1.DirectoryCleanAction().name]: DirectoryCleanAction_1.DirectoryCleanAction,
|
|
@@ -36,16 +40,8 @@ exports.coreActions = {
|
|
|
36
40
|
[new DocumentationAction_1.DocumentationAction().name]: DocumentationAction_1.DocumentationAction,
|
|
37
41
|
[new FileCopyAction_1.FileCopyAction().name]: FileCopyAction_1.FileCopyAction,
|
|
38
42
|
[new FileRenameAction_1.FileRenameAction().name]: FileRenameAction_1.FileRenameAction,
|
|
39
|
-
[new JavaScriptMinifyAction_1.JavaScriptMinifyAction().name]: JavaScriptMinifyAction_1.JavaScriptMinifyAction,
|
|
40
|
-
[new LintAction_1.LintAction().name]: LintAction_1.LintAction,
|
|
41
43
|
[new PackageManagerAction_1.PackageManagerAction().name]: PackageManagerAction_1.PackageManagerAction,
|
|
42
44
|
[new RunScriptAction_1.RunScriptAction().name]: RunScriptAction_1.RunScriptAction,
|
|
43
|
-
[new StyleProcessingAction_1.StyleProcessingAction().name]: StyleProcessingAction_1.StyleProcessingAction,
|
|
44
|
-
[new SvgPackagerAction_1.SvgPackagerAction().name]: SvgPackagerAction_1.SvgPackagerAction,
|
|
45
|
-
[new SvgReaderAction_1.SvgReaderAction().name]: SvgReaderAction_1.SvgReaderAction,
|
|
46
|
-
[new SvgSpriteAction_1.SvgSpriteAction().name]: SvgSpriteAction_1.SvgSpriteAction,
|
|
47
|
-
[new SvgToPngAction_1.SvgToPngAction().name]: SvgToPngAction_1.SvgToPngAction,
|
|
48
|
-
[new TemplateRenderAction_1.TemplateRenderAction().name]: TemplateRenderAction_1.TemplateRenderAction,
|
|
49
45
|
[new TypeScriptCompilerAction_1.TypeScriptCompilerAction().name]: TypeScriptCompilerAction_1.TypeScriptCompilerAction,
|
|
50
46
|
[new VersionWriteAction_1.VersionWriteAction().name]: VersionWriteAction_1.VersionWriteAction,
|
|
51
47
|
};
|
|
@@ -5,8 +5,15 @@ import { ActionOptionsType } from "../../types/ActionOptionsType";
|
|
|
5
5
|
* location to a destination directory. This action handles file path
|
|
6
6
|
* resolution and ensures that existing files in the destination can be
|
|
7
7
|
* replaced if necessary.
|
|
8
|
+
*
|
|
9
|
+
* Performance features:
|
|
10
|
+
* - Uses streaming for large files to reduce memory usage
|
|
11
|
+
* - Supports file caching to skip unchanged files
|
|
12
|
+
* - Parallel batch copy support
|
|
8
13
|
*/
|
|
9
14
|
export declare class FileCopyAction extends Action {
|
|
15
|
+
private fileCache;
|
|
16
|
+
constructor();
|
|
10
17
|
/**
|
|
11
18
|
* Executes the file copy action.
|
|
12
19
|
* @param options - The options specific to file copying, including source
|
|
@@ -15,10 +22,21 @@ export declare class FileCopyAction extends Action {
|
|
|
15
22
|
* copied, or rejects with an error if the action fails.
|
|
16
23
|
*/
|
|
17
24
|
execute(options: ActionOptionsType): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Copies a single file with optional caching.
|
|
27
|
+
*/
|
|
28
|
+
private copySingleFile;
|
|
29
|
+
/**
|
|
30
|
+
* Copies multiple files with optional parallel execution.
|
|
31
|
+
*/
|
|
32
|
+
private copyMultipleFiles;
|
|
33
|
+
/**
|
|
34
|
+
* Copies files in parallel with concurrency control.
|
|
35
|
+
*/
|
|
36
|
+
private copyFilesInParallel;
|
|
18
37
|
/**
|
|
19
38
|
* Copies a file from a specified source to a destination directory.
|
|
20
|
-
*
|
|
21
|
-
* exists.
|
|
39
|
+
* Uses streaming for large files to reduce memory usage.
|
|
22
40
|
*
|
|
23
41
|
* @param srcFile - The path of the source file to be copied.
|
|
24
42
|
* @param destDir - The destination directory where the file should
|
|
@@ -29,6 +47,10 @@ export declare class FileCopyAction extends Action {
|
|
|
29
47
|
* permission errors or the source file not existing.
|
|
30
48
|
*/
|
|
31
49
|
private copyFileToDirectory;
|
|
50
|
+
/**
|
|
51
|
+
* Copies a file using streams for memory-efficient handling of large files.
|
|
52
|
+
*/
|
|
53
|
+
private streamCopyFile;
|
|
32
54
|
/**
|
|
33
55
|
* Ensures that the given directory exists, creating it if it does not.
|
|
34
56
|
* @param dirPath - The path of the directory to check and create.
|
|
@@ -18,7 +18,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.FileCopyAction = void 0;
|
|
19
19
|
const fs_1 = __importDefault(require("fs"));
|
|
20
20
|
const path_1 = __importDefault(require("path"));
|
|
21
|
+
const promises_1 = require("stream/promises");
|
|
21
22
|
const Action_1 = require("../../core/pipeline/Action");
|
|
23
|
+
const FileCache_1 = require("../../core/cache/FileCache");
|
|
24
|
+
// ============================================================================
|
|
25
|
+
// Constants
|
|
26
|
+
// ============================================================================
|
|
27
|
+
/** Threshold for using streaming copy (5MB) */
|
|
28
|
+
const STREAMING_THRESHOLD = 5 * 1024 * 1024;
|
|
22
29
|
// ============================================================================
|
|
23
30
|
// Classes
|
|
24
31
|
// ============================================================================
|
|
@@ -27,12 +34,19 @@ const Action_1 = require("../../core/pipeline/Action");
|
|
|
27
34
|
* location to a destination directory. This action handles file path
|
|
28
35
|
* resolution and ensures that existing files in the destination can be
|
|
29
36
|
* replaced if necessary.
|
|
37
|
+
*
|
|
38
|
+
* Performance features:
|
|
39
|
+
* - Uses streaming for large files to reduce memory usage
|
|
40
|
+
* - Supports file caching to skip unchanged files
|
|
41
|
+
* - Parallel batch copy support
|
|
30
42
|
*/
|
|
31
43
|
class FileCopyAction extends Action_1.Action {
|
|
32
|
-
// Parameters
|
|
33
|
-
// ========================================================================
|
|
34
44
|
// Constructor
|
|
35
45
|
// ========================================================================
|
|
46
|
+
constructor() {
|
|
47
|
+
super();
|
|
48
|
+
this.fileCache = FileCache_1.FileCache.getInstance();
|
|
49
|
+
}
|
|
36
50
|
// Methods
|
|
37
51
|
// ========================================================================
|
|
38
52
|
/**
|
|
@@ -45,13 +59,44 @@ class FileCopyAction extends Action_1.Action {
|
|
|
45
59
|
execute(options) {
|
|
46
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
61
|
const srcFile = options.srcFile;
|
|
62
|
+
const srcFiles = options.srcFiles;
|
|
48
63
|
const destDir = options.destDir;
|
|
49
|
-
|
|
50
|
-
|
|
64
|
+
const useCache = options.useCache;
|
|
65
|
+
const parallel = options.parallel;
|
|
66
|
+
if ((!srcFile && !srcFiles) || !destDir) {
|
|
67
|
+
throw new Error("Missing required options: srcFile/srcFiles or destDir.");
|
|
68
|
+
}
|
|
69
|
+
// Handle batch copy
|
|
70
|
+
if (srcFiles && srcFiles.length > 0) {
|
|
71
|
+
yield this.copyMultipleFiles(srcFiles, destDir, { useCache, parallel });
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
// Handle single file copy
|
|
75
|
+
if (srcFile) {
|
|
76
|
+
yield this.copySingleFile(srcFile, destDir, { useCache });
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Copies a single file with optional caching.
|
|
82
|
+
*/
|
|
83
|
+
copySingleFile(srcFile_1, destDir_1) {
|
|
84
|
+
return __awaiter(this, arguments, void 0, function* (srcFile, destDir, options = {}) {
|
|
85
|
+
// Check cache if enabled
|
|
86
|
+
if (options.useCache) {
|
|
87
|
+
const hasChanged = yield this.fileCache.hasFileChanged(srcFile);
|
|
88
|
+
if (!hasChanged) {
|
|
89
|
+
this.logDebug(`Skipping unchanged file: ${srcFile}`);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
51
92
|
}
|
|
52
93
|
this.logInfo(`Copying file from ${srcFile} to ${destDir}.`);
|
|
53
94
|
try {
|
|
54
95
|
yield this.copyFileToDirectory(srcFile, destDir);
|
|
96
|
+
// Update cache
|
|
97
|
+
if (options.useCache) {
|
|
98
|
+
yield this.fileCache.updateFileEntry(srcFile);
|
|
99
|
+
}
|
|
55
100
|
this.logInfo(`File copied successfully from ${srcFile} to ${destDir}.`);
|
|
56
101
|
}
|
|
57
102
|
catch (error) {
|
|
@@ -60,10 +105,70 @@ class FileCopyAction extends Action_1.Action {
|
|
|
60
105
|
}
|
|
61
106
|
});
|
|
62
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Copies multiple files with optional parallel execution.
|
|
110
|
+
*/
|
|
111
|
+
copyMultipleFiles(srcFiles_1, destDir_1) {
|
|
112
|
+
return __awaiter(this, arguments, void 0, function* (srcFiles, destDir, options = {}) {
|
|
113
|
+
const startTime = performance.now();
|
|
114
|
+
let filesToCopy = srcFiles;
|
|
115
|
+
// Filter unchanged files if caching is enabled
|
|
116
|
+
if (options.useCache) {
|
|
117
|
+
filesToCopy = yield this.fileCache.getChangedFiles(srcFiles);
|
|
118
|
+
const skipped = srcFiles.length - filesToCopy.length;
|
|
119
|
+
if (skipped > 0) {
|
|
120
|
+
this.logInfo(`Skipping ${skipped} unchanged files.`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (filesToCopy.length === 0) {
|
|
124
|
+
this.logInfo("All files are up to date, nothing to copy.");
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
this.logInfo(`Copying ${filesToCopy.length} files to ${destDir}.`);
|
|
128
|
+
try {
|
|
129
|
+
if (options.parallel) {
|
|
130
|
+
// Parallel copy with concurrency limit
|
|
131
|
+
yield this.copyFilesInParallel(filesToCopy, destDir, 10);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
// Sequential copy
|
|
135
|
+
for (const file of filesToCopy) {
|
|
136
|
+
yield this.copyFileToDirectory(file, destDir);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// Update cache for all copied files
|
|
140
|
+
if (options.useCache) {
|
|
141
|
+
yield this.fileCache.updateFileEntries(filesToCopy);
|
|
142
|
+
}
|
|
143
|
+
const duration = performance.now() - startTime;
|
|
144
|
+
this.logInfo(`Copied ${filesToCopy.length} files in ${duration.toFixed(2)}ms.`);
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
this.logError(`Error copying files: ${error}`);
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Copies files in parallel with concurrency control.
|
|
154
|
+
*/
|
|
155
|
+
copyFilesInParallel(srcFiles_1, destDir_1) {
|
|
156
|
+
return __awaiter(this, arguments, void 0, function* (srcFiles, destDir, maxConcurrent = 10) {
|
|
157
|
+
const executing = new Set();
|
|
158
|
+
for (const srcFile of srcFiles) {
|
|
159
|
+
const copyPromise = this.copyFileToDirectory(srcFile, destDir)
|
|
160
|
+
.finally(() => executing.delete(copyPromise));
|
|
161
|
+
executing.add(copyPromise);
|
|
162
|
+
if (executing.size >= maxConcurrent) {
|
|
163
|
+
yield Promise.race(executing);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
yield Promise.all(executing);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
63
169
|
/**
|
|
64
170
|
* Copies a file from a specified source to a destination directory.
|
|
65
|
-
*
|
|
66
|
-
* exists.
|
|
171
|
+
* Uses streaming for large files to reduce memory usage.
|
|
67
172
|
*
|
|
68
173
|
* @param srcFile - The path of the source file to be copied.
|
|
69
174
|
* @param destDir - The destination directory where the file should
|
|
@@ -81,8 +186,16 @@ class FileCopyAction extends Action_1.Action {
|
|
|
81
186
|
// Resolve the destination file path
|
|
82
187
|
const fileName = path_1.default.basename(srcFile);
|
|
83
188
|
const destFilePath = path_1.default.join(destDir, fileName);
|
|
84
|
-
//
|
|
85
|
-
yield fs_1.default.promises.
|
|
189
|
+
// Check file size to determine copy method
|
|
190
|
+
const stat = yield fs_1.default.promises.stat(srcFile);
|
|
191
|
+
if (stat.size > STREAMING_THRESHOLD) {
|
|
192
|
+
// Use streaming for large files
|
|
193
|
+
yield this.streamCopyFile(srcFile, destFilePath);
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
// Use standard copy for smaller files
|
|
197
|
+
yield fs_1.default.promises.copyFile(srcFile, destFilePath);
|
|
198
|
+
}
|
|
86
199
|
}
|
|
87
200
|
catch (error) {
|
|
88
201
|
this.logError(`Error copying file: ${error}`);
|
|
@@ -90,6 +203,16 @@ class FileCopyAction extends Action_1.Action {
|
|
|
90
203
|
}
|
|
91
204
|
});
|
|
92
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Copies a file using streams for memory-efficient handling of large files.
|
|
208
|
+
*/
|
|
209
|
+
streamCopyFile(srcFile, destFile) {
|
|
210
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
211
|
+
const readStream = fs_1.default.createReadStream(srcFile);
|
|
212
|
+
const writeStream = fs_1.default.createWriteStream(destFile);
|
|
213
|
+
yield (0, promises_1.pipeline)(readStream, writeStream);
|
|
214
|
+
});
|
|
215
|
+
}
|
|
93
216
|
/**
|
|
94
217
|
* Ensures that the given directory exists, creating it if it does not.
|
|
95
218
|
* @param dirPath - The path of the directory to check and create.
|
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Defines which actions are
|
|
3
|
-
* kist package. All other actions should be moved to separate plugin packages.
|
|
2
|
+
* Defines which actions are in the main kist package vs. separate plugins.
|
|
4
3
|
*
|
|
5
|
-
* Core Actions (
|
|
4
|
+
* Core Actions (in main kist package):
|
|
6
5
|
* - Directory operations (create, copy, clean)
|
|
7
6
|
* - File operations (copy, rename)
|
|
8
7
|
* - Version management
|
|
9
|
-
* -
|
|
8
|
+
* - TypeScript compilation
|
|
9
|
+
* - Documentation generation
|
|
10
|
+
* - Package management
|
|
11
|
+
* - Script running
|
|
10
12
|
*
|
|
11
|
-
*
|
|
12
|
-
* - StyleProcessingAction -> @
|
|
13
|
-
* -
|
|
14
|
-
* -
|
|
15
|
-
* -
|
|
16
|
-
* -
|
|
17
|
-
* -
|
|
18
|
-
* -
|
|
19
|
-
* -
|
|
20
|
-
* - DocumentationAction -> @kist/action-docs
|
|
21
|
-
* - PackageManagerAction -> @kist/action-package-manager
|
|
22
|
-
* - RunScriptAction -> @kist/action-scripts
|
|
13
|
+
* Migrated to Plugin Packages:
|
|
14
|
+
* - StyleProcessingAction -> @getkist/action-sass
|
|
15
|
+
* - JavaScriptMinifyAction -> @getkist/action-terser
|
|
16
|
+
* - SvgPackagerAction -> @getkist/action-svg
|
|
17
|
+
* - SvgSpriteAction -> @getkist/action-svg
|
|
18
|
+
* - SvgToPngAction -> @getkist/action-svg
|
|
19
|
+
* - SvgReaderAction -> @getkist/action-svg
|
|
20
|
+
* - LintAction -> @getkist/action-eslint
|
|
21
|
+
* - TemplateRenderAction -> @getkist/action-nunjucks
|
|
23
22
|
*/
|
|
24
|
-
export declare const CORE_ACTIONS: readonly ["DirectoryCleanAction", "DirectoryCopyAction", "DirectoryCreateAction", "FileCopyAction", "FileRenameAction", "
|
|
25
|
-
export declare const
|
|
23
|
+
export declare const CORE_ACTIONS: readonly ["DirectoryCleanAction", "DirectoryCopyAction", "DirectoryCreateAction", "DocumentationAction", "FileCopyAction", "FileRenameAction", "PackageManagerAction", "RunScriptAction", "TypeScriptCompilerAction", "VersionWriteAction"];
|
|
24
|
+
export declare const MIGRATED_ACTIONS: readonly ["StyleProcessingAction", "JavaScriptMinifyAction", "SvgPackagerAction", "SvgReaderAction", "SvgSpriteAction", "SvgToPngAction", "LintAction", "TemplateRenderAction"];
|
|
26
25
|
export type CoreActionName = (typeof CORE_ACTIONS)[number];
|
|
27
|
-
export type
|
|
26
|
+
export type MigratedActionName = (typeof MIGRATED_ACTIONS)[number];
|
|
28
27
|
/**
|
|
29
|
-
* Plugin package mappings for
|
|
28
|
+
* Plugin package mappings - use these packages for the migrated actions
|
|
30
29
|
*/
|
|
31
|
-
export declare const
|
|
30
|
+
export declare const MIGRATED_PACKAGES: Record<MigratedActionName, {
|
|
32
31
|
package: string;
|
|
33
32
|
npm: string;
|
|
34
33
|
github: string;
|
|
@@ -3,117 +3,98 @@
|
|
|
3
3
|
// Core Actions Configuration
|
|
4
4
|
// ============================================================================
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.MIGRATED_PACKAGES = exports.MIGRATED_ACTIONS = exports.CORE_ACTIONS = void 0;
|
|
7
7
|
/**
|
|
8
|
-
* Defines which actions are
|
|
9
|
-
* kist package. All other actions should be moved to separate plugin packages.
|
|
8
|
+
* Defines which actions are in the main kist package vs. separate plugins.
|
|
10
9
|
*
|
|
11
|
-
* Core Actions (
|
|
10
|
+
* Core Actions (in main kist package):
|
|
12
11
|
* - Directory operations (create, copy, clean)
|
|
13
12
|
* - File operations (copy, rename)
|
|
14
13
|
* - Version management
|
|
15
|
-
* -
|
|
14
|
+
* - TypeScript compilation
|
|
15
|
+
* - Documentation generation
|
|
16
|
+
* - Package management
|
|
17
|
+
* - Script running
|
|
16
18
|
*
|
|
17
|
-
*
|
|
18
|
-
* - StyleProcessingAction -> @
|
|
19
|
-
* -
|
|
20
|
-
* -
|
|
21
|
-
* -
|
|
22
|
-
* -
|
|
23
|
-
* -
|
|
24
|
-
* -
|
|
25
|
-
* -
|
|
26
|
-
* - DocumentationAction -> @kist/action-docs
|
|
27
|
-
* - PackageManagerAction -> @kist/action-package-manager
|
|
28
|
-
* - RunScriptAction -> @kist/action-scripts
|
|
19
|
+
* Migrated to Plugin Packages:
|
|
20
|
+
* - StyleProcessingAction -> @getkist/action-sass
|
|
21
|
+
* - JavaScriptMinifyAction -> @getkist/action-terser
|
|
22
|
+
* - SvgPackagerAction -> @getkist/action-svg
|
|
23
|
+
* - SvgSpriteAction -> @getkist/action-svg
|
|
24
|
+
* - SvgToPngAction -> @getkist/action-svg
|
|
25
|
+
* - SvgReaderAction -> @getkist/action-svg
|
|
26
|
+
* - LintAction -> @getkist/action-eslint
|
|
27
|
+
* - TemplateRenderAction -> @getkist/action-nunjucks
|
|
29
28
|
*/
|
|
30
29
|
exports.CORE_ACTIONS = [
|
|
31
30
|
"DirectoryCleanAction",
|
|
32
31
|
"DirectoryCopyAction",
|
|
33
32
|
"DirectoryCreateAction",
|
|
33
|
+
"DocumentationAction",
|
|
34
34
|
"FileCopyAction",
|
|
35
35
|
"FileRenameAction",
|
|
36
|
-
"
|
|
36
|
+
"PackageManagerAction",
|
|
37
|
+
"RunScriptAction",
|
|
38
|
+
"TypeScriptCompilerAction",
|
|
37
39
|
"VersionWriteAction",
|
|
38
40
|
];
|
|
39
|
-
exports.
|
|
40
|
-
// @
|
|
41
|
+
exports.MIGRATED_ACTIONS = [
|
|
42
|
+
// @getkist/action-sass
|
|
41
43
|
"StyleProcessingAction",
|
|
42
|
-
// @
|
|
43
|
-
"TypeScriptCompilerAction",
|
|
44
|
-
// @kist/action-terser
|
|
44
|
+
// @getkist/action-terser
|
|
45
45
|
"JavaScriptMinifyAction",
|
|
46
|
-
// @
|
|
46
|
+
// @getkist/action-svg
|
|
47
47
|
"SvgPackagerAction",
|
|
48
48
|
"SvgReaderAction",
|
|
49
49
|
"SvgSpriteAction",
|
|
50
50
|
"SvgToPngAction",
|
|
51
|
-
// @
|
|
51
|
+
// @getkist/action-eslint
|
|
52
52
|
"LintAction",
|
|
53
|
-
// @
|
|
54
|
-
"
|
|
55
|
-
// @kist/action-package-manager
|
|
56
|
-
"PackageManagerAction",
|
|
57
|
-
// @kist/action-scripts
|
|
58
|
-
"RunScriptAction",
|
|
53
|
+
// @getkist/action-nunjucks
|
|
54
|
+
"TemplateRenderAction",
|
|
59
55
|
];
|
|
60
56
|
/**
|
|
61
|
-
* Plugin package mappings for
|
|
57
|
+
* Plugin package mappings - use these packages for the migrated actions
|
|
62
58
|
*/
|
|
63
|
-
exports.
|
|
59
|
+
exports.MIGRATED_PACKAGES = {
|
|
64
60
|
StyleProcessingAction: {
|
|
65
|
-
package: "@
|
|
66
|
-
npm: "npm install --save-dev @
|
|
67
|
-
github: "https://github.com/getkist/action-sass",
|
|
68
|
-
},
|
|
69
|
-
TypeScriptCompilerAction: {
|
|
70
|
-
package: "@kist/action-typescript",
|
|
71
|
-
npm: "npm install --save-dev @kist/action-typescript",
|
|
72
|
-
github: "https://github.com/getkist/action-typescript",
|
|
61
|
+
package: "@getkist/action-sass",
|
|
62
|
+
npm: "npm install --save-dev @getkist/action-sass",
|
|
63
|
+
github: "https://github.com/getkist/kist-action-sass",
|
|
73
64
|
},
|
|
74
65
|
JavaScriptMinifyAction: {
|
|
75
|
-
package: "@
|
|
76
|
-
npm: "npm install --save-dev @
|
|
77
|
-
github: "https://github.com/getkist/action-terser",
|
|
66
|
+
package: "@getkist/action-terser",
|
|
67
|
+
npm: "npm install --save-dev @getkist/action-terser",
|
|
68
|
+
github: "https://github.com/getkist/kist-action-terser",
|
|
78
69
|
},
|
|
79
70
|
SvgPackagerAction: {
|
|
80
|
-
package: "@
|
|
81
|
-
npm: "npm install --save-dev @
|
|
82
|
-
github: "https://github.com/getkist/action-svg",
|
|
71
|
+
package: "@getkist/action-svg",
|
|
72
|
+
npm: "npm install --save-dev @getkist/action-svg",
|
|
73
|
+
github: "https://github.com/getkist/kist-action-svg",
|
|
83
74
|
},
|
|
84
75
|
SvgReaderAction: {
|
|
85
|
-
package: "@
|
|
86
|
-
npm: "npm install --save-dev @
|
|
87
|
-
github: "https://github.com/getkist/action-svg",
|
|
76
|
+
package: "@getkist/action-svg",
|
|
77
|
+
npm: "npm install --save-dev @getkist/action-svg",
|
|
78
|
+
github: "https://github.com/getkist/kist-action-svg",
|
|
88
79
|
},
|
|
89
80
|
SvgSpriteAction: {
|
|
90
|
-
package: "@
|
|
91
|
-
npm: "npm install --save-dev @
|
|
92
|
-
github: "https://github.com/getkist/action-svg",
|
|
81
|
+
package: "@getkist/action-svg",
|
|
82
|
+
npm: "npm install --save-dev @getkist/action-svg",
|
|
83
|
+
github: "https://github.com/getkist/kist-action-svg",
|
|
93
84
|
},
|
|
94
85
|
SvgToPngAction: {
|
|
95
|
-
package: "@
|
|
96
|
-
npm: "npm install --save-dev @
|
|
97
|
-
github: "https://github.com/getkist/action-svg",
|
|
86
|
+
package: "@getkist/action-svg",
|
|
87
|
+
npm: "npm install --save-dev @getkist/action-svg",
|
|
88
|
+
github: "https://github.com/getkist/kist-action-svg",
|
|
98
89
|
},
|
|
99
90
|
LintAction: {
|
|
100
|
-
package: "@
|
|
101
|
-
npm: "npm install --save-dev @
|
|
102
|
-
github: "https://github.com/getkist/action-
|
|
103
|
-
},
|
|
104
|
-
DocumentationAction: {
|
|
105
|
-
package: "@kist/action-docs",
|
|
106
|
-
npm: "npm install --save-dev @kist/action-docs",
|
|
107
|
-
github: "https://github.com/getkist/action-docs",
|
|
108
|
-
},
|
|
109
|
-
PackageManagerAction: {
|
|
110
|
-
package: "@kist/action-package-manager",
|
|
111
|
-
npm: "npm install --save-dev @kist/action-package-manager",
|
|
112
|
-
github: "https://github.com/getkist/action-package-manager",
|
|
91
|
+
package: "@getkist/action-eslint",
|
|
92
|
+
npm: "npm install --save-dev @getkist/action-eslint",
|
|
93
|
+
github: "https://github.com/getkist/kist-action-eslint",
|
|
113
94
|
},
|
|
114
|
-
|
|
115
|
-
package: "@
|
|
116
|
-
npm: "npm install --save-dev @
|
|
117
|
-
github: "https://github.com/getkist/action-
|
|
95
|
+
TemplateRenderAction: {
|
|
96
|
+
package: "@getkist/action-nunjucks",
|
|
97
|
+
npm: "npm install --save-dev @getkist/action-nunjucks",
|
|
98
|
+
github: "https://github.com/getkist/kist-action-nunjucks",
|
|
118
99
|
},
|
|
119
100
|
};
|