React Native 在世博会项目中,eas.json是否会取代app.json?

ffdz8vbo  于 2022-11-25  发布在  React
关注(0)|答案(1)|浏览(212)

我正在从旧的expo build进程迁移到eas。我需要配置我的eas.json,但不确定这里到底需要做什么。
我找不到一个明确的答案,关于eas.json是否取代了我的app.json,或者我是否仍然需要我的app.json
当然,在我的app.json,我有版本号,我的应用程序的名称,鼻涕虫,图标,iOS和Android配置等.
另外,这对我的app.config.js有什么影响?

7d7tgy0s

7d7tgy0s1#

事实上,expo-cli不同于eas-cli,同样,eas.json也不同于app.json,因此它不会取代app.json,eas.json仅包含eas-cli的配置,主要在您运行eas build或任何eas命令时使用,因此它不同于expo-cli,后者使用app.json配置来配置应用的详细信息。
注:expo build以同样的方式区别于eas build
而且,app.config.js与app.json相同,因此对app.config.js的更改将影响app.json,但这并不意味着替换app.json。
app.config.js将主要用于配置插件和本地更改(如果更新版本的expo需要)。
eas.json应该看起来像这样:

{
  "cli": {
    "version": ">= 2.6.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal"
    },
     "preview": {
      "android": {
        "buildType": "apk"
      }
    },
    "production": {}
  },
  "submit": {
    "production": {}
  }
}

您的app.json应该看起来像这样:

{
  "expo": {
    "name": "Your App Name",
    "slug": "yourappslug",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "cover",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true,
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#FFFFFF"
      },
      "versionCode": 1
    },
    "web": {
      "favicon": "./assets/favicon.png"
    },
  }
}

您的app.config.js应该如下所示:

export default ({ config }) => {
    return {
        ...config,
        plugins: [
            [
                '@config-plugins/react-native-webrtc',
                {
                    cameraPermission:
                        'Camera permission is required to click pictures, (Example: setting a profile picture, or taking a picture and uploading it to a chat and while video calling some one within the app.)',
                    microphonePermission:
                        'Microphone permission is required to record and use audio, (Example: recording a voice message while chatting with someone within the app or while in video calling or voice calling.)',
                },
            ],
            
        ],
    };
};

相关问题