@edgedev/create-edge-app 1.1.29 → 1.2.29

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/firebase_init.sh CHANGED
@@ -1,3 +1,46 @@
1
+ # Install gcloud if missing (best-effort by platform)
2
+ ensure_gcloud() {
3
+ if command -v gcloud >/dev/null 2>&1; then
4
+ return 0
5
+ fi
6
+
7
+ echo "gcloud CLI not found. Attempting to install Google Cloud SDK..."
8
+
9
+ if command -v brew >/dev/null 2>&1; then
10
+ if ! brew list --cask google-cloud-sdk >/dev/null 2>&1; then
11
+ brew install --cask google-cloud-sdk || {
12
+ echo "Failed to install Google Cloud SDK with Homebrew."
13
+ exit 1
14
+ }
15
+ fi
16
+ elif command -v snap >/dev/null 2>&1; then
17
+ if [ "$(id -u)" -eq 0 ]; then
18
+ snap install google-cloud-cli --classic || {
19
+ echo "Failed to install Google Cloud SDK with Snap."
20
+ exit 1
21
+ }
22
+ elif command -v sudo >/dev/null 2>&1; then
23
+ sudo snap install google-cloud-cli --classic || {
24
+ echo "Failed to install Google Cloud SDK with Snap."
25
+ exit 1
26
+ }
27
+ else
28
+ echo "Snap install requires elevated privileges, but 'sudo' is unavailable."
29
+ exit 1
30
+ fi
31
+ else
32
+ echo "Unable to auto-install Google Cloud SDK on this system."
33
+ echo "Please install it manually: https://cloud.google.com/sdk/docs/install"
34
+ exit 1
35
+ fi
36
+
37
+ if ! command -v gcloud >/dev/null 2>&1; then
38
+ echo "gcloud is still not available in PATH after install."
39
+ echo "Open a new terminal and run this script again."
40
+ exit 1
41
+ fi
42
+ }
43
+
1
44
  # Prompt for the Firebase configuration values
2
45
  echo "Please enter your Firebase project ID:"
3
46
  read project_id
@@ -34,11 +77,29 @@ if [ -z "$project_id" ]; then
34
77
  fi
35
78
 
36
79
  # Check if firebase is installed
37
- if ! command -v firebase &> /dev/null; then
80
+ if ! command -v firebase >/dev/null 2>&1; then
38
81
  echo "Firebase CLI could not be found. Please install it and try again."
39
82
  exit 1
40
83
  fi
41
84
 
85
+ ensure_gcloud
86
+
87
+ # Initialize gcloud account/config if needed, then set active project
88
+ active_account="$(gcloud auth list --filter=status:ACTIVE --format='value(account)' 2>/dev/null)"
89
+ if [ -z "$active_account" ]; then
90
+ echo "No active gcloud account found. Running gcloud init..."
91
+ if ! gcloud init; then
92
+ echo "gcloud init failed."
93
+ exit 1
94
+ fi
95
+ fi
96
+
97
+ echo "Setting gcloud project to '$project_id'..."
98
+ if ! gcloud config set project "$project_id"; then
99
+ echo "Failed to set gcloud project to '$project_id'."
100
+ exit 1
101
+ fi
102
+
42
103
  # Backup firebase.json if it exists
43
104
  if [ -f ./firebase.json ]; then
44
105
  cp ./firebase.json ./firebase.json.temp
@@ -93,4 +154,4 @@ echo "VITE_FIREBASE_EMULATOR_FIRESTORE=8080" >> .env.dev
93
154
  echo "VITE_FIREBASE_EMULATOR_FUNCTIONS=5001" >> .env.dev
94
155
  echo "VITE_FIREBASE_EMULATOR_STORAGE=9199" >> .env.dev
95
156
  echo "REGISTRATION_CODE=organization-registration-template" >> .env.dev
96
- echo "DEVELOPMENT_MODE=true" >> .env.dev
157
+ echo "DEVELOPMENT_MODE=true" >> .env.dev
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgedev/create-edge-app",
3
- "version": "1.1.29",
3
+ "version": "1.2.29",
4
4
  "description": "Create Edge Starter App",
5
5
  "bin": {
6
6
  "create-edge-app": "./bin/cli.js"
@@ -0,0 +1,12 @@
1
+ # Optional shared deploy settings for all services.
2
+ # Copy to services/.deploy.shared.env and customize as needed.
3
+
4
+ # Defaults to .firebaserc project if omitted.
5
+ # PROJECT_ID=clearwater-hub
6
+
7
+ # Falls back to VITE_FIREBASE_FUNCTIONS_REGION from root .env if omitted.
8
+ # REGION=us-central1
9
+
10
+ # Comma-separated IAM members to grant Cloud Run Invoker when ALLOW_UNAUTHENTICATED=false.
11
+ # If member type is omitted, serviceAccount: is assumed by deploy-services.sh.
12
+ # INVOKER_MEMBERS=serviceAccount:201505998870-compute@developer.gserviceaccount.com