Преглед изворни кода

feat: added .env support | API url

Oleksandr Honcharov пре 1 година
родитељ
комит
013175515d
6 измењених фајлова са 792 додато и 108 уклоњено
  1. 2 0
      .gitignore
  2. 34 0
      app.config.ts
  3. 0 30
      app.json
  4. 744 76
      package-lock.json
  5. 7 2
      package.json
  6. 5 0
      src/constants/secrets.ts

+ 2 - 0
.gitignore

@@ -37,3 +37,5 @@ yarn-error.*
 # dev
 .idea
 .vscode
+.env
+temp

+ 34 - 0
app.config.ts

@@ -0,0 +1,34 @@
+import 'dotenv/config';
+import type { ConfigContext, ExpoConfig } from 'expo/config';
+import { env } from 'process';
+
+export default ({ config }: ConfigContext): ExpoConfig => ({
+  ...config,
+  name: 'nomadmania-app',
+  slug: 'nomadmania-app',
+  version: '1.0.0',
+  orientation: 'portrait',
+  icon: './assets/icon.png',
+  userInterfaceStyle: 'light',
+  extra: {
+    API_HOST: env.API_HOST
+  },
+  splash: {
+    image: './assets/splash.png',
+    resizeMode: 'contain',
+    backgroundColor: '#ffffff'
+  },
+  assetBundlePatterns: ['**/*'],
+  ios: {
+    supportsTablet: true
+  },
+  android: {
+    adaptiveIcon: {
+      foregroundImage: './assets/adaptive-icon.png',
+      backgroundColor: '#ffffff'
+    }
+  },
+  web: {
+    favicon: './assets/favicon.png'
+  }
+});

+ 0 - 30
app.json

@@ -1,30 +0,0 @@
-{
-  "expo": {
-    "name": "nomadmania-app",
-    "slug": "nomadmania-app",
-    "version": "1.0.0",
-    "orientation": "portrait",
-    "icon": "./assets/icon.png",
-    "userInterfaceStyle": "light",
-    "splash": {
-      "image": "./assets/splash.png",
-      "resizeMode": "contain",
-      "backgroundColor": "#ffffff"
-    },
-    "assetBundlePatterns": [
-      "**/*"
-    ],
-    "ios": {
-      "supportsTablet": true
-    },
-    "android": {
-      "adaptiveIcon": {
-        "foregroundImage": "./assets/adaptive-icon.png",
-        "backgroundColor": "#ffffff"
-      }
-    },
-    "web": {
-      "favicon": "./assets/favicon.png"
-    }
-  }
-}

Разлика између датотеке није приказан због своје велике величине
+ 744 - 76
package-lock.json


+ 7 - 2
package.json

@@ -9,24 +9,29 @@
     "web": "expo start --web"
   },
   "dependencies": {
+    "@react-native-async-storage/async-storage": "1.18.2",
     "@react-navigation/bottom-tabs": "^6.5.11",
     "@react-navigation/native": "^6.1.9",
     "@react-navigation/native-stack": "^6.9.17",
     "@react-navigation/stack": "^6.3.20",
+    "@tanstack/react-query": "^5.8.3",
     "axios": "^1.6.1",
+    "dotenv": "^16.3.1",
     "expo": "~49.0.15",
+    "expo-splash-screen": "~0.20.5",
     "expo-status-bar": "~1.6.0",
     "react": "18.2.0",
     "react-native": "0.72.6",
     "react-native-safe-area-context": "4.6.3",
     "react-native-screens": "~3.22.0",
-    "react-query": "^3.39.3"
+    "react-native-svg": "13.9.0"
   },
   "devDependencies": {
     "@babel/core": "^7.20.0",
     "@types/react": "~18.2.14",
     "prettier": "^3.1.0",
-    "typescript": "^5.1.3"
+    "typescript": "^5.1.3",
+    "react-native-svg-transformer": "^1.1.0"
   },
   "private": true
 }

+ 5 - 0
src/constants/secrets.ts

@@ -0,0 +1,5 @@
+import Constants from 'expo-constants';
+
+export const { API_HOST } = Constants.manifest2?.extra?.expoClient?.extra ?? {};
+
+export const API_URL = `${API_HOST}/webapi`;

Неке датотеке нису приказане због велике количине промена