@capawesome/cli 3.7.0-dev.445ea3a.1764843317 → 3.7.0-dev.7eacfed.1764844131
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.
|
@@ -205,7 +205,7 @@ export default defineCommand({
|
|
|
205
205
|
initial: false,
|
|
206
206
|
});
|
|
207
207
|
if (shouldSetupRollback) {
|
|
208
|
-
const timeoutStr = await prompt('Enter
|
|
208
|
+
const timeoutStr = await prompt('Enter a timeout in milliseconds (recommended: 10000) after which the app rolls back if not ready:', {
|
|
209
209
|
type: 'text',
|
|
210
210
|
initial: '10000',
|
|
211
211
|
});
|
|
@@ -225,19 +225,40 @@ export default defineCommand({
|
|
|
225
225
|
consola.success(`Updated Capacitor configuration with ready timeout: ${readyTimeout}ms`);
|
|
226
226
|
// Show code snippet
|
|
227
227
|
console.log(); // Blank line
|
|
228
|
-
consola.
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
`
|
|
228
|
+
consola.info('Add this code to your app as soon as possible during app startup:');
|
|
229
|
+
console.log(); // Blank line
|
|
230
|
+
const readyCode = `import { LiveUpdate } from '@capawesome/capacitor-live-update';\n\n` +
|
|
231
|
+
`const ready = async () => {\n` +
|
|
232
|
+
` // Notify that the app is ready\n` +
|
|
233
|
+
` await LiveUpdate.ready();\n` +
|
|
234
|
+
`};`;
|
|
235
|
+
consola.box(readyCode);
|
|
236
|
+
// Ask if user wants to copy to clipboard
|
|
237
|
+
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
238
|
+
const shouldCopyReady = await prompt('Do you want to copy this code to your clipboard?', {
|
|
239
|
+
type: 'confirm',
|
|
240
|
+
initial: true,
|
|
241
|
+
});
|
|
242
|
+
if (shouldCopyReady) {
|
|
243
|
+
try {
|
|
244
|
+
await copyToClipboard(readyCode);
|
|
245
|
+
consola.success('Code copied to clipboard!');
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
consola.warn('Failed to copy to clipboard. Please copy the code manually.');
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
// Wait for user to apply the code
|
|
252
|
+
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
253
|
+
await prompt('Press Enter to continue once you have added this code to your app...', {
|
|
254
|
+
type: 'confirm',
|
|
255
|
+
initial: true,
|
|
256
|
+
});
|
|
232
257
|
}
|
|
233
258
|
}
|
|
234
|
-
// Step 7:
|
|
259
|
+
// Step 7: Show sync code snippet
|
|
235
260
|
console.log(); // Blank line
|
|
236
|
-
consola.
|
|
237
|
-
consola.info('Next steps:');
|
|
238
|
-
consola.info('1. Sync your Capacitor project: `npx cap sync`');
|
|
239
|
-
consola.info('2. Create your first bundle: `npx @capawesome/cli apps:bundles:create`');
|
|
240
|
-
consola.info('3. Download and apply the latest bundle in your app by calling the `sync(...)` method:');
|
|
261
|
+
consola.info('Download and apply live updates in your app using the sync method:');
|
|
241
262
|
console.log(); // Blank line
|
|
242
263
|
const syncCode = `import { LiveUpdate } from '@capawesome/capacitor-live-update';\n\n` +
|
|
243
264
|
`const sync = async () => {\n` +
|
|
@@ -251,11 +272,11 @@ export default defineCommand({
|
|
|
251
272
|
consola.box(syncCode);
|
|
252
273
|
// Ask if user wants to copy to clipboard
|
|
253
274
|
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
254
|
-
const
|
|
275
|
+
const shouldCopySync = await prompt('Do you want to copy this code to your clipboard?', {
|
|
255
276
|
type: 'confirm',
|
|
256
277
|
initial: true,
|
|
257
278
|
});
|
|
258
|
-
if (
|
|
279
|
+
if (shouldCopySync) {
|
|
259
280
|
try {
|
|
260
281
|
await copyToClipboard(syncCode);
|
|
261
282
|
consola.success('Code copied to clipboard!');
|
|
@@ -264,6 +285,20 @@ export default defineCommand({
|
|
|
264
285
|
consola.warn('Failed to copy to clipboard. Please copy the code manually.');
|
|
265
286
|
}
|
|
266
287
|
}
|
|
288
|
+
// Wait for user to apply the code
|
|
289
|
+
// @ts-ignore wait till https://github.com/unjs/consola/pull/280 is merged
|
|
290
|
+
await prompt('Press Enter to continue once you have added this code to your app...', {
|
|
291
|
+
type: 'confirm',
|
|
292
|
+
initial: true,
|
|
293
|
+
});
|
|
294
|
+
// Step 8: Final message and next steps
|
|
295
|
+
console.log(); // Blank line
|
|
296
|
+
consola.success('Live Updates setup completed!');
|
|
297
|
+
console.log(); // Blank line
|
|
298
|
+
consola.info('Next steps:');
|
|
299
|
+
consola.info('1. Create a new web assets build and sync the Capacitor platforms: `npm run build && npx cap sync`');
|
|
300
|
+
consola.info('2. Deploy your first live update: `npx @capawesome/cli apps:bundles:create`');
|
|
301
|
+
consola.info('3. Run the app and test the live update functionality: `npx cap run <platform>`');
|
|
267
302
|
// Show helpful resources
|
|
268
303
|
console.log(); // Blank line
|
|
269
304
|
consola.log('Learn more:');
|
package/package.json
CHANGED