ota-manager 1.0.6 → 1.0.13
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/README.md +2 -2
- package/lib/flatten-dist.cjs +6 -3
- package/lib/ota-build.cjs +505 -280
- package/lib/ota-deploy.js +84 -4
- package/lib/ota-main.js +243 -214
- package/lib/ota-rollback.js +130 -0
- package/lib/ota-version.js +34 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Modern mobile hybrid apps (built with Astro, Vite, or Capacitor) require a robus
|
|
|
17
17
|
* 🔄 **Flexible CLI Shorthands**: Supports both `npx ota-manager` and `npx ota-updates`. Features lightning-fast shorthands like `npx ota-manager -d training` and `-d live`.
|
|
18
18
|
* 🔀 **Multi-Provider & Multi-Channel Routing**: Built-in support for GitHub and GitLab strategies. Configure independent target repositories and branches for `training` vs `live` environments.
|
|
19
19
|
* 🛡️ **Size Guardian Protocol**: Pre-flight audit of your `dist/` directory and generated ZIP archive to prevent Zip Bombs (>50MB threshold protection).
|
|
20
|
-
*
|
|
20
|
+
* ⚙️ **Absolute Path Normalization (`flatten-dist.cjs`)**: Post-build normalization of absolute asset paths (`/assets/`) to relative paths (`./assets/`) to guarantee flawless Capacitor WebView navigation.
|
|
21
21
|
* 🙈 **API Route Protection**: Automatically isolates and hides `/src/pages/api` during static export/build to prevent build failures, then restores them seamlessly.
|
|
22
22
|
* 🔐 **Security Auditor (`ota-security.js`)**: Automated inspection of Personal Access Tokens (PAT) to prevent token leaks or overly broad repository access.
|
|
23
23
|
* 📡 **E2E Connection Simulation**: Built-in `test` command to simulate push and read capabilities against your Git provider before executing actual deployments.
|
|
@@ -124,7 +124,7 @@ PUBLIC_OTA_UPDATE_URL=https://raw.githubusercontent.com/your-org/your-ota-repo/m
|
|
|
124
124
|
└─────────────────────────────┬────────────────────────────┘
|
|
125
125
|
▼
|
|
126
126
|
┌──────────────────────────────────────────────────────────┐
|
|
127
|
-
│ 3. Build &
|
|
127
|
+
│ 3. Build & Path Normalization: Normalizes /assets/ paths │
|
|
128
128
|
└─────────────────────────────┬────────────────────────────┘
|
|
129
129
|
▼
|
|
130
130
|
┌──────────────────────────────────────────────────────────┐
|
package/lib/flatten-dist.cjs
CHANGED
|
@@ -2,9 +2,12 @@ const fs = require('fs');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* ABSOLUTE PATH NORMALIZATION UTILITY:
|
|
6
6
|
* Menghancurkan SEMUA variasi "/assets/" dan ".//assets/" di seluruh file
|
|
7
7
|
* tanpa peduli ada tanda kutip atau tidak.
|
|
8
|
+
|
|
9
|
+
Catatan: Mengubah jalur absolut menjadi relatif agar aplikasi Capacitor
|
|
10
|
+
dapat merender aset dengan benar di WebView lokal.
|
|
8
11
|
*/
|
|
9
12
|
function fixPathsInFile(filePath) {
|
|
10
13
|
let content = fs.readFileSync(filePath, 'utf8');
|
|
@@ -32,7 +35,7 @@ function fixPathsInFile(filePath) {
|
|
|
32
35
|
|
|
33
36
|
if (content !== fixedContent) {
|
|
34
37
|
fs.writeFileSync(filePath, fixedContent);
|
|
35
|
-
console.log(`
|
|
38
|
+
console.log(` ⚙️ PATH NORMALIZATION in: ${path.basename(filePath)}`);
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
|
|
@@ -70,7 +73,7 @@ function flatten(dir, rootDir = dir) {
|
|
|
70
73
|
|
|
71
74
|
const distPath = path.join(process.cwd(), 'dist');
|
|
72
75
|
if (fs.existsSync(distPath)) {
|
|
73
|
-
console.log('🚀
|
|
76
|
+
console.log('🚀 PATH NORMALIZATION: Running absolute path normalization...');
|
|
74
77
|
flatten(distPath);
|
|
75
78
|
console.log('✅ ALL PATHS ARE NOW 100% PURE RELATIVE!');
|
|
76
79
|
} else {
|