@stoker-platform/cli 0.5.136 → 0.5.137
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/lib/package.json +4 -4
- package/lib/src/deploy/deployProject.js +31 -1
- package/package.json +1 -1
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoker-platform/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.136",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"main": "./lib/src/main.js",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"@google-cloud/secret-manager": "^6.1.2",
|
|
25
25
|
"@google-cloud/storage": "^7.19.0",
|
|
26
26
|
"@inquirer/prompts": "^8.5.2",
|
|
27
|
-
"@stoker-platform/node-client": "0.5.
|
|
28
|
-
"@stoker-platform/types": "0.5.
|
|
29
|
-
"@stoker-platform/utils": "0.5.
|
|
27
|
+
"@stoker-platform/node-client": "0.5.86",
|
|
28
|
+
"@stoker-platform/types": "0.5.64",
|
|
29
|
+
"@stoker-platform/utils": "0.5.77",
|
|
30
30
|
"algoliasearch": "^5.53.0",
|
|
31
31
|
"commander": "^15.0.0",
|
|
32
32
|
"cross-spawn": "^7.0.6",
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { fetchCurrentSchema, initializeFirebase, runChildProcess } from "@stoker-platform/node-client";
|
|
2
2
|
import { setDeploymentStatus } from "./maintenance/setDeploymentStatus.js";
|
|
3
3
|
import { getFunctionsData } from "./cloud-functions/getFunctionsData.js";
|
|
4
|
-
import { retryOperation } from "@stoker-platform/utils";
|
|
4
|
+
import { getFirestoreDatabaseId, retryOperation } from "@stoker-platform/utils";
|
|
5
5
|
import { generateSchema } from "./schema/generateSchema.js";
|
|
6
6
|
import isEqual from "lodash/isEqual.js";
|
|
7
7
|
import cloneDeep from "lodash/cloneDeep.js";
|
|
8
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
9
|
+
import { join } from "node:path";
|
|
8
10
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
11
|
export const deployProject = async (options) => {
|
|
10
12
|
try {
|
|
@@ -59,6 +61,34 @@ export const deployProject = async (options) => {
|
|
|
59
61
|
await runChildProcess("npx", ["stoker", "migrate"]);
|
|
60
62
|
}
|
|
61
63
|
await initializeFirebase();
|
|
64
|
+
const firebaseJsonPath = join(process.cwd(), "firebase.json");
|
|
65
|
+
const firebaseJson = JSON.parse(await readFile(firebaseJsonPath, "utf8"));
|
|
66
|
+
if ((process.env.FB_FIRESTORE_EDITION || "enterprise") === "enterprise") {
|
|
67
|
+
firebaseJson.firestore = [
|
|
68
|
+
{
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
70
|
+
database: getFirestoreDatabaseId(process.env.FB_FIRESTORE_EDITION, process.env.GCP_PROJECT),
|
|
71
|
+
rules: "firebase-rules/firestore.rules",
|
|
72
|
+
indexes: "firebase-rules/firestore.indexes.json",
|
|
73
|
+
},
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
firebaseJson.firestore = {
|
|
78
|
+
rules: "firebase-rules/firestore.rules",
|
|
79
|
+
indexes: "firebase-rules/firestore.indexes.json",
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
await writeFile(firebaseJsonPath, JSON.stringify(firebaseJson, null, 4), "utf8");
|
|
83
|
+
const extensionEnvPath = join(process.cwd(), "extensions", "firestore-send-email.env");
|
|
84
|
+
const extensionEnvFile = await readFile(extensionEnvPath, "utf8");
|
|
85
|
+
const extensionEnvFileLines = extensionEnvFile.split("\n");
|
|
86
|
+
const linesToRemove = ["DATABASE="];
|
|
87
|
+
const filteredLines = extensionEnvFileLines.filter((line) => !linesToRemove.some((removeStr) => line.startsWith(removeStr)));
|
|
88
|
+
filteredLines.push(
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
90
|
+
`DATABASE=${getFirestoreDatabaseId(process.env.FB_FIRESTORE_EDITION, process.env.GCP_PROJECT)}`);
|
|
91
|
+
await writeFile(extensionEnvPath, filteredLines.join("\n"));
|
|
62
92
|
if (options.initial) {
|
|
63
93
|
await retryOperation(async () => {
|
|
64
94
|
await runChildProcess("npx", [
|