cwresdev 0.2.5 → 0.2.6
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 +1 -1
- package/src/cwgit.js +10 -4
package/package.json
CHANGED
package/src/cwgit.js
CHANGED
|
@@ -297,11 +297,12 @@ async function detectChanges(projectDir, docRoot) {
|
|
|
297
297
|
process.stderr.write("\n");
|
|
298
298
|
|
|
299
299
|
const changes = [];
|
|
300
|
+
const baseCreatedAt = baseData.createdAt ? new Date(baseData.createdAt) : null;
|
|
300
301
|
|
|
301
302
|
// Check for modified and deleted files
|
|
302
303
|
for (const [file, hash] of Object.entries(baseFiles)) {
|
|
303
304
|
if (!(file in currentFiles)) {
|
|
304
|
-
changes.push({ file, status: "D", mtime:
|
|
305
|
+
changes.push({ file, status: "D", mtime: baseCreatedAt });
|
|
305
306
|
} else if (currentFiles[file] !== hash) {
|
|
306
307
|
const fullPath = path.join(resolvedProject, file.replace(/\//g, path.sep));
|
|
307
308
|
let mtime = null;
|
|
@@ -365,10 +366,14 @@ function formatLocalDate(date) {
|
|
|
365
366
|
const y = date.getFullYear();
|
|
366
367
|
const m = String(date.getMonth() + 1).padStart(2, "0");
|
|
367
368
|
const d = String(date.getDate()).padStart(2, "0");
|
|
369
|
+
return `${y}-${m}-${d}`;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
function formatLocalTime(date) {
|
|
368
373
|
const h = String(date.getHours()).padStart(2, "0");
|
|
369
374
|
const min = String(date.getMinutes()).padStart(2, "0");
|
|
370
375
|
const s = String(date.getSeconds()).padStart(2, "0");
|
|
371
|
-
return `${
|
|
376
|
+
return `${h}:${min}:${s}`;
|
|
372
377
|
}
|
|
373
378
|
|
|
374
379
|
/**
|
|
@@ -376,7 +381,7 @@ function formatLocalDate(date) {
|
|
|
376
381
|
*/
|
|
377
382
|
async function exportCsv(changes, outputDir) {
|
|
378
383
|
const csvPath = path.join(outputDir, "cwgit-changes.csv");
|
|
379
|
-
const lines = ["File,Status,Date"];
|
|
384
|
+
const lines = ["File,Status,Date,Time"];
|
|
380
385
|
|
|
381
386
|
for (const { file, status, mtime } of changes) {
|
|
382
387
|
const safeFile = sanitizeCsvCell(file);
|
|
@@ -385,7 +390,8 @@ async function exportCsv(changes, outputDir) {
|
|
|
385
390
|
: safeFile;
|
|
386
391
|
const label = STATUS_LABELS[status] || status;
|
|
387
392
|
const date = mtime ? formatLocalDate(mtime) : "";
|
|
388
|
-
|
|
393
|
+
const time = mtime ? formatLocalTime(mtime) : "";
|
|
394
|
+
lines.push(`${escaped},${label},${date},${time}`);
|
|
389
395
|
}
|
|
390
396
|
|
|
391
397
|
await fs.promises.writeFile(csvPath, lines.join("\n") + "\n", "utf8");
|