@pitcher/cli-scripts 2.1.0 ā 2.1.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/dist/src/devSync.js +21 -5
- package/package.json +6 -6
package/dist/src/devSync.js
CHANGED
|
@@ -155,7 +155,10 @@ export function createDevSyncCommand() {
|
|
|
155
155
|
console.log("");
|
|
156
156
|
let syncTimeout = null;
|
|
157
157
|
let isSyncing = false;
|
|
158
|
+
let isShuttingDown = false;
|
|
158
159
|
const doSync = async () => {
|
|
160
|
+
if (isShuttingDown)
|
|
161
|
+
return;
|
|
159
162
|
if (isSyncing) {
|
|
160
163
|
console.log("ā³ Sync already in progress, queuing...");
|
|
161
164
|
syncTimeout = setTimeout(doSync, debounceMs);
|
|
@@ -192,13 +195,23 @@ export function createDevSyncCommand() {
|
|
|
192
195
|
console.log(`š Change detected: ${path.relative(distPath, filePath)}`);
|
|
193
196
|
syncTimeout = setTimeout(doSync, debounceMs);
|
|
194
197
|
});
|
|
195
|
-
//
|
|
196
|
-
console.log("š Initial sync...");
|
|
197
|
-
await doSync();
|
|
198
|
-
// Graceful shutdown - revert dev override
|
|
198
|
+
// Graceful shutdown - revert dev override (register before initial sync)
|
|
199
199
|
const shutdown = async (signal) => {
|
|
200
|
-
|
|
200
|
+
if (isShuttingDown)
|
|
201
|
+
return;
|
|
202
|
+
isShuttingDown = true;
|
|
203
|
+
console.log(`\nš ${signal} received...`);
|
|
201
204
|
watcher.close();
|
|
205
|
+
if (syncTimeout)
|
|
206
|
+
clearTimeout(syncTimeout);
|
|
207
|
+
// Wait for any in-progress sync to complete
|
|
208
|
+
if (isSyncing) {
|
|
209
|
+
console.log("ā³ Waiting for sync to complete...");
|
|
210
|
+
while (isSyncing) {
|
|
211
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
console.log("š Reverting dev override...");
|
|
202
215
|
try {
|
|
203
216
|
await revertDevOverride(options.org, options.fileId, apiKey);
|
|
204
217
|
}
|
|
@@ -209,6 +222,9 @@ export function createDevSyncCommand() {
|
|
|
209
222
|
};
|
|
210
223
|
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
211
224
|
process.on("SIGTERM", () => shutdown("SIGTERM"));
|
|
225
|
+
// Initial sync
|
|
226
|
+
console.log("š Initial sync...");
|
|
227
|
+
await doSync();
|
|
212
228
|
});
|
|
213
229
|
program
|
|
214
230
|
.command("revert")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pitcher/cli-scripts",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "The Pitcher CLI for various tasks in its ecosystem.",
|
|
5
5
|
"author": "Pitcher AG",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
],
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/archiver": "^7.0.0",
|
|
27
|
-
"@types/node": "^
|
|
28
|
-
"typescript": "^5.9.
|
|
27
|
+
"@types/node": "^24.10.9",
|
|
28
|
+
"typescript": "^5.9.3"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"archiver": "^7.0.1",
|
|
32
|
-
"axios": "^1.
|
|
32
|
+
"axios": "^1.13.5",
|
|
33
33
|
"chokidar": "^5.0.0",
|
|
34
|
-
"commander": "^14.0.
|
|
35
|
-
"form-data": "^4.0.
|
|
34
|
+
"commander": "^14.0.3",
|
|
35
|
+
"form-data": "^4.0.5"
|
|
36
36
|
}
|
|
37
37
|
}
|