代码之家  ›  专栏  ›  技术社区  ›  Dario

展览和发布渠道……如何识别开发/生产和真正的渠道

  •  0
  • Dario  · 技术社区  · 6 年前

    我在世博会发布渠道上遇到了一些问题。 我对React National和Expo不是很在行,因为它使事情变得更容易:

    如果我在本地开发环境中工作,那么将不会设置通道(这是有意义的)。

    但最终发布或“生产”也不会有渠道设置, 这让我很不清楚如何认识到“生产”和“发展”。

    然后,如果我想添加一个通道,就会添加一个新的复杂性级别,比如“分段”,它将有一个通道…

    最重要的是,在我的部署系统(循环)中,我必须在一个通道中构建“开发”(否则节点环境将是“生产”)。

    有人知道如何正确使用频道吗?:)

    基本上,我没有找到比这个更好的解决方案:

    import { Constants } from 'expo'
    const ENV= {production:{},staging:{},development:{}}
    
    // Having fun with channels
    const channel = Constants.manifest.releaseChannel;
    if (channel === null || channel === undefined || channel === '') {
      if (process.env.NODE_ENV === 'production') {
        return ENV.production;
      }
      if (process.env.NODE_ENV === 'development') {
        return ENV.development;
      }
    }
    if (channel === 'staging') {
      return ENV.staging;
    }
    if (channel === 'development') {
      return ENV.development;
    }
    return ENV.production;

    非常感谢!

    1 回复  |  直到 6 年前
        1
  •  2
  •   jakubste devius    6 年前

    exp build default exp publish

    prod