@by-association-only/theme-backup 1.0.1 → 1.0.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.
Files changed (2) hide show
  1. package/index.js +13 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -457,6 +457,8 @@ async function backupTheme(store, theme) {
457
457
 
458
458
  // Function to prompt user for text input
459
459
  async function promptTextInput(message, maxLength = 50) {
460
+ // Remove all existing listeners to prevent conflicts
461
+ process.stdin.removeAllListeners('data')
460
462
  process.stdin.setRawMode(true)
461
463
  process.stdin.resume()
462
464
 
@@ -476,8 +478,11 @@ async function promptTextInput(message, maxLength = 50) {
476
478
  updateDisplay()
477
479
 
478
480
  return new Promise((resolve) => {
479
- const handleKey = (key) => {
481
+ const handleKey = (data) => {
482
+ const key = data.toString()
483
+
480
484
  if (key === '\x03') { // Ctrl+C
485
+ process.stdin.removeAllListeners('data')
481
486
  process.stdin.setRawMode(false)
482
487
  process.stdin.pause()
483
488
  console.log(chalk.yellow('\nCancelled...'))
@@ -494,6 +499,7 @@ async function promptTextInput(message, maxLength = 50) {
494
499
  updateDisplay()
495
500
  return
496
501
  }
502
+ process.stdin.removeAllListeners('data')
497
503
  process.stdin.setRawMode(false)
498
504
  process.stdin.pause()
499
505
  resolve(input.trim())
@@ -589,7 +595,9 @@ async function runBackup() {
589
595
 
590
596
  // Clear screen before processing each store (except the first)
591
597
  if (i > 0) {
592
- process.stdout.write('\x1B[2J\x1B[H')
598
+ // Use multiple methods for maximum compatibility
599
+ process.stdout.write('\x1B[2J\x1B[H') // ANSI clear
600
+ console.log('\n'.repeat(50)) // Fallback: push content off screen
593
601
  }
594
602
 
595
603
  console.log(chalk.bold(`\nProcessing ${store}:`))
@@ -637,6 +645,9 @@ async function runBackup() {
637
645
  }
638
646
  }
639
647
 
648
+ // Clear screen before theme selection to remove any previous store's theme list
649
+ process.stdout.write('\x1B[2J\x1B[H')
650
+
640
651
  // Select theme to backup
641
652
  const selectedTheme = await selectTheme(store, 'Please select theme to backup')
642
653
  if (!selectedTheme) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@by-association-only/theme-backup",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Backup Shopify themes across multiple stores.",
5
5
  "type": "module",
6
6
  "main": "index.js",