@forthtilliath/expo-release-updates 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +132 -112
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/package.json +7 -6
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Forthtilliath
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Forthtilliath
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,112 +1,132 @@
|
|
|
1
|
-
# @forthtilliath/expo-release-updates
|
|
2
|
-
|
|
3
|
-
Self-update a sideloaded Android Expo app from its GitHub Releases: check the latest release, show a release history, download and trigger the install of a new APK. No backend needed — just a GitHub repo that publishes an `.apk` asset on each release.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @forthtilliath/expo-release-updates expo-file-system expo-intent-launcher
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Or, from within this monorepo, as a workspace dependency:
|
|
12
|
-
|
|
13
|
-
```json
|
|
14
|
-
{
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"@forthtilliath/expo-release-updates": "workspace:*"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
`expo-file-system` and `expo-intent-launcher` are peer dependencies — install them in the consuming app if not already present.
|
|
22
|
-
|
|
23
|
-
## Usage
|
|
24
|
-
|
|
25
|
-
Each function is its own module — import the file you need directly
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
import {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
1
|
+
# @forthtilliath/expo-release-updates
|
|
2
|
+
|
|
3
|
+
Self-update a sideloaded Android Expo app from its GitHub Releases: check the latest release, show a release history, download and trigger the install of a new APK. No backend needed — just a GitHub repo that publishes an `.apk` asset on each release.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @forthtilliath/expo-release-updates expo-file-system expo-intent-launcher
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or, from within this monorepo, as a workspace dependency:
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@forthtilliath/expo-release-updates": "workspace:*"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`expo-file-system` and `expo-intent-launcher` are peer dependencies — install them in the consuming app if not already present.
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
Each function is its own module — import the file you need directly, or use
|
|
26
|
+
the barrel to pull everything from a single import:
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { compareVersions } from "@forthtilliath/expo-release-updates/compareVersions";
|
|
30
|
+
import {
|
|
31
|
+
fetchLatestRelease,
|
|
32
|
+
fetchReleaseHistory,
|
|
33
|
+
} from "@forthtilliath/expo-release-updates/githubReleases";
|
|
34
|
+
import { downloadAndInstallApk } from "@forthtilliath/expo-release-updates/downloadAndInstallApk";
|
|
35
|
+
import { parseChangelogNotes } from "@forthtilliath/expo-release-updates/parseChangelogNotes";
|
|
36
|
+
|
|
37
|
+
// Or, everything at once:
|
|
38
|
+
import {
|
|
39
|
+
compareVersions,
|
|
40
|
+
fetchLatestRelease,
|
|
41
|
+
fetchReleaseHistory,
|
|
42
|
+
downloadAndInstallApk,
|
|
43
|
+
parseChangelogNotes,
|
|
44
|
+
} from "@forthtilliath/expo-release-updates";
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Avoid the barrel under Jest (or any other CommonJS `require` consumer).**
|
|
48
|
+
`export * from` re-exports are evaluated eagerly on `require()` — unlike
|
|
49
|
+
Metro's ESM bundling, there's no tree-shaking to skip the unused ones.
|
|
50
|
+
Requiring the barrel from _any_ file, even one that only wants
|
|
51
|
+
`compareVersions`, pulls in `downloadAndInstallApk`'s module graph too,
|
|
52
|
+
including native-module imports (`expo-file-system`, `expo-intent-launcher`)
|
|
53
|
+
that don't exist in a Jest environment — this throws at require time, not
|
|
54
|
+
just at runtime for unused code. Deep imports only ever load the one module
|
|
55
|
+
you asked for, so they don't have this problem in any environment.
|
|
56
|
+
|
|
57
|
+
### `compareVersions(a, b)`
|
|
58
|
+
|
|
59
|
+
Compares two `"x.y.z"` version strings, segment by segment. Returns `-1` if `a < b`, `0` if equal, `1` if `a > b`.
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
compareVersions("1.2.0", "1.10.0"); // -1 (numeric, not lexicographic)
|
|
63
|
+
compareVersions("2.0.0", "1.9.9"); // 1
|
|
64
|
+
compareVersions("1.2.3", "1.2.3"); // 0
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### `fetchLatestRelease({ owner, repo })`
|
|
68
|
+
|
|
69
|
+
Fetches the latest GitHub release and its `.apk` asset. Returns `null` if the latest release has no `.apk` attached; throws if the GitHub API request fails.
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
const release = await fetchLatestRelease({ owner: "acme", repo: "app" });
|
|
73
|
+
if (release && compareVersions(release.version, currentVersion) > 0) {
|
|
74
|
+
// an update is available: release.version, release.notes, release.apkUrl
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### `fetchReleaseHistory({ owner, repo, limit? })`
|
|
79
|
+
|
|
80
|
+
Fetches the most recent releases (version, notes, publish date), most recent first. `limit` defaults to `10` — useful for a "release history" / "what's new" screen.
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
const history = await fetchReleaseHistory({
|
|
84
|
+
owner: "acme",
|
|
85
|
+
repo: "app",
|
|
86
|
+
limit: 5,
|
|
87
|
+
});
|
|
88
|
+
// [{ version: "1.11.0", notes: "### Added\n- ...", publishedAt: "2026-07-30T..." }, ...]
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### `downloadAndInstallApk({ apkUrl, fileName, onProgress? })`
|
|
92
|
+
|
|
93
|
+
Downloads an APK to the app's cache directory and triggers the Android install-package intent. **Android only** — there is no iOS equivalent (sideloading isn't possible there).
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
await downloadAndInstallApk({
|
|
97
|
+
apkUrl: release.apkUrl,
|
|
98
|
+
fileName: "myapp-update.apk",
|
|
99
|
+
onProgress: (fraction) => setProgress(fraction),
|
|
100
|
+
});
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### `parseChangelogNotes(notes)`
|
|
104
|
+
|
|
105
|
+
Parses a small subset of Markdown (`### heading`, `- item`, `**bold**`) commonly found in GitHub release notes into a list of typed blocks (`heading` / `item` / `text`, each with `bold`-aware segments), ready for a UI layer to render without a full Markdown dependency. Pair it with `@forthtilliath/react-native-kit`'s `ChangelogNotes` component to render the result directly.
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
parseChangelogNotes("### Added\n- **Auto-backup**: saves every 5 minutes.");
|
|
109
|
+
// [
|
|
110
|
+
// { type: "heading", text: "Added" },
|
|
111
|
+
// {
|
|
112
|
+
// type: "item",
|
|
113
|
+
// segments: [
|
|
114
|
+
// { text: "Auto-backup", bold: true },
|
|
115
|
+
// { text: ": saves every 5 minutes.", bold: false },
|
|
116
|
+
// ],
|
|
117
|
+
// },
|
|
118
|
+
// ]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Scripts
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
pnpm run dev # tsc --watch -> dist/
|
|
125
|
+
pnpm run build # tsc -> dist/
|
|
126
|
+
pnpm run check-types # tsc --noEmit
|
|
127
|
+
pnpm run lint # eslint
|
|
128
|
+
pnpm run test # vitest run
|
|
129
|
+
pnpm run test:watch # vitest
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Built to `dist/` (see the `exports` field in `package.json`), so run `pnpm run build` (or `dev`) after source changes for consumers to see them.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Convenience barrel re-exporting everything below one import path. Deep
|
|
2
|
+
// imports (`@forthtilliath/expo-release-updates/downloadAndInstallApk`, etc.)
|
|
3
|
+
// remain the recommended default for apps that want to avoid pulling in the
|
|
4
|
+
// Expo peer deps they don't have installed — see the README.
|
|
5
|
+
export * from "./compareVersions.js";
|
|
6
|
+
export * from "./downloadAndInstallApk.js";
|
|
7
|
+
export * from "./githubReleases.js";
|
|
8
|
+
export * from "./parseChangelogNotes.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forthtilliath/expo-release-updates",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -8,15 +8,16 @@
|
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/Forthtilliath/
|
|
11
|
+
"url": "https://github.com/Forthtilliath/forthtilliath-packages.git",
|
|
12
12
|
"directory": "packages/expo-release-updates"
|
|
13
13
|
},
|
|
14
|
-
"homepage": "https://github.com/Forthtilliath/
|
|
15
|
-
"bugs": "https://github.com/Forthtilliath/
|
|
14
|
+
"homepage": "https://github.com/Forthtilliath/forthtilliath-packages/tree/main/packages/expo-release-updates#readme",
|
|
15
|
+
"bugs": "https://github.com/Forthtilliath/forthtilliath-packages/issues",
|
|
16
16
|
"files": [
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
19
|
"exports": {
|
|
20
|
+
".": "./dist/index.js",
|
|
20
21
|
"./*": "./dist/*.js"
|
|
21
22
|
},
|
|
22
23
|
"peerDependencies": {
|
|
@@ -24,10 +25,10 @@
|
|
|
24
25
|
"expo-intent-launcher": ">=12.0.0"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
|
-
"eslint": "
|
|
28
|
+
"eslint": "catalog:",
|
|
28
29
|
"expo-file-system": "~57.0.1",
|
|
29
30
|
"expo-intent-launcher": "~57.0.1",
|
|
30
|
-
"typescript": "
|
|
31
|
+
"typescript": "catalog:",
|
|
31
32
|
"vitest": "^4.1.10",
|
|
32
33
|
"@forthtilliath/eslint-config": "0.0.0",
|
|
33
34
|
"@forthtilliath/typescript-config": "0.0.0"
|