Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add codepush support for extra bundler options #330

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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,9 @@ Here is the list of all existing parameters:
| `bundle_name` <br/> `APPCENTER_CODEPUSH_BUNDLE_NAME` | Specifies the name of the bundle file |
| `output_dir` <br/> `APPCENTER_CODEPUSH_OUTPUT` | Specifies path to where the bundle and sourcemap should be written |
| `sourcemap_output` <br/> `APPCENTER_CODEPUSH_SOURCEMAP_OUTPUT` | Specifies path to write sourcemaps to |
| `development` <br/> `APPCENTER_CODEPUH_DEVELOPMENT` | Specifies whether to generate dev or release build (default: `false`) |
| `development` <br/> `APPCENTER_CODEPUSH_DEVELOPMENT` | Specifies whether to generate dev or release build (default: `false`) |
| `private_key_path` <br/> `APPCENTER_CODEPUSH_PRIVATE_KEY_PATH` | Specifies path to private key that will be used for signing bundles |
| `extra_bundler_options` <br/> `APPCENTER_CODEPUSH_EXTRA_BUNDLER_OPTIONS` | A list of extra options that get passed to the react-native bundler |

## Example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def self.run(params)
plist_file = params[:plist_file]
xcode_project_file = params[:xcode_project_file]
use_hermes = params[:use_hermes]
extra_bundler_options = params[:extra_bundler_options]

base_executable = "appcenter "

Expand Down Expand Up @@ -78,6 +79,10 @@ def self.run(params)
unless use_hermes.nil?
command += "--use-hermes #{use_hermes} "
end
if extra_bundler_options
command += extra_bundler_options.map { |option| "--extra-bundler-option='#{option}' " }.join
end

if dry_run
UI.message("Dry run!".red + " Would have run: " + command + "\n")
else
Expand Down Expand Up @@ -174,17 +179,17 @@ def self.available_options
env_name: "APPCENTER_CODEPUSH_USE_LOCAL_APPCENTER_CLI",
optional: true,
default_value: false,
description: "When true, the appcenter cli installed in the project directory is used"),
description: "When true, the appcenter cli installed in the project directory is used"),
FastlaneCore::ConfigItem.new(key: :plist_file,
type: String,
env_name: "APPCENTER_CODEPUSH_PLIST_FILE",
optional: true,
description: "Path to the Info.plist"),
description: "Path to the Info.plist"),
FastlaneCore::ConfigItem.new(key: :xcode_project_file,
type: String,
env_name: "APPCENTER_CODEPUSH_XCODE_PROJECT_FILE",
optional: true,
description: "Path to the .pbxproj file"),
description: "Path to the .pbxproj file"),
FastlaneCore::ConfigItem.new(key: :private_key_path,
type: String,
env_name: "APPCENTER_CODEPUSH_PRIVATE_KEY_PATH",
Expand All @@ -194,7 +199,12 @@ def self.available_options
type: Boolean,
env_name: "APPCENTER_CODEPUSH_USE_HERMES",
optional: true,
description: "Enable hermes and bypass automatic checks")
description: "Enable hermes and bypass automatic checks"),
FastlaneCore::ConfigItem.new(key: :extra_bundler_options,
type: Array,
env_name: "APPCENTER_CODEPUSH_EXTRA_BUNDLER_OPTIONS",
optional: true,
description: "Options that get passed to the react-native bundler"),
]
end

Expand Down
17 changes: 16 additions & 1 deletion spec/appcenter_codepush_release_react_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@
)
end").runner.execute(:test_codepush)
end

it "can add extra bundler options" do
allow(Fastlane::Actions::AppcenterCodepushReleaseReactAction).to(
receive(:sh).with(/--extra-bundler-option='--reset-cache' --extra-bundler-option='--max-workers=1'/)
)

Fastlane::FastFile.new.parse("lane :test_codepush do
appcenter_codepush_release_react(
api_token: 'an-api-token',
owner_name: 'owner',
app_name: 'app',
deployment: 'Staging',
extra_bundler_options: ['--reset-cache', '--max-workers=1'],
)
end").runner.execute(:test_codepush)
end
end
end

Loading