pipecraft 0.29.2 → 0.36.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -34
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +66 -24
- package/dist/cli/index.js.map +1 -1
- package/dist/generators/init.tpl.d.ts +4 -4
- package/dist/generators/init.tpl.d.ts.map +1 -1
- package/dist/generators/init.tpl.js +369 -79
- package/dist/generators/init.tpl.js.map +1 -1
- package/dist/generators/workflows.tpl.d.ts +9 -9
- package/dist/generators/workflows.tpl.d.ts.map +1 -1
- package/dist/generators/workflows.tpl.js +33 -24
- package/dist/generators/workflows.tpl.js.map +1 -1
- package/dist/templates/actions/calculate-version.yml.tpl.d.ts +7 -4
- package/dist/templates/actions/calculate-version.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/calculate-version.yml.tpl.js +16 -9
- package/dist/templates/actions/calculate-version.yml.tpl.js.map +1 -1
- package/dist/templates/actions/create-pr.yml.tpl.d.ts +5 -2
- package/dist/templates/actions/create-pr.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/create-pr.yml.tpl.js +9 -6
- package/dist/templates/actions/create-pr.yml.tpl.js.map +1 -1
- package/dist/templates/actions/create-release.yml.tpl.d.ts +5 -2
- package/dist/templates/actions/create-release.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/create-release.yml.tpl.js +9 -6
- package/dist/templates/actions/create-release.yml.tpl.js.map +1 -1
- package/dist/templates/actions/create-tag.yml.tpl.d.ts +5 -2
- package/dist/templates/actions/create-tag.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/create-tag.yml.tpl.js +9 -6
- package/dist/templates/actions/create-tag.yml.tpl.js.map +1 -1
- package/dist/templates/actions/detect-changes.yml.tpl.d.ts +24 -52
- package/dist/templates/actions/detect-changes.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/detect-changes.yml.tpl.js +281 -108
- package/dist/templates/actions/detect-changes.yml.tpl.js.map +1 -1
- package/dist/templates/actions/manage-branch.yml.tpl.d.ts +5 -2
- package/dist/templates/actions/manage-branch.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/manage-branch.yml.tpl.js +9 -6
- package/dist/templates/actions/manage-branch.yml.tpl.js.map +1 -1
- package/dist/templates/actions/promote-branch.yml.tpl.d.ts +5 -2
- package/dist/templates/actions/promote-branch.yml.tpl.d.ts.map +1 -1
- package/dist/templates/actions/promote-branch.yml.tpl.js +27 -76
- package/dist/templates/actions/promote-branch.yml.tpl.js.map +1 -1
- package/dist/templates/actions/run-nx-affected.yml.tpl.d.ts +33 -0
- package/dist/templates/actions/run-nx-affected.yml.tpl.d.ts.map +1 -0
- package/dist/templates/actions/run-nx-affected.yml.tpl.js +346 -0
- package/dist/templates/actions/run-nx-affected.yml.tpl.js.map +1 -0
- package/dist/templates/release-it.cjs.tpl.d.ts +1 -1
- package/dist/templates/release-it.cjs.tpl.d.ts.map +1 -1
- package/dist/templates/release-it.cjs.tpl.js +24 -26
- package/dist/templates/release-it.cjs.tpl.js.map +1 -1
- package/dist/templates/workflows/enforce-pr-target.yml.tpl.d.ts +1 -1
- package/dist/templates/workflows/enforce-pr-target.yml.tpl.d.ts.map +1 -1
- package/dist/templates/workflows/enforce-pr-target.yml.tpl.js +2 -3
- package/dist/templates/workflows/enforce-pr-target.yml.tpl.js.map +1 -1
- package/dist/templates/workflows/pipeline-nx.yml.tpl.d.ts +2 -2
- package/dist/templates/workflows/pipeline-nx.yml.tpl.d.ts.map +1 -1
- package/dist/templates/workflows/pipeline-nx.yml.tpl.js +300 -93
- package/dist/templates/workflows/pipeline-nx.yml.tpl.js.map +1 -1
- package/dist/templates/workflows/pipeline.yml.tpl.d.ts +2 -2
- package/dist/templates/workflows/pipeline.yml.tpl.d.ts.map +1 -1
- package/dist/templates/workflows/pipeline.yml.tpl.js +347 -74
- package/dist/templates/workflows/pipeline.yml.tpl.js.map +1 -1
- package/dist/templates/workflows/pr-title-check.yml.tpl.d.ts +1 -1
- package/dist/templates/workflows/pr-title-check.yml.tpl.d.ts.map +1 -1
- package/dist/templates/workflows/pr-title-check.yml.tpl.js +101 -22
- package/dist/templates/workflows/pr-title-check.yml.tpl.js.map +1 -1
- package/dist/templates/workflows/shared/index.d.ts +3 -2
- package/dist/templates/workflows/shared/index.d.ts.map +1 -1
- package/dist/templates/workflows/shared/index.js +3 -2
- package/dist/templates/workflows/shared/index.js.map +1 -1
- package/dist/templates/workflows/shared/operations-changes.d.ts +13 -2
- package/dist/templates/workflows/shared/operations-changes.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-changes.js +47 -16
- package/dist/templates/workflows/shared/operations-changes.js.map +1 -1
- package/dist/templates/workflows/shared/operations-domain-jobs.d.ts +18 -1
- package/dist/templates/workflows/shared/operations-domain-jobs.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-domain-jobs.js +143 -19
- package/dist/templates/workflows/shared/operations-domain-jobs.js.map +1 -1
- package/dist/templates/workflows/shared/operations-gate.d.ts +32 -0
- package/dist/templates/workflows/shared/operations-gate.d.ts.map +1 -0
- package/dist/templates/workflows/shared/operations-gate.js +77 -0
- package/dist/templates/workflows/shared/operations-gate.js.map +1 -0
- package/dist/templates/workflows/shared/operations-header.d.ts +1 -1
- package/dist/templates/workflows/shared/operations-header.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-header.js +46 -6
- package/dist/templates/workflows/shared/operations-header.js.map +1 -1
- package/dist/templates/workflows/shared/operations-tag-promote.d.ts +5 -1
- package/dist/templates/workflows/shared/operations-tag-promote.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-tag-promote.js +138 -31
- package/dist/templates/workflows/shared/operations-tag-promote.js.map +1 -1
- package/dist/templates/workflows/shared/operations-version.d.ts +3 -1
- package/dist/templates/workflows/shared/operations-version.d.ts.map +1 -1
- package/dist/templates/workflows/shared/operations-version.js +18 -10
- package/dist/templates/workflows/shared/operations-version.js.map +1 -1
- package/dist/templates/yaml-format-utils.d.ts.map +1 -1
- package/dist/templates/yaml-format-utils.js.map +1 -1
- package/dist/types/index.d.ts +57 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/action-reference.d.ts +73 -0
- package/dist/utils/action-reference.d.ts.map +1 -0
- package/dist/utils/action-reference.js +120 -0
- package/dist/utils/action-reference.js.map +1 -0
- package/dist/utils/ast-path-operations.d.ts +3 -3
- package/dist/utils/ast-path-operations.d.ts.map +1 -1
- package/dist/utils/ast-path-operations.js +58 -17
- package/dist/utils/ast-path-operations.js.map +1 -1
- package/dist/utils/config.d.ts +11 -5
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +33 -8
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/github-setup.d.ts +4 -4
- package/dist/utils/github-setup.d.ts.map +1 -1
- package/dist/utils/github-setup.js +57 -36
- package/dist/utils/github-setup.js.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/messaging.d.ts.map +1 -1
- package/dist/utils/messaging.js +7 -3
- package/dist/utils/messaging.js.map +1 -1
- package/dist/utils/preflight.d.ts +2 -2
- package/dist/utils/preflight.d.ts.map +1 -1
- package/dist/utils/preflight.js +43 -41
- package/dist/utils/preflight.js.map +1 -1
- package/dist/utils/versioning.d.ts +1 -1
- package/dist/utils/versioning.d.ts.map +1 -1
- package/dist/utils/versioning.js +10 -10
- package/dist/utils/versioning.js.map +1 -1
- package/package.json +11 -4
- package/src/generators/init.tpl.ts +434 -96
- package/src/generators/workflows.tpl.ts +54 -45
- package/dist/templates/actions/detect-changes-nx.yml.tpl.d.ts +0 -32
- package/dist/templates/actions/detect-changes-nx.yml.tpl.d.ts.map +0 -1
- package/dist/templates/actions/detect-changes-nx.yml.tpl.js +0 -227
- package/dist/templates/actions/detect-changes-nx.yml.tpl.js.map +0 -1
- package/dist/utils/idempotency.d.ts +0 -187
- package/dist/utils/idempotency.d.ts.map +0 -1
- package/dist/utils/idempotency.js +0 -304
- package/dist/utils/idempotency.js.map +0 -1
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Idempotency and Caching Utilities
|
|
3
|
-
*
|
|
4
|
-
* This module implements intelligent caching to avoid unnecessary workflow regeneration.
|
|
5
|
-
* It tracks file hashes and modification times for:
|
|
6
|
-
* - Configuration files (.pipecraftrc.json)
|
|
7
|
-
* - Template source files (src/templates/)
|
|
8
|
-
* - Generator code (src/generators/)
|
|
9
|
-
*
|
|
10
|
-
* Workflows are only regenerated when relevant source files have changed,
|
|
11
|
-
* significantly improving performance during iterative development.
|
|
12
|
-
*
|
|
13
|
-
* The cache is stored in `.pipecraft-cache.json` and contains hashes
|
|
14
|
-
* of all tracked files along with metadata.
|
|
15
|
-
*
|
|
16
|
-
* @module utils/idempotency
|
|
17
|
-
*/
|
|
18
|
-
import { createHash } from 'crypto';
|
|
19
|
-
import { readFileSync, existsSync, writeFileSync, statSync } from 'fs';
|
|
20
|
-
/**
|
|
21
|
-
* Manager for idempotent workflow generation through intelligent caching.
|
|
22
|
-
*
|
|
23
|
-
* This class tracks changes to configuration and template files to determine
|
|
24
|
-
* when workflows need to be regenerated. It creates cryptographic hashes of
|
|
25
|
-
* files and directories to detect changes efficiently.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```typescript
|
|
29
|
-
* const manager = new IdempotencyManager(config)
|
|
30
|
-
*
|
|
31
|
-
* if (await manager.hasChanges()) {
|
|
32
|
-
* // Generate workflows
|
|
33
|
-
* await generateWorkflows()
|
|
34
|
-
* // Update cache after successful generation
|
|
35
|
-
* await manager.updateCache()
|
|
36
|
-
* } else {
|
|
37
|
-
* console.log('No changes detected, skipping regeneration')
|
|
38
|
-
* }
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export class IdempotencyManager {
|
|
42
|
-
cacheFile;
|
|
43
|
-
config;
|
|
44
|
-
/**
|
|
45
|
-
* Create a new IdempotencyManager instance.
|
|
46
|
-
*
|
|
47
|
-
* @param config - PipeCraft configuration object
|
|
48
|
-
* @param cacheFile - Path to cache file (default: .pipecraft-cache.json)
|
|
49
|
-
*/
|
|
50
|
-
constructor(config, cacheFile = '.pipecraft-cache.json') {
|
|
51
|
-
this.config = config;
|
|
52
|
-
this.cacheFile = cacheFile;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Calculate cryptographic hash for a file or directory.
|
|
56
|
-
*
|
|
57
|
-
* For files: Hashes content + mtime + size to detect any changes
|
|
58
|
-
* For directories: Recursively hashes all files within
|
|
59
|
-
*
|
|
60
|
-
* Returns empty string if the path doesn't exist.
|
|
61
|
-
*
|
|
62
|
-
* @param filePath - Path to file or directory to hash
|
|
63
|
-
* @param algorithm - Hashing algorithm (default: sha256)
|
|
64
|
-
* @returns Hex-encoded hash string
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```typescript
|
|
68
|
-
* const configHash = await manager.calculateHash('.pipecraftrc.json')
|
|
69
|
-
* const templateHash = await manager.calculateHash('src/templates')
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
async calculateHash(filePath, algorithm = 'sha256') {
|
|
73
|
-
if (!existsSync(filePath)) {
|
|
74
|
-
return '';
|
|
75
|
-
}
|
|
76
|
-
const stats = statSync(filePath);
|
|
77
|
-
if (stats.isDirectory()) {
|
|
78
|
-
// For directories, hash all files recursively
|
|
79
|
-
return await this.hashDirectory(filePath, algorithm);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
// For files, hash content + metadata
|
|
83
|
-
// Including mtime and size ensures any change is detected
|
|
84
|
-
const content = readFileSync(filePath);
|
|
85
|
-
const hash = createHash(algorithm);
|
|
86
|
-
hash.update(content);
|
|
87
|
-
hash.update(stats.mtime.toString());
|
|
88
|
-
hash.update(stats.size.toString());
|
|
89
|
-
return hash.digest('hex');
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Hash directory contents recursively.
|
|
94
|
-
*
|
|
95
|
-
* Traverses all files in the directory tree and combines their hashes
|
|
96
|
-
* along with metadata into a single directory hash. This allows detecting
|
|
97
|
-
* when any file within the directory structure has changed.
|
|
98
|
-
*
|
|
99
|
-
* @param dirPath - Path to directory to hash
|
|
100
|
-
* @param algorithm - Hashing algorithm
|
|
101
|
-
* @returns Hex-encoded hash string representing the entire directory
|
|
102
|
-
* @private
|
|
103
|
-
*/
|
|
104
|
-
async hashDirectory(dirPath, algorithm) {
|
|
105
|
-
const fs = await import('fs');
|
|
106
|
-
const path = await import('path');
|
|
107
|
-
const hash = createHash(algorithm);
|
|
108
|
-
// Recursively hash all files in the directory tree
|
|
109
|
-
const hashDir = (dir) => {
|
|
110
|
-
const items = fs.readdirSync(dir);
|
|
111
|
-
for (const item of items) {
|
|
112
|
-
const itemPath = path.join(dir, item);
|
|
113
|
-
const stats = fs.statSync(itemPath);
|
|
114
|
-
if (stats.isDirectory()) {
|
|
115
|
-
hashDir(itemPath);
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
// Include file content and metadata in hash
|
|
119
|
-
const content = fs.readFileSync(itemPath);
|
|
120
|
-
hash.update(content);
|
|
121
|
-
hash.update(stats.mtime.toString());
|
|
122
|
-
hash.update(stats.size.toString());
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
hashDir(dirPath);
|
|
127
|
-
return hash.digest('hex');
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Load rebuild cache from filesystem.
|
|
131
|
-
*
|
|
132
|
-
* Reads and parses the cache file containing previous generation state.
|
|
133
|
-
* Returns null if cache doesn't exist or can't be parsed.
|
|
134
|
-
*
|
|
135
|
-
* @returns Parsed cache object or null if unavailable
|
|
136
|
-
*/
|
|
137
|
-
loadCache() {
|
|
138
|
-
if (!existsSync(this.cacheFile)) {
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
try {
|
|
142
|
-
const content = readFileSync(this.cacheFile, 'utf8');
|
|
143
|
-
return JSON.parse(content);
|
|
144
|
-
}
|
|
145
|
-
catch (error) {
|
|
146
|
-
console.warn(`Failed to load cache file: ${error.message}`);
|
|
147
|
-
return null;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Save rebuild cache to filesystem.
|
|
152
|
-
*
|
|
153
|
-
* Writes the cache object to disk as formatted JSON.
|
|
154
|
-
* Failures are logged as warnings but don't throw errors.
|
|
155
|
-
*
|
|
156
|
-
* @param cache - Cache object to persist
|
|
157
|
-
*/
|
|
158
|
-
saveCache(cache) {
|
|
159
|
-
try {
|
|
160
|
-
writeFileSync(this.cacheFile, JSON.stringify(cache, null, 2));
|
|
161
|
-
}
|
|
162
|
-
catch (error) {
|
|
163
|
-
console.warn(`Failed to save cache file: ${error.message}`);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Check if any tracked files have changed since last generation.
|
|
168
|
-
*
|
|
169
|
-
* Compares current file hashes against cached values to detect changes in:
|
|
170
|
-
* - Configuration file (.pipecraftrc.json)
|
|
171
|
-
* - Template source files (src/templates/)
|
|
172
|
-
* - Generator code (src/generators/)
|
|
173
|
-
*
|
|
174
|
-
* Returns true if:
|
|
175
|
-
* - Rebuild is disabled (always regenerate)
|
|
176
|
-
* - Force regenerate flag is set
|
|
177
|
-
* - No cache exists
|
|
178
|
-
* - Any tracked file has changed
|
|
179
|
-
*
|
|
180
|
-
* @returns true if workflows should be regenerated
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* ```typescript
|
|
184
|
-
* if (await manager.hasChanges()) {
|
|
185
|
-
* console.log('Changes detected, regenerating workflows...')
|
|
186
|
-
* await generateWorkflows()
|
|
187
|
-
* await manager.updateCache()
|
|
188
|
-
* }
|
|
189
|
-
* ```
|
|
190
|
-
*/
|
|
191
|
-
async hasChanges() {
|
|
192
|
-
// Always regenerate if idempotency is disabled
|
|
193
|
-
if (!this.config.rebuild?.enabled) {
|
|
194
|
-
return true;
|
|
195
|
-
}
|
|
196
|
-
// Always regenerate if force flag is set
|
|
197
|
-
if (this.config.rebuild?.forceRegenerate) {
|
|
198
|
-
return true;
|
|
199
|
-
}
|
|
200
|
-
const cache = this.loadCache();
|
|
201
|
-
if (!cache) {
|
|
202
|
-
return true; // No cache exists, need to generate
|
|
203
|
-
}
|
|
204
|
-
// Check if configuration file has changed
|
|
205
|
-
const configHash = await this.calculateHash('.pipecraftrc.json');
|
|
206
|
-
if (cache.configHash !== configHash) {
|
|
207
|
-
return true;
|
|
208
|
-
}
|
|
209
|
-
// Check if template source files have changed
|
|
210
|
-
const templateDir = 'src/templates';
|
|
211
|
-
if (existsSync(templateDir)) {
|
|
212
|
-
const templateHash = await this.calculateHash(templateDir);
|
|
213
|
-
if (cache.files[templateDir]?.hash !== templateHash) {
|
|
214
|
-
return true;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
// Check if generator source files have changed
|
|
218
|
-
const sourceDir = 'src/generators';
|
|
219
|
-
if (existsSync(sourceDir)) {
|
|
220
|
-
const sourceHash = await this.calculateHash(sourceDir);
|
|
221
|
-
if (cache.files[sourceDir]?.hash !== sourceHash) {
|
|
222
|
-
return true;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
return false;
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Update cache with current file states after successful generation.
|
|
229
|
-
*
|
|
230
|
-
* Should be called after workflows are successfully generated to save
|
|
231
|
-
* the current state of all tracked files. This allows future runs to
|
|
232
|
-
* skip regeneration if nothing has changed.
|
|
233
|
-
*
|
|
234
|
-
* @example
|
|
235
|
-
* ```typescript
|
|
236
|
-
* await generateWorkflows()
|
|
237
|
-
* await manager.updateCache() // Save current state
|
|
238
|
-
* ```
|
|
239
|
-
*/
|
|
240
|
-
async updateCache() {
|
|
241
|
-
const cache = {
|
|
242
|
-
files: {},
|
|
243
|
-
configHash: await this.calculateHash('.pipecraftrc.json'),
|
|
244
|
-
lastGenerated: Date.now(),
|
|
245
|
-
version: '1.0.0'
|
|
246
|
-
};
|
|
247
|
-
// Cache template directory state
|
|
248
|
-
const templateDir = 'src/templates';
|
|
249
|
-
if (existsSync(templateDir)) {
|
|
250
|
-
cache.files[templateDir] = {
|
|
251
|
-
path: templateDir,
|
|
252
|
-
hash: await this.calculateHash(templateDir),
|
|
253
|
-
mtime: statSync(templateDir).mtime.getTime(),
|
|
254
|
-
size: 0 // Directory size not meaningful
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
// Cache generator directory state
|
|
258
|
-
const sourceDir = 'src/generators';
|
|
259
|
-
if (existsSync(sourceDir)) {
|
|
260
|
-
cache.files[sourceDir] = {
|
|
261
|
-
path: sourceDir,
|
|
262
|
-
hash: await this.calculateHash(sourceDir),
|
|
263
|
-
mtime: statSync(sourceDir).mtime.getTime(),
|
|
264
|
-
size: 0
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
this.saveCache(cache);
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Check if a specific file should be regenerated.
|
|
271
|
-
*
|
|
272
|
-
* Similar to hasChanges() but checks a single file instead of the
|
|
273
|
-
* entire project. Useful for selective regeneration.
|
|
274
|
-
*
|
|
275
|
-
* @param filePath - Path to file to check
|
|
276
|
-
* @returns true if file should be regenerated
|
|
277
|
-
*
|
|
278
|
-
* @example
|
|
279
|
-
* ```typescript
|
|
280
|
-
* if (await manager.shouldRegenerateFile('.github/workflows/pipeline.yml')) {
|
|
281
|
-
* await generatePipeline()
|
|
282
|
-
* }
|
|
283
|
-
* ```
|
|
284
|
-
*/
|
|
285
|
-
async shouldRegenerateFile(filePath) {
|
|
286
|
-
if (!this.config.rebuild?.enabled) {
|
|
287
|
-
return true;
|
|
288
|
-
}
|
|
289
|
-
if (this.config.rebuild?.forceRegenerate) {
|
|
290
|
-
return true;
|
|
291
|
-
}
|
|
292
|
-
const cache = this.loadCache();
|
|
293
|
-
if (!cache) {
|
|
294
|
-
return true;
|
|
295
|
-
}
|
|
296
|
-
const currentHash = await this.calculateHash(filePath);
|
|
297
|
-
const cachedFile = cache.files[filePath];
|
|
298
|
-
if (!cachedFile) {
|
|
299
|
-
return true; // File not in cache, needs generation
|
|
300
|
-
}
|
|
301
|
-
return cachedFile.hash !== currentHash;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
//# sourceMappingURL=idempotency.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"idempotency.js","sourceRoot":"","sources":["../../src/utils/idempotency.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAU,MAAM,IAAI,CAAA;AAyC9E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,kBAAkB;IACrB,SAAS,CAAQ;IACjB,MAAM,CAAiB;IAE/B;;;;;OAKG;IACH,YAAY,MAAuB,EAAE,SAAS,GAAG,uBAAuB;QACtE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,aAAa,CAAC,QAAgB,EAAE,YAAoB,QAAQ;QAChE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1B,OAAO,EAAE,CAAA;QACX,CAAC;QAED,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAA;QAChC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,8CAA8C;YAC9C,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;QACtD,CAAC;aAAM,CAAC;YACN,qCAAqC;YACrC,0DAA0D;YAC1D,MAAM,OA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