Skip to content

Commit b4f0900

Browse files
authored
Vendor acquisition-sdk instead of depending on the code-push npm package (#9)
Adds src/acquisition-sdk/ (vendored TypeScript from the archived microsoft/code-push repo, trimmed types.ts to only what's used, tests ported for future reference but not wired into any runner), a tsconfig.build.json + build:ts script compiling it to lib/ at prepack/setup time, and points CodePush.js at the compiled output instead of the code-push package. Drops the code-push dependency entirely, which was only ever used for this one submodule and pulled in the superagent/proxy-agent/vm2 CLI dependency chain that never actually shipped in the bundled app JS.
1 parent d23b044 commit b4f0900

14 files changed

Lines changed: 925 additions & 438 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ build/Release
7777
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
7878
node_modules
7979

80+
# Compiled output of src/ (built via `npm run build:ts`, generated fresh at prepare time)
81+
lib/
82+
8083
# Xcode
8184
#
8285
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

.npmignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ Recipes/
3434
bin/
3535
test/
3636

37+
# Don't publish TypeScript source, only the compiled lib/ output (built via `npm run build:ts`
38+
# as part of `prepare`) ships
39+
# Anchored to repo root (leading slash): an unanchored `src/` would also match `android/app/src/`.
40+
/src/
41+
3742
# Remove after this framework is published on NPM
3843
code-push-plugin-testing-framework/
3944

@@ -101,3 +106,9 @@ packages/
101106

102107
.watchmanconfig
103108

109+
# Dev tooling, not relevant to consumers
110+
.claude/
111+
CLAUDE.md
112+
mise.toml
113+
tsconfig.json
114+
tsconfig.build.json

CLAUDE.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ React Native CodePush is a native module that enables over-the-air updates for R
1616
### Build
1717
- `npm run build` - Build TypeScript tests to bin/ directory
1818
- `npm run tsc` - TypeScript compilation
19+
- `npm run build:ts` - Compiles `src/` (currently just the vendored `acquisition-sdk`) to `lib/`, which is what ships to consumers instead of raw `.ts`. Wired into `setup` (so local dev/tests have `lib/` available) and `prepare` (so `npm publish`/`npm pack` always ship a freshly built `lib/`).
20+
- This split (a separate `tsconfig.build.json` and `tsconfig.json` for `test/` -> `bin/`) is temporary. Once `CodePush.js` and the rest of this repo's runtime JS are migrated to TypeScript, these should be unified into a single build, and adopting `react-native-builder-bob` (or some other common tool) is worth considering at that point instead of hand-rolled `tsc` + npm script wiring.
1921

2022
### Platform Testing
2123
- Tests run on actual emulators/simulators with real React Native apps
@@ -28,7 +30,7 @@ React Native CodePush is a native module that enables over-the-air updates for R
2830
- **JavaScript Bridge** (`CodePush.js`): Main API layer exposing update methods
2931
- **Native Modules**: Platform-specific implementations handling file operations, bundle management
3032
- **Update Manager**: Handles download, installation, and rollback logic
31-
- **Acquisition SDK**: Manages server communication and update metadata
33+
- **Acquisition SDK** (`src/acquisition-sdk/`): Manages server communication and update metadata
3234

3335
### Platform Structure
3436
- **iOS**: `ios/` - Objective-C implementation with CocoaPods integration
@@ -46,6 +48,7 @@ React Native CodePush is a native module that enables over-the-air updates for R
4648
- **Custom Test Runner**: TypeScript-based test framework in `test/`
4749
- **Real App Testing**: Creates actual React Native apps for integration testing
4850
- **Scenario Testing**: Update, rollback, and error scenarios
51+
- **No unit test infra yet**: this repo only has the mocha-based integration suite above. `src/acquisition-sdk/__tests__/` contains tests ported from upstream `microsoft/code-push`, kept for future reference - they are deliberately not wired into `npm test` or any runner. Don't assume they're dead/forgotten code, and don't wire them in without setting up real unit test infra first.
4952
- **Templates**: `test/template/` holds native files (Podfile, AppDelegate, Android app files) and JS scenarios copied over top of a freshly generated RN/Expo app during test setup, overwriting its defaults — edit files here, not the generated project, for changes to persist
5053
- **`test:ios` vs `test:setup:ios` vs `test:fast:ios`**: `test:ios` is just `test:setup:ios` followed by `test:fast:ios` — the two are meant to be split apart for local iteration.
5154
- `test:setup:ios` (mocha `--ios --setup`) boots the simulator and provisions the test app once: copies templates, runs `pod install`, patches Info.plist/AppDelegate. It never builds or runs any test scenario.
@@ -61,3 +64,4 @@ React Native CodePush is a native module that enables over-the-air updates for R
6164
- **Android Gradle Plugin**: Automatically generates bundle hashes and processes assets
6265
- **iOS CocoaPods**: Manages native dependencies and build configuration
6366
- **Bundle Processing**: Automated zip creation and hash calculation for OTA updates
67+
- **`.npmignore` is a blocklist, not an allowlist**: `package.json` has no `files` field, so any new top-level file/dir ships to npm by default unless explicitly excluded. When adding new repo tooling/config, check whether it needs a `.npmignore` entry. Verify with `npm pack --dry-run`.

CodePush.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AcquisitionManager as Sdk } from "code-push/script/acquisition-sdk";
1+
import { AcquisitionManager as Sdk } from "./lib/acquisition-sdk/acquisition-sdk";
22
import { Alert } from "./AlertAdapter";
33
import requestFetchAdapter from "./request-fetch-adapter";
44
import { AppState, Platform } from "react-native";

0 commit comments

Comments
 (0)