Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

[xdl][Project] Support app.config.js #1524

Merged
merged 5 commits into from
Feb 20, 2020

Conversation

EvanBacon
Copy link
Contributor

@EvanBacon EvanBacon commented Feb 5, 2020

  • _getExpAsync(): use slugify to transform config name from ThirdParty module
  • Update types
  • Remove unused variables
  • Add support for app.config.js when starting a project on any platform
  • Add support for app.config.js when getting build status, and starting a build.

Notes

  • I guess you can make config changes then refresh the client (⌘R) to see them.

Test Plan

This effects:

  • expo start
  • expo start:web
  • expo publish
  • expo url

Each should be run with an app.config.js and app.json.

Test Project

app.json

{
  "expo": {
    "version": "1.0.0"
    // ...
  }
}

app.config.js

module.exports = function({ config, mode }) {
    return {
        ...config,
        name: "My Project - " + mode
    }
}

App.js

import React from 'react';
import { Text } from 'react-native';
import Constants from 'expo-constants';

export default () => <Text>Data: {Constants.manifest.name}</Text>

- _getExpAsync(): use slugify to transform config name from ThirdParty module
- Update types
- Remove unused variables
- Add support for app.config.js when starting a project on any platform
- Add support for app.config.js when getting build status, and starting a build.
@EvanBacon EvanBacon added the Expo config Related to the app.json config for Expo projects label Feb 5, 2020
@EvanBacon EvanBacon self-assigned this Feb 5, 2020
@EvanBacon EvanBacon marked this pull request as ready for review February 6, 2020 00:02
Copy link
Contributor

@jkhales jkhales left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@EvanBacon
Copy link
Contributor Author

I'm thinking it might make sense to set an environment variable which we use for getting the environment in expo-cli. CC @fson

@fson
Copy link
Contributor

fson commented Feb 6, 2020

What would this look like for a user of Expo CLI? Where would this environment variable usually be set?

@EvanBacon EvanBacon merged commit 52eb39e into master Feb 20, 2020
@EvanBacon EvanBacon deleted the @evanbacon/xdl/Project/support-app.config.js branch February 20, 2020 04:15
@rungwe
Copy link

rungwe commented May 7, 2020

Hi @EvanBacon, in the app.config.js, there are two properties which we can extract,
config and mode
I do understand what config is, I am not sure what mode is? is this the release channel.

I am trying to get the release channel info so that I can apply some logic in the function to determine which config properties to use

module.exports = function({ config, mode }) { return { ...config, name: "My Project - " + mode } }

@arlyon
Copy link

arlyon commented May 14, 2020

@rungwe mode: packagerOpts.dev ? 'development' : 'production'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Expo config Related to the app.json config for Expo projects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants