@hot-updater/firebase 0.26.2 → 0.27.1
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/firebase/functions/index.cjs +11 -0
- package/dist/index.cjs +4 -1
- package/dist/index.js +4 -1
- package/package.json +6 -6
|
@@ -4905,6 +4905,17 @@ const handleUpdateRequest = async (db, updateConfig) => {
|
|
|
4905
4905
|
...rest,
|
|
4906
4906
|
fileUrl: null
|
|
4907
4907
|
};
|
|
4908
|
+
const cdnUrl = process.env.HOT_UPDATER_CDN_URL;
|
|
4909
|
+
if (cdnUrl) {
|
|
4910
|
+
let storagePath;
|
|
4911
|
+
if (!storageUri) storagePath = [rest.id, "bundle.zip"].join("/");
|
|
4912
|
+
else storagePath = new URL(storageUri).pathname.slice(1);
|
|
4913
|
+
const baseUrl = cdnUrl.endsWith("/") ? cdnUrl.slice(0, -1) : cdnUrl;
|
|
4914
|
+
return {
|
|
4915
|
+
...rest,
|
|
4916
|
+
fileUrl: `${baseUrl}/${storagePath}`
|
|
4917
|
+
};
|
|
4918
|
+
}
|
|
4908
4919
|
let signedUrl = null;
|
|
4909
4920
|
if (!storageUri) {
|
|
4910
4921
|
const [_signedUrl] = await firebase_admin.storage().bucket(firebase_admin.app().options.storageBucket).file([rest.id, "bundle.zip"].join("/")).getSignedUrl({
|
package/dist/index.cjs
CHANGED
|
@@ -208,7 +208,10 @@ const firebaseStorage = (0, __hot_updater_plugin_core.createStoragePlugin)({
|
|
|
208
208
|
const fileContent = await fs_promises.default.readFile(filePath);
|
|
209
209
|
const contentType = (0, __hot_updater_plugin_core.getContentType)(filePath);
|
|
210
210
|
const storageKey = getStorageKey(key, path.default.basename(filePath));
|
|
211
|
-
await bucket.file(storageKey).save(fileContent, { metadata: {
|
|
211
|
+
await bucket.file(storageKey).save(fileContent, { metadata: {
|
|
212
|
+
contentType,
|
|
213
|
+
cacheControl: "public, max-age=31536000, immutable"
|
|
214
|
+
} });
|
|
212
215
|
return { storageUri: `gs://${config.storageBucket}/${storageKey}` };
|
|
213
216
|
} catch (error) {
|
|
214
217
|
console.error("Error uploading bundle:", error);
|
package/dist/index.js
CHANGED
|
@@ -181,7 +181,10 @@ const firebaseStorage = createStoragePlugin({
|
|
|
181
181
|
const fileContent = await fs.readFile(filePath);
|
|
182
182
|
const contentType = getContentType(filePath);
|
|
183
183
|
const storageKey = getStorageKey(key, path.basename(filePath));
|
|
184
|
-
await bucket.file(storageKey).save(fileContent, { metadata: {
|
|
184
|
+
await bucket.file(storageKey).save(fileContent, { metadata: {
|
|
185
|
+
contentType,
|
|
186
|
+
cacheControl: "public, max-age=31536000, immutable"
|
|
187
|
+
} });
|
|
185
188
|
return { storageUri: `gs://${config.storageBucket}/${storageKey}` };
|
|
186
189
|
} catch (error) {
|
|
187
190
|
console.error("Error uploading bundle:", error);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/firebase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.27.1",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"firebase": "^11.3.1",
|
|
38
|
-
"@hot-updater/cli-tools": "0.
|
|
39
|
-
"@hot-updater/core": "0.
|
|
40
|
-
"@hot-updater/plugin-core": "0.
|
|
38
|
+
"@hot-updater/cli-tools": "0.27.1",
|
|
39
|
+
"@hot-updater/core": "0.27.1",
|
|
40
|
+
"@hot-updater/plugin-core": "0.27.1"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"fkill": "^9.0.0",
|
|
54
54
|
"hono": "^4.6.3",
|
|
55
55
|
"mime": "^4.0.4",
|
|
56
|
-
"@hot-updater/js": "0.
|
|
57
|
-
"@hot-updater/test-utils": "0.
|
|
56
|
+
"@hot-updater/js": "0.27.1",
|
|
57
|
+
"@hot-updater/test-utils": "0.27.1"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"firebase-admin": "*"
|