@sleekcms/sync 1.4.3 ā 1.4.4
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/AGENT.md +1 -1
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +15 -5
- package/dist/index.js +12 -0
- package/package.json +1 -1
package/dist/AGENT.md
CHANGED
|
@@ -732,4 +732,4 @@ Template:
|
|
|
732
732
|
17. Always create RSS feed for blogs and link them in meta so it is discoverable. Use "rss.xml" as the key.
|
|
733
733
|
18. Make the sites extremely SEO friendly and sharing friendly.
|
|
734
734
|
19. When naming files for models, use - (dash) as word separator. Don't use _ (underscore) as it is mapped to / (slash) in path
|
|
735
|
-
|
|
735
|
+
20. Not all content details need to be modeled. If there is content which is not meant to be updated, such as button labels, links etc. you can inline that in the EJS view instead of adding fields to model and using from there. Decide what is relevant.
|
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -67,7 +67,7 @@ function commandExists(cmd) {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
function showWatchHelp() {
|
|
70
|
-
console.log("š Commands: [r] Re-fetch all files [x] Exit\n");
|
|
70
|
+
console.log("š Commands: [r] Re-fetch all files [x] Exit (cleanup) [q] Quit (keep files)\n");
|
|
71
71
|
}
|
|
72
72
|
function setupKeyboardInput(handlers) {
|
|
73
73
|
if (process.stdin.isTTY) {
|
|
@@ -93,6 +93,9 @@ function setupKeyboardInput(handlers) {
|
|
|
93
93
|
else if (cmd === "x" && handlers.onExit) {
|
|
94
94
|
await handlers.onExit();
|
|
95
95
|
}
|
|
96
|
+
else if (cmd === "q" && handlers.onQuit) {
|
|
97
|
+
await handlers.onQuit();
|
|
98
|
+
}
|
|
96
99
|
});
|
|
97
100
|
}
|
|
98
101
|
const EDITOR_CANDIDATES = [
|
|
@@ -112,13 +115,14 @@ function showEditorMenu(viewsDir, handlers) {
|
|
|
112
115
|
console.log("\nš Open in editor:");
|
|
113
116
|
editors.forEach(e => console.log(` [${e.key}] ${e.name}`));
|
|
114
117
|
console.log(" [Enter] Skip");
|
|
115
|
-
console.log(" [x]
|
|
118
|
+
console.log(" [x] Exit (cleanup)");
|
|
119
|
+
console.log(" [q] Quit (keep files)\n");
|
|
116
120
|
const rl = readline_1.default.createInterface({
|
|
117
121
|
input: process.stdin,
|
|
118
122
|
output: process.stdout,
|
|
119
123
|
});
|
|
120
|
-
// Count lines to clear (menu header + editors + skip + quit + empty + prompt)
|
|
121
|
-
const linesToClear = editors.length +
|
|
124
|
+
// Count lines to clear (menu header + editors + skip + exit + quit + empty + prompt)
|
|
125
|
+
const linesToClear = editors.length + 6;
|
|
122
126
|
rl.question("Select editor: ", async (answer) => {
|
|
123
127
|
rl.close();
|
|
124
128
|
// Clear the menu lines
|
|
@@ -127,11 +131,17 @@ function showEditorMenu(viewsDir, handlers) {
|
|
|
127
131
|
process.stdout.write("\x1b[2K\n"); // Clear each line
|
|
128
132
|
}
|
|
129
133
|
process.stdout.write(`\x1b[${linesToClear}A`); // Move back up
|
|
130
|
-
|
|
134
|
+
const choice = answer.trim().toLowerCase();
|
|
135
|
+
if (choice === "x") {
|
|
131
136
|
if (handlers.onExit)
|
|
132
137
|
await handlers.onExit();
|
|
133
138
|
return;
|
|
134
139
|
}
|
|
140
|
+
if (choice === "q") {
|
|
141
|
+
if (handlers.onQuit)
|
|
142
|
+
await handlers.onQuit();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
135
145
|
const selected = editors.find(e => e.key === answer.trim());
|
|
136
146
|
if (selected) {
|
|
137
147
|
console.log(`š Watching for changes... (opened ${selected.name})`);
|
package/dist/index.js
CHANGED
|
@@ -116,6 +116,17 @@ async function handleExit() {
|
|
|
116
116
|
await cleanupFiles(VIEWS_DIR);
|
|
117
117
|
process.exit(0);
|
|
118
118
|
}
|
|
119
|
+
async function handleQuit() {
|
|
120
|
+
if (isShuttingDown)
|
|
121
|
+
return;
|
|
122
|
+
isShuttingDown = true;
|
|
123
|
+
watcher.setShuttingDown(true);
|
|
124
|
+
console.log("\nā ļø Quitting (keeping files)...");
|
|
125
|
+
await watcher.stopWatching();
|
|
126
|
+
if (VIEWS_DIR)
|
|
127
|
+
console.log(`š Workspace left at: ${VIEWS_DIR}`);
|
|
128
|
+
process.exit(0);
|
|
129
|
+
}
|
|
119
130
|
async function main() {
|
|
120
131
|
await initConfig();
|
|
121
132
|
try {
|
|
@@ -135,6 +146,7 @@ async function main() {
|
|
|
135
146
|
console.log(`\nā ļø Files will be cleaned up on exit (Ctrl+C).`);
|
|
136
147
|
cli.showEditorMenu(VIEWS_DIR, {
|
|
137
148
|
onExit: handleExit,
|
|
149
|
+
onQuit: handleQuit,
|
|
138
150
|
onRefetch: () => runSync({ flush: true }),
|
|
139
151
|
});
|
|
140
152
|
process.on("SIGINT", async () => {
|
package/package.json
CHANGED