backend-manager 5.0.136 → 5.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backend-manager",
3
- "version": "5.0.136",
3
+ "version": "5.0.137",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -174,25 +174,41 @@ Manager.prototype.init = function (exporter, options) {
174
174
  Manager: self,
175
175
  }, options.assistant);
176
176
 
177
+ // Helper functions for URLs based on environment
178
+ self.project.getFunctionsUrl = function(env) {
179
+ const isDev = env === 'development' || (!env && self.assistant.isDevelopment());
180
+ return isDev
181
+ ? `http://localhost:5001/${self.project.projectId}/${self.project.resourceZone}`
182
+ : `https://${self.project.resourceZone}-${self.project.projectId}.cloudfunctions.net`;
183
+ };
184
+
185
+ self.project.getApiUrl = function(env) {
186
+ const isDev = env === 'development' || (!env && self.assistant.isDevelopment());
187
+ return isDev
188
+ ? 'http://localhost:5002'
189
+ : `https://api.${(self.config.brand?.url || '').replace(/^https?:\/\//, '')}`;
190
+ };
191
+
192
+ self.project.getWebsiteUrl = function(env) {
193
+ const isDev = env === 'development' || (!env && self.assistant.isDevelopment());
194
+ return isDev
195
+ ? 'https://localhost:4000'
196
+ : self.config.brand?.url || '';
197
+ };
198
+
177
199
  // Set more properties (need to wait for assistant to determine if DEV)
178
- self.project.functionsUrl = self.assistant.isDevelopment()
179
- ? `http://localhost:5001/${self.project.projectId}/${self.project.resourceZone}`
180
- : `https://${self.project.resourceZone}-${self.project.projectId}.cloudfunctions.net`;
200
+ self.project.functionsUrl = self.project.getFunctionsUrl();
181
201
 
182
202
  // Set API URL (like web-manager's getApiUrl)
183
203
  // Testing: http://localhost:5002 (hosting emulator with rewrites)
184
204
  // Development: http://localhost:5002 (local hosting)
185
205
  // Production: https://api.{domain}
186
- self.project.apiUrl = self.assistant.isDevelopment()
187
- ? 'http://localhost:5002'
188
- : `https://api.${(self.config.brand?.url || '').replace(/^https?:\/\//, '')}`;
206
+ self.project.apiUrl = self.project.getApiUrl();
189
207
 
190
208
  // Set website URL
191
209
  // Development: https://localhost:4000 (local hosting)
192
210
  // Production: https://{domain} (from brand.url)
193
- self.project.websiteUrl = self.assistant.isDevelopment()
194
- ? 'https://localhost:4000'
195
- : self.config.brand?.url || '';
211
+ self.project.websiteUrl = self.project.getWebsiteUrl();
196
212
 
197
213
  // Set environment
198
214
  process.env.ENVIRONMENT = process.env.ENVIRONMENT || self.assistant.meta.environment;