cwresdev 0.2.1 → 0.2.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/bin/cwgit.js +2 -4
- package/package.json +1 -1
- package/src/cwgit.js +10 -7
package/bin/cwgit.js
CHANGED
|
@@ -49,10 +49,8 @@ async function main() {
|
|
|
49
49
|
const docRoot = resolveDocRoot(workspaceRoot);
|
|
50
50
|
|
|
51
51
|
if (command === "init") {
|
|
52
|
-
|
|
53
|
-
process.stdout.write(
|
|
54
|
-
process.stdout.write(`[cwgit] Stored at: ${basePath}\n`);
|
|
55
|
-
process.stdout.write(`[cwgit] Tip: add .cwgit/ to .gitignore if using Git.\n`);
|
|
52
|
+
await initBase(targetPath, docRoot);
|
|
53
|
+
process.stdout.write("[cwgit] Successfully initiated.\n");
|
|
56
54
|
return;
|
|
57
55
|
}
|
|
58
56
|
|
package/package.json
CHANGED
package/src/cwgit.js
CHANGED
|
@@ -195,10 +195,9 @@ async function initBase(projectDir, docRoot) {
|
|
|
195
195
|
const filePaths = await collectFiles(resolvedProject, resolvedProject);
|
|
196
196
|
const fileCount = filePaths.length;
|
|
197
197
|
|
|
198
|
-
process.stderr.write(`[cwgit] Hashing ${fileCount} files...\n`);
|
|
199
|
-
|
|
200
198
|
const files = {};
|
|
201
199
|
let processed = 0;
|
|
200
|
+
let lastPercent = -1;
|
|
202
201
|
|
|
203
202
|
for (const filePath of filePaths) {
|
|
204
203
|
const relFilePath = path.relative(resolvedProject, filePath).replace(/\\/g, "/");
|
|
@@ -207,7 +206,6 @@ async function initBase(projectDir, docRoot) {
|
|
|
207
206
|
files[relFilePath] = await hashFile(filePath);
|
|
208
207
|
} catch (err) {
|
|
209
208
|
if (err.code === "EBUSY" || err.code === "EPERM" || err.code === "ENOENT") {
|
|
210
|
-
process.stderr.write(`[cwgit] Warning: skipped inaccessible file: ${relFilePath}\n`);
|
|
211
209
|
continue;
|
|
212
210
|
}
|
|
213
211
|
|
|
@@ -215,12 +213,16 @@ async function initBase(projectDir, docRoot) {
|
|
|
215
213
|
}
|
|
216
214
|
|
|
217
215
|
processed += 1;
|
|
216
|
+
const percent = Math.floor((processed / fileCount) * 100);
|
|
218
217
|
|
|
219
|
-
if (
|
|
220
|
-
|
|
218
|
+
if (percent !== lastPercent) {
|
|
219
|
+
lastPercent = percent;
|
|
220
|
+
process.stderr.write(`\r[cwgit] ${percent}%`);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
+
process.stderr.write("\n");
|
|
225
|
+
|
|
224
226
|
const baseData = {
|
|
225
227
|
version: 1,
|
|
226
228
|
createdAt: new Date().toISOString(),
|
|
@@ -265,7 +267,7 @@ async function detectChanges(projectDir, docRoot) {
|
|
|
265
267
|
const currentPaths = await collectFiles(resolvedProject, resolvedProject);
|
|
266
268
|
const currentFiles = {};
|
|
267
269
|
|
|
268
|
-
process.stderr.write(
|
|
270
|
+
process.stderr.write(`\r[cwgit] Scanning...`);
|
|
269
271
|
|
|
270
272
|
for (const filePath of currentPaths) {
|
|
271
273
|
const relFilePath = path.relative(resolvedProject, filePath).replace(/\\/g, "/");
|
|
@@ -274,7 +276,6 @@ async function detectChanges(projectDir, docRoot) {
|
|
|
274
276
|
currentFiles[relFilePath] = await hashFile(filePath);
|
|
275
277
|
} catch (err) {
|
|
276
278
|
if (err.code === "EBUSY" || err.code === "EPERM" || err.code === "ENOENT") {
|
|
277
|
-
process.stderr.write(`[cwgit] Warning: skipped inaccessible file: ${relFilePath}\n`);
|
|
278
279
|
continue;
|
|
279
280
|
}
|
|
280
281
|
|
|
@@ -282,6 +283,8 @@ async function detectChanges(projectDir, docRoot) {
|
|
|
282
283
|
}
|
|
283
284
|
}
|
|
284
285
|
|
|
286
|
+
process.stderr.write("\n");
|
|
287
|
+
|
|
285
288
|
const changes = [];
|
|
286
289
|
|
|
287
290
|
// Check for modified and deleted files
|