@topogram/cli 0.3.66 → 0.3.67
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/package.json
CHANGED
|
@@ -236,6 +236,24 @@ export function fileHash(file) {
|
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
+
/**
|
|
240
|
+
* @param {string} relativePath
|
|
241
|
+
* @param {{ absolutePath: string|null, content: string|null }} file
|
|
242
|
+
* @returns {{ sha256: string, size: number }}
|
|
243
|
+
*/
|
|
244
|
+
function templateOwnedFileHash(relativePath, file) {
|
|
245
|
+
if (relativePath !== "topogram.project.json" || file.content !== null) {
|
|
246
|
+
return fileHash(file);
|
|
247
|
+
}
|
|
248
|
+
if (!file.absolutePath) {
|
|
249
|
+
return fileHash(file);
|
|
250
|
+
}
|
|
251
|
+
return fileHash({
|
|
252
|
+
absolutePath: null,
|
|
253
|
+
content: `${stableJsonStringify(JSON.parse(fs.readFileSync(file.absolutePath, "utf8")))}\n`
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
|
|
239
257
|
/**
|
|
240
258
|
* @param {ResolvedTemplate} template
|
|
241
259
|
* @param {Record<string, any>|null} [currentProjectConfig]
|
|
@@ -335,7 +353,7 @@ export function includesTemplateImplementation(projectConfig) {
|
|
|
335
353
|
export function currentTemplateOwnedFileHashes(projectRoot, projectConfig) {
|
|
336
354
|
const files = currentTemplateOwnedFiles(projectRoot, includesTemplateImplementation(projectConfig), projectConfig);
|
|
337
355
|
return new Map([...files.entries()].map(([relativePath, file]) => {
|
|
338
|
-
const hash =
|
|
356
|
+
const hash = templateOwnedFileHash(relativePath, file);
|
|
339
357
|
return [relativePath, { path: relativePath, ...hash }];
|
|
340
358
|
}));
|
|
341
359
|
}
|