-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move function to filter versions based on the diff requirements to `u…
…tils`
- Loading branch information
Lucas Bento
committed
Jun 11, 2019
1 parent
7cbf274
commit bcee9e0
Showing
2 changed files
with
20 additions
and
13 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
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,4 +1,21 @@ | ||
import semver from 'semver' | ||
import { versions } from './releases' | ||
|
||
const releasedVersions = versions.map(version => ({ | ||
...require(`./releases/${version}`).default, | ||
version | ||
})) | ||
|
||
export const RELEASES_URL = | ||
'https://raw.githubusercontent.com/react-native-community/rn-diff-purge/master/RELEASES' | ||
|
||
export const removeAppPathPrefix = path => path.replace(/RnDiffApp\//, '') | ||
|
||
export const getVersionsInDiff = ({ fromVersion, toVersion }) => { | ||
const cleanedToVersion = semver.valid(semver.coerce(toVersion)) | ||
|
||
return releasedVersions.filter( | ||
({ version }) => | ||
semver.lte(version, cleanedToVersion) && semver.gt(version, fromVersion) | ||
) | ||
} |