This repository has been archived by the owner on Jan 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 479
[config] Create dynamic config "app.config.js" #1342
Merged
Merged
Changes from 26 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
8d8be68
Update Modules.ts
EvanBacon f259da9
Update Project.ts
EvanBacon 4035f52
Created eval method
EvanBacon ff86c23
Added types and comments
EvanBacon 49c9cc0
Add getConfig method
EvanBacon 73db509
split tests
EvanBacon 74e9422
Added tests
EvanBacon f74b86c
Add TS support
EvanBacon 8db2ca4
Update Config.ts
EvanBacon 6d26924
Disable language support for yaml, toml, and TypeScript
EvanBacon 330c1dc
Update resolve-from.js
EvanBacon 935e7ef
Merge branch 'master' into @evanbacon/config/basic-app.config.js
EvanBacon 7141f69
revert auto-format changes
EvanBacon 5228dd4
serialize config
EvanBacon e75c6c6
Merge branch 'master' into @evanbacon/config/basic-app.config.js
EvanBacon 1d438de
Pass the app.json into the app.config.js method
EvanBacon 367b9cf
Added mode option to config
EvanBacon 537c5de
Remove generated
EvanBacon 6823236
Move serialize
EvanBacon 8ae9dc6
Update ConfigParsing-test.js
EvanBacon 094a38e
Merge branch 'master' into @evanbacon/config/basic-app.config.js
EvanBacon 1c16f65
Update Config.ts
EvanBacon f2ddf98
Remove support for yaml, toml, ts
EvanBacon 65b5a90
Updated tests
EvanBacon 09c3322
Move context resolver to another method
EvanBacon 0456477
import ConfigContext
EvanBacon 3420528
Merge branch 'master' into @evanbacon/config/basic-app.config.js
brentvatne b65a012
Merge branch 'master' into @evanbacon/config/basic-app.config.js
EvanBacon 7e5cefd
Format error messages for syntax errors in JS
EvanBacon 2b84c0b
Support expo object in app.json
EvanBacon e62f020
Update getConfig.ts
EvanBacon 17c186d
Remove support for json5
EvanBacon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
module.exports = { | ||
silent: (fromDirectory, request) => { | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
module.exports = require(require.resolve('resolve-from')); | ||
|
||
try { | ||
fromDirectory = fs.realpathSync(fromDirectory); | ||
} catch (error) { | ||
if (error.code === 'ENOENT') { | ||
fromDirectory = path.resolve(fromDirectory); | ||
} else { | ||
return; | ||
} | ||
} | ||
module.exports.silent = (fromDirectory, request) => { | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const outputPath = path.join(fromDirectory, 'node_modules', request); | ||
if (fs.existsSync(outputPath)) { | ||
return outputPath; | ||
try { | ||
fromDirectory = fs.realpathSync(fromDirectory); | ||
} catch (error) { | ||
if (error.code === 'ENOENT') { | ||
fromDirectory = path.resolve(fromDirectory); | ||
} else { | ||
return; | ||
} | ||
}, | ||
} | ||
|
||
const outputPath = path.join(fromDirectory, 'node_modules', request); | ||
if (fs.existsSync(outputPath)) { | ||
return outputPath; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we want to get rid of this capability, and make the JSON/JS configurations mutually exclusive, for a few reasons:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We support this functionality for values that are generated by Expo CLI like
bundleIdentifier
. I'm totally open to better ideas though. I imagine a new project's config would look something like:The spread of another config is somewhat unpleasant.
We can add a mechanism for printing out the serialized config after it's been returned from
app.config.js
.I imagine eventually
app.json
will be the static location for generated values.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we could add this to
expo diagnostics
? and we could automatically filter out any potentially sensitive fieldsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all we'd have to do to support this is switch the method used to read the config file.