Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/brave-maps-sign.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@rock-js/platform-ios': patch
'@rock-js/platform-apple-helpers': patch
'@rock-js/platform-android': patch
---

Add `--sourcemap-output` to `sign:ios` and `sign:android` to write the source map of the JS bundle built with `--build-jsbundle`.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type SignFlags = {
keyAlias?: string;
keyPassword?: string;
buildJsbundle?: boolean;
sourcemapOutput?: string;
jsbundle?: string;
noHermes?: boolean;
};
Expand Down Expand Up @@ -50,6 +51,11 @@ const OPTIONS = [
name: '--build-jsbundle',
description: 'Build the JS bundle before signing.',
},
{
name: '--sourcemap-output <string>',
description:
'Path to write the source map of the built JS bundle. Requires "--build-jsbundle".',
},
{
name: '--jsbundle <string>',
description: 'Path to the JS bundle to apply before signing.',
Expand All @@ -75,6 +81,7 @@ export const registerSignCommand = (api: PluginApi) => {
keyPassword: flags.keyPassword,
outputPath: flags.output,
buildJsBundle: flags.buildJsbundle,
sourcemapOutputPath: flags.sourcemapOutput,
jsBundlePath: flags.jsbundle,
useHermes: !flags.noHermes,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type SignAndroidOptions = {
keyPassword?: string;
outputPath?: string;
buildJsBundle?: boolean;
sourcemapOutputPath?: string;
jsBundlePath?: string;
useHermes?: boolean;
};
Expand All @@ -48,10 +49,9 @@ export async function signAndroid(options: SignAndroidOptions) {
await buildJsBundle({
bundleOutputPath,
assetsDestPath: path.join(tempPath, 'res'),
sourcemapOutputPath: path.join(
tempPath,
'index.android.bundle.packager.map',
),
sourcemapOutputPath:
options.sourcemapOutputPath ??
path.join(tempPath, 'index.android.bundle.packager.map'),
useHermes: options.useHermes ?? true,
});
loader.stop(
Expand Down Expand Up @@ -126,6 +126,12 @@ function validateOptions(options: SignAndroidOptions) {
);
}

if (options.sourcemapOutputPath && !options.buildJsBundle) {
throw new RockError(
'The "--sourcemap-output" flag requires "--build-jsbundle".',
);
}

if (options.jsBundlePath && !fs.existsSync(options.jsBundlePath)) {
throw new RockError(`JS bundle file not found "${options.jsBundlePath}"`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type ModifyAppOptions = {
appPath: string;
outputPath?: string;
buildJsBundle?: boolean;
sourcemapOutputPath?: string;
jsBundlePath?: string;
useHermes?: boolean;
useAppEntitlements?: boolean;
Expand Down Expand Up @@ -48,6 +49,7 @@ export const modifyApp = async (options: ModifyAppOptions) => {
await buildJsBundle({
bundleOutputPath: appPaths.jsBundle,
assetsDestPath: appPaths.assetsDest,
sourcemapOutputPath: options.sourcemapOutputPath,
useHermes: options.useHermes ?? true,
});
loader.stop(
Expand Down Expand Up @@ -85,6 +87,12 @@ function validateOptions(options: ModifyAppOptions) {
);
}

if (options.sourcemapOutputPath && !options.buildJsBundle) {
throw new RockError(
'The "--sourcemap-output" flag requires "--build-jsbundle".',
);
}

if (options.jsBundlePath && !fs.existsSync(options.jsBundlePath)) {
throw new RockError(
`JS bundle file not found at "${options.jsBundlePath}". Please provide a correct path.`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export type ModifyIpaOptions = {
identity?: string;
outputPath?: string;
buildJsBundle?: boolean;
sourcemapOutputPath?: string;
jsBundlePath?: string;
useHermes?: boolean;
useAppEntitlements?: boolean;
Expand All @@ -51,6 +52,7 @@ export const modifyIpa = async (options: ModifyIpaOptions) => {
await buildJsBundle({
bundleOutputPath: appPaths.jsBundle,
assetsDestPath: appPaths.assetsDest,
sourcemapOutputPath: options.sourcemapOutputPath,
useHermes: options.useHermes ?? true,
});
loader.stop(
Expand Down Expand Up @@ -140,6 +142,12 @@ function validateOptions(options: ModifyIpaOptions) {
);
}

if (options.sourcemapOutputPath && !options.buildJsBundle) {
throw new RockError(
'The "--sourcemap-output" flag requires "--build-jsbundle".',
);
}

if (options.jsBundlePath && !fs.existsSync(options.jsBundlePath)) {
throw new RockError(
`JS bundle file not found at "${options.jsBundlePath}". Please provide a correct path.`,
Expand Down
8 changes: 8 additions & 0 deletions packages/platform-ios/src/lib/commands/signIos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type SignFlags = {
output?: string;
identity?: string;
buildJsbundle?: boolean;
sourcemapOutput?: string;
jsbundle?: string;
noHermes?: boolean;
useAppEntitlements?: boolean;
Expand Down Expand Up @@ -38,6 +39,11 @@ const OPTIONS = [
name: '--build-jsbundle',
description: 'Build the JS bundle before signing.',
},
{
name: '--sourcemap-output <string>',
description:
'Path to write the source map of the built JS bundle. Requires "--build-jsbundle".',
},
{
name: '--jsbundle <string>',
description: 'Path to the JS bundle to apply before signing.',
Expand Down Expand Up @@ -65,6 +71,7 @@ export const registerSignCommand = (api: PluginApi) => {
appPath: binaryPath,
outputPath: flags.output,
buildJsBundle: flags.buildJsbundle,
sourcemapOutputPath: flags.sourcemapOutput,
jsBundlePath: flags.jsbundle,
useHermes: !flags.noHermes,
useAppEntitlements: flags.useAppEntitlements,
Expand All @@ -76,6 +83,7 @@ export const registerSignCommand = (api: PluginApi) => {
identity: flags.identity,
outputPath: flags.output,
buildJsBundle: flags.buildJsbundle,
sourcemapOutputPath: flags.sourcemapOutput,
jsBundlePath: flags.jsbundle,
useHermes: !flags.noHermes,
useAppEntitlements: flags.useAppEntitlements,
Expand Down
57 changes: 29 additions & 28 deletions website/src/docs/cli/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ Platform plugins are configured through the [`platform`](/docs/configuration/ind

- `@rock-js/platform-android` – Android platform plugin with the following commands:

| Command | Description |
| :------------------------- | :-------------------------------------------------------------- |
| `run:android` | Runs Android app on emulator or device |
| `build:android` | Builds Android app for generic emulator, device or distribution |
| `sign:android` | Signs Android app with keystore |
| `validate-elf-alignment` | Validates ELF alignment of shared libraries in an APK |
| Command | Description |
| :----------------------- | :-------------------------------------------------------------- |
| `run:android` | Runs Android app on emulator or device |
| `build:android` | Builds Android app for generic emulator, device or distribution |
| `sign:android` | Signs Android app with keystore |
| `validate-elf-alignment` | Validates ELF alignment of shared libraries in an APK |

- `@rock-js/platform-ios` – iOS platform plugin with the following commands:

Expand Down Expand Up @@ -203,15 +203,16 @@ The `sign:ios` command either signs your iOS app with certificates and provision
| :----------- | :-------------------------- |
| `binaryPath` | Path to the IPA or APP file |

| Option | Description |
| :----------------------- | :------------------------------------------------------------------------------------------------------ |
| `--app` | Modify APP file (directory) instead of IPA file. No signing is done |
| `--identity <string>` | Certificate Identity name for code signing |
| `--output <string>` | Path to output IPA file |
| `--build-jsbundle` | Build JS bundle before signing |
| `--jsbundle <string>` | Path to JS bundle to apply before signing |
| `--no-hermes` | Don't use Hermes for JS bundle |
| `--use-app-entitlements` | Extract app bundle codesigning entitlements and combine with entitlements from new provisioning profile |
| Option | Description |
| :---------------------------- | :------------------------------------------------------------------------------------------------------ |
| `--app` | Modify APP file (directory) instead of IPA file. No signing is done |
| `--identity <string>` | Certificate Identity name for code signing |
| `--output <string>` | Path to output IPA file |
| `--build-jsbundle` | Build JS bundle before signing |
| `--sourcemap-output <string>` | Path to write the source map of the built JS bundle (requires `--build-jsbundle`) |
| `--jsbundle <string>` | Path to JS bundle to apply before signing |
| `--no-hermes` | Don't use Hermes for JS bundle |
| `--use-app-entitlements` | Extract app bundle codesigning entitlements and combine with entitlements from new provisioning profile |

## Platform Android

Expand Down Expand Up @@ -256,15 +257,15 @@ The `sign:android <binaryPath>` command signs your Android app with a keystore,
| :----------- | :-------------------------- |
| `binaryPath` | Path to the APK or AAB file |

| Option | Description |
| :----------------------------- | :---------------------------------------- |
| `--keystore <string>` | Path to keystore file |
| `--keystore-password <string>` | Password for keystore file |
| `--output <string>` | Path to output APK or AAB file |
| `--build-jsbundle` | Build JS bundle before signing |
| `--jsbundle <string>` | Path to JS bundle to apply before signing |
| `--no-hermes` | Don't use Hermes for JS bundle |

| Option | Description |
| :----------------------------- | :-------------------------------------------------------------------------------- |
| `--keystore <string>` | Path to keystore file |
| `--keystore-password <string>` | Password for keystore file |
| `--output <string>` | Path to output APK or AAB file |
| `--build-jsbundle` | Build JS bundle before signing |
| `--sourcemap-output <string>` | Path to write the source map of the built JS bundle (requires `--build-jsbundle`) |
| `--jsbundle <string>` | Path to JS bundle to apply before signing |
| `--no-hermes` | Don't use Hermes for JS bundle |

### `rock validate-elf-alignment` Options

Expand Down Expand Up @@ -407,11 +408,11 @@ The `config` command outputs the autolinking configuration from Community CLI, w

The `clean` command helps you free up disk space by removing various caches and temporary files from your React Native project. It can clean Android (Gradle), iOS (CocoaPods), Metro, Watchman, Rock's own project caches, package manager caches, and CCache compiler cache.

| Option | Description |
| :------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Option | Description |
| :------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--include <string>` | Comma-separated list of caches to clean. Available options: `android`, `gradle`, `cocoapods`, `metro`, `watchman`, `npm`, `yarn`, `bun`, `pnpm`, `rock`, `ccache` |
| `--verify-cache` | Whether to verify the cache (currently only applies to npm cache) |
| `--all` | Clean all available caches without interactive prompt |
| `--verify-cache` | Whether to verify the cache (currently only applies to npm cache) |
| `--all` | Clean all available caches without interactive prompt |

## Plugin Remote Cache

Expand Down
Loading