nstantpage-agent 0.8.2 → 0.8.3
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/commands/sync.js +23 -1
- package/package.json +1 -1
package/dist/commands/sync.js
CHANGED
|
@@ -19,6 +19,7 @@ const SKIP_DIRS = new Set([
|
|
|
19
19
|
'node_modules', 'dist', '.git', '.vite-cache', '.next',
|
|
20
20
|
'__pycache__', '.turbo', '.cache', 'build', 'out',
|
|
21
21
|
'.svelte-kit', '.nuxt', '.output', '.vercel',
|
|
22
|
+
'.angular', '.parcel-cache', '.rollup.cache',
|
|
22
23
|
]);
|
|
23
24
|
const SKIP_FILES = new Set([
|
|
24
25
|
'.DS_Store', 'Thumbs.db', '.env.local',
|
|
@@ -173,7 +174,28 @@ export async function syncCommand(directory, options) {
|
|
|
173
174
|
console.log(chalk.red(` ✗ ${err.message}`));
|
|
174
175
|
process.exit(1);
|
|
175
176
|
}
|
|
176
|
-
// 4.
|
|
177
|
+
// 4. Create new version and clear old files (clean sync)
|
|
178
|
+
console.log(chalk.gray(' Creating new version (clearing old files)...'));
|
|
179
|
+
try {
|
|
180
|
+
const syncRes = await fetch(`${backendUrl}/api/projects/${projectId}/sync`, {
|
|
181
|
+
method: 'POST',
|
|
182
|
+
headers: {
|
|
183
|
+
'Authorization': `Bearer ${token}`,
|
|
184
|
+
'Content-Type': 'application/json',
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
if (!syncRes.ok) {
|
|
188
|
+
const text = await syncRes.text().catch(() => '');
|
|
189
|
+
throw new Error(`Sync init failed (${syncRes.status}): ${text}`);
|
|
190
|
+
}
|
|
191
|
+
const syncData = await syncRes.json();
|
|
192
|
+
console.log(chalk.green(` ✓ Version ${syncData.versionNumber} created (old files cleared)`));
|
|
193
|
+
}
|
|
194
|
+
catch (err) {
|
|
195
|
+
console.log(chalk.red(` ✗ ${err.message}`));
|
|
196
|
+
process.exit(1);
|
|
197
|
+
}
|
|
198
|
+
// 5. Push all files to DB
|
|
177
199
|
console.log(chalk.gray(` Pushing ${files.length} files to database...`));
|
|
178
200
|
// Push in batches of 100 to avoid huge payloads
|
|
179
201
|
const BATCH_SIZE = 100;
|
package/package.json
CHANGED