@gfean/react-native-bundle-drop 0.4.1 → 0.4.3
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/README.md +203 -64
- package/android/build.gradle +18 -0
- package/android/src/main/cpp/CMakeLists.txt +12 -0
- package/lib/CLI/cli.js +10 -17
- package/lib/CLI/logo.d.ts +9 -0
- package/lib/CLI/logo.js +26 -0
- package/lib/CLI/scripts/aipowered/scanner.js +22 -0
- package/lib/CLI/scripts/init-config.js +1 -2
- package/lib/CLI/scripts/upload-cli.js +72 -16
- package/lib/context.js +1 -1
- package/lib/loadConfig.d.ts +5 -1
- package/lib/scripts/bundle.js +32 -3
- package/lib/scripts/download-bundle.js +1 -1
- package/package.json +27 -13
- package/lib/scripts/upload-bundle.d.ts +0 -9
- package/lib/scripts/upload-bundle.js +0 -317
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Bundle Drop
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@gfean/react-native-bundle-drop)
|
|
4
4
|
[](#license)
|
|
@@ -6,36 +6,45 @@
|
|
|
6
6
|
[](https://bundledrop.app/docs)
|
|
7
7
|
[](https://developer.bundledrop.app)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
**Ship OTA updates to React Native with confidence.**
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Push instant over-the-air updates to your React Native apps and skip the App Store
|
|
12
|
+
and Play Store review cycle entirely. Full-bundle reliability with patch-sized
|
|
13
|
+
downloads — a drop-in [CodePush alternative](https://bundledrop.app/codepush-alternative)
|
|
14
|
+
for bare React Native.
|
|
12
15
|
|
|
13
|
-
[Website](https://bundledrop.app) • [Docs](https://bundledrop.app/docs) • [Dashboard](https://developer.bundledrop.app)
|
|
16
|
+
[Website](https://bundledrop.app) • [Docs](https://bundledrop.app/docs) • [Dashboard](https://developer.bundledrop.app) • [Coming from CodePush?](https://bundledrop.app/codepush-alternative)
|
|
14
17
|
|
|
15
18
|
---
|
|
16
19
|
|
|
17
|
-
## Why
|
|
20
|
+
## Why Bundle Drop?
|
|
18
21
|
|
|
19
22
|
Shipping a small fix should not require a full mobile release.
|
|
20
23
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- manage releases from a dedicated dashboard
|
|
24
|
+
| The old way | With Bundle Drop |
|
|
25
|
+
| --- | --- |
|
|
26
|
+
| Fix a typo, rebuild the whole app. | Publish the JavaScript change from your machine or CI. |
|
|
27
|
+
| Wait days on an App Store / Play Store review. | Compatible devices pick it up in minutes, no review cycle. |
|
|
28
|
+
| Users stay on the broken version until they manually update. | Roll it out gradually, and roll back instantly if something looks off. |
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
Over-the-air updates deliver the JavaScript and assets that run on top of your
|
|
31
|
+
existing native binary — so the fixes and features that don't touch native code
|
|
32
|
+
reach users the moment you publish them.
|
|
29
33
|
|
|
30
34
|
---
|
|
31
35
|
|
|
32
|
-
##
|
|
36
|
+
## Features
|
|
33
37
|
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
- target
|
|
37
|
-
-
|
|
38
|
-
-
|
|
38
|
+
- **Instant delivery** — publish an update and compatible devices pick it up on their next check.
|
|
39
|
+
- **Channel-based distribution** — ship to `develop`, `production`, `beta`, or any channel you define.
|
|
40
|
+
- **Targeted rollouts** — stage releases and target specific cohorts with user properties.
|
|
41
|
+
- **Rollback safety** — every install is a verified, immutable bundle; rollback is an instant local pointer switch.
|
|
42
|
+
- **Hybrid OTA transport** — full-bundle reliability with patch-sized downloads (see [below](#hybrid-ota-delivery)).
|
|
43
|
+
- **Version gating** — updates only reach binaries they're compatible with, so a JS update never lands on the wrong native build.
|
|
44
|
+
- **Works with your error stack** — per-bundle hashes and source maps keep stack traces accurate in Sentry, Bugsnag, Datadog, or anything else.
|
|
45
|
+
- **CI/CD friendly** — upload with a Personal Access Token from any pipeline.
|
|
46
|
+
|
|
47
|
+
Built for production React Native apps on iOS and Android.
|
|
39
48
|
|
|
40
49
|
---
|
|
41
50
|
|
|
@@ -43,6 +52,7 @@ Built for production React Native apps.
|
|
|
43
52
|
|
|
44
53
|
```bash
|
|
45
54
|
npm install @gfean/react-native-bundle-drop
|
|
55
|
+
# or: yarn add @gfean/react-native-bundle-drop
|
|
46
56
|
```
|
|
47
57
|
|
|
48
58
|
```bash
|
|
@@ -60,7 +70,17 @@ npx bundle-drop login
|
|
|
60
70
|
npx bundle-drop init
|
|
61
71
|
```
|
|
62
72
|
|
|
63
|
-
|
|
73
|
+
`init` generates `bundle.drop.config.js` from your logged-in account context.
|
|
74
|
+
Optionally, apply the native wiring automatically:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npx bundle-drop init-native # patches AppDelegate / MainApplication
|
|
78
|
+
npx bundle-drop init-metro # lets Metro resolve bundle.drop.config.js
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 2. Bootstrap Bundle Drop in your app
|
|
82
|
+
|
|
83
|
+
Call `init` once, as early as possible in your app entrypoint:
|
|
64
84
|
|
|
65
85
|
```ts
|
|
66
86
|
import { BundleDrop } from '@gfean/react-native-bundle-drop';
|
|
@@ -68,62 +88,75 @@ import { BundleDrop } from '@gfean/react-native-bundle-drop';
|
|
|
68
88
|
BundleDrop.init({
|
|
69
89
|
enabled: !__DEV__,
|
|
70
90
|
environment: __DEV__ ? 'development' : 'production',
|
|
91
|
+
channelName: 'develop', // the channel created for every new project by default
|
|
71
92
|
policy: 'on-next-launch',
|
|
72
|
-
channelName: 'General',
|
|
73
93
|
});
|
|
74
94
|
```
|
|
75
95
|
|
|
76
96
|
### 3. Ship an update
|
|
77
97
|
|
|
78
98
|
```bash
|
|
79
|
-
npx bundle-drop upload android --version 1.2.3 --channel
|
|
80
|
-
npx bundle-drop upload ios --plist-file ios/Info.plist --channel
|
|
99
|
+
npx bundle-drop upload android --version 1.2.3 --channel develop
|
|
100
|
+
npx bundle-drop upload ios --plist-file ios/Info.plist --channel develop
|
|
81
101
|
```
|
|
82
102
|
|
|
83
|
-
|
|
103
|
+
Add `--sourcemap` to keep crash reports readable, and `--token <PAT>` to upload
|
|
104
|
+
from CI/CD without an interactive login.
|
|
84
105
|
|
|
85
106
|
---
|
|
86
107
|
|
|
87
108
|
## Update Policies
|
|
88
109
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
- `manual`: check only, no automatic apply
|
|
92
|
-
- `immediate`: download and apply right away
|
|
93
|
-
- `on-next-launch`: stage now, apply on next launch
|
|
110
|
+
`policy` controls what happens after Bundle Drop hydrates its local state on startup:
|
|
94
111
|
|
|
95
|
-
|
|
112
|
+
| Policy | Behavior |
|
|
113
|
+
| --- | --- |
|
|
114
|
+
| `manual` | Check only when you call the APIs yourself. Default. |
|
|
115
|
+
| `immediate` | Download and apply a new bundle right away. |
|
|
116
|
+
| `on-next-launch` | Stage the update now, apply it on the next cold launch. |
|
|
96
117
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
BundleDrop installs complete immutable bundle folders, identified by a canonical
|
|
100
|
-
`bundleHash` for the full reconstructed file tree. Patch transports are only a
|
|
101
|
-
download optimization: the SDK reconstructs a complete target folder, validates
|
|
102
|
-
the manifest contract in JS, verifies file hashes/sizes with native batch
|
|
103
|
-
verification, then promotes `bundle-drop/bundles/{bundleHash}`.
|
|
104
|
-
The SDK always supports `asset-only-v1` patch sets and advertises
|
|
105
|
-
`xdelta3-vcdiff` when native xdelta support passes its probe.
|
|
106
|
-
|
|
107
|
-
The current production manifest contract is `manifestVersion: 1`. This is not a
|
|
108
|
-
legacy compatibility mode; it is the only accepted canonical manifest after the
|
|
109
|
-
hard shift. `jsBundleHash` is retained as metadata only.
|
|
110
|
-
|
|
111
|
-
When patch transport is unavailable or fails, the SDK falls back to the signed
|
|
112
|
-
full ZIP. Rollback remains a local pointer switch between verified bundle hashes.
|
|
118
|
+
`on-next-launch` is the safest choice for most apps: users never see a reload
|
|
119
|
+
mid-session, and the update is already on-device the next time they open the app.
|
|
113
120
|
|
|
114
121
|
---
|
|
115
122
|
|
|
116
|
-
##
|
|
117
|
-
|
|
118
|
-
|
|
123
|
+
## Driving Updates Manually
|
|
124
|
+
|
|
125
|
+
For custom "Update available" UI, use the `useBundleDrop()` hook. It subscribes to
|
|
126
|
+
the singleton runtime and exposes actions plus live state:
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
import { useBundleDrop } from '@gfean/react-native-bundle-drop';
|
|
130
|
+
|
|
131
|
+
function UpdateBanner() {
|
|
132
|
+
const { checkLatest, downloadUpdate, applyUpdate, pendingApply, isBusy } =
|
|
133
|
+
useBundleDrop();
|
|
134
|
+
|
|
135
|
+
if (pendingApply) {
|
|
136
|
+
return <Button title="Restart to update" onPress={applyUpdate} />;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<Button
|
|
141
|
+
title="Check for updates"
|
|
142
|
+
disabled={isBusy}
|
|
143
|
+
onPress={async () => {
|
|
144
|
+
await checkLatest();
|
|
145
|
+
await downloadUpdate();
|
|
146
|
+
}}
|
|
147
|
+
/>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
```
|
|
119
151
|
|
|
120
|
-
|
|
152
|
+
The same actions are available as standalone functions (`checkForUpdate`,
|
|
153
|
+
`downloadUpdate`, `applyUpdate`, `setChannel`, `reportHealthy`, …) for use outside React.
|
|
121
154
|
|
|
122
155
|
---
|
|
123
156
|
|
|
124
157
|
## Targeted Rollouts
|
|
125
158
|
|
|
126
|
-
|
|
159
|
+
Attach user properties to target specific cohorts when you stage a release:
|
|
127
160
|
|
|
128
161
|
```ts
|
|
129
162
|
import { setUserProperty } from '@gfean/react-native-bundle-drop';
|
|
@@ -133,29 +166,135 @@ await setUserProperty('age', 33);
|
|
|
133
166
|
await setUserProperty('beta', true);
|
|
134
167
|
```
|
|
135
168
|
|
|
136
|
-
|
|
137
|
-
non-empty, 128 characters or fewer, and cannot start with `$`, contain `.`,
|
|
138
|
-
use reserved prototype names.
|
|
169
|
+
Property values must be strings, finite numbers, or booleans. Keys are trimmed and
|
|
170
|
+
must be non-empty, 128 characters or fewer, and cannot start with `$`, contain `.`,
|
|
171
|
+
contain a null byte, or use reserved prototype names.
|
|
139
172
|
|
|
140
173
|
---
|
|
141
174
|
|
|
142
|
-
##
|
|
175
|
+
## Hybrid OTA Delivery
|
|
143
176
|
|
|
144
|
-
|
|
177
|
+
Bundle Drop installs complete, immutable bundle folders, each identified by a
|
|
178
|
+
canonical `bundleHash` for the full reconstructed file tree. Patch transports are
|
|
179
|
+
purely a download optimization: the SDK reconstructs the complete target folder,
|
|
180
|
+
validates the manifest contract in JS, verifies file hashes and sizes with native
|
|
181
|
+
batch verification, then promotes `bundle-drop/bundles/{bundleHash}`.
|
|
145
182
|
|
|
146
|
-
-
|
|
147
|
-
|
|
148
|
-
-
|
|
183
|
+
The result is **full-bundle reliability with patch-sized downloads**: you get the
|
|
184
|
+
integrity guarantees of shipping a whole bundle, without making every device
|
|
185
|
+
re-download everything on each release.
|
|
186
|
+
|
|
187
|
+
- The SDK always supports `asset-only-v1` patch sets and advertises `xdelta3-vcdiff`
|
|
188
|
+
when native xdelta support passes its probe.
|
|
189
|
+
- When patch transport is unavailable or fails, the SDK falls back to the signed full ZIP.
|
|
190
|
+
- Rollback stays a local pointer switch between already-verified bundle hashes.
|
|
191
|
+
|
|
192
|
+
The current production manifest contract is `manifestVersion: 1`. This is not a
|
|
193
|
+
legacy compatibility mode — it is the only accepted canonical manifest. `jsBundleHash`
|
|
194
|
+
is retained as metadata only.
|
|
149
195
|
|
|
150
196
|
---
|
|
151
197
|
|
|
152
|
-
##
|
|
198
|
+
## Observability
|
|
199
|
+
|
|
200
|
+
OTA shouldn't blind your crash reporter. Every bundle has a unique hash, and
|
|
201
|
+
`bundle-drop upload --sourcemap` produces source maps alongside the bundle so stack
|
|
202
|
+
traces stay accurate across every update. Use `getObservabilityContext()` to tag
|
|
203
|
+
error reports with the currently running bundle:
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
import { getObservabilityContext } from '@gfean/react-native-bundle-drop';
|
|
207
|
+
|
|
208
|
+
const context = await getObservabilityContext(); // e.g. attach to Sentry/Bugsnag scope
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Works with Sentry, Bugsnag, Datadog, or any error tracker. See the
|
|
212
|
+
[observability guide](https://bundledrop.app/docs/observability). Apps on
|
|
213
|
+
`@sentry/react-native` 7.8.x that combine Sentry's Metro wrapper with Hermes
|
|
214
|
+
should follow the guide's
|
|
215
|
+
[Sentry/Hermes OTA setup](https://bundledrop.app/docs/observability#sentry-and-hermes-ota-builds)
|
|
216
|
+
to keep content-derived Debug IDs from inflating binary patches.
|
|
153
217
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## API Reference
|
|
221
|
+
|
|
222
|
+
Import from `@gfean/react-native-bundle-drop`.
|
|
223
|
+
|
|
224
|
+
**Runtime controller**
|
|
225
|
+
|
|
226
|
+
| Export | Description |
|
|
227
|
+
| --- | --- |
|
|
228
|
+
| `BundleDrop.init(options)` | Initialize the runtime for the app process. |
|
|
229
|
+
| `BundleDrop.setChannel(name)` / `setChannel` | Change the active channel for singleton actions. |
|
|
230
|
+
| `BundleDrop.getChannelName()` / `getChannelName` | Read the active channel. |
|
|
231
|
+
| `BundleDrop.reportHealthy()` / `reportHealthy` | Mark the running OTA candidate healthy for this device. |
|
|
232
|
+
|
|
233
|
+
**`BundleDrop.init(options)`**
|
|
234
|
+
|
|
235
|
+
| Option | Type | Default | Description |
|
|
236
|
+
| --- | --- | --- | --- |
|
|
237
|
+
| `environment` | `string` | — (required) | App environment shown in analytics, e.g. `production`, `staging`, `development`. |
|
|
238
|
+
| `enabled` | `boolean` | `true` | When `false`, the SDK stays configured but fully no-ops. |
|
|
239
|
+
| `channelName` | `string` | config `defaultChannel` (`develop`) | Initial OTA channel for this process. |
|
|
240
|
+
| `policy` | `'manual' \| 'immediate' \| 'on-next-launch'` | `'manual'` | Startup behavior after hydration. |
|
|
241
|
+
| `checkOnly` | `boolean` | `false` | Startup performs only a resolve/check, never download/apply. |
|
|
242
|
+
| `onStatusUpdate` | `(status: string) => void` | — | Listener for human-readable status messages. |
|
|
243
|
+
|
|
244
|
+
**Update actions** — `checkForUpdate`, `downloadUpdate`, `installBundle`, `applyUpdate`, `getUpdateState`, `getInstalledBundleInfo`, `getAvailableBundles`, `getAvailableChannels`.
|
|
245
|
+
|
|
246
|
+
**React** — `useBundleDrop()` → live state (`status`, `isEnabled`, `isBusy`, `channelName`, `installedInfo`, `pendingApply`, `hasBundle`, `availableChannels`) plus the action functions above.
|
|
247
|
+
|
|
248
|
+
**User properties** — `setUserProperty`, `removeUserProperty`, `getUserProperties`, `getCurrentUserProperties`, `resetUserProperties`.
|
|
249
|
+
|
|
250
|
+
**Errors** — `BundleDropError`, `isBundleDropError`.
|
|
251
|
+
|
|
252
|
+
**CLI** (`npx bundle-drop <command>`) — `login`, `logout`, `whoami`, `init`, `init-native`, `init-metro`, `upload <ios|android>`.
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## Requirements
|
|
257
|
+
|
|
258
|
+
- Bare React Native on iOS and Android (`react-native >= 0.71`, `react >= 17`).
|
|
259
|
+
- iOS 13.0 or newer.
|
|
260
|
+
- A Bundle Drop account and project (`npx bundle-drop login && npx bundle-drop init`).
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Good To Know
|
|
265
|
+
|
|
266
|
+
Bundle Drop is an OTA delivery system for React Native, not a magic bypass of how
|
|
267
|
+
mobile apps work. A few things to keep in mind so it works the way you expect:
|
|
268
|
+
|
|
269
|
+
- **OTA covers JavaScript and assets, not native code.** Anything that changes the
|
|
270
|
+
native binary — new native modules, native dependency upgrades, permission or
|
|
271
|
+
config changes, a React Native version bump — still ships through a normal App
|
|
272
|
+
Store / Play Store release. Bundle Drop updates run on top of that native binary.
|
|
273
|
+
- **Use it within store policies.** Over-the-air updates are meant to fix bugs and
|
|
274
|
+
improve the app you already shipped, not to change its core purpose or sneak in
|
|
275
|
+
behavior that would fail review. Ship responsibly and stay within Apple and Google
|
|
276
|
+
guidelines.
|
|
277
|
+
- **Version gating is a feature, not a bug.** A JS bundle is only delivered to
|
|
278
|
+
binaries it's compatible with. If a device is on an older native build, it won't
|
|
279
|
+
receive an incompatible update — that's what keeps rollouts safe.
|
|
280
|
+
- **It's a hosted service.** Bundle Drop needs its backend and your project to
|
|
281
|
+
resolve, sign, and serve bundles. It is not a zero-backend, offline-only tool.
|
|
282
|
+
- **Native changes need a rebuild.** Updating this package's native code requires
|
|
283
|
+
rebuilding the host app; `nativeVersion` tracks that boundary (bump it → run `pod install`).
|
|
284
|
+
- **It is not a crash reporter.** Bundle Drop keeps your existing error tracker
|
|
285
|
+
accurate across OTA updates; it doesn't replace Sentry, Bugsnag, or Datadog.
|
|
286
|
+
- **Not for the Expo Go / managed workflow.** You need a native build (bare RN or an
|
|
287
|
+
Expo prebuild) to install the native module.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## Docs & Links
|
|
292
|
+
|
|
293
|
+
- Website: [bundledrop.app](https://bundledrop.app)
|
|
294
|
+
- Docs: [bundledrop.app/docs](https://bundledrop.app/docs)
|
|
295
|
+
- Dashboard: [developer.bundledrop.app](https://developer.bundledrop.app)
|
|
296
|
+
- Migrating from CodePush: [bundledrop.app/codepush-alternative](https://bundledrop.app/codepush-alternative)
|
|
297
|
+
- Issues: [github.com/GFean/react-native-bundle-drop/issues](https://github.com/GFean/react-native-bundle-drop/issues)
|
|
159
298
|
|
|
160
299
|
---
|
|
161
300
|
|
package/android/build.gradle
CHANGED
|
@@ -102,6 +102,24 @@ repositories {
|
|
|
102
102
|
google()
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
if (project.hasProperty("standalone")) {
|
|
106
|
+
// The standalone unit-test build resolves "react-android:+" to exercise the module
|
|
107
|
+
// against the newest React Native. Gradle's "+" also matches pre-releases, and a
|
|
108
|
+
// pre-release react-android (e.g. 0.87.0-rc.1) can ship newer Kotlin metadata than
|
|
109
|
+
// the standalone Kotlin compiler (BundleDrop_kotlinVersion) can read, which breaks
|
|
110
|
+
// compileDebugKotlin. Reject pre-release candidates so "+" keeps meaning "latest
|
|
111
|
+
// stable" without pinning a specific version.
|
|
112
|
+
configurations.all {
|
|
113
|
+
resolutionStrategy.componentSelection.all { selection ->
|
|
114
|
+
if (selection.candidate.group == "com.facebook.react"
|
|
115
|
+
&& selection.candidate.module == "react-android"
|
|
116
|
+
&& selection.candidate.version ==~ /(?i).*[-.](rc|alpha|beta|snapshot|dev|preview|m)\d*.*/) {
|
|
117
|
+
selection.reject("pre-release React Native is unsupported by the pinned standalone Kotlin toolchain")
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
105
123
|
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
106
124
|
|
|
107
125
|
dependencies {
|
|
@@ -26,6 +26,18 @@ set_target_properties(
|
|
|
26
26
|
C_STANDARD_REQUIRED ON
|
|
27
27
|
)
|
|
28
28
|
|
|
29
|
+
# Force 16 KB ELF segment alignment on this shared library. Google Play rejects
|
|
30
|
+
# apps whose native libraries are not 16 KB page-size compatible on Android 15+
|
|
31
|
+
# devices. Setting the flags directly on the target is reliable across NDK
|
|
32
|
+
# versions; the ANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES gradle argument alone does
|
|
33
|
+
# not consistently reach this target's link line on NDK r27 and lower.
|
|
34
|
+
target_link_options(
|
|
35
|
+
bundledropxdelta
|
|
36
|
+
PRIVATE
|
|
37
|
+
"-Wl,-z,max-page-size=16384"
|
|
38
|
+
"-Wl,-z,common-page-size=16384"
|
|
39
|
+
)
|
|
40
|
+
|
|
29
41
|
target_compile_definitions(
|
|
30
42
|
bundledropxdelta
|
|
31
43
|
PRIVATE
|
package/lib/CLI/cli.js
CHANGED
|
@@ -8,21 +8,14 @@ exports.buildProgram = void 0;
|
|
|
8
8
|
const axios_1 = __importDefault(require("axios"));
|
|
9
9
|
const chalk_1 = __importDefault(require("chalk"));
|
|
10
10
|
const commander_1 = require("commander");
|
|
11
|
-
const figures_1 = __importDefault(require("figures"));
|
|
12
11
|
const fs_1 = __importDefault(require("fs"));
|
|
13
12
|
const os_1 = __importDefault(require("os"));
|
|
14
13
|
const path_1 = __importDefault(require("path"));
|
|
15
14
|
const upload_cli_1 = __importDefault(require("./scripts/upload-cli"));
|
|
16
15
|
const post_init_1 = require("./scripts/post-init");
|
|
16
|
+
const logo_1 = require("./logo");
|
|
17
17
|
const package_json_1 = __importDefault(require("../../package.json"));
|
|
18
|
-
const logo =
|
|
19
|
-
______ ______
|
|
20
|
-
|_ _ \\ |_ _ \`.
|
|
21
|
-
| |_) | | | \`. \\
|
|
22
|
-
| __'. | | | |
|
|
23
|
-
_| |__) |_| |_.' /
|
|
24
|
-
|_______/|______.'
|
|
25
|
-
`) + chalk_1.default.bold.cyanBright(`\n${figures_1.default.star} React Native Bundle Drop CLI ${figures_1.default.star}`);
|
|
18
|
+
const logo = (0, logo_1.buildBundleDropLogo)();
|
|
26
19
|
const DEFAULT_SERVER_URL = 'https://api.bundledrop.app';
|
|
27
20
|
const DOCS_CLI_URL = 'https://bundledrop.app/docs/cli';
|
|
28
21
|
const DOCS_UPLOADING_URL = 'https://bundledrop.app/docs/uploading';
|
|
@@ -97,9 +90,9 @@ ${chalk_1.default.bold.cyan('Available Commands:')}
|
|
|
97
90
|
${chalk_1.default.bold.cyan('Common Usage:')}
|
|
98
91
|
${chalk_1.default.gray('bundle-drop login')}
|
|
99
92
|
${chalk_1.default.gray('bundle-drop init')}
|
|
100
|
-
${chalk_1.default.gray('bundle-drop upload android --version 1.2.3 --channel
|
|
101
|
-
${chalk_1.default.gray('bundle-drop upload ios --plist-file ios/Info.plist --channel
|
|
102
|
-
${chalk_1.default.gray('bundle-drop upload android --buildgradle-path android/app/build.gradle --channel
|
|
93
|
+
${chalk_1.default.gray('bundle-drop upload android --version 1.2.3 --channel develop')}
|
|
94
|
+
${chalk_1.default.gray('bundle-drop upload ios --plist-file ios/Info.plist --channel develop')}
|
|
95
|
+
${chalk_1.default.gray('bundle-drop upload android --buildgradle-path android/app/build.gradle --channel develop --release-notes "Fixes"')}
|
|
103
96
|
|
|
104
97
|
${chalk_1.default.gray('Docs →')} ${chalk_1.default.underline.gray(DOCS_CLI_URL)}
|
|
105
98
|
${chalk_1.default.gray('Uploading →')} ${chalk_1.default.underline.gray(DOCS_UPLOADING_URL)}
|
|
@@ -119,11 +112,11 @@ ${chalk_1.default.gray('CI/CD →')} ${chalk_1.default.underline.gray(DOCS_CI_CD
|
|
|
119
112
|
.description(chalk_1.default.whiteBright('Bundle and upload an OTA zip to the server'))
|
|
120
113
|
.addHelpText('after', `
|
|
121
114
|
${chalk_1.default.bold('Examples:')}
|
|
122
|
-
${chalk_1.default.gray('bundle-drop upload android --version 1.2.3 --channel
|
|
123
|
-
${chalk_1.default.gray('bundle-drop upload ios --plist-file ios/Info.plist --channel
|
|
124
|
-
${chalk_1.default.gray('bundle-drop upload android --buildgradle-path android/app/build.gradle --channel
|
|
125
|
-
${chalk_1.default.gray('bundle-drop upload android --version 1.2.3 --channel
|
|
126
|
-
${chalk_1.default.gray('bundle-drop upload android --version 1.2.3 --channel
|
|
115
|
+
${chalk_1.default.gray('bundle-drop upload android --version 1.2.3 --channel develop')}
|
|
116
|
+
${chalk_1.default.gray('bundle-drop upload ios --plist-file ios/Info.plist --channel develop')}
|
|
117
|
+
${chalk_1.default.gray('bundle-drop upload android --buildgradle-path android/app/build.gradle --channel beta --release-notes "Bug fixes"')}
|
|
118
|
+
${chalk_1.default.gray('bundle-drop upload android --version 1.2.3 --channel develop --token bdp_pat_xxx')}
|
|
119
|
+
${chalk_1.default.gray('bundle-drop upload android --version 1.2.3 --channel develop --sourcemap --artifact-dir ./build/bundledrop')}
|
|
127
120
|
|
|
128
121
|
${chalk_1.default.gray('Uploading docs →')} ${chalk_1.default.underline.gray(DOCS_UPLOADING_URL)}
|
|
129
122
|
${chalk_1.default.gray('CI/CD docs →')} ${chalk_1.default.underline.gray(DOCS_CI_CD_URL)}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** 24-bit truecolor half-block render of the Bundle Drop logo. */
|
|
2
|
+
export declare const BUNDLE_DROP_LOGO_TRUECOLOR = "\u001B[0m \u001B[38;2;49;219;247m\u001B[48;2;53;239;251m\u2580\u001B[38;2;53;236;252m\u001B[48;2;52;233;251m\u2580\u001B[38;2;54;243;255m\u001B[48;2;49;225;247m\u2580\u001B[38;2;52;232;250m\u001B[48;2;51;229;249m\u2580\u001B[38;2;51;233;251m\u001B[48;2;53;238;255m\u2580\u001B[38;2;52;235;252m\u001B[49m\u2584\u001B[38;2;51;231;250m\u2584\u001B[0m \u001B[38;2;52;231;249m\u2584\u001B[38;2;52;235;252m\u2584\u001B[38;2;52;233;251m\u001B[48;2;53;238;255m\u2580\u001B[38;2;51;232;250m\u001B[48;2;51;228;248m\u2580\u001B[38;2;55;243;255m\u001B[48;2;51;225;247m\u2580\u001B[38;2;52;236;252m\u001B[48;2;52;232;251m\u2580\u001B[38;2;50;220;243m\u001B[48;2;53;238;251m\u2580\u001B[0m\n\u001B[0m \u001B[38;2;51;227;249m\u001B[48;2;51;227;248m\u2580\u001B[38;2;54;240;253m\u001B[48;2;50;226;246m\u2580\u001B[0m \u001B[38;2;52;233;251m\u2580\u001B[38;2;58;255;255m\u001B[48;2;50;229;248m\u2580\u001B[38;2;52;236;250m\u001B[48;2;54;241;251m\u2580\u001B[38;2;51;232;251m\u001B[49m\u2584\u001B[38;2;51;231;249m\u2584\u001B[38;2;53;236;250m\u001B[48;2;54;241;252m\u2580\u001B[38;2;57;255;255m\u001B[48;2;52;231;249m\u2580\u001B[38;2;51;233;250m\u001B[49m\u2580\u001B[0m \u001B[38;2;55;246;255m\u001B[48;2;50;225;247m\u2580\u001B[38;2;51;228;248m\u001B[48;2;51;227;247m\u2580\u001B[0m\n\u001B[0m \u001B[38;2;51;228;248m\u001B[48;2;51;228;248m\u2580\u001B[38;2;50;228;247m\u001B[48;2;50;229;248m\u2580\u001B[0m \u001B[38;2;46;212;243m\u001B[48;2;53;240;252m\u2580\u001B[38;2;55;247;255m\u001B[48;2;51;232;251m\u2580\u001B[38;2;57;253;255m\u001B[48;2;52;233;252m\u2580\u001B[38;2;47;216;245m\u001B[48;2;54;239;251m\u2580\u001B[0m \u001B[38;2;51;227;247m\u001B[48;2;50;227;246m\u2580\u001B[38;2;50;227;248m\u001B[48;2;51;227;247m\u2580\u001B[0m\n\u001B[0m \u001B[38;2;51;227;247m\u001B[48;2;49;227;247m\u2580\u001B[38;2;51;226;248m\u001B[48;2;53;237;253m\u2580\u001B[0m \u001B[38;2;52;232;249m\u2584\u001B[38;2;52;234;251m\u001B[48;2;56;251;255m\u2580\u001B[38;2;54;240;251m\u001B[48;2;48;218;243m\u2580\u001B[0m \u001B[38;2;54;241;251m\u001B[48;2;48;221;243m\u2580\u001B[38;2;52;234;251m\u001B[48;2;57;252;255m\u2580\u001B[38;2;52;231;249m\u001B[49m\u2584\u001B[0m \u001B[38;2;51;228;248m\u001B[48;2;54;242;255m\u2580\u001B[38;2;50;227;248m\u001B[48;2;51;226;249m\u2580\u001B[0m\n\u001B[0m \u001B[38;2;52;233;251m\u2584\u001B[38;2;52;233;250m\u2584\u001B[38;2;51;232;250m\u001B[48;2;54;241;255m\u2580\u001B[38;2;54;239;253m\u001B[48;2;52;231;251m\u2580\u001B[38;2;51;228;248m\u001B[48;2;51;229;248m\u2580\u001B[38;2;51;228;247m\u001B[48;2;51;228;249m\u2580\u001B[38;2;51;229;248m\u001B[48;2;51;228;248m\u2580\u001B[38;2;51;227;248m\u001B[48;2;54;242;255m\u2580\u001B[38;2;57;254;255m\u001B[48;2;49;228;248m\u2580\u001B[38;2;49;224;246m\u001B[49m\u2580\u001B[0m \u001B[38;2;2;205;235m\u001B[48;2;1;209;238m\u2580\u001B[38;2;2;203;233m\u2580\u001B[0m \u001B[38;2;48;224;246m\u2580\u001B[38;2;57;253;255m\u001B[48;2;51;226;248m\u2580\u001B[38;2;50;227;248m\u001B[48;2;55;244;255m\u2580\u001B[38;2;51;228;248m\u001B[48;2;50;226;246m\u2580\u001B[48;2;51;228;249m\u2580\u001B[38;2;50;227;247m\u001B[48;2;51;227;247m\u2580\u001B[38;2;53;237;252m\u001B[48;2;51;230;250m\u2580\u001B[38;2;52;231;250m\u001B[48;2;53;239;255m\u2580\u001B[38;2;52;232;250m\u001B[49m\u2584\u001B[38;2;52;234;251m\u2584\u001B[38;2;49;230;250m\u2584\u001B[0m\n\u001B[0m \u001B[38;2;52;234;249m\u2584\u001B[38;2;51;232;249m\u001B[48;2;56;251;255m\u2580\u001B[38;2;55;247;255m\u001B[48;2;51;232;250m\u2580\u001B[38;2;52;233;251m\u001B[49m\u2580\u001B[38;2;51;233;251m\u2580\u001B[38;2;51;224;246m\u2580\u001B[38;2;50;230;248m\u001B[48;2;52;228;246m\u2580\u001B[38;2;52;234;251m\u001B[48;2;54;241;255m\u2580\u001B[38;2;49;224;247m\u001B[49m\u2584\u001B[38;2;50;226;246m\u001B[48;2;53;238;255m\u2580\u001B[38;2;54;241;252m\u001B[48;2;49;224;246m\u2580\u001B[0m \u001B[38;2;1;205;233m\u2584\u001B[38;2;1;207;236m\u001B[48;2;1;220;251m\u2580\u001B[38;2;1;213;243m\u001B[48;2;1;214;244m\u2580\u001B[38;2;1;212;242m\u001B[48;2;1;217;247m\u2580\u001B[38;2;1;206;236m\u001B[48;2;1;221;252m\u2580\u001B[38;2;1;203;234m\u001B[49m\u2584\u001B[0m \u001B[38;2;54;241;251m\u001B[48;2;49;223;246m\u2580\u001B[38;2;50;226;247m\u001B[48;2;54;239;255m\u2580\u001B[38;2;50;226;248m\u001B[49m\u2584\u001B[38;2;52;236;251m\u001B[48;2;53;239;255m\u2580\u001B[38;2;51;229;248m\u001B[49m\u2580\u001B[0m \u001B[38;2;51;234;251m\u2580\u001B[38;2;52;233;250m\u2580\u001B[38;2;56;249;255m\u001B[48;2;51;232;250m\u2580\u001B[38;2;51;234;250m\u001B[48;2;56;249;255m\u2580\u001B[38;2;52;235;251m\u001B[49m\u2584\u001B[0m\n\u001B[38;2;50;226;247m\u001B[48;2;54;243;255m\u2580\u001B[38;2;55;244;255m\u001B[48;2;50;226;247m\u2580\u001B[38;2;51;227;247m\u001B[49m\u2580\u001B[0m \u001B[38;2;50;226;247m\u001B[48;2;51;230;248m\u2580\u001B[38;2;56;251;255m\u001B[48;2;57;255;255m\u2580\u001B[38;2;50;229;249m\u001B[48;2;56;230;247m\u2580\u001B[0m \u001B[38;2;3;200;231m\u001B[48;2;2;212;241m\u2580\u001B[38;2;1;230;255m\u001B[48;2;1;218;247m\u2580\u001B[38;2;1;217;248m\u001B[48;2;0;206;233m\u2580\u001B[38;2;1;205;233m\u001B[48;2;0;210;240m\u2580\u001B[38;2;1;205;234m\u001B[48;2;0;208;237m\u2580\u001B[38;2;1;212;242m\u001B[49m\u2580\u001B[38;2;1;232;255m\u001B[48;2;1;219;248m\u2580\u001B[38;2;3;204;234m\u001B[48;2;2;212;241m\u2580\u001B[0m \u001B[38;2;50;229;249m\u001B[48;2;55;230;248m\u2580\u001B[38;2;57;254;255m\u001B[48;2;57;254;255m\u2580\u001B[38;2;51;226;247m\u001B[48;2;51;227;249m\u2580\u001B[0m \u001B[38;2;50;224;247m\u2580\u001B[38;2;55;245;255m\u001B[48;2;49;223;247m\u2580\u001B[38;2;50;226;247m\u001B[48;2;55;244;255m\u2580\u001B[0m\n\u001B[38;2;52;234;251m\u001B[48;2;49;225;246m\u2580\u001B[38;2;50;229;248m\u001B[48;2;57;255;255m\u2580\u001B[38;2;52;231;247m\u001B[49m\u2584\u001B[0m \u001B[38;2;51;226;247m\u001B[48;2;51;232;249m\u2580\u001B[38;2;51;228;249m\u001B[48;2;60;229;249m\u2580\u001B[38;2;0;199;231m\u001B[49m\u2584\u001B[38;2;1;205;234m\u001B[48;2;2;206;235m\u2580\u001B[38;2;0;213;244m\u001B[49m\u2580\u001B[38;2;0;197;228m\u001B[48;2;0;207;238m\u2580\u001B[38;2;1;214;242m\u001B[48;2;0;209;238m\u2580\u001B[38;2;1;213;242m\u001B[48;2;0;201;230m\u2580\u001B[38;2;0;205;232m\u001B[48;2;1;214;242m\u2580\u001B[38;2;0;212;240m\u001B[48;2;1;215;243m\u2580\u001B[38;2;0;205;234m\u001B[48;2;0;202;234m\u2580\u001B[38;2;0;213;243m\u001B[49m\u2580\u001B[38;2;1;204;234m\u001B[48;2;2;207;236m\u2580\u001B[38;2;0;199;230m\u001B[49m\u2584\u001B[38;2;50;229;249m\u001B[48;2;58;232;249m\u2580\u001B[38;2;50;225;247m\u001B[48;2;51;234;250m\u2580\u001B[0m \u001B[38;2;51;230;248m\u2584\u001B[38;2;51;229;248m\u001B[48;2;57;255;255m\u2580\u001B[38;2;52;234;251m\u001B[48;2;50;225;246m\u2580\u001B[0m\n\u001B[0m \u001B[38;2;51;230;248m\u2580\u001B[38;2;58;255;255m\u001B[48;2;50;228;247m\u2580\u001B[38;2;53;233;251m\u001B[48;2;52;236;252m\u2580\u001B[38;2;54;241;255m\u001B[49m\u2584\u001B[38;2;52;230;249m\u2584\u001B[38;2;51;226;249m\u2584\u001B[38;2;50;225;246m\u001B[48;2;52;229;249m\u2580\u001B[38;2;55;249;255m\u001B[48;2;51;233;251m\u2580\u001B[0m \u001B[38;2;0;204;233m\u001B[48;2;0;204;234m\u2580\u001B[38;2;1;206;236m\u001B[48;2;1;205;234m\u2580\u001B[38;2;0;208;237m\u001B[48;2;0;208;237m\u2580\u001B[38;2;1;205;233m\u001B[48;2;1;209;239m\u2580\u001B[38;2;0;207;236m\u001B[49m\u2584\u001B[38;2;0;209;236m\u001B[48;2;0;205;233m\u2580\u001B[38;2;0;213;242m\u001B[48;2;0;205;235m\u2580\u001B[38;2;0;205;235m\u001B[48;2;1;229;255m\u2580\u001B[38;2;1;220;248m\u001B[48;2;1;227;255m\u2580\u001B[38;2;0;205;234m\u001B[48;2;0;208;233m\u2580\u001B[38;2;1;206;235m\u001B[48;2;1;206;235m\u2580\u001B[38;2;0;204;233m\u001B[48;2;0;205;234m\u2580\u001B[0m \u001B[38;2;55;250;255m\u001B[48;2;51;232;251m\u2580\u001B[38;2;50;228;247m\u001B[48;2;51;229;249m\u2580\u001B[38;2;49;225;247m\u001B[49m\u2584\u001B[38;2;51;233;249m\u2584\u001B[38;2;55;244;255m\u2584\u001B[38;2;53;233;252m\u001B[48;2;53;235;252m\u2580\u001B[38;2;58;255;255m\u001B[48;2;51;228;246m\u2580\u001B[38;2;51;228;247m\u001B[49m\u2580\u001B[0m\n\u001B[0m \u001B[38;2;51;234;250m\u2580\u001B[38;2;52;233;251m\u2580\u001B[38;2;54;239;255m\u001B[48;2;51;231;250m\u2580\u001B[38;2;53;235;255m\u001B[48;2;53;236;253m\u2580\u001B[38;2;51;233;254m\u001B[48;2;49;227;248m\u2580\u001B[0m \u001B[38;2;0;205;234m\u2580\u001B[38;2;1;206;234m\u001B[48;2;1;205;234m\u2580\u001B[0m \u001B[38;2;1;230;255m\u001B[48;2;0;205;232m\u2580\u001B[38;2;1;236;255m\u001B[48;2;1;223;249m\u2580\u001B[38;2;0;207;235m\u001B[48;2;0;206;234m\u2580\u001B[38;2;0;205;236m\u001B[48;2;0;204;233m\u2580\u001B[38;2;1;231;255m\u001B[48;2;1;222;249m\u2580\u001B[38;2;1;224;255m\u001B[48;2;0;206;234m\u2580\u001B[0m \u001B[38;2;1;205;234m\u001B[48;2;1;206;235m\u2580\u001B[38;2;0;204;234m\u001B[48;2;0;200;230m\u2580\u001B[0m \u001B[38;2;51;232;253m\u001B[48;2;49;227;247m\u2580\u001B[38;2;53;235;255m\u001B[48;2;53;236;253m\u2580\u001B[38;2;54;241;255m\u001B[48;2;51;230;248m\u2580\u001B[38;2;52;232;251m\u001B[49m\u2580\u001B[38;2;52;233;252m\u2580\u001B[0m\n\u001B[0m \u001B[38;2;51;226;247m\u001B[48;2;51;228;248m\u2580\u001B[38;2;51;230;249m\u001B[48;2;50;227;246m\u2580\u001B[0m \u001B[38;2;1;206;236m\u2580\u001B[38;2;1;219;246m\u001B[48;2;1;208;237m\u2580\u001B[38;2;0;209;240m\u001B[48;2;1;242;255m\u2580\u001B[38;2;1;211;241m\u001B[49m\u2584\u001B[38;2;0;205;234m\u2584\u2584\u001B[38;2;1;211;241m\u2584\u001B[38;2;0;208;238m\u001B[48;2;1;242;255m\u2580\u001B[38;2;1;220;246m\u001B[48;2;1;208;237m\u2580\u001B[38;2;1;207;234m\u001B[49m\u2580\u001B[0m \u001B[38;2;51;228;248m\u001B[48;2;51;228;248m\u2580\u001B[38;2;51;226;247m\u2580\u001B[0m\n\u001B[0m \u001B[38;2;50;227;247m\u001B[48;2;51;228;248m\u2580\u001B[38;2;50;227;248m\u001B[48;2;50;229;248m\u2580\u001B[0m \u001B[38;2;2;208;238m\u2580\u001B[38;2;2;212;241m\u2580\u001B[38;2;2;210;239m\u2580\u001B[38;2;2;209;239m\u2580\u001B[38;2;2;211;241m\u2580\u001B[38;2;2;211;239m\u2580\u001B[0m \u001B[38;2;51;227;247m\u001B[48;2;51;228;247m\u2580\u001B[38;2;51;227;248m\u001B[48;2;50;229;248m\u2580\u001B[0m\n\u001B[0m \u001B[38;2;50;227;247m\u001B[48;2;50;228;247m\u2580\u001B[38;2;51;224;247m\u001B[48;2;54;239;251m\u2580\u001B[0m \u001B[38;2;51;230;250m\u2584\u001B[38;2;54;242;255m\u2584\u001B[38;2;53;240;253m\u001B[48;2;53;238;251m\u2580\u001B[38;2;52;228;247m\u001B[48;2;49;225;245m\u2580\u001B[38;2;52;229;249m\u001B[48;2;52;228;248m\u2580\u001B[38;2;53;238;252m\u001B[48;2;53;240;251m\u2580\u001B[38;2;53;237;252m\u001B[49m\u2584\u001B[38;2;51;231;250m\u2584\u001B[0m \u001B[38;2;51;225;247m\u001B[48;2;55;245;255m\u2580\u001B[38;2;50;227;247m\u001B[48;2;50;227;249m\u2580\u001B[0m\n\u001B[0m \u001B[38;2;53;238;251m\u001B[48;2;48;219;246m\u2580\u001B[38;2;52;233;252m\u001B[48;2;52;236;252m\u2580\u001B[38;2;50;227;247m\u001B[48;2;53;239;255m\u2580\u001B[38;2;51;228;248m\u001B[48;2;52;234;253m\u2580\u001B[38;2;52;232;250m\u001B[48;2;52;233;250m\u2580\u001B[38;2;55;244;255m\u001B[48;2;51;226;245m\u2580\u001B[38;2;53;234;251m\u001B[49m\u2580\u001B[0m \u001B[38;2;52;233;250m\u2580\u001B[38;2;56;249;255m\u001B[48;2;51;229;247m\u2580\u001B[38;2;51;232;250m\u001B[48;2;52;234;250m\u2580\u001B[38;2;50;226;247m\u001B[48;2;52;233;252m\u2580\u001B[38;2;51;225;245m\u001B[48;2;54;241;255m\u2580\u001B[38;2;52;234;251m\u001B[48;2;53;236;252m\u2580\u001B[38;2;53;237;251m\u001B[48;2;50;218;245m\u2580\u001B[0m";
|
|
3
|
+
/** Monochrome silhouette (glyphs only); colorized at runtime for non-truecolor terminals. */
|
|
4
|
+
export declare const BUNDLE_DROP_LOGO_MONO = " \u2588\u2588\u2588\u2588\u2588\u2584\u2584 \u2584\u2584\u2588\u2588\u2588\u2588\u2588\n \u2588\u2588 \u2580\u2588\u2588\u2584\u2584\u2588\u2588\u2580 \u2588\u2588\n \u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\n \u2588\u2588 \u2584\u2588\u2588 \u2588\u2588\u2584 \u2588\u2588\n \u2584\u2584\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2580 \u2588\u2588 \u2580\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584\u2584\u2584\n \u2584\u2588\u2588\u2580\u2580\u2580\u2588\u2588\u2584\u2588\u2588 \u2584\u2588\u2588\u2588\u2588\u2584 \u2588\u2588\u2584\u2588\u2580 \u2580\u2580\u2588\u2588\u2584\n\u2588\u2588\u2580 \u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2580\u2588\u2588 \u2588\u2588\u2588 \u2580\u2588\u2588\n\u2588\u2588\u2584 \u2588\u2588\u2584\u2588\u2580\u2588\u2588\u2588\u2588\u2588\u2588\u2580\u2588\u2584\u2588\u2588 \u2584\u2588\u2588\n \u2580\u2588\u2588\u2584\u2584\u2584\u2588\u2588 \u2588\u2588\u2588\u2588\u2584\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2584\u2584\u2584\u2588\u2588\u2580\n \u2580\u2580\u2588\u2588\u2588 \u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2580\u2580\n \u2588\u2588 \u2580\u2588\u2588\u2584\u2584\u2584\u2584\u2588\u2588\u2580 \u2588\u2588\n \u2588\u2588 \u2580\u2580\u2580\u2580\u2580\u2580 \u2588\u2588\n \u2588\u2588 \u2584\u2584\u2588\u2588\u2588\u2588\u2584\u2584 \u2588\u2588\n \u2588\u2588\u2588\u2588\u2588\u2588\u2580 \u2580\u2588\u2588\u2588\u2588\u2588\u2588";
|
|
5
|
+
/**
|
|
6
|
+
* Builds the CLI banner. Truecolor terminals get the full-color logo; every
|
|
7
|
+
* other terminal falls back to a cyan silhouette so the banner still renders.
|
|
8
|
+
*/
|
|
9
|
+
export declare const buildBundleDropLogo: () => string;
|
package/lib/CLI/logo.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AUTO-GENERATED from bundle-drop-logo-no-bg.png (half-block render, width 32).
|
|
3
|
+
// The string constants below are generated; regenerate rather than hand-editing them.
|
|
4
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.buildBundleDropLogo = exports.BUNDLE_DROP_LOGO_MONO = exports.BUNDLE_DROP_LOGO_TRUECOLOR = void 0;
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const figures_1 = __importDefault(require("figures"));
|
|
11
|
+
/** 24-bit truecolor half-block render of the Bundle Drop logo. */
|
|
12
|
+
exports.BUNDLE_DROP_LOGO_TRUECOLOR = "\u001b[0m \u001b[38;2;49;219;247m\u001b[48;2;53;239;251m\u2580\u001b[38;2;53;236;252m\u001b[48;2;52;233;251m\u2580\u001b[38;2;54;243;255m\u001b[48;2;49;225;247m\u2580\u001b[38;2;52;232;250m\u001b[48;2;51;229;249m\u2580\u001b[38;2;51;233;251m\u001b[48;2;53;238;255m\u2580\u001b[38;2;52;235;252m\u001b[49m\u2584\u001b[38;2;51;231;250m\u2584\u001b[0m \u001b[38;2;52;231;249m\u2584\u001b[38;2;52;235;252m\u2584\u001b[38;2;52;233;251m\u001b[48;2;53;238;255m\u2580\u001b[38;2;51;232;250m\u001b[48;2;51;228;248m\u2580\u001b[38;2;55;243;255m\u001b[48;2;51;225;247m\u2580\u001b[38;2;52;236;252m\u001b[48;2;52;232;251m\u2580\u001b[38;2;50;220;243m\u001b[48;2;53;238;251m\u2580\u001b[0m\n\u001b[0m \u001b[38;2;51;227;249m\u001b[48;2;51;227;248m\u2580\u001b[38;2;54;240;253m\u001b[48;2;50;226;246m\u2580\u001b[0m \u001b[38;2;52;233;251m\u2580\u001b[38;2;58;255;255m\u001b[48;2;50;229;248m\u2580\u001b[38;2;52;236;250m\u001b[48;2;54;241;251m\u2580\u001b[38;2;51;232;251m\u001b[49m\u2584\u001b[38;2;51;231;249m\u2584\u001b[38;2;53;236;250m\u001b[48;2;54;241;252m\u2580\u001b[38;2;57;255;255m\u001b[48;2;52;231;249m\u2580\u001b[38;2;51;233;250m\u001b[49m\u2580\u001b[0m \u001b[38;2;55;246;255m\u001b[48;2;50;225;247m\u2580\u001b[38;2;51;228;248m\u001b[48;2;51;227;247m\u2580\u001b[0m\n\u001b[0m \u001b[38;2;51;228;248m\u001b[48;2;51;228;248m\u2580\u001b[38;2;50;228;247m\u001b[48;2;50;229;248m\u2580\u001b[0m \u001b[38;2;46;212;243m\u001b[48;2;53;240;252m\u2580\u001b[38;2;55;247;255m\u001b[48;2;51;232;251m\u2580\u001b[38;2;57;253;255m\u001b[48;2;52;233;252m\u2580\u001b[38;2;47;216;245m\u001b[48;2;54;239;251m\u2580\u001b[0m \u001b[38;2;51;227;247m\u001b[48;2;50;227;246m\u2580\u001b[38;2;50;227;248m\u001b[48;2;51;227;247m\u2580\u001b[0m\n\u001b[0m \u001b[38;2;51;227;247m\u001b[48;2;49;227;247m\u2580\u001b[38;2;51;226;248m\u001b[48;2;53;237;253m\u2580\u001b[0m \u001b[38;2;52;232;249m\u2584\u001b[38;2;52;234;251m\u001b[48;2;56;251;255m\u2580\u001b[38;2;54;240;251m\u001b[48;2;48;218;243m\u2580\u001b[0m \u001b[38;2;54;241;251m\u001b[48;2;48;221;243m\u2580\u001b[38;2;52;234;251m\u001b[48;2;57;252;255m\u2580\u001b[38;2;52;231;249m\u001b[49m\u2584\u001b[0m \u001b[38;2;51;228;248m\u001b[48;2;54;242;255m\u2580\u001b[38;2;50;227;248m\u001b[48;2;51;226;249m\u2580\u001b[0m\n\u001b[0m \u001b[38;2;52;233;251m\u2584\u001b[38;2;52;233;250m\u2584\u001b[38;2;51;232;250m\u001b[48;2;54;241;255m\u2580\u001b[38;2;54;239;253m\u001b[48;2;52;231;251m\u2580\u001b[38;2;51;228;248m\u001b[48;2;51;229;248m\u2580\u001b[38;2;51;228;247m\u001b[48;2;51;228;249m\u2580\u001b[38;2;51;229;248m\u001b[48;2;51;228;248m\u2580\u001b[38;2;51;227;248m\u001b[48;2;54;242;255m\u2580\u001b[38;2;57;254;255m\u001b[48;2;49;228;248m\u2580\u001b[38;2;49;224;246m\u001b[49m\u2580\u001b[0m \u001b[38;2;2;205;235m\u001b[48;2;1;209;238m\u2580\u001b[38;2;2;203;233m\u2580\u001b[0m \u001b[38;2;48;224;246m\u2580\u001b[38;2;57;253;255m\u001b[48;2;51;226;248m\u2580\u001b[38;2;50;227;248m\u001b[48;2;55;244;255m\u2580\u001b[38;2;51;228;248m\u001b[48;2;50;226;246m\u2580\u001b[48;2;51;228;249m\u2580\u001b[38;2;50;227;247m\u001b[48;2;51;227;247m\u2580\u001b[38;2;53;237;252m\u001b[48;2;51;230;250m\u2580\u001b[38;2;52;231;250m\u001b[48;2;53;239;255m\u2580\u001b[38;2;52;232;250m\u001b[49m\u2584\u001b[38;2;52;234;251m\u2584\u001b[38;2;49;230;250m\u2584\u001b[0m\n\u001b[0m \u001b[38;2;52;234;249m\u2584\u001b[38;2;51;232;249m\u001b[48;2;56;251;255m\u2580\u001b[38;2;55;247;255m\u001b[48;2;51;232;250m\u2580\u001b[38;2;52;233;251m\u001b[49m\u2580\u001b[38;2;51;233;251m\u2580\u001b[38;2;51;224;246m\u2580\u001b[38;2;50;230;248m\u001b[48;2;52;228;246m\u2580\u001b[38;2;52;234;251m\u001b[48;2;54;241;255m\u2580\u001b[38;2;49;224;247m\u001b[49m\u2584\u001b[38;2;50;226;246m\u001b[48;2;53;238;255m\u2580\u001b[38;2;54;241;252m\u001b[48;2;49;224;246m\u2580\u001b[0m \u001b[38;2;1;205;233m\u2584\u001b[38;2;1;207;236m\u001b[48;2;1;220;251m\u2580\u001b[38;2;1;213;243m\u001b[48;2;1;214;244m\u2580\u001b[38;2;1;212;242m\u001b[48;2;1;217;247m\u2580\u001b[38;2;1;206;236m\u001b[48;2;1;221;252m\u2580\u001b[38;2;1;203;234m\u001b[49m\u2584\u001b[0m \u001b[38;2;54;241;251m\u001b[48;2;49;223;246m\u2580\u001b[38;2;50;226;247m\u001b[48;2;54;239;255m\u2580\u001b[38;2;50;226;248m\u001b[49m\u2584\u001b[38;2;52;236;251m\u001b[48;2;53;239;255m\u2580\u001b[38;2;51;229;248m\u001b[49m\u2580\u001b[0m \u001b[38;2;51;234;251m\u2580\u001b[38;2;52;233;250m\u2580\u001b[38;2;56;249;255m\u001b[48;2;51;232;250m\u2580\u001b[38;2;51;234;250m\u001b[48;2;56;249;255m\u2580\u001b[38;2;52;235;251m\u001b[49m\u2584\u001b[0m\n\u001b[38;2;50;226;247m\u001b[48;2;54;243;255m\u2580\u001b[38;2;55;244;255m\u001b[48;2;50;226;247m\u2580\u001b[38;2;51;227;247m\u001b[49m\u2580\u001b[0m \u001b[38;2;50;226;247m\u001b[48;2;51;230;248m\u2580\u001b[38;2;56;251;255m\u001b[48;2;57;255;255m\u2580\u001b[38;2;50;229;249m\u001b[48;2;56;230;247m\u2580\u001b[0m \u001b[38;2;3;200;231m\u001b[48;2;2;212;241m\u2580\u001b[38;2;1;230;255m\u001b[48;2;1;218;247m\u2580\u001b[38;2;1;217;248m\u001b[48;2;0;206;233m\u2580\u001b[38;2;1;205;233m\u001b[48;2;0;210;240m\u2580\u001b[38;2;1;205;234m\u001b[48;2;0;208;237m\u2580\u001b[38;2;1;212;242m\u001b[49m\u2580\u001b[38;2;1;232;255m\u001b[48;2;1;219;248m\u2580\u001b[38;2;3;204;234m\u001b[48;2;2;212;241m\u2580\u001b[0m \u001b[38;2;50;229;249m\u001b[48;2;55;230;248m\u2580\u001b[38;2;57;254;255m\u001b[48;2;57;254;255m\u2580\u001b[38;2;51;226;247m\u001b[48;2;51;227;249m\u2580\u001b[0m \u001b[38;2;50;224;247m\u2580\u001b[38;2;55;245;255m\u001b[48;2;49;223;247m\u2580\u001b[38;2;50;226;247m\u001b[48;2;55;244;255m\u2580\u001b[0m\n\u001b[38;2;52;234;251m\u001b[48;2;49;225;246m\u2580\u001b[38;2;50;229;248m\u001b[48;2;57;255;255m\u2580\u001b[38;2;52;231;247m\u001b[49m\u2584\u001b[0m \u001b[38;2;51;226;247m\u001b[48;2;51;232;249m\u2580\u001b[38;2;51;228;249m\u001b[48;2;60;229;249m\u2580\u001b[38;2;0;199;231m\u001b[49m\u2584\u001b[38;2;1;205;234m\u001b[48;2;2;206;235m\u2580\u001b[38;2;0;213;244m\u001b[49m\u2580\u001b[38;2;0;197;228m\u001b[48;2;0;207;238m\u2580\u001b[38;2;1;214;242m\u001b[48;2;0;209;238m\u2580\u001b[38;2;1;213;242m\u001b[48;2;0;201;230m\u2580\u001b[38;2;0;205;232m\u001b[48;2;1;214;242m\u2580\u001b[38;2;0;212;240m\u001b[48;2;1;215;243m\u2580\u001b[38;2;0;205;234m\u001b[48;2;0;202;234m\u2580\u001b[38;2;0;213;243m\u001b[49m\u2580\u001b[38;2;1;204;234m\u001b[48;2;2;207;236m\u2580\u001b[38;2;0;199;230m\u001b[49m\u2584\u001b[38;2;50;229;249m\u001b[48;2;58;232;249m\u2580\u001b[38;2;50;225;247m\u001b[48;2;51;234;250m\u2580\u001b[0m \u001b[38;2;51;230;248m\u2584\u001b[38;2;51;229;248m\u001b[48;2;57;255;255m\u2580\u001b[38;2;52;234;251m\u001b[48;2;50;225;246m\u2580\u001b[0m\n\u001b[0m \u001b[38;2;51;230;248m\u2580\u001b[38;2;58;255;255m\u001b[48;2;50;228;247m\u2580\u001b[38;2;53;233;251m\u001b[48;2;52;236;252m\u2580\u001b[38;2;54;241;255m\u001b[49m\u2584\u001b[38;2;52;230;249m\u2584\u001b[38;2;51;226;249m\u2584\u001b[38;2;50;225;246m\u001b[48;2;52;229;249m\u2580\u001b[38;2;55;249;255m\u001b[48;2;51;233;251m\u2580\u001b[0m \u001b[38;2;0;204;233m\u001b[48;2;0;204;234m\u2580\u001b[38;2;1;206;236m\u001b[48;2;1;205;234m\u2580\u001b[38;2;0;208;237m\u001b[48;2;0;208;237m\u2580\u001b[38;2;1;205;233m\u001b[48;2;1;209;239m\u2580\u001b[38;2;0;207;236m\u001b[49m\u2584\u001b[38;2;0;209;236m\u001b[48;2;0;205;233m\u2580\u001b[38;2;0;213;242m\u001b[48;2;0;205;235m\u2580\u001b[38;2;0;205;235m\u001b[48;2;1;229;255m\u2580\u001b[38;2;1;220;248m\u001b[48;2;1;227;255m\u2580\u001b[38;2;0;205;234m\u001b[48;2;0;208;233m\u2580\u001b[38;2;1;206;235m\u001b[48;2;1;206;235m\u2580\u001b[38;2;0;204;233m\u001b[48;2;0;205;234m\u2580\u001b[0m \u001b[38;2;55;250;255m\u001b[48;2;51;232;251m\u2580\u001b[38;2;50;228;247m\u001b[48;2;51;229;249m\u2580\u001b[38;2;49;225;247m\u001b[49m\u2584\u001b[38;2;51;233;249m\u2584\u001b[38;2;55;244;255m\u2584\u001b[38;2;53;233;252m\u001b[48;2;53;235;252m\u2580\u001b[38;2;58;255;255m\u001b[48;2;51;228;246m\u2580\u001b[38;2;51;228;247m\u001b[49m\u2580\u001b[0m\n\u001b[0m \u001b[38;2;51;234;250m\u2580\u001b[38;2;52;233;251m\u2580\u001b[38;2;54;239;255m\u001b[48;2;51;231;250m\u2580\u001b[38;2;53;235;255m\u001b[48;2;53;236;253m\u2580\u001b[38;2;51;233;254m\u001b[48;2;49;227;248m\u2580\u001b[0m \u001b[38;2;0;205;234m\u2580\u001b[38;2;1;206;234m\u001b[48;2;1;205;234m\u2580\u001b[0m \u001b[38;2;1;230;255m\u001b[48;2;0;205;232m\u2580\u001b[38;2;1;236;255m\u001b[48;2;1;223;249m\u2580\u001b[38;2;0;207;235m\u001b[48;2;0;206;234m\u2580\u001b[38;2;0;205;236m\u001b[48;2;0;204;233m\u2580\u001b[38;2;1;231;255m\u001b[48;2;1;222;249m\u2580\u001b[38;2;1;224;255m\u001b[48;2;0;206;234m\u2580\u001b[0m \u001b[38;2;1;205;234m\u001b[48;2;1;206;235m\u2580\u001b[38;2;0;204;234m\u001b[48;2;0;200;230m\u2580\u001b[0m \u001b[38;2;51;232;253m\u001b[48;2;49;227;247m\u2580\u001b[38;2;53;235;255m\u001b[48;2;53;236;253m\u2580\u001b[38;2;54;241;255m\u001b[48;2;51;230;248m\u2580\u001b[38;2;52;232;251m\u001b[49m\u2580\u001b[38;2;52;233;252m\u2580\u001b[0m\n\u001b[0m \u001b[38;2;51;226;247m\u001b[48;2;51;228;248m\u2580\u001b[38;2;51;230;249m\u001b[48;2;50;227;246m\u2580\u001b[0m \u001b[38;2;1;206;236m\u2580\u001b[38;2;1;219;246m\u001b[48;2;1;208;237m\u2580\u001b[38;2;0;209;240m\u001b[48;2;1;242;255m\u2580\u001b[38;2;1;211;241m\u001b[49m\u2584\u001b[38;2;0;205;234m\u2584\u2584\u001b[38;2;1;211;241m\u2584\u001b[38;2;0;208;238m\u001b[48;2;1;242;255m\u2580\u001b[38;2;1;220;246m\u001b[48;2;1;208;237m\u2580\u001b[38;2;1;207;234m\u001b[49m\u2580\u001b[0m \u001b[38;2;51;228;248m\u001b[48;2;51;228;248m\u2580\u001b[38;2;51;226;247m\u2580\u001b[0m\n\u001b[0m \u001b[38;2;50;227;247m\u001b[48;2;51;228;248m\u2580\u001b[38;2;50;227;248m\u001b[48;2;50;229;248m\u2580\u001b[0m \u001b[38;2;2;208;238m\u2580\u001b[38;2;2;212;241m\u2580\u001b[38;2;2;210;239m\u2580\u001b[38;2;2;209;239m\u2580\u001b[38;2;2;211;241m\u2580\u001b[38;2;2;211;239m\u2580\u001b[0m \u001b[38;2;51;227;247m\u001b[48;2;51;228;247m\u2580\u001b[38;2;51;227;248m\u001b[48;2;50;229;248m\u2580\u001b[0m\n\u001b[0m \u001b[38;2;50;227;247m\u001b[48;2;50;228;247m\u2580\u001b[38;2;51;224;247m\u001b[48;2;54;239;251m\u2580\u001b[0m \u001b[38;2;51;230;250m\u2584\u001b[38;2;54;242;255m\u2584\u001b[38;2;53;240;253m\u001b[48;2;53;238;251m\u2580\u001b[38;2;52;228;247m\u001b[48;2;49;225;245m\u2580\u001b[38;2;52;229;249m\u001b[48;2;52;228;248m\u2580\u001b[38;2;53;238;252m\u001b[48;2;53;240;251m\u2580\u001b[38;2;53;237;252m\u001b[49m\u2584\u001b[38;2;51;231;250m\u2584\u001b[0m \u001b[38;2;51;225;247m\u001b[48;2;55;245;255m\u2580\u001b[38;2;50;227;247m\u001b[48;2;50;227;249m\u2580\u001b[0m\n\u001b[0m \u001b[38;2;53;238;251m\u001b[48;2;48;219;246m\u2580\u001b[38;2;52;233;252m\u001b[48;2;52;236;252m\u2580\u001b[38;2;50;227;247m\u001b[48;2;53;239;255m\u2580\u001b[38;2;51;228;248m\u001b[48;2;52;234;253m\u2580\u001b[38;2;52;232;250m\u001b[48;2;52;233;250m\u2580\u001b[38;2;55;244;255m\u001b[48;2;51;226;245m\u2580\u001b[38;2;53;234;251m\u001b[49m\u2580\u001b[0m \u001b[38;2;52;233;250m\u2580\u001b[38;2;56;249;255m\u001b[48;2;51;229;247m\u2580\u001b[38;2;51;232;250m\u001b[48;2;52;234;250m\u2580\u001b[38;2;50;226;247m\u001b[48;2;52;233;252m\u2580\u001b[38;2;51;225;245m\u001b[48;2;54;241;255m\u2580\u001b[38;2;52;234;251m\u001b[48;2;53;236;252m\u2580\u001b[38;2;53;237;251m\u001b[48;2;50;218;245m\u2580\u001b[0m";
|
|
13
|
+
/** Monochrome silhouette (glyphs only); colorized at runtime for non-truecolor terminals. */
|
|
14
|
+
exports.BUNDLE_DROP_LOGO_MONO = " \u2588\u2588\u2588\u2588\u2588\u2584\u2584 \u2584\u2584\u2588\u2588\u2588\u2588\u2588\n \u2588\u2588 \u2580\u2588\u2588\u2584\u2584\u2588\u2588\u2580 \u2588\u2588\n \u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\n \u2588\u2588 \u2584\u2588\u2588 \u2588\u2588\u2584 \u2588\u2588\n \u2584\u2584\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2580 \u2588\u2588 \u2580\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584\u2584\u2584\n \u2584\u2588\u2588\u2580\u2580\u2580\u2588\u2588\u2584\u2588\u2588 \u2584\u2588\u2588\u2588\u2588\u2584 \u2588\u2588\u2584\u2588\u2580 \u2580\u2580\u2588\u2588\u2584\n\u2588\u2588\u2580 \u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2580\u2588\u2588 \u2588\u2588\u2588 \u2580\u2588\u2588\n\u2588\u2588\u2584 \u2588\u2588\u2584\u2588\u2580\u2588\u2588\u2588\u2588\u2588\u2588\u2580\u2588\u2584\u2588\u2588 \u2584\u2588\u2588\n \u2580\u2588\u2588\u2584\u2584\u2584\u2588\u2588 \u2588\u2588\u2588\u2588\u2584\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2584\u2584\u2584\u2588\u2588\u2580\n \u2580\u2580\u2588\u2588\u2588 \u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2580\u2580\n \u2588\u2588 \u2580\u2588\u2588\u2584\u2584\u2584\u2584\u2588\u2588\u2580 \u2588\u2588\n \u2588\u2588 \u2580\u2580\u2580\u2580\u2580\u2580 \u2588\u2588\n \u2588\u2588 \u2584\u2584\u2588\u2588\u2588\u2588\u2584\u2584 \u2588\u2588\n \u2588\u2588\u2588\u2588\u2588\u2588\u2580 \u2580\u2588\u2588\u2588\u2588\u2588\u2588";
|
|
15
|
+
/**
|
|
16
|
+
* Builds the CLI banner. Truecolor terminals get the full-color logo; every
|
|
17
|
+
* other terminal falls back to a cyan silhouette so the banner still renders.
|
|
18
|
+
*/
|
|
19
|
+
const buildBundleDropLogo = () => {
|
|
20
|
+
const art = chalk_1.default.level >= 3
|
|
21
|
+
? exports.BUNDLE_DROP_LOGO_TRUECOLOR
|
|
22
|
+
: chalk_1.default.cyanBright(exports.BUNDLE_DROP_LOGO_MONO);
|
|
23
|
+
const title = chalk_1.default.bold.cyanBright(`${figures_1.default.star} React Native Bundle Drop CLI ${figures_1.default.star}`);
|
|
24
|
+
return `\n${art}\n${title}`;
|
|
25
|
+
};
|
|
26
|
+
exports.buildBundleDropLogo = buildBundleDropLogo;
|
|
@@ -35,6 +35,10 @@ const CONTEXT_SUMMARY_SIGNALS = [
|
|
|
35
35
|
'@gfean/react-native-bundle-drop',
|
|
36
36
|
'react-native-bundle-drop',
|
|
37
37
|
'bundle-drop-config',
|
|
38
|
+
'react-native-code-push',
|
|
39
|
+
'CodePush',
|
|
40
|
+
'codepush.gradle',
|
|
41
|
+
'CodePushDeploymentKey',
|
|
38
42
|
'serverUrl',
|
|
39
43
|
'org',
|
|
40
44
|
'project',
|
|
@@ -288,6 +292,24 @@ const detectSignals = (files) => {
|
|
|
288
292
|
signals.push('multipleAndroidEntrypoints');
|
|
289
293
|
if (iosEntrypoints.length > 1)
|
|
290
294
|
signals.push('multipleIosEntrypoints');
|
|
295
|
+
// CodePush migration detection. The native bundle-resolution hooks CodePush
|
|
296
|
+
// overrides (Android getJSBundleFile, iOS bundleURL/sourceURLForBridge) are the
|
|
297
|
+
// exact seams BundleDrop rewrites, so surfacing these lets the planner migrate
|
|
298
|
+
// them and flag the remaining CodePush cleanup.
|
|
299
|
+
const hasCodePushDependency = allContent.includes('react-native-code-push');
|
|
300
|
+
const hasCodePushAndroidOverride = codeContent.includes('CodePush.getJSBundleFile');
|
|
301
|
+
const hasCodePushIosOverride = codeContent.includes('[CodePush bundleURL]') ||
|
|
302
|
+
codeContent.includes('CodePush.bundleURL') ||
|
|
303
|
+
codeContent.includes('CodePushConfig');
|
|
304
|
+
if (hasCodePushDependency)
|
|
305
|
+
signals.push('codePushDependency');
|
|
306
|
+
if (hasCodePushAndroidOverride)
|
|
307
|
+
signals.push('codePushAndroidBundleOverride');
|
|
308
|
+
if (hasCodePushIosOverride)
|
|
309
|
+
signals.push('codePushIosBundleOverride');
|
|
310
|
+
if (hasCodePushDependency || hasCodePushAndroidOverride || hasCodePushIosOverride) {
|
|
311
|
+
signals.push('codePushDetected');
|
|
312
|
+
}
|
|
291
313
|
return {
|
|
292
314
|
rnVersion: null,
|
|
293
315
|
androidLanguage,
|
|
@@ -145,7 +145,7 @@ async function initConfig(params) {
|
|
|
145
145
|
}
|
|
146
146
|
const content = `module.exports = {
|
|
147
147
|
serverUrl: '${resolvedServerUrl}',
|
|
148
|
-
defaultChannel: '
|
|
148
|
+
defaultChannel: 'develop',
|
|
149
149
|
runtimeVersion: {
|
|
150
150
|
ios: '1.0.0',
|
|
151
151
|
android: '1.0.0',
|
|
@@ -158,7 +158,6 @@ async function initConfig(params) {
|
|
|
158
158
|
slug: '${projectSlug}',
|
|
159
159
|
apiKey: '${apiKey.replace(/'/g, "\\'")}',
|
|
160
160
|
},
|
|
161
|
-
debugLocal: false,
|
|
162
161
|
};
|
|
163
162
|
`;
|
|
164
163
|
await fs_extra_1.default.writeFile(configPath, content, 'utf8');
|
|
@@ -49,7 +49,23 @@ const DOCS_INSTALLATION_URL = 'https://bundledrop.app/docs/installation';
|
|
|
49
49
|
const DOCS_UPLOADING_URL = 'https://bundledrop.app/docs/uploading';
|
|
50
50
|
const DOCS_CI_CD_URL = 'https://bundledrop.app/docs/ci-cd';
|
|
51
51
|
const DOCS_RUNTIME_VERSION_URL = 'https://bundledrop.app/docs/runtime-version';
|
|
52
|
+
const BUNDLE_DROP_ARTIFACT_FILES = [
|
|
53
|
+
'main.jsbundle',
|
|
54
|
+
'main.jsbundle.map',
|
|
55
|
+
'bundle-drop-result.json',
|
|
56
|
+
];
|
|
52
57
|
const getPackageRoot = () => process.env.BUNDLE_DROP_PACKAGE_ROOT_OVERRIDE || path.resolve(__dirname, '..', '..', '..');
|
|
58
|
+
const readPackageVersion = (packageRoot) => {
|
|
59
|
+
try {
|
|
60
|
+
const packageJson = JSON.parse(fs.readFileSync(path.join(packageRoot, 'package.json'), 'utf-8'));
|
|
61
|
+
return typeof packageJson.version === 'string' && packageJson.version.trim()
|
|
62
|
+
? packageJson.version.trim()
|
|
63
|
+
: undefined;
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
53
69
|
const readManifestRuntimeVersion = (manifestPath) => {
|
|
54
70
|
let manifest;
|
|
55
71
|
try {
|
|
@@ -66,10 +82,32 @@ const readManifestRuntimeVersion = (manifestPath) => {
|
|
|
66
82
|
}
|
|
67
83
|
return manifest.runtimeVersion;
|
|
68
84
|
};
|
|
85
|
+
const prepareArtifactDirForRun = (artifactDir) => {
|
|
86
|
+
if (!artifactDir)
|
|
87
|
+
return;
|
|
88
|
+
fs.mkdirSync(artifactDir, { recursive: true });
|
|
89
|
+
for (const fileName of BUNDLE_DROP_ARTIFACT_FILES) {
|
|
90
|
+
const filePath = path.join(artifactDir, fileName);
|
|
91
|
+
if (fs.existsSync(filePath))
|
|
92
|
+
fs.unlinkSync(filePath);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const writeArtifactResult = (artifactDir, result) => {
|
|
96
|
+
if (!artifactDir)
|
|
97
|
+
return;
|
|
98
|
+
fs.mkdirSync(artifactDir, { recursive: true });
|
|
99
|
+
fs.writeFileSync(path.join(artifactDir, 'bundle-drop-result.json'), JSON.stringify(result, null, 2));
|
|
100
|
+
};
|
|
101
|
+
const stringifyUploadError = (err) => {
|
|
102
|
+
const raw = err?.response?.data || err.message;
|
|
103
|
+
return typeof raw === 'object' ? JSON.stringify(raw, null, 2) : String(raw);
|
|
104
|
+
};
|
|
69
105
|
async function upload(platform, options) {
|
|
70
106
|
console.log(); // blank line
|
|
71
107
|
ui_1.log.info('🚀 React Native OTA Upload Initialized');
|
|
72
108
|
const projectRoot = process.cwd();
|
|
109
|
+
const artifactDir = options.artifactDir ? path.resolve(options.artifactDir) : undefined;
|
|
110
|
+
prepareArtifactDirForRun(artifactDir);
|
|
73
111
|
const configPath = path.resolve(projectRoot, 'bundle.drop.config.js');
|
|
74
112
|
//eslint-disable-next-line
|
|
75
113
|
const authPath = path.join(require('os').homedir(), '.bundle-drop', 'auth.json');
|
|
@@ -181,6 +219,7 @@ async function upload(platform, options) {
|
|
|
181
219
|
console.log();
|
|
182
220
|
ui_1.log.arrow(`Bundling ${platform} app...`);
|
|
183
221
|
const packageRoot = getPackageRoot();
|
|
222
|
+
const packageVersion = readPackageVersion(packageRoot);
|
|
184
223
|
const compiledBundleScript = path.join(packageRoot, 'lib', 'scripts', 'bundle.js');
|
|
185
224
|
const tsBundleScript = path.join(packageRoot, 'src', 'scripts', 'bundle.ts');
|
|
186
225
|
const bundleCommand = fs.existsSync(compiledBundleScript)
|
|
@@ -224,6 +263,9 @@ async function upload(platform, options) {
|
|
|
224
263
|
form.append('version', version);
|
|
225
264
|
form.append('channelName', channel);
|
|
226
265
|
form.append('runtimeVersion', runtimeVersion);
|
|
266
|
+
if (packageVersion) {
|
|
267
|
+
form.append('packageVersion', packageVersion);
|
|
268
|
+
}
|
|
227
269
|
if (releaseNotes) {
|
|
228
270
|
form.append('releaseNotes', releaseNotes);
|
|
229
271
|
}
|
|
@@ -232,6 +274,7 @@ async function upload(platform, options) {
|
|
|
232
274
|
}
|
|
233
275
|
form.append('file', fs.createReadStream(zipPath));
|
|
234
276
|
const uploadLoader = (0, ui_1.startLoadingStatus)('Uploading bundle to server');
|
|
277
|
+
let uploadSucceeded = false;
|
|
235
278
|
try {
|
|
236
279
|
const res = await axios_1.default.post(`${serverUrl}/bundle/upload`, form, {
|
|
237
280
|
headers: {
|
|
@@ -243,14 +286,14 @@ async function upload(platform, options) {
|
|
|
243
286
|
});
|
|
244
287
|
const sourceMapFile = path.join(outputDir, 'main.jsbundle.map');
|
|
245
288
|
const hasSourceMap = options.sourcemap && fs.existsSync(sourceMapFile);
|
|
246
|
-
const artifactDir = options.artifactDir ? path.resolve(options.artifactDir) : undefined;
|
|
247
289
|
const result = {
|
|
248
290
|
platform,
|
|
249
|
-
appVersion: version
|
|
250
|
-
channel
|
|
251
|
-
orgSlug
|
|
252
|
-
projectSlug
|
|
291
|
+
appVersion: version,
|
|
292
|
+
channel,
|
|
293
|
+
orgSlug,
|
|
294
|
+
projectSlug,
|
|
253
295
|
runtimeVersion: res.data?.runtimeVersion ?? runtimeVersion ?? null,
|
|
296
|
+
packageVersion: res.data?.packageVersion ?? packageVersion ?? null,
|
|
254
297
|
bundleId: res.data?.bundleId ?? null,
|
|
255
298
|
bundleVersion: res.data?.bundleVersion ?? null,
|
|
256
299
|
bundleVersionLabel: res.data?.bundleVersionLabel ?? null,
|
|
@@ -292,17 +335,28 @@ async function upload(platform, options) {
|
|
|
292
335
|
if (artifactDir) {
|
|
293
336
|
ui_1.log.label('Artifact dir', artifactDir);
|
|
294
337
|
}
|
|
338
|
+
uploadSucceeded = true;
|
|
295
339
|
}
|
|
296
340
|
catch (err) {
|
|
297
341
|
uploadLoader.stop();
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
342
|
+
const uploadError = stringifyUploadError(err);
|
|
343
|
+
writeArtifactResult(artifactDir, {
|
|
344
|
+
success: false,
|
|
345
|
+
status: 'failed',
|
|
346
|
+
error: uploadError,
|
|
347
|
+
platform,
|
|
348
|
+
appVersion: version,
|
|
349
|
+
channel,
|
|
350
|
+
orgSlug,
|
|
351
|
+
projectSlug,
|
|
352
|
+
runtimeVersion,
|
|
353
|
+
packageVersion: packageVersion ?? null,
|
|
354
|
+
releaseNotes: releaseNotes ?? null,
|
|
355
|
+
author: options.author ?? null,
|
|
356
|
+
});
|
|
357
|
+
ui_1.log.error(`Upload failed: ${uploadError}`);
|
|
358
|
+
process.exitCode = 1;
|
|
359
|
+
return;
|
|
306
360
|
}
|
|
307
361
|
finally {
|
|
308
362
|
try {
|
|
@@ -321,9 +375,11 @@ async function upload(platform, options) {
|
|
|
321
375
|
if (fs.existsSync(assetsPath)) {
|
|
322
376
|
fs.rmSync(assetsPath, { recursive: true, force: true });
|
|
323
377
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
378
|
+
if (uploadSucceeded) {
|
|
379
|
+
console.log();
|
|
380
|
+
ui_1.log.success('🎉 Done! Bundle uploaded and cleaned.');
|
|
381
|
+
console.log();
|
|
382
|
+
}
|
|
327
383
|
}
|
|
328
384
|
catch (cleanupErr) {
|
|
329
385
|
ui_1.log.warn(`Cleanup failed: ${cleanupErr.message}`);
|
package/lib/context.js
CHANGED
|
@@ -11,7 +11,7 @@ exports.config = (0, loadConfig_1.loadConfig)();
|
|
|
11
11
|
exports.platform = react_native_1.Platform.OS === 'ios' ? 'ios' : 'android';
|
|
12
12
|
exports.isIOS = exports.platform === 'ios';
|
|
13
13
|
exports.runtimeVersion = exports.config.runtimeVersion?.[exports.platform];
|
|
14
|
-
exports.defaultChannel = exports.config.defaultChannel || '
|
|
14
|
+
exports.defaultChannel = exports.config.defaultChannel || 'develop';
|
|
15
15
|
exports.BUNDLE_DROP_ROOT = exports.isIOS
|
|
16
16
|
? `${fs_1.default.LibraryDirectoryPath}/bundle-drop`
|
|
17
17
|
: `${fs_1.default.DocumentDirectoryPath}/bundle-drop`;
|
package/lib/loadConfig.d.ts
CHANGED
|
@@ -18,7 +18,11 @@ export type BundleDropProjectConfig = {
|
|
|
18
18
|
/** Optional public API key used by CLI/runtime integrations. */
|
|
19
19
|
apiKey?: string;
|
|
20
20
|
};
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Internal, undocumented escape hatch. When true, routes local dev traffic to
|
|
23
|
+
* emulator/simulator-friendly localhost URLs. Intentionally not written by the
|
|
24
|
+
* CLI template or documented; add it manually only when debugging locally.
|
|
25
|
+
*/
|
|
22
26
|
debugLocal?: boolean;
|
|
23
27
|
/** Native runtime versions for platform compatibility checks. */
|
|
24
28
|
runtimeVersion?: {
|
package/lib/scripts/bundle.js
CHANGED
|
@@ -47,6 +47,8 @@ const path = __importStar(require("path"));
|
|
|
47
47
|
const bundleManifest_1 = require("../manifest/bundleManifest");
|
|
48
48
|
const projectRoot_1 = require("./projectRoot");
|
|
49
49
|
Object.defineProperty(exports, "findProjectRoot", { enumerable: true, get: function () { return projectRoot_1.findProjectRoot; } });
|
|
50
|
+
const SENTRY_HERMES_OTA_DOCS_URL = 'https://bundledrop.app/docs/observability#sentry-and-hermes-ota-builds';
|
|
51
|
+
const SENTRY_DEBUG_ID_MARKERS = ['//# debugId=', 'sentry-dbid-'];
|
|
50
52
|
const getPackageRoot = () => process.env.BUNDLE_DROP_PACKAGE_ROOT_OVERRIDE || path.resolve(__dirname, '..', '..');
|
|
51
53
|
const sha256Buffer = (buffer) => (0, crypto_1.createHash)('sha256').update(buffer).digest('hex');
|
|
52
54
|
const manifestRoleForPath = (filePath) => {
|
|
@@ -125,6 +127,22 @@ const buildHermesFlags = (hermescPath, generateSourceMap) => {
|
|
|
125
127
|
}
|
|
126
128
|
return flags;
|
|
127
129
|
};
|
|
130
|
+
const promoteHermesBytecode = (hbcPath, bundlePath) => {
|
|
131
|
+
if (!fs.existsSync(hbcPath)) {
|
|
132
|
+
throw new Error(`Hermes compiler did not write bytecode output at ${hbcPath}`);
|
|
133
|
+
}
|
|
134
|
+
fs.copyFileSync(hbcPath, bundlePath);
|
|
135
|
+
fs.unlinkSync(hbcPath);
|
|
136
|
+
};
|
|
137
|
+
const warnAboutSentryDebugId = (bundlePath, hermesEnabled) => {
|
|
138
|
+
if (!hermesEnabled || !fs.existsSync(bundlePath))
|
|
139
|
+
return;
|
|
140
|
+
const bundleSource = fs.readFileSync(bundlePath, 'utf8');
|
|
141
|
+
const hasSentryDebugId = SENTRY_DEBUG_ID_MARKERS.some(marker => bundleSource.includes(marker));
|
|
142
|
+
if (!hasSentryDebugId)
|
|
143
|
+
return;
|
|
144
|
+
console.warn(`⚠️ Sentry Debug ID detected in a Hermes OTA bundle. Content-derived Debug IDs can increase binary patch sizes. Configure the Sentry Metro wrapper for Bundle Drop OTA builds: ${SENTRY_HERMES_OTA_DOCS_URL}`);
|
|
145
|
+
};
|
|
128
146
|
const detectHermesFromNativeProject = (projectRoot, platform) => {
|
|
129
147
|
if (platform === 'android') {
|
|
130
148
|
return detectBoolean([
|
|
@@ -206,6 +224,7 @@ function runBundleScript(options) {
|
|
|
206
224
|
console.error('❌ BUNDLE_DROP_APP_VERSION is required so bundle-manifest.json can include the app version');
|
|
207
225
|
process.exit(1);
|
|
208
226
|
}
|
|
227
|
+
const hermesEnabled = shouldCompileHermesBytecode(cfg, platform, projectRoot);
|
|
209
228
|
[bundlePath, zipPath, metadataPath, manifestPath, sourceMapPath].forEach(file => {
|
|
210
229
|
if (fs.existsSync(file))
|
|
211
230
|
fs.unlinkSync(file);
|
|
@@ -221,8 +240,16 @@ function runBundleScript(options) {
|
|
|
221
240
|
--dev false \
|
|
222
241
|
--entry-file index.js \
|
|
223
242
|
--bundle-output "${bundlePath}" \
|
|
224
|
-
--assets-dest "${assetsDir}"
|
|
243
|
+
--assets-dest "${assetsDir}" \
|
|
244
|
+
--reset-cache${sourcemapFlag}`, {
|
|
245
|
+
stdio: 'inherit',
|
|
246
|
+
env: {
|
|
247
|
+
...process.env,
|
|
248
|
+
BUNDLE_DROP_OTA_BUILD: '1',
|
|
249
|
+
},
|
|
250
|
+
});
|
|
225
251
|
console.log('✅ Bundle created');
|
|
252
|
+
warnAboutSentryDebugId(bundlePath, hermesEnabled);
|
|
226
253
|
const osBin = process.platform === 'darwin'
|
|
227
254
|
? 'osx-bin'
|
|
228
255
|
: process.platform === 'win32'
|
|
@@ -234,14 +261,13 @@ function runBundleScript(options) {
|
|
|
234
261
|
path.join(projectRoot, 'node_modules', 'hermes-engine', osBin, 'hermesc'),
|
|
235
262
|
];
|
|
236
263
|
const hermescPath = hermesLocations.find(p => fs.existsSync(p));
|
|
237
|
-
const hermesEnabled = shouldCompileHermesBytecode(cfg, platform, projectRoot);
|
|
238
264
|
if (hermesEnabled && hermescPath) {
|
|
239
265
|
const hbcPath = bundlePath + '.hbc';
|
|
240
266
|
try {
|
|
241
267
|
console.log(`🔥 Compiling to Hermes bytecode (${platform})...`);
|
|
242
268
|
const hermesFlags = buildHermesFlags(hermescPath, generateSourceMap).join(' ');
|
|
243
269
|
(0, child_process_1.execSync)(`"${hermescPath}" ${hermesFlags} -out "${hbcPath}" "${bundlePath}"`, { stdio: ['ignore', 'ignore', 'ignore'] });
|
|
244
|
-
|
|
270
|
+
promoteHermesBytecode(hbcPath, bundlePath);
|
|
245
271
|
console.log('✅ Hermes bytecode compiled');
|
|
246
272
|
}
|
|
247
273
|
catch (e) {
|
|
@@ -276,6 +302,9 @@ function runBundleScript(options) {
|
|
|
276
302
|
else {
|
|
277
303
|
console.log(`ℹ️ Hermes bytecode disabled for ${platform} — bundling plain JS`);
|
|
278
304
|
}
|
|
305
|
+
if (!fs.existsSync(bundlePath)) {
|
|
306
|
+
throw new Error(`Bundle output missing after bundling: ${bundlePath}`);
|
|
307
|
+
}
|
|
279
308
|
const bundleBuffer = fs.readFileSync(bundlePath);
|
|
280
309
|
const jsBundleHash = sha256Buffer(bundleBuffer);
|
|
281
310
|
const metadata = {
|
|
@@ -68,7 +68,7 @@ async function runDownloadBundle(options) {
|
|
|
68
68
|
process.exit(1);
|
|
69
69
|
}
|
|
70
70
|
const runtimeVersion = config?.runtimeVersion?.[platform] || config?.runtimeVersion?.[platform];
|
|
71
|
-
const channelName = argv[3] || config?.defaultChannel || '
|
|
71
|
+
const channelName = argv[3] || config?.defaultChannel || 'develop';
|
|
72
72
|
const resolveEndpoint = `${serverUrl}/projects/${encodeURIComponent(project.slug)}/ota/resolve`;
|
|
73
73
|
const outputPath = path.join(outputDir, `bundle-${platform}.zip`);
|
|
74
74
|
if (!fs.existsSync(outputDir)) {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gfean/react-native-bundle-drop",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"nativeVersion": "0.4.
|
|
5
|
-
"description": "
|
|
3
|
+
"version": "0.4.3",
|
|
4
|
+
"nativeVersion": "0.4.2",
|
|
5
|
+
"description": "Instant over-the-air (OTA) updates for React Native — ship JavaScript & asset fixes with no App Store or Play Store review. Channels, staged rollouts, instant rollback, and hybrid patch-sized delivery. A drop-in CodePush alternative for bare React Native.",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
8
8
|
"author": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
],
|
|
36
36
|
"scripts": {
|
|
37
37
|
"clean": "rimraf lib dist",
|
|
38
|
-
"build": "tsc -p tsconfig.build.json && node scripts/make-cli-executable.js",
|
|
38
|
+
"build": "yarn clean && tsc -p tsconfig.build.json && node scripts/make-cli-executable.js",
|
|
39
39
|
"prepare": "husky",
|
|
40
40
|
"test": "jest --runInBand",
|
|
41
41
|
"test:coverage": "jest --runInBand --coverage",
|
|
@@ -123,24 +123,38 @@
|
|
|
123
123
|
"keywords": [
|
|
124
124
|
"react-native",
|
|
125
125
|
"react-native-ota",
|
|
126
|
+
"ota",
|
|
126
127
|
"ota-updates",
|
|
127
128
|
"over-the-air",
|
|
129
|
+
"over-the-air-updates",
|
|
130
|
+
"codepush",
|
|
131
|
+
"codepush-alternative",
|
|
132
|
+
"react-native-code-push",
|
|
133
|
+
"app-center-codepush",
|
|
134
|
+
"eas-update-alternative",
|
|
135
|
+
"expo-updates-alternative",
|
|
136
|
+
"expo-eas-update-alternative",
|
|
128
137
|
"react-native-update",
|
|
129
138
|
"react-native-updates",
|
|
130
|
-
"bundle-updates",
|
|
131
139
|
"hot-update",
|
|
132
|
-
"codepush-alternative",
|
|
133
|
-
"expo-eas-update-alternative",
|
|
134
|
-
"react-native-deployment",
|
|
135
|
-
"mobile-updates",
|
|
136
|
-
"app-updates",
|
|
137
140
|
"live-updates",
|
|
138
|
-
"
|
|
141
|
+
"instant-updates",
|
|
142
|
+
"hotfix",
|
|
143
|
+
"bundle-updates",
|
|
144
|
+
"js-bundle",
|
|
145
|
+
"delta-updates",
|
|
146
|
+
"patch-updates",
|
|
139
147
|
"staged-rollout",
|
|
148
|
+
"feature-rollout",
|
|
140
149
|
"rollback",
|
|
141
|
-
"react-native-
|
|
150
|
+
"react-native-deployment",
|
|
142
151
|
"react-native-release",
|
|
143
|
-
"react-native-
|
|
152
|
+
"react-native-ci",
|
|
153
|
+
"react-native-production",
|
|
154
|
+
"mobile-updates",
|
|
155
|
+
"app-updates",
|
|
156
|
+
"react-native-ios",
|
|
157
|
+
"react-native-android"
|
|
144
158
|
],
|
|
145
159
|
"peerDependencies": {
|
|
146
160
|
"react": ">=17.0.0",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { findProjectRoot } from './projectRoot';
|
|
3
|
-
export { findProjectRoot };
|
|
4
|
-
export declare function parseAndroidVersionFromGradle(filePath: string): string;
|
|
5
|
-
export declare const cleanupArtifacts: (platform: string, zipPath: string) => void;
|
|
6
|
-
export declare function runUploadBundle(options?: {
|
|
7
|
-
argv?: string[];
|
|
8
|
-
cwd?: string;
|
|
9
|
-
}): Promise<any>;
|
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.cleanupArtifacts = exports.findProjectRoot = void 0;
|
|
41
|
-
exports.parseAndroidVersionFromGradle = parseAndroidVersionFromGradle;
|
|
42
|
-
exports.runUploadBundle = runUploadBundle;
|
|
43
|
-
const axios_1 = __importDefault(require("axios"));
|
|
44
|
-
const child_process_1 = require("child_process");
|
|
45
|
-
const form_data_1 = __importDefault(require("form-data"));
|
|
46
|
-
const fs = __importStar(require("fs"));
|
|
47
|
-
const os_1 = __importDefault(require("os"));
|
|
48
|
-
const path = __importStar(require("path"));
|
|
49
|
-
const plist = __importStar(require("plist"));
|
|
50
|
-
const projectRoot_1 = require("./projectRoot");
|
|
51
|
-
Object.defineProperty(exports, "findProjectRoot", { enumerable: true, get: function () { return projectRoot_1.findProjectRoot; } });
|
|
52
|
-
const resolve_ios_version_1 = require("./resolve-ios-version");
|
|
53
|
-
const getPackageRoot = () => process.env.BUNDLE_DROP_PACKAGE_ROOT_OVERRIDE || path.resolve(__dirname, '..', '..');
|
|
54
|
-
const readManifestRuntimeVersion = (manifestPath) => {
|
|
55
|
-
let manifest;
|
|
56
|
-
try {
|
|
57
|
-
manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
throw new Error(`bundle-manifest.json is required and must be valid JSON: ${error.message}`);
|
|
61
|
-
}
|
|
62
|
-
if (manifest.manifestVersion !== 1) {
|
|
63
|
-
throw new Error('bundle-manifest.json must use manifestVersion 1');
|
|
64
|
-
}
|
|
65
|
-
if (typeof manifest.runtimeVersion !== 'string' || !manifest.runtimeVersion) {
|
|
66
|
-
throw new Error('bundle-manifest.json is missing runtimeVersion');
|
|
67
|
-
}
|
|
68
|
-
return manifest.runtimeVersion;
|
|
69
|
-
};
|
|
70
|
-
function parseAndroidVersionFromGradle(filePath) {
|
|
71
|
-
if (!fs.existsSync(filePath)) {
|
|
72
|
-
console.error(`❌ build.gradle not found at ${filePath}`);
|
|
73
|
-
process.exit(1);
|
|
74
|
-
}
|
|
75
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
76
|
-
const match = content.match(/versionName\s+['"]([^'"]+)['"]/);
|
|
77
|
-
if (!match) {
|
|
78
|
-
console.error('❌ Could not parse versionName from build.gradle');
|
|
79
|
-
process.exit(1);
|
|
80
|
-
}
|
|
81
|
-
return match[1];
|
|
82
|
-
}
|
|
83
|
-
const cleanupArtifacts = (platform, zipPath) => {
|
|
84
|
-
const outputDir = path.join(getPackageRoot(), 'dist');
|
|
85
|
-
try {
|
|
86
|
-
const suffix = platform === 'ios' ? 'ios' : 'android';
|
|
87
|
-
const filesToDelete = [
|
|
88
|
-
zipPath,
|
|
89
|
-
path.join(outputDir, `metadata-${suffix}.json`),
|
|
90
|
-
path.join(outputDir, 'bundle-manifest.json'),
|
|
91
|
-
path.join(outputDir, 'main.jsbundle'),
|
|
92
|
-
path.join(outputDir, 'main.jsbundle.map'),
|
|
93
|
-
];
|
|
94
|
-
for (const file of filesToDelete) {
|
|
95
|
-
if (fs.existsSync(file))
|
|
96
|
-
fs.unlinkSync(file);
|
|
97
|
-
}
|
|
98
|
-
const assetsPath = path.join(outputDir, 'assets');
|
|
99
|
-
if (fs.existsSync(assetsPath)) {
|
|
100
|
-
fs.rmSync(assetsPath, { recursive: true, force: true });
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
catch (err) {
|
|
104
|
-
console.warn('⚠️ Cleanup failed:', err);
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
exports.cleanupArtifacts = cleanupArtifacts;
|
|
108
|
-
async function runUploadBundle(options) {
|
|
109
|
-
const packageRoot = getPackageRoot();
|
|
110
|
-
const outputDir = path.join(packageRoot, 'dist');
|
|
111
|
-
const argv = options?.argv || process.argv;
|
|
112
|
-
const projectRoot = (0, projectRoot_1.findProjectRoot)(options?.cwd || process.cwd());
|
|
113
|
-
const configPath = path.resolve(projectRoot, 'bundle.drop.config.js');
|
|
114
|
-
if (!fs.existsSync(configPath)) {
|
|
115
|
-
console.error('❌ bundle.drop.config.js not found in project root');
|
|
116
|
-
process.exit(1);
|
|
117
|
-
}
|
|
118
|
-
// eslint-disable-next-line
|
|
119
|
-
const config = require(configPath);
|
|
120
|
-
if (!config.serverUrl) {
|
|
121
|
-
console.error('❌ Missing "serverUrl" in bundle.drop.config.js');
|
|
122
|
-
process.exit(1);
|
|
123
|
-
}
|
|
124
|
-
if (!config.project?.slug) {
|
|
125
|
-
console.error('❌ Missing "project.slug" in bundle.drop.config.js');
|
|
126
|
-
process.exit(1);
|
|
127
|
-
}
|
|
128
|
-
if (!config.org?.slug) {
|
|
129
|
-
console.error('❌ Missing "org.slug" in bundle.drop.config.js');
|
|
130
|
-
process.exit(1);
|
|
131
|
-
}
|
|
132
|
-
const serverUrl = config.serverUrl;
|
|
133
|
-
const orgSlug = config.org.slug;
|
|
134
|
-
const projectSlug = config.project.slug;
|
|
135
|
-
const authPath = path.join(os_1.default.homedir(), '.bundle-drop', 'auth.json');
|
|
136
|
-
if (!fs.existsSync(authPath)) {
|
|
137
|
-
console.error('❌ Not authenticated. Please run `bundle-drop login` first.');
|
|
138
|
-
process.exit(1);
|
|
139
|
-
}
|
|
140
|
-
let token;
|
|
141
|
-
try {
|
|
142
|
-
const parsedAuth = JSON.parse(fs.readFileSync(authPath, 'utf-8'));
|
|
143
|
-
token = parsedAuth.token;
|
|
144
|
-
if (!token) {
|
|
145
|
-
throw new Error('Token missing in auth file');
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
catch (err) {
|
|
149
|
-
console.error(`❌ Invalid auth file at ${authPath}:`, err.message);
|
|
150
|
-
console.error('ℹ️ Please log in again with `bundle-drop login`.');
|
|
151
|
-
process.exit(1);
|
|
152
|
-
}
|
|
153
|
-
const platform = argv[2];
|
|
154
|
-
const args = argv.slice(3);
|
|
155
|
-
const plistArg = args.find(arg => arg.startsWith('--plist-file='));
|
|
156
|
-
const plistFile = plistArg?.split('=')[1];
|
|
157
|
-
const versionArg = args.find(arg => arg.startsWith('--version='));
|
|
158
|
-
const versionFromFlag = versionArg?.split('=')[1];
|
|
159
|
-
const buildGradleArg = args.find(arg => arg.startsWith('--buildgradle-path='));
|
|
160
|
-
const buildGradlePath = buildGradleArg?.split('=')[1];
|
|
161
|
-
const channelArg = args.find(arg => arg.startsWith('--channel='));
|
|
162
|
-
const channelName = channelArg?.split('=')[1];
|
|
163
|
-
const releaseNotesArg = args.find(arg => arg.startsWith('--release-notes='));
|
|
164
|
-
let releaseNotes = releaseNotesArg ? releaseNotesArg.split('=')[1] : undefined;
|
|
165
|
-
const generateSourceMap = args.includes('--sourcemap');
|
|
166
|
-
const artifactDirArg = args.find(arg => arg.startsWith('--artifact-dir='));
|
|
167
|
-
const artifactDir = artifactDirArg ? path.resolve(artifactDirArg.split('=')[1]) : undefined;
|
|
168
|
-
const MAX_NOTES = 2000;
|
|
169
|
-
if (releaseNotes && releaseNotes.length > MAX_NOTES) {
|
|
170
|
-
console.warn(`⚠️ Release notes too long (${releaseNotes.length}); truncating to ${MAX_NOTES} chars.`);
|
|
171
|
-
releaseNotes = releaseNotes.slice(0, MAX_NOTES);
|
|
172
|
-
}
|
|
173
|
-
if (!platform || !['ios', 'android'].includes(platform)) {
|
|
174
|
-
console.error('❌ Please pass a platform: ios or android');
|
|
175
|
-
process.exit(1);
|
|
176
|
-
}
|
|
177
|
-
if (!channelName) {
|
|
178
|
-
console.error('❌ Missing required --channel=name');
|
|
179
|
-
process.exit(1);
|
|
180
|
-
}
|
|
181
|
-
let version;
|
|
182
|
-
if (platform === 'ios') {
|
|
183
|
-
if (versionFromFlag) {
|
|
184
|
-
version = versionFromFlag;
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
if (!plistFile) {
|
|
188
|
-
console.error('❌ Please provide --plist-file=path/to/Info.plist or --version for iOS');
|
|
189
|
-
process.exit(1);
|
|
190
|
-
}
|
|
191
|
-
try {
|
|
192
|
-
const plistContent = fs.readFileSync(plistFile, 'utf-8');
|
|
193
|
-
const parsed = plist.parse(plistContent);
|
|
194
|
-
const rawVersion = parsed.CFBundleShortVersionString;
|
|
195
|
-
if (!rawVersion) {
|
|
196
|
-
console.error('❌ Could not find CFBundleShortVersionString in plist');
|
|
197
|
-
process.exit(1);
|
|
198
|
-
}
|
|
199
|
-
const resolved = (0, resolve_ios_version_1.resolveIosPlistVersion)(rawVersion, projectRoot);
|
|
200
|
-
if (!resolved) {
|
|
201
|
-
process.exit(1);
|
|
202
|
-
}
|
|
203
|
-
version = resolved;
|
|
204
|
-
}
|
|
205
|
-
catch (err) {
|
|
206
|
-
console.error('❌ Failed to read plist file:', err);
|
|
207
|
-
process.exit(1);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
else if (versionFromFlag) {
|
|
212
|
-
version = versionFromFlag;
|
|
213
|
-
}
|
|
214
|
-
else if (buildGradlePath) {
|
|
215
|
-
version = parseAndroidVersionFromGradle(path.resolve(projectRoot, buildGradlePath));
|
|
216
|
-
}
|
|
217
|
-
else {
|
|
218
|
-
const defaultGradlePath = path.join(projectRoot, 'android', 'app', 'build.gradle');
|
|
219
|
-
if (fs.existsSync(defaultGradlePath)) {
|
|
220
|
-
version = parseAndroidVersionFromGradle(defaultGradlePath);
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
console.error('❌ Please provide --version=x.y.z for Android or --buildgradle-path=path/to/build.gradle');
|
|
224
|
-
process.exit(1);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
let runtimeVersion;
|
|
228
|
-
const compiledBundleScript = path.join(packageRoot, 'lib', 'scripts', 'bundle.js');
|
|
229
|
-
const tsBundleScript = path.join(packageRoot, 'src', 'scripts', 'bundle.ts');
|
|
230
|
-
const bundleCommand = fs.existsSync(compiledBundleScript)
|
|
231
|
-
? `node "${compiledBundleScript}"`
|
|
232
|
-
: `ts-node "${tsBundleScript}"`;
|
|
233
|
-
try {
|
|
234
|
-
const sourcemapArg = generateSourceMap ? ' --sourcemap' : '';
|
|
235
|
-
console.log(`📦 Running bundler for ${platform}...`);
|
|
236
|
-
(0, child_process_1.execSync)(`${bundleCommand} ${platform}${sourcemapArg}`, {
|
|
237
|
-
stdio: 'inherit',
|
|
238
|
-
env: {
|
|
239
|
-
...process.env,
|
|
240
|
-
BUNDLE_DROP_APP_VERSION: version,
|
|
241
|
-
},
|
|
242
|
-
});
|
|
243
|
-
const manifestPath = path.join(outputDir, 'bundle-manifest.json');
|
|
244
|
-
runtimeVersion = readManifestRuntimeVersion(manifestPath);
|
|
245
|
-
console.log(`🆔 Runtime Version: ${runtimeVersion}`);
|
|
246
|
-
}
|
|
247
|
-
catch (err) {
|
|
248
|
-
console.error('❌ Failed to bundle:', err);
|
|
249
|
-
process.exit(1);
|
|
250
|
-
}
|
|
251
|
-
const zipPath = path.join(outputDir, `bundle-${platform}.zip`);
|
|
252
|
-
if (!fs.existsSync(zipPath)) {
|
|
253
|
-
console.error(`❌ Bundle ZIP not found at ${zipPath}`);
|
|
254
|
-
process.exit(1);
|
|
255
|
-
}
|
|
256
|
-
const form = new form_data_1.default();
|
|
257
|
-
form.append('orgSlug', orgSlug);
|
|
258
|
-
form.append('projectSlug', projectSlug);
|
|
259
|
-
form.append('project', projectSlug);
|
|
260
|
-
form.append('platform', platform);
|
|
261
|
-
form.append('version', version);
|
|
262
|
-
form.append('channelName', channelName);
|
|
263
|
-
form.append('runtimeVersion', runtimeVersion);
|
|
264
|
-
if (releaseNotes) {
|
|
265
|
-
form.append('releaseNotes', releaseNotes);
|
|
266
|
-
}
|
|
267
|
-
form.append('file', fs.createReadStream(zipPath));
|
|
268
|
-
console.log(`→ Uploading bundle to server...`);
|
|
269
|
-
try {
|
|
270
|
-
const res = await axios_1.default.post(`${serverUrl}/bundle/upload`, form, {
|
|
271
|
-
headers: {
|
|
272
|
-
...form.getHeaders(),
|
|
273
|
-
Authorization: `Bearer ${token}`,
|
|
274
|
-
},
|
|
275
|
-
maxContentLength: Infinity,
|
|
276
|
-
maxBodyLength: Infinity,
|
|
277
|
-
});
|
|
278
|
-
if (artifactDir) {
|
|
279
|
-
try {
|
|
280
|
-
fs.mkdirSync(artifactDir, { recursive: true });
|
|
281
|
-
const bundleFile = path.join(outputDir, 'main.jsbundle');
|
|
282
|
-
const sourceMapFile = path.join(outputDir, 'main.jsbundle.map');
|
|
283
|
-
const result = { ...res.data };
|
|
284
|
-
if (fs.existsSync(bundleFile)) {
|
|
285
|
-
fs.copyFileSync(bundleFile, path.join(artifactDir, 'main.jsbundle'));
|
|
286
|
-
result.bundlePath = path.join(artifactDir, 'main.jsbundle');
|
|
287
|
-
}
|
|
288
|
-
if (generateSourceMap && fs.existsSync(sourceMapFile)) {
|
|
289
|
-
fs.copyFileSync(sourceMapFile, path.join(artifactDir, 'main.jsbundle.map'));
|
|
290
|
-
result.sourceMapPath = path.join(artifactDir, 'main.jsbundle.map');
|
|
291
|
-
}
|
|
292
|
-
fs.writeFileSync(path.join(artifactDir, 'bundle-drop-result.json'), JSON.stringify(result, null, 2));
|
|
293
|
-
console.log('📁 Artifacts saved to:', artifactDir);
|
|
294
|
-
}
|
|
295
|
-
catch (copyErr) {
|
|
296
|
-
console.warn('⚠️ Upload succeeded but artifact copy failed:', copyErr.message);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
console.log('✅ Upload complete');
|
|
300
|
-
if (res.data?.bundleVersion != null)
|
|
301
|
-
console.log(`Bundle Version: ${res.data.bundleVersion}`);
|
|
302
|
-
if (res.data?.hash)
|
|
303
|
-
console.log(`Hash: ${res.data.hash}`);
|
|
304
|
-
return res.data;
|
|
305
|
-
}
|
|
306
|
-
catch (err) {
|
|
307
|
-
console.error('❌ Upload failed:', err?.response?.data || err.message);
|
|
308
|
-
throw err;
|
|
309
|
-
}
|
|
310
|
-
finally {
|
|
311
|
-
(0, exports.cleanupArtifacts)(platform, zipPath);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
/* istanbul ignore next */
|
|
315
|
-
if (require.main === module) {
|
|
316
|
-
runUploadBundle().catch(() => process.exit(1));
|
|
317
|
-
}
|