native-update 1.1.6 → 1.2.0
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/NativeUpdate.podspec +1 -0
- package/dist/esm/__tests__/bundle-manager.test.js +1 -0
- package/dist/esm/__tests__/bundle-manager.test.js.map +1 -1
- package/dist/esm/__tests__/config.test.js +1 -0
- package/dist/esm/__tests__/config.test.js.map +1 -1
- package/dist/esm/__tests__/integration.test.js.map +1 -1
- package/dist/esm/__tests__/security.test.js.map +1 -1
- package/dist/esm/app-review/app-review-manager.d.ts +2 -2
- package/dist/esm/app-review/app-review-manager.js.map +1 -1
- package/dist/esm/app-review/platform-review-handler.js.map +1 -1
- package/dist/esm/app-review/review-conditions-checker.d.ts +1 -1
- package/dist/esm/app-review/review-conditions-checker.js.map +1 -1
- package/dist/esm/app-review/types.d.ts +1 -1
- package/dist/esm/app-update/app-update-manager.d.ts +1 -1
- package/dist/esm/app-update/app-update-manager.js.map +1 -1
- package/dist/esm/app-update/app-update-notifier.js.map +1 -1
- package/dist/esm/app-update/platform-app-update.js.map +1 -1
- package/dist/esm/background-update/background-scheduler.js.map +1 -1
- package/dist/esm/core/analytics.d.ts +7 -7
- package/dist/esm/core/analytics.js.map +1 -1
- package/dist/esm/core/performance.js +16 -2
- package/dist/esm/core/performance.js.map +1 -1
- package/dist/esm/core/security.d.ts +13 -2
- package/dist/esm/core/security.js +13 -3
- package/dist/esm/core/security.js.map +1 -1
- package/dist/esm/live-update/bundle-manager.js +16 -1
- package/dist/esm/live-update/bundle-manager.js.map +1 -1
- package/dist/esm/live-update/download-manager.d.ts +8 -0
- package/dist/esm/live-update/download-manager.js +54 -7
- package/dist/esm/live-update/download-manager.js.map +1 -1
- package/dist/esm/plugin.js +3 -1
- package/dist/esm/plugin.js.map +1 -1
- package/dist/plugin.cjs.js +1 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.esm.js +1 -1
- package/dist/plugin.esm.js.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/plugin.js.map +1 -1
- package/docs/COMPREHENSIVE_AUDIT_REPORT.md +526 -0
- package/docs/FIREBASE_INTEGRATION_TRACKER.md +321 -0
- package/docs/KNOWN_LIMITATIONS.md +203 -0
- package/docs/PROJECT_COMPLETION_TRACKER.md +243 -0
- package/ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift +68 -26
- package/package.json +26 -25
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# Project Completion Tracker
|
|
2
|
+
|
|
3
|
+
**Last Updated**: 2025-12-26
|
|
4
|
+
**Project**: Native Update - Capacitor Plugin
|
|
5
|
+
**Version**: 1.1.6
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## ✅ COMPLETED FEATURES
|
|
10
|
+
|
|
11
|
+
### Core TypeScript Implementation
|
|
12
|
+
- [x] Plugin architecture with proper interfaces (`src/definitions.ts`)
|
|
13
|
+
- [x] Live update manager (`src/live-update/update-manager.ts`)
|
|
14
|
+
- [x] Bundle manager with download and installation (`src/live-update/bundle-manager.ts`)
|
|
15
|
+
- [x] Version manager with semantic versioning (`src/live-update/version-manager.ts`)
|
|
16
|
+
- [x] Download manager with progress tracking (`src/live-update/download-manager.ts`)
|
|
17
|
+
- [x] Certificate pinning for secure connections (`src/live-update/certificate-pinning.ts`)
|
|
18
|
+
- [x] App update checker (`src/app-update/app-update-checker.ts`)
|
|
19
|
+
- [x] App update installer (`src/app-update/app-update-installer.ts`)
|
|
20
|
+
- [x] App update manager (`src/app-update/app-update-manager.ts`)
|
|
21
|
+
- [x] App update notifier with UI (`src/app-update/app-update-notifier.ts`)
|
|
22
|
+
- [x] Platform app update integration (`src/app-update/platform-app-update.ts`)
|
|
23
|
+
- [x] App review manager (`src/app-review/app-review-manager.ts`)
|
|
24
|
+
- [x] Platform review handler (`src/app-review/platform-review-handler.ts`)
|
|
25
|
+
- [x] Review conditions checker (`src/app-review/review-conditions-checker.ts`)
|
|
26
|
+
- [x] Review rate limiter (`src/app-review/review-rate-limiter.ts`)
|
|
27
|
+
- [x] Background scheduler (`src/background-update/background-scheduler.ts`)
|
|
28
|
+
- [x] Notification manager (`src/background-update/notification-manager.ts`)
|
|
29
|
+
|
|
30
|
+
### Core Infrastructure
|
|
31
|
+
- [x] Analytics framework (`src/core/analytics.ts`)
|
|
32
|
+
- [x] Cache manager (`src/core/cache-manager.ts`)
|
|
33
|
+
- [x] Configuration system (`src/core/config.ts`)
|
|
34
|
+
- [x] Error handling (`src/core/errors.ts`)
|
|
35
|
+
- [x] Event emitter (`src/core/event-emitter.ts`)
|
|
36
|
+
- [x] Logger (`src/core/logger.ts`)
|
|
37
|
+
- [x] Performance monitoring (`src/core/performance.ts`)
|
|
38
|
+
- [x] Plugin manager (`src/core/plugin-manager.ts`)
|
|
39
|
+
- [x] Security utilities (`src/core/security.ts`)
|
|
40
|
+
|
|
41
|
+
### Security Implementation
|
|
42
|
+
- [x] Crypto utilities (`src/security/crypto.ts`)
|
|
43
|
+
- [x] Input/output validator (`src/security/validator.ts`)
|
|
44
|
+
- [x] SHA-256 checksum verification
|
|
45
|
+
- [x] RSA/ECDSA signature verification
|
|
46
|
+
- [x] HTTPS enforcement
|
|
47
|
+
- [x] Certificate pinning architecture
|
|
48
|
+
|
|
49
|
+
### Native Implementations
|
|
50
|
+
|
|
51
|
+
#### iOS (Swift)
|
|
52
|
+
- [x] Main plugin class (`ios/Plugin/NativeUpdatePlugin.swift`)
|
|
53
|
+
- [x] Live update implementation (`ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift`)
|
|
54
|
+
- [x] Bundle manager (`ios/Plugin/LiveUpdate/BundleManager.swift`)
|
|
55
|
+
- [x] Security manager (`ios/Plugin/Security/SecurityManager.swift`)
|
|
56
|
+
- [x] App update plugin (`ios/Plugin/AppUpdate/AppUpdatePlugin.swift`)
|
|
57
|
+
- [x] App review plugin (`ios/Plugin/AppReview/AppReviewPlugin.swift`)
|
|
58
|
+
- [x] Background update plugin (`ios/Plugin/BackgroundUpdate/BackgroundUpdatePlugin.swift`)
|
|
59
|
+
|
|
60
|
+
#### Android (Kotlin)
|
|
61
|
+
- [x] Main plugin class (`android/src/main/java/com/aoneahsan/nativeupdate/NativeUpdatePlugin.kt`)
|
|
62
|
+
- [x] Live update implementation (`android/src/main/java/com/aoneahsan/nativeupdate/LiveUpdatePlugin.kt`)
|
|
63
|
+
- [x] Bundle manager (`android/src/main/java/com/aoneahsan/nativeupdate/BundleManager.kt`)
|
|
64
|
+
- [x] Security manager (`android/src/main/java/com/aoneahsan/nativeupdate/SecurityManager.kt`)
|
|
65
|
+
- [x] App update plugin (`android/src/main/java/com/aoneahsan/nativeupdate/AppUpdatePlugin.kt`)
|
|
66
|
+
- [x] App review plugin (`android/src/main/java/com/aoneahsan/nativeupdate/AppReviewPlugin.kt`)
|
|
67
|
+
- [x] Background update plugin (`android/src/main/java/com/aoneahsan/nativeupdate/BackgroundUpdatePlugin.kt`)
|
|
68
|
+
|
|
69
|
+
### Testing Infrastructure
|
|
70
|
+
- [x] Vitest configuration (`vitest.config.ts`)
|
|
71
|
+
- [x] Bundle manager tests (`src/__tests__/bundle-manager.test.ts`)
|
|
72
|
+
- [x] Config tests (`src/__tests__/config.test.ts`)
|
|
73
|
+
- [x] Integration tests (`src/__tests__/integration.test.ts`)
|
|
74
|
+
- [x] Security tests (`src/__tests__/security.test.ts`)
|
|
75
|
+
- [x] Version manager tests (`src/__tests__/version-manager.test.ts`)
|
|
76
|
+
|
|
77
|
+
### CLI Tools
|
|
78
|
+
- [x] Main CLI (`cli/index.js`)
|
|
79
|
+
- [x] Init command (`cli/commands/init.js`)
|
|
80
|
+
- [x] Bundle create command (`cli/commands/bundle-create.js`)
|
|
81
|
+
- [x] Bundle sign command (`cli/commands/bundle-sign.js`)
|
|
82
|
+
- [x] Bundle verify command (`cli/commands/bundle-verify.js`)
|
|
83
|
+
- [x] Keys generate command (`cli/commands/keys-generate.js`)
|
|
84
|
+
- [x] Backend create command (`cli/commands/backend-create.js`)
|
|
85
|
+
- [x] Server start command (`cli/commands/server-start.js`)
|
|
86
|
+
- [x] Monitor command (`cli/commands/monitor.js`)
|
|
87
|
+
|
|
88
|
+
### Backend Infrastructure
|
|
89
|
+
|
|
90
|
+
#### Production Backend (Node.js + SQLite)
|
|
91
|
+
- [x] Main server (`production-backend/src/index.js`)
|
|
92
|
+
- [x] Database initialization (`production-backend/src/database/init.js`)
|
|
93
|
+
- [x] Auth middleware (`production-backend/src/middleware/auth.js`)
|
|
94
|
+
- [x] Error middleware (`production-backend/src/middleware/error.js`)
|
|
95
|
+
- [x] Logging middleware (`production-backend/src/middleware/logging.js`)
|
|
96
|
+
- [x] Validation middleware (`production-backend/src/middleware/validation.js`)
|
|
97
|
+
- [x] Analytics routes (`production-backend/src/routes/analytics.js`)
|
|
98
|
+
- [x] Auth routes (`production-backend/src/routes/auth.js`)
|
|
99
|
+
- [x] Bundles routes (`production-backend/src/routes/bundles.js`)
|
|
100
|
+
- [x] Health routes (`production-backend/src/routes/health.js`)
|
|
101
|
+
- [x] Updates routes (`production-backend/src/routes/updates.js`)
|
|
102
|
+
- [x] Logger utility (`production-backend/src/utils/logger.js`)
|
|
103
|
+
|
|
104
|
+
#### Firebase Backend Example
|
|
105
|
+
- [x] Firebase Functions (`example-app/firebase-backend/src/index.ts`)
|
|
106
|
+
- [x] Auth middleware (`example-app/firebase-backend/src/middleware/auth.ts`)
|
|
107
|
+
- [x] Analytics routes (`example-app/firebase-backend/src/routes/analytics.ts`)
|
|
108
|
+
- [x] Bundles routes (`example-app/firebase-backend/src/routes/bundles.ts`)
|
|
109
|
+
- [x] Updates routes (`example-app/firebase-backend/src/routes/updates.ts`)
|
|
110
|
+
- [x] Validation utils (`example-app/firebase-backend/src/utils/validation.ts`)
|
|
111
|
+
- [x] Version utils (`example-app/firebase-backend/src/utils/version.ts`)
|
|
112
|
+
- [x] Firestore indexes (`example-app/firebase-backend/firestore.indexes.json`)
|
|
113
|
+
- [x] Firestore rules (`example-app/firebase-backend/firestore.rules`)
|
|
114
|
+
- [x] Storage rules (`example-app/firebase-backend/storage.rules`)
|
|
115
|
+
|
|
116
|
+
#### Backend Template (Express)
|
|
117
|
+
- [x] Simple server (`backend-template/server.js`)
|
|
118
|
+
|
|
119
|
+
### Documentation
|
|
120
|
+
- [x] Main README (`Readme.md`)
|
|
121
|
+
- [x] API documentation (`API.md`)
|
|
122
|
+
- [x] Changelog (`CHANGELOG.md`)
|
|
123
|
+
- [x] Contributing guide (`CONTRIBUTING.md`)
|
|
124
|
+
- [x] Security policy (`SECURITY.md`)
|
|
125
|
+
- [x] Features overview (`FEATURES.md`)
|
|
126
|
+
- [x] Quick start guide (`docs/QUICK_START.md`)
|
|
127
|
+
- [x] Live updates guide (`docs/LIVE_UPDATES_GUIDE.md`)
|
|
128
|
+
- [x] Native updates guide (`docs/NATIVE_UPDATES_GUIDE.md`)
|
|
129
|
+
- [x] App review guide (`docs/APP_REVIEW_GUIDE.md`)
|
|
130
|
+
- [x] Bundle signing guide (`docs/BUNDLE_SIGNING.md`)
|
|
131
|
+
- [x] Background updates (`docs/background-updates.md`)
|
|
132
|
+
- [x] CLI reference (`docs/cli-reference.md`)
|
|
133
|
+
- [x] Migration guide (`docs/MIGRATION.md`)
|
|
134
|
+
- [x] Production readiness (`docs/production-readiness.md`)
|
|
135
|
+
- [x] Server requirements (`docs/server-requirements.md`)
|
|
136
|
+
- [x] Installation (`docs/getting-started/installation.md`)
|
|
137
|
+
- [x] Configuration (`docs/getting-started/configuration.md`)
|
|
138
|
+
- [x] Quick start (`docs/getting-started/quick-start.md`)
|
|
139
|
+
- [x] Live updates feature (`docs/features/live-updates.md`)
|
|
140
|
+
- [x] App updates feature (`docs/features/app-updates.md`)
|
|
141
|
+
- [x] App reviews feature (`docs/features/app-reviews.md`)
|
|
142
|
+
- [x] Basic usage examples (`docs/examples/basic-usage.md`)
|
|
143
|
+
- [x] Advanced scenarios (`docs/examples/advanced-scenarios.md`)
|
|
144
|
+
- [x] Deployment guide (`docs/guides/deployment-guide.md`)
|
|
145
|
+
- [x] Key management (`docs/guides/key-management.md`)
|
|
146
|
+
- [x] Migration from CodePush (`docs/guides/migration-from-codepush.md`)
|
|
147
|
+
- [x] Security best practices (`docs/guides/security-best-practices.md`)
|
|
148
|
+
- [x] Testing guide (`docs/guides/testing-guide.md`)
|
|
149
|
+
- [x] Certificate pinning (`docs/security/certificate-pinning.md`)
|
|
150
|
+
- [x] API references for all modules (`docs/api/`)
|
|
151
|
+
|
|
152
|
+
### Example Applications
|
|
153
|
+
- [x] Basic example app (`example/`)
|
|
154
|
+
- [x] Advanced example app with Firebase (`example-app/`)
|
|
155
|
+
- [x] Test app for development (`test-app/`)
|
|
156
|
+
|
|
157
|
+
### Build & Development Tools
|
|
158
|
+
- [x] TypeScript configuration (`tsconfig.json`, `tsconfig.node.json`)
|
|
159
|
+
- [x] Rollup bundler config (`rollup.config.js`)
|
|
160
|
+
- [x] ESLint config (`eslint.config.js`)
|
|
161
|
+
- [x] Prettier config (`.prettierrc`)
|
|
162
|
+
- [x] Vitest config (`vitest.config.ts`)
|
|
163
|
+
- [x] Package.json with all scripts
|
|
164
|
+
- [x] NVM version file (`.nvmrc`)
|
|
165
|
+
- [x] EditorConfig (`.editorconfig`)
|
|
166
|
+
- [x] Capacitor config (`capacitor.config.ts`)
|
|
167
|
+
- [x] CocoaPods spec (`NativeUpdate.podspec`)
|
|
168
|
+
|
|
169
|
+
### Utilities
|
|
170
|
+
- [x] Bundle creator tool (`tools/bundle-creator.js`)
|
|
171
|
+
- [x] Bundle signer tool (`tools/bundle-signer.js`)
|
|
172
|
+
- [x] Server example (`server-example/`)
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## ⚠️ PENDING FIXES (MUST COMPLETE NOW)
|
|
177
|
+
|
|
178
|
+
### Code Quality Issues
|
|
179
|
+
- [ ] **CRITICAL**: Fix all 40 ESLint warnings (TypeScript `any` types) - MUST FIX NOW
|
|
180
|
+
- [ ] **CRITICAL**: Remove placeholder code in `src/core/performance.ts` (storage check) - MUST IMPLEMENT NOW
|
|
181
|
+
- [ ] **CRITICAL**: Remove placeholder code in `src/core/security.ts` (certificate pinning note) - MUST CLARIFY NOW
|
|
182
|
+
- [ ] **CRITICAL**: Remove placeholder code in `ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift` (file copy & unzip) - MUST IMPLEMENT NOW
|
|
183
|
+
|
|
184
|
+
### Documentation Updates
|
|
185
|
+
- [ ] Update `FINAL_STATUS.md` to reflect current TRUE status
|
|
186
|
+
- [ ] Update `PRODUCTION_STATUS.md` to reflect current TRUE status
|
|
187
|
+
- [ ] Update `REMAINING_FEATURES.md` to reflect ACTUAL remaining work
|
|
188
|
+
- [ ] Update `ROADMAP.md` to reflect completed items
|
|
189
|
+
- [ ] Create Firebase indexes/rules verification document
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## 🚫 NOT APPLICABLE / NOT NEEDED
|
|
194
|
+
|
|
195
|
+
### Items That Don't Apply
|
|
196
|
+
- ❌ Vite logging level change (not a Vite project, uses Rollup)
|
|
197
|
+
- ❌ Firebase permissions errors in core plugin (Firebase only used in example-app)
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## 📊 COMPLETION STATISTICS
|
|
202
|
+
|
|
203
|
+
### Overall Progress
|
|
204
|
+
- **Core Plugin**: 100% Complete
|
|
205
|
+
- **Native Implementations**: 95% Complete (some placeholders need implementation)
|
|
206
|
+
- **CLI Tools**: 100% Complete
|
|
207
|
+
- **Backend Examples**: 100% Complete
|
|
208
|
+
- **Documentation**: 100% Complete
|
|
209
|
+
- **Testing**: 100% Complete
|
|
210
|
+
- **Code Quality**: 90% (40 ESLint warnings to fix)
|
|
211
|
+
|
|
212
|
+
### Issues to Resolve
|
|
213
|
+
1. **40 ESLint warnings** - Replace `any` with proper types
|
|
214
|
+
2. **3 code placeholders** - Implement or document as intentional
|
|
215
|
+
3. **Documentation inconsistency** - Status files show conflicting states
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## 🎯 IMMEDIATE ACTION ITEMS
|
|
220
|
+
|
|
221
|
+
1. ✅ Fix all 40 ESLint `any` type warnings
|
|
222
|
+
2. ✅ Remove or implement all placeholder code
|
|
223
|
+
3. ✅ Create Firebase tracking document
|
|
224
|
+
4. ✅ Update all status documents for consistency
|
|
225
|
+
5. ✅ Run final build with zero warnings
|
|
226
|
+
6. ✅ Verify no errors or warnings in entire project
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## 📝 NOTES
|
|
231
|
+
|
|
232
|
+
- This is a **Capacitor plugin package**, not a web app, so:
|
|
233
|
+
- No Vite (uses Rollup instead)
|
|
234
|
+
- No browser-based development server
|
|
235
|
+
- Firebase only used in example-app, not core plugin
|
|
236
|
+
|
|
237
|
+
- The plugin provides:
|
|
238
|
+
- Live/OTA updates for web assets
|
|
239
|
+
- Native app store update checking
|
|
240
|
+
- In-app review prompts
|
|
241
|
+
|
|
242
|
+
- Backend implementation is left to users (examples provided)
|
|
243
|
+
- Real device testing recommended before production use
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
import Capacitor
|
|
3
3
|
import CommonCrypto
|
|
4
|
+
import ZIPFoundation
|
|
4
5
|
|
|
5
6
|
class LiveUpdatePlugin {
|
|
6
7
|
private weak var plugin: CAPPlugin?
|
|
@@ -548,40 +549,81 @@ class LiveUpdatePlugin {
|
|
|
548
549
|
|
|
549
550
|
private func extractAndApplyBundle(_ bundleUrl: URL, bundleId: String) throws {
|
|
550
551
|
let extractedPath = getUpdatesDirectory().appendingPathComponent(bundleId).appendingPathComponent("www")
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
552
|
+
|
|
553
|
+
do {
|
|
554
|
+
// Extract the zip bundle
|
|
555
|
+
try extractZipBundle(from: bundleUrl, to: extractedPath)
|
|
556
|
+
|
|
557
|
+
// Update bundle info with extracted path
|
|
558
|
+
var bundleInfo = getAllBundles().first { $0["bundleId"] as? String == bundleId } ?? [:]
|
|
559
|
+
bundleInfo["extractedPath"] = extractedPath.path
|
|
560
|
+
bundleInfo["status"] = "READY"
|
|
561
|
+
saveBundleInfo(bundleInfo)
|
|
562
|
+
|
|
563
|
+
// Configure WebView to use new path
|
|
564
|
+
configureWebViewPath(extractedPath.path)
|
|
565
|
+
} catch {
|
|
566
|
+
// Get the safe bundle path (current working bundle)
|
|
567
|
+
let safePath = UserDefaults.standard.string(forKey: "native_update_webview_path") ?? "/"
|
|
568
|
+
|
|
569
|
+
// Rollback to safe bundle
|
|
570
|
+
try? rollbackToSafeBundle(currentPath: extractedPath.path, safePath: safePath)
|
|
571
|
+
|
|
572
|
+
// Re-throw the error
|
|
573
|
+
throw error
|
|
574
|
+
}
|
|
563
575
|
}
|
|
564
576
|
|
|
565
577
|
private func extractZipBundle(from zipUrl: URL, to destinationUrl: URL) throws {
|
|
566
|
-
//
|
|
567
|
-
try FileManager.default.createDirectory(at: destinationUrl, withIntermediateDirectories: true)
|
|
568
|
-
|
|
569
|
-
//
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
578
|
+
// Ensure destination directory exists
|
|
579
|
+
try FileManager.default.createDirectory(at: destinationUrl, withIntermediateDirectories: true, attributes: nil)
|
|
580
|
+
|
|
581
|
+
// Extract the ZIP archive using ZIPFoundation
|
|
582
|
+
try FileManager.default.unzipItem(at: zipUrl, to: destinationUrl)
|
|
583
|
+
|
|
584
|
+
// Verify extraction succeeded by checking for index.html
|
|
585
|
+
let indexPath = destinationUrl.appendingPathComponent("index.html")
|
|
586
|
+
guard FileManager.default.fileExists(atPath: indexPath.path) else {
|
|
587
|
+
throw NSError(domain: "LiveUpdatePlugin", code: 6, userInfo: [
|
|
588
|
+
NSLocalizedDescriptionKey: "Bundle extraction failed: index.html not found in extracted bundle"
|
|
589
|
+
])
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
// Clean up the ZIP file after successful extraction
|
|
593
|
+
try? FileManager.default.removeItem(at: zipUrl)
|
|
577
594
|
}
|
|
578
595
|
|
|
579
596
|
private func configureWebViewPath(_ path: String) {
|
|
580
597
|
// Store the active bundle path
|
|
581
598
|
UserDefaults.standard.set(path, forKey: "native_update_webview_path")
|
|
582
|
-
|
|
583
|
-
//
|
|
584
|
-
|
|
599
|
+
|
|
600
|
+
// Configure Capacitor WebView to use the new bundle path
|
|
601
|
+
DispatchQueue.main.async { [weak self] in
|
|
602
|
+
guard let bridge = self?.plugin?.bridge else { return }
|
|
603
|
+
|
|
604
|
+
// Set the server base path to the extracted bundle directory
|
|
605
|
+
bridge.setServerBasePath(path)
|
|
606
|
+
|
|
607
|
+
// Optionally trigger a WebView reload (commented out by default)
|
|
608
|
+
// Uncomment if you want automatic reload after bundle extraction
|
|
609
|
+
// bridge.webView?.reload()
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
private func rollbackToSafeBundle(currentPath: String, safePath: String) throws {
|
|
614
|
+
// Remove the failed bundle directory
|
|
615
|
+
let currentUrl = URL(fileURLWithPath: currentPath)
|
|
616
|
+
try? FileManager.default.removeItem(at: currentUrl)
|
|
617
|
+
|
|
618
|
+
// Restore to the safe bundle
|
|
619
|
+
DispatchQueue.main.async { [weak self] in
|
|
620
|
+
guard let bridge = self?.plugin?.bridge else { return }
|
|
621
|
+
bridge.setServerBasePath(safePath)
|
|
622
|
+
bridge.webView?.reload()
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
// Update stored path
|
|
626
|
+
UserDefaults.standard.set(safePath, forKey: "native_update_webview_path")
|
|
585
627
|
}
|
|
586
628
|
}
|
|
587
629
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "native-update",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Foundation package for building a comprehensive update system for Capacitor apps. Provides architecture and interfaces but requires backend implementation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/plugin.cjs.js",
|
|
@@ -56,15 +56,16 @@
|
|
|
56
56
|
"android",
|
|
57
57
|
"hybrid"
|
|
58
58
|
],
|
|
59
|
+
"packageManager": "pnpm@9.15.4",
|
|
59
60
|
"scripts": {
|
|
60
|
-
"build": "
|
|
61
|
-
"build:prod": "
|
|
61
|
+
"build": "pnpm run clean && pnpm run tsc && rollup -c rollup.config.js",
|
|
62
|
+
"build:prod": "pnpm run clean && pnpm run tsc && NODE_ENV=production rollup -c rollup.config.js",
|
|
62
63
|
"clean": "rimraf ./dist",
|
|
63
64
|
"tsc": "tsc",
|
|
64
65
|
"watch": "tsc --watch",
|
|
65
66
|
"lint": "eslint . --ext ts",
|
|
66
67
|
"prettier": "prettier --write .",
|
|
67
|
-
"prepublishOnly": "
|
|
68
|
+
"prepublishOnly": "pnpm run build:prod",
|
|
68
69
|
"swiftlint": "cd ios && swiftlint lint --fix --format --path Plugin --verbose",
|
|
69
70
|
"test": "vitest",
|
|
70
71
|
"test:ui": "vitest --ui",
|
|
@@ -73,34 +74,34 @@
|
|
|
73
74
|
"dependencies": {
|
|
74
75
|
"archiver": "^7.0.1",
|
|
75
76
|
"chalk": "^5.6.2",
|
|
76
|
-
"commander": "^14.0.
|
|
77
|
-
"express": "^5.1
|
|
78
|
-
"ora": "^
|
|
77
|
+
"commander": "^14.0.2",
|
|
78
|
+
"express": "^5.2.1",
|
|
79
|
+
"ora": "^9.0.0",
|
|
79
80
|
"prompts": "^2.4.2"
|
|
80
81
|
},
|
|
81
82
|
"devDependencies": {
|
|
82
|
-
"@capacitor/android": "^
|
|
83
|
-
"@capacitor/core": "^
|
|
84
|
-
"@capacitor/filesystem": "^
|
|
85
|
-
"@capacitor/ios": "^
|
|
86
|
-
"@capacitor/preferences": "^
|
|
83
|
+
"@capacitor/android": "^8.0.0",
|
|
84
|
+
"@capacitor/core": "^8.0.0",
|
|
85
|
+
"@capacitor/filesystem": "^8.0.0",
|
|
86
|
+
"@capacitor/ios": "^8.0.0",
|
|
87
|
+
"@capacitor/preferences": "^8.0.0",
|
|
87
88
|
"@rollup/plugin-json": "^6.1.0",
|
|
88
|
-
"@rollup/plugin-node-resolve": "^16.0.
|
|
89
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
89
90
|
"@rollup/plugin-terser": "^0.4.4",
|
|
90
|
-
"@types/node": "^
|
|
91
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
92
|
-
"@typescript-eslint/parser": "^8.
|
|
93
|
-
"@vitest/ui": "^
|
|
94
|
-
"eslint": "^9.
|
|
95
|
-
"happy-dom": "^
|
|
96
|
-
"prettier": "^3.
|
|
97
|
-
"rimraf": "^6.
|
|
98
|
-
"rollup": "^4.
|
|
99
|
-
"typescript": "^5.9.
|
|
100
|
-
"vitest": "^
|
|
91
|
+
"@types/node": "^25.0.3",
|
|
92
|
+
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
|
93
|
+
"@typescript-eslint/parser": "^8.50.1",
|
|
94
|
+
"@vitest/ui": "^4.0.16",
|
|
95
|
+
"eslint": "^9.39.2",
|
|
96
|
+
"happy-dom": "^20.0.11",
|
|
97
|
+
"prettier": "^3.7.4",
|
|
98
|
+
"rimraf": "^6.1.2",
|
|
99
|
+
"rollup": "^4.54.0",
|
|
100
|
+
"typescript": "^5.9.3",
|
|
101
|
+
"vitest": "^4.0.16"
|
|
101
102
|
},
|
|
102
103
|
"peerDependencies": {
|
|
103
|
-
"@capacitor/core": "^
|
|
104
|
+
"@capacitor/core": "^8.0.0"
|
|
104
105
|
},
|
|
105
106
|
"capacitor": {
|
|
106
107
|
"ios": {
|