forked from react-native-async-storage/async-storage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(changeset): add an Expo config plugin to simplify enabling Next …
…Storage Fixes react-native-async-storage#750 Co-Authored-By: Bill Spooner <[email protected]>
- Loading branch information
1 parent
471a1b8
commit 01a758d
Showing
8 changed files
with
3,180 additions
and
48 deletions.
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@react-native-async-storage/async-storage": minor | ||
--- | ||
|
||
Add an Expo config plugin to simplify enabling Next Storage |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./plugin/build'); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// @generated by expo-module-scripts | ||
module.exports = require('expo-module-scripts/eslintrc.base.js'); |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('expo-module-scripts/jest-preset-plugin'); |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import type { ConfigPlugin} from '@expo/config-plugins'; | ||
import { withGradleProperties } from '@expo/config-plugins'; | ||
|
||
export type AsyncStorageOptions = { | ||
useNextStorage?: boolean; | ||
} | ||
|
||
const withUseNextStorage: ConfigPlugin<AsyncStorageOptions> = (config, { useNextStorage = false }) => { | ||
if (!useNextStorage) { | ||
return config; | ||
} | ||
|
||
return withGradleProperties(config, (config) => { | ||
config.modResults.push({ | ||
key: 'AsyncStorage_useNextStorage', | ||
value: 'true', | ||
type: 'property', | ||
}); | ||
|
||
return config; | ||
}); | ||
}; | ||
|
||
const DEFAULT_OPTS: AsyncStorageOptions = { | ||
useNextStorage: false, | ||
} | ||
|
||
const withAsyncStorage: ConfigPlugin<AsyncStorageOptions> = (config, props) => { | ||
const normalizedProps = { ...DEFAULT_OPTS, ...props }; | ||
config = withUseNextStorage(config, normalizedProps); | ||
return config; | ||
}; | ||
|
||
export default withAsyncStorage; |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "expo-module-scripts/tsconfig.plugin", | ||
"compilerOptions": { | ||
"outDir": "build", | ||
"rootDir": "src" | ||
}, | ||
"include": ["./src"], | ||
"exclude": ["**/__mocks__/*", "**/__tests__/*"] | ||
} |
Oops, something went wrong.