@stoker-platform/cli 0.5.157 → 0.5.159
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/init-files/package.json
CHANGED
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.159",
|
|
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": "^7.0.0",
|
|
25
25
|
"@google-cloud/storage": "^8.0.1",
|
|
26
26
|
"@inquirer/prompts": "^8.6.0",
|
|
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.103",
|
|
28
|
+
"@stoker-platform/types": "0.5.72",
|
|
29
|
+
"@stoker-platform/utils": "0.5.89",
|
|
30
30
|
"algoliasearch": "^5.57.0",
|
|
31
31
|
"commander": "^15.0.0",
|
|
32
32
|
"cross-spawn": "^7.0.6",
|
|
@@ -40,6 +40,6 @@
|
|
|
40
40
|
},
|
|
41
41
|
"engines": {
|
|
42
42
|
"node": ">=22",
|
|
43
|
-
"npm": "
|
|
43
|
+
"npm": ">=12"
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -64,20 +64,25 @@ export const deployProject = async (options) => {
|
|
|
64
64
|
const firebaseJsonPath = join(process.cwd(), "firebase.json");
|
|
65
65
|
const firebaseJson = JSON.parse(await readFile(firebaseJsonPath, "utf8"));
|
|
66
66
|
if ((process.env.FB_FIRESTORE_EDITION || "enterprise") === "enterprise") {
|
|
67
|
-
firebaseJson.firestore =
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
firebaseJson.firestore = {
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
69
|
+
database: getFirestoreDatabaseId(process.env.FB_FIRESTORE_EDITION, process.env.GCP_PROJECT),
|
|
70
|
+
rules: "firebase-rules/firestore.rules",
|
|
71
|
+
indexes: "firebase-rules/firestore.indexes.json",
|
|
72
|
+
edition: "enterprise",
|
|
73
|
+
};
|
|
74
|
+
firebaseJson.emulators ||= {};
|
|
75
|
+
firebaseJson.emulators.firestore ||= {};
|
|
76
|
+
firebaseJson.emulators.firestore.edition = "enterprise";
|
|
75
77
|
}
|
|
76
78
|
else {
|
|
77
79
|
firebaseJson.firestore = {
|
|
78
80
|
rules: "firebase-rules/firestore.rules",
|
|
79
81
|
indexes: "firebase-rules/firestore.indexes.json",
|
|
80
82
|
};
|
|
83
|
+
if (firebaseJson.emulators?.firestore?.edition) {
|
|
84
|
+
delete firebaseJson.emulators.firestore.edition;
|
|
85
|
+
}
|
|
81
86
|
}
|
|
82
87
|
await writeFile(firebaseJsonPath, JSON.stringify(firebaseJson, null, 4), "utf8");
|
|
83
88
|
const extensionEnvPath = join(process.cwd(), "extensions", "firestore-send-email.env");
|
|
@@ -6,6 +6,7 @@ import { retryOperation, getFirestoreDatabaseId } from "@stoker-platform/utils";
|
|
|
6
6
|
import { SecretManagerServiceClient } from "@google-cloud/secret-manager";
|
|
7
7
|
import { addTenant } from "./addTenant.js";
|
|
8
8
|
import { existsSync } from "fs";
|
|
9
|
+
import { randomUUID } from "node:crypto";
|
|
9
10
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
11
|
export const addProject = async (options) => {
|
|
11
12
|
if (!process.env.GCP_BILLING_ACCOUNT) {
|
|
@@ -441,13 +442,15 @@ export const addProject = async (options) => {
|
|
|
441
442
|
const firebaseJsonPath = join(process.cwd(), "firebase.json");
|
|
442
443
|
const firebaseJson = JSON.parse(await readFile(firebaseJsonPath, "utf8"));
|
|
443
444
|
if ((process.env.FB_FIRESTORE_EDITION || "enterprise") === "enterprise") {
|
|
444
|
-
firebaseJson.firestore =
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
445
|
+
firebaseJson.firestore = {
|
|
446
|
+
database: projectId,
|
|
447
|
+
rules: "firebase-rules/firestore.rules",
|
|
448
|
+
indexes: "firebase-rules/firestore.indexes.json",
|
|
449
|
+
edition: "enterprise",
|
|
450
|
+
};
|
|
451
|
+
firebaseJson.emulators ||= {};
|
|
452
|
+
firebaseJson.emulators.firestore ||= {};
|
|
453
|
+
firebaseJson.emulators.firestore.edition = "enterprise";
|
|
451
454
|
await writeFile(firebaseJsonPath, JSON.stringify(firebaseJson, null, 4), "utf8");
|
|
452
455
|
}
|
|
453
456
|
else {
|
|
@@ -455,6 +458,9 @@ export const addProject = async (options) => {
|
|
|
455
458
|
rules: "firebase-rules/firestore.rules",
|
|
456
459
|
indexes: "firebase-rules/firestore.indexes.json",
|
|
457
460
|
};
|
|
461
|
+
if (firebaseJson.emulators?.firestore?.edition) {
|
|
462
|
+
delete firebaseJson.emulators.firestore.edition;
|
|
463
|
+
}
|
|
458
464
|
await writeFile(firebaseJsonPath, JSON.stringify(firebaseJson, null, 4), "utf8");
|
|
459
465
|
}
|
|
460
466
|
await updateProjectData(17);
|
|
@@ -979,6 +985,31 @@ export const addProject = async (options) => {
|
|
|
979
985
|
const functionsPort = firebaseJson.emulators.functions.port;
|
|
980
986
|
const envDir = join(process.cwd(), ".env");
|
|
981
987
|
const envFile = join(envDir, `.env.${projectId}`);
|
|
988
|
+
let appCheckDebugToken;
|
|
989
|
+
if (process.env.FB_ENABLE_APP_CHECK === "true") {
|
|
990
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
991
|
+
if (existsSync(envFile)) {
|
|
992
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
993
|
+
appCheckDebugToken = dotenv.parse(await readFile(envFile)).STOKER_FB_APP_CHECK_DEBUG_TOKEN;
|
|
994
|
+
}
|
|
995
|
+
if (!appCheckDebugToken) {
|
|
996
|
+
appCheckDebugToken = randomUUID();
|
|
997
|
+
await runChildProcess("firebase", [
|
|
998
|
+
"appcheck:debugtokens:create",
|
|
999
|
+
appCheckDebugToken,
|
|
1000
|
+
"--app",
|
|
1001
|
+
appId,
|
|
1002
|
+
"--display-name",
|
|
1003
|
+
"Stoker Development",
|
|
1004
|
+
"--project",
|
|
1005
|
+
projectId,
|
|
1006
|
+
"--non-interactive",
|
|
1007
|
+
"--force",
|
|
1008
|
+
]).catch(() => {
|
|
1009
|
+
throw new Error("Error creating App Check debug token.");
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
982
1013
|
let envContent = `STOKER_FB_WEB_APP_CONFIG='${JSON.stringify(webAppConfig)}'
|
|
983
1014
|
STOKER_FB_ENABLE_APP_CHECK=${process.env.FB_ENABLE_APP_CHECK}
|
|
984
1015
|
STOKER_FB_APP_CHECK_KEY="${recaptchaKeyId}"
|
|
@@ -987,6 +1018,9 @@ STOKER_FB_FUNCTIONS_REGION="${process.env.FB_FUNCTIONS_REGION}"
|
|
|
987
1018
|
STOKER_FB_FIRESTORE_EDITION="${process.env.FB_FIRESTORE_EDITION || "enterprise"}"
|
|
988
1019
|
FB_DATABASE="${projectId}-default-rtdb"
|
|
989
1020
|
FB_FIRESTORE_EXPORT_BUCKET="${projectId}-export"`;
|
|
1021
|
+
if (appCheckDebugToken) {
|
|
1022
|
+
envContent += `\nSTOKER_FB_APP_CHECK_DEBUG_TOKEN="${appCheckDebugToken}"`;
|
|
1023
|
+
}
|
|
990
1024
|
if (process.env.SENTRY_DSN && !options.development) {
|
|
991
1025
|
envContent += `\nSTOKER_SENTRY_DSN="${process.env.SENTRY_DSN}"`;
|
|
992
1026
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoker-platform/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.159",
|
|
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": "^7.0.0",
|
|
25
25
|
"@google-cloud/storage": "^8.0.1",
|
|
26
26
|
"@inquirer/prompts": "^8.6.0",
|
|
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.103",
|
|
28
|
+
"@stoker-platform/types": "0.5.72",
|
|
29
|
+
"@stoker-platform/utils": "0.5.89",
|
|
30
30
|
"algoliasearch": "^5.57.0",
|
|
31
31
|
"commander": "^15.0.0",
|
|
32
32
|
"cross-spawn": "^7.0.6",
|
|
@@ -40,6 +40,6 @@
|
|
|
40
40
|
},
|
|
41
41
|
"engines": {
|
|
42
42
|
"node": ">=22",
|
|
43
|
-
"npm": "
|
|
43
|
+
"npm": ">=12"
|
|
44
44
|
}
|
|
45
45
|
}
|